summaryrefslogtreecommitdiffhomepage
path: root/Private/FSKit
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-04-06 09:31:44 +0200
committerAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-04-06 09:31:44 +0200
commit422b8029eba71b6fbb6b3dcb386b8e115bbd08ef (patch)
tree665dcc4c71571b48e6498614f74d6b4c9de575d1 /Private/FSKit
parentef604f691e2e3a6f710c96d0270cd9e2a223f08d (diff)
NewFS, Implementing the NewFSParser class, added CreateFork method.
Diffstat (limited to 'Private/FSKit')
-rw-r--r--Private/FSKit/NewFS.hxx51
1 files changed, 33 insertions, 18 deletions
diff --git a/Private/FSKit/NewFS.hxx b/Private/FSKit/NewFS.hxx
index 6c4be37f..04e68cc6 100644
--- a/Private/FSKit/NewFS.hxx
+++ b/Private/FSKit/NewFS.hxx
@@ -38,8 +38,8 @@
/// @brief Partition GUID on EPM and GPT disks.
#define kNewFSUUID "@{DD997393-9CCE-4288-A8D5-C0FDE3908DBE}"
-#define kNewFSVersionInteger 0x121
-#define kNewFSVerionString "1.2.1"
+#define kNewFSVersionInteger 0x122
+#define kNewFSVerionString "1.2.2"
/// @brief Standard fork types.
#define kNewFSDataFork "data"
@@ -87,8 +87,8 @@
#define kPartLen 32
#define kNewFSFlagDeleted 0xF0
-#define kNewFSFlagUnallocated 0x0F
-#define kNewFSFlagCatalog 0xFF
+#define kNewFSFlagUnallocated 0x00
+#define kNewFSFlagCreated 0x0F
typedef NewOS::Char NewCharType;
@@ -156,22 +156,37 @@ struct PACKED NewPartitionBlock final {
};
namespace NewOS {
+
+enum {
+ kNewFSSubDriveA,
+ kNewFSSubDriveB,
+ kNewFSSubDriveC,
+ kNewFSSubDriveD,
+ kNewFSSubDriveInvalid,
+ kNewFSSubDriveCount,
+};
+
+
///
/// \name NewFSParser
/// \brief NewFS parser class. (catalog creation, remove removal, root, forks...)
/// Designed like the DOM, detects the filesystem automatically.
///
-class NewFSParser {
+class NewFSParser final {
public:
explicit NewFSParser() = default;
- virtual ~NewFSParser() = default;
+ ~NewFSParser() = default;
public:
NEWOS_COPY_DEFAULT(NewFSParser);
public:
- virtual _Output NewFork* CreateFork(_Input NewCatalog* catalog, _Input NewFork& theFork) = 0;
+ /// @brief Creates a new fork inside the New filesystem partition.
+ /// @param catalog it's catalog
+ /// @param theFork the fork itself.
+ /// @return the fork
+ _Output NewFork* CreateFork(_Input NewCatalog* catalog, _Input NewFork& theFork);
virtual _Output NewFork* FindFork(_Input NewCatalog* catalog, _Input const Char* name) = 0;
@@ -214,6 +229,10 @@ class NewFSParser {
/// @param drive The drive to write on.
/// @return If it was sucessful, see DbgLastError().
virtual bool Format(_Input _Output DriveTrait* drive) = 0;
+
+public:
+ Int32 fDriveIndex{ kNewFSSubDriveA };
+
};
///
@@ -228,26 +247,22 @@ class NewFilesystemHelper final {
static const char Separator();
};
-enum {
- kHCFSSubDriveA,
- kHCFSSubDriveB,
- kHCFSSubDriveC,
- kHCFSSubDriveD,
- kHCFSSubDriveInvalid,
- kHCFSSubDriveCount,
-};
-
/// @brief Write to newfs disk.
/// @param Mnt mounted interface.
/// @param DrvTrait drive info
/// @param DrvIndex drive index.
/// @return
-Int32 fs_newfs_write_raw(MountpointInterface* Mnt, DriveTrait& DrvTrait, Int32 DrvIndex);
+Int32 fs_newfs_write(MountpointInterface* Mnt, DriveTrait& DrvTrait, Int32 DrvIndex);
/// @brief Read from newfs disk.
/// @param Mnt mounted interface.
/// @param DrvTrait drive info
/// @param DrvIndex drive index.
/// @return
-Int32 fs_newfs_read_raw(MountpointInterface* Mnt, DriveTrait& DrvTrait, Int32 DrvIndex);
+Int32 fs_newfs_read(MountpointInterface* Mnt, DriveTrait& DrvTrait, Int32 DrvIndex);
+
+namespace Detail
+{
+Boolean fs_init_newfs(Void) noexcept;
+} // namespace Detail
} // namespace NewOS