summaryrefslogtreecommitdiffhomepage
path: root/Private/FSKit
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-04-07 23:11:13 +0200
committerAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-04-07 23:11:13 +0200
commitdd9c90c0d7d65f4481b1072f11cbb81017382006 (patch)
tree6b4f0c80de77e16ac536fa6ccd24ccf40845d757 /Private/FSKit
parentf21456cae169f9d911cefe39f1b99615f3c39e5d (diff)
MHR-3: Everything is ready now, we need to implement the NewFSParser
class now. Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'Private/FSKit')
-rw-r--r--Private/FSKit/NewFS.hxx84
1 files changed, 39 insertions, 45 deletions
diff --git a/Private/FSKit/NewFS.hxx b/Private/FSKit/NewFS.hxx
index 3d5071c5..3f93700f 100644
--- a/Private/FSKit/NewFS.hxx
+++ b/Private/FSKit/NewFS.hxx
@@ -9,7 +9,8 @@
?/?/?: Added file (amlel)
12/02/24: Add UUID macro for EPM and GPT partition schemes.
- 3/16/24: Add mandatory sector size, kNewFSMinimumSectorSz is set to 2048 by default.
+ 3/16/24: Add mandatory sector size, kNewFSMinimumSectorSz is set to 2048 by
+default.
------------------------------------------- */
@@ -39,10 +40,10 @@
#define kNewFSUUID "@{DD997393-9CCE-4288-A8D5-C0FDE3908DBE}"
#define kNewFSVersionInteger 0x122
-#define kNewFSVerionString "1.2.2"
+#define kNewFSVerionString "1.2.2"
/// @brief Standard fork types.
-#define kNewFSDataFork "data"
+#define kNewFSDataFork "data"
#define kNewFSResourceFork "rsrc"
#define kNewFSCatalogKindFile 1
@@ -117,7 +118,7 @@ struct PACKED NewCatalog final {
/// @brief Fork type.
struct PACKED NewFork final {
- NewCharType Name[kNewFSNodeNameLen];
+ NewCharType Name[kNewFSNodeNameLen];
NewOS::Int32 Flags;
NewOS::Int32 Kind;
@@ -126,7 +127,7 @@ struct PACKED NewFork final {
NewOS::Int32 ResourceKind;
NewOS::Int32 ResourceFlags;
- NewOS::Lba DataOffset; //8 Where to look for this data?
+ NewOS::Lba DataOffset; // 8 Where to look for this data?
NewOS::SizeT DataSize; /// Data size according using sector count.
NewOS::Lba NextSibling;
@@ -166,11 +167,10 @@ enum {
kNewFSSubDriveCount,
};
-
///
/// \name NewFSParser
-/// \brief NewFS parser class. (catalog creation, remove removal, root, forks...)
-/// Designed like the DOM, detects the filesystem automatically.
+/// \brief NewFS parser class. (catalog creation, remove removal, root,
+/// forks...) Designed like the DOM, detects the filesystem automatically.
///
class NewFSParser final {
@@ -186,42 +186,36 @@ class NewFSParser final {
/// @param catalog it's catalog
/// @param theFork the fork itself.
/// @return the fork
- _Output NewFork* CreateFork(_Input NewCatalog* catalog, _Input NewFork& theFork);
-
+ _Output NewFork* CreateFork(_Input NewCatalog* catalog,
+ _Input NewFork& theFork);
+
/// @brief Find fork inside New filesystem.
/// @param catalog the catalog.
/// @param name the fork name.
/// @return the fork.
- _Output NewFork* FindFork(_Input NewCatalog* catalog, _Input const Char* name);
-
- virtual _Output Void RemoveFork(_Input NewFork* fork) = 0;
-
- virtual _Output Void CloseFork(_Input NewFork* fork) = 0;
-
- virtual _Output NewCatalog* FindCatalog(const char* catalogName) = 0;
+ _Output NewFork* FindFork(_Input NewCatalog* catalog,
+ _Input const Char* name);
- virtual _Output NewCatalog* RootCatalog() = 0;
+ virtual _Output Void RemoveFork(_Input NewFork* fork) = 0;
- virtual _Output NewCatalog* NextCatalog(_Input _Output NewCatalog* cur) = 0;
+ virtual _Output Void CloseFork(_Input NewFork* fork) = 0;
- virtual _Output NewCatalog* PrevCatalog(_Input _Output NewCatalog* cur) = 0;
+ virtual _Output NewCatalog* FindCatalog(_Input const char* catalogName) = 0;
virtual _Output NewCatalog* GetCatalog(_Input const char* name) = 0;
virtual _Output NewCatalog* CreateCatalog(_Input const char* name,
- _Input const Int32& flags,
- _Input const Int32& kind) = 0;
+ _Input const Int32& flags,
+ _Input const Int32& kind);
- virtual _Output NewCatalog* CreateCatalog(_Input const char* name) = 0;
+ virtual _Output NewCatalog* CreateCatalog(_Input const char* name);
+
+ virtual bool WriteCatalog(_Input _Output NewCatalog* catalog, voidPtr data);
- virtual bool WriteCatalog(_Input _Output NewCatalog* catalog,
- voidPtr data) = 0;
-
virtual VoidPtr ReadCatalog(_Input _Output NewCatalog* catalog,
- SizeT dataSz) = 0;
-
- virtual bool Seek(_Input _Output NewCatalog* catalog,
- SizeT off) = 0;
+ SizeT dataSz) = 0;
+
+ virtual bool Seek(_Input _Output NewCatalog* catalog, SizeT off) = 0;
virtual SizeT Tell(_Input _Output NewCatalog* catalog) = 0;
@@ -234,9 +228,8 @@ class NewFSParser final {
/// @return If it was sucessful, see DbgLastError().
bool Format(_Input _Output DriveTrait* drive);
-public:
- Int32 fDriveIndex{ kNewFSSubDriveA };
-
+ public:
+ Int32 fDriveIndex{kNewFSSubDriveA};
};
///
@@ -251,22 +244,23 @@ class NewFilesystemHelper final {
static const char Separator();
};
+namespace Detail {
+Boolean fs_init_newfs(Void) noexcept;
+} // namespace Detail
+} // namespace NewOS
+
/// @brief Write to newfs disk.
-/// @param Mnt mounted interface.
-/// @param DrvTrait drive info
+/// @param Mnt mounted interface.
+/// @param DrvTrait drive info
/// @param DrvIndex drive index.
-/// @return
-Int32 fs_newfs_write(MountpointInterface* Mnt, DriveTrait& DrvTrait, Int32 DrvIndex);
+/// @return
+NewOS::Int32 fs_newfs_write(NewOS::MountpointInterface* Mnt,
+ NewOS::DriveTrait& DrvTrait, NewOS::Int32 DrvIndex);
/// @brief Read from newfs disk.
/// @param Mnt mounted interface.
/// @param DrvTrait drive info
/// @param DrvIndex drive index.
-/// @return
-Int32 fs_newfs_read(MountpointInterface* Mnt, DriveTrait& DrvTrait, Int32 DrvIndex);
-
-namespace Detail
-{
-Boolean fs_init_newfs(Void) noexcept;
-} // namespace Detail
-} // namespace NewOS
+/// @return
+NewOS::Int32 fs_newfs_read(NewOS::MountpointInterface* Mnt,
+ NewOS::DriveTrait& DrvTrait, NewOS::Int32 DrvIndex);