blob: 96fb95d5531c6c1717b2c4d893f260c826ba6e6b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
// Copyright 2024-2025, Amlal El Mahrouss (amlal@nekernel.org)
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
#ifndef HEADERS_DISKIMAGE_H
#define HEADERS_DISKIMAGE_H
#include <libSystem/SystemKit/System.h>
#ifndef __DISK_IMAGE_CDROM__
#define kDISectorSz (512)
#else
#define kDISectorSz (2048)
#endif // __DISK_IMAGE_CDROM__
#define kDIMinDiskSz mib_cast(1)
#define kDIDefaultOutputName "disk.eimg"
#define kDIDefaultDiskName "Disk"
#define kDISuccessStatus (0)
#define kDIFailureStatus (1)
#define kDIDiskNameLen (16)
#define kDIOutNameLen (256)
namespace DI {
/// @brief Disk Image file structure.
/// @param disk_name Disk partition name.
/// @param sector_sz Disk sector_sz.
/// @param block_cnt Disk block count.
/// @param disk_sz Disk size.
/// @param out_name Output file name.
struct DI_DISK_IMAGE {
Char disk_name[kDIDiskNameLen] = kDIDefaultDiskName;
SInt32 sector_sz = kDISectorSz;
SInt32 block_cnt = 0;
SizeT disk_sz = kDIMinDiskSz;
Char out_name[kDIOutNameLen] = kDIDefaultOutputName;
SInt32 fs_version = 0UL;
};
/// @brief Format with an EPM partition.
/// @param img disk image structure.
/// @return Status code upon completion.
SInt32 DIFormatPartitionEPM(struct DI_DISK_IMAGE& img);
/// @brief NeFS format over EPM.
/// @param img disk image structure.
/// @return Status code upon completion.
SInt32 DIFormatFilesystemNeFS(struct DI_DISK_IMAGE& img);
/// @brief OpenHeFS format over EPM.
/// @param img disk image structure.
/// @return Status code upon completion.
SInt32 DIFormatFilesystemOpenHeFS(struct DI_DISK_IMAGE& img);
} // namespace DI
#endif
|