From 461fe537aa1f9533bfa5c2504cb84843b9eac501 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Mon, 29 Apr 2024 10:12:36 +0200 Subject: MHR-18: Filesystem fixes and improvements see ticket. - Implement CreateCatalog for file creation, an implementation of RemoveCatalog is also needed. - Boot Kit only takes a single root file now. Must be ending with '/'. Signed-off-by: Amlal El Mahrouss --- Private/FSKit/NewFS.hxx | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'Private/FSKit') diff --git a/Private/FSKit/NewFS.hxx b/Private/FSKit/NewFS.hxx index 2a783b11..619c6c6b 100644 --- a/Private/FSKit/NewFS.hxx +++ b/Private/FSKit/NewFS.hxx @@ -38,13 +38,13 @@ default. #define kNewFSIdentLen 8 #define kNewFSIdent " NewFS" -#define kNewFSPadLen 408 +#define kNewFSPadLen 400 /// @brief Partition GUID on EPM and GPT disks. #define kNewFSUUID "@{DD997393-9CCE-4288-A8D5-C0FDE3908DBE}" -#define kNewFSVersionInteger 0x122 -#define kNewFSVerionString "1.2.2" +#define kNewFSVersionInteger 0x123 +#define kNewFSVerionString "1.23" /// @brief Standard fork types. #define kNewFSDataFork "data" @@ -83,7 +83,7 @@ default. /// Start After the PM headers, pad 1024 bytes. #define kNewFSAddressAsLba (512) -#define kNewFSCatalogStartAddress (1024 + sizeof(NewPartitionBlock)) +#define kNewFSCatalogStartAddress (1024 + sizeof(NewPartitionBlock) + sizeof(NewCatalog)) #define kResourceTypeDialog 10 #define kResourceTypeString 11 @@ -96,7 +96,7 @@ default. #define kNewFSFlagUnallocated 0x00 #define kNewFSFlagCreated 0x0F -#define kNewFSMimeNameLen (216) +#define kNewFSMimeNameLen (200) typedef NewOS::Char NewCharType; @@ -117,6 +117,12 @@ struct PACKED NewCatalog final { NewOS::Int32 Flags; NewOS::Int32 Kind; + /// Size of the data fork. + NewOS::Lba DataForkSize; + + /// Size of all resource forks. + NewOS::Lba ResourceForkOverallSize; + NewOS::Lba DataFork; NewOS::Lba ResourceFork; @@ -164,6 +170,8 @@ struct PACKED NewPartitionBlock final { NewOS::SizeT SectorCount; NewOS::SizeT SectorSize; + NewOS::UInt64 Version; + NewOS::Char Pad[kNewFSPadLen]; }; @@ -214,7 +222,7 @@ class NewFSParser final { _Output Void CloseFork(_Input NewFork* fork); - _Output NewCatalog* FindCatalog(_Input const char* catalogName); + _Output NewCatalog* FindCatalog(_Input const char* catalogName, Lba& outLba); _Output NewCatalog* GetCatalog(_Input const char* name); @@ -224,7 +232,8 @@ class NewFSParser final { _Output NewCatalog* CreateCatalog(_Input const char* name); - bool WriteCatalog(_Input _Output NewCatalog* catalog, voidPtr data); + bool WriteCatalog(_Input _Output NewCatalog* catalog, + voidPtr data, SizeT sizeOfData); VoidPtr ReadCatalog(_Input _Output NewCatalog* catalog, SizeT dataSz); -- cgit v1.2.3