diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2025-01-12 16:25:31 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2025-01-12 16:25:31 +0100 |
| commit | fa8b964f649762db56647dccd63e64f6e1d42522 (patch) | |
| tree | 034e37d53cc65f9eb11856ec43410646486baf7d /dev/Kernel/src/FS/NeFS.cc | |
| parent | 59418dea34d886712b99392d891e4a71fb59e05e (diff) | |
ADD: NeFS.cc: Tweaks and improvements on NeFS.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/Kernel/src/FS/NeFS.cc')
| -rw-r--r-- | dev/Kernel/src/FS/NeFS.cc | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/dev/Kernel/src/FS/NeFS.cc b/dev/Kernel/src/FS/NeFS.cc index 10bcad02..5df4daca 100644 --- a/dev/Kernel/src/FS/NeFS.cc +++ b/dev/Kernel/src/FS/NeFS.cc @@ -64,7 +64,7 @@ _Output BOOL NeFileSystemParser::CreateFork(_Input const Char* catalog_name, _Input NFS_FORK_STRUCT& the_fork) { if (the_fork.DataSize > 0) - { + { auto catalog = this->GetCatalog(catalog_name); if (!catalog) @@ -75,9 +75,10 @@ _Output BOOL NeFileSystemParser::CreateFork(_Input const Char* catalog_name, auto drv = kDiskMountpoint.A(); - NFS_FORK_STRUCT cur_fork; - Lba lba_prev_fork = lba; - Lba lba_next_fork = lba; + NFS_FORK_STRUCT cur_fork{}; + + Lba lba_prev_fork = lba; + Lba lba_next_fork = lba; if (the_fork.Kind == kNeFSDataForkKind) catalog->DataForkSize += the_fork.DataSize; @@ -85,7 +86,7 @@ _Output BOOL NeFileSystemParser::CreateFork(_Input const Char* catalog_name, catalog->ResourceForkSize += the_fork.DataSize; /// do not check for anything. Loop until we get what we want, that is a free fork zone. - while (lba_next_fork >= kNeFSCatalogStartAddress) + do { drv.fPacket.fPacketLba = lba_next_fork; drv.fPacket.fPacketSize = sizeof(NFS_FORK_STRUCT); @@ -93,6 +94,8 @@ _Output BOOL NeFileSystemParser::CreateFork(_Input const Char* catalog_name, drv.fInput(&drv.fPacket); + kcout << "LBA: " << hex_number(lba_next_fork) << endl; + if (cur_fork.Flags & kNeFSFlagCreated) { /// sanity check. @@ -116,17 +119,17 @@ _Output BOOL NeFileSystemParser::CreateFork(_Input const Char* catalog_name, drv.fPacket.fPacketSize = sizeof(NFS_FORK_STRUCT); drv.fPacket.fPacketContent = &the_fork; - drv.fOutput(&drv.fPacket); - /// log what we have now. kcout << "Wrote fork data at: " << hex_number(the_fork.DataOffset) << endl; kcout << "Wrote fork at: " << hex_number(lba) << endl; + drv.fOutput(&drv.fPacket); + return YES; } - } + } while (drv.fPacket.fPacketGood); } return NO; |
