summaryrefslogtreecommitdiffhomepage
path: root/public/frameworks/DiskImage.fwrk/headers/DiskImage.h
blob: 78b39bf84cd1e4c17e90c486d0dd05c6a1728440 (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
/* -------------------------------------------

  Copyright (C) 2025, Amlal El Mahrouss, all rights reserved.

  FILE: DiskImage.h
  PURPOSE: Disk Imaging framework.

   ------------------------------------------- */

#pragma once

#include <user/SystemCalls.h>

#define kDISectorSz (512)
#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;
};

/// @brief Format with an EPM partition.
/// @param img disk image structure.
/// @return Status code upon completion.
SInt32 DIFormatPartitionEPM(struct DI_DISK_IMAGE& img) noexcept;

/// @brief NeFS format over EPM.
/// @param img disk image structure.
/// @return Status code upon completion.
SInt32 DIFormatFilesystemNeFS(struct DI_DISK_IMAGE& img) noexcept;

}  // namespace DI