diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-06-23 22:59:26 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-06-23 22:59:26 +0200 |
| commit | 0d44c75062a313f7d1b8813816843bc8ab51b135 (patch) | |
| tree | 6d44b12ba358c19f8512f1fe61dce58cd3a11a3c /dev/kernel/src/FS | |
| parent | cbda3fef30c3575eb12a22b5fd7cd7d5d2e01c20 (diff) | |
fix: Fix AP init code, and format codebase.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/kernel/src/FS')
| -rw-r--r-- | dev/kernel/src/FS/HeFS+FileSystemParser.cc | 8 | ||||
| -rw-r--r-- | dev/kernel/src/FS/NeFS+FileSystemParser.cc | 34 |
2 files changed, 24 insertions, 18 deletions
diff --git a/dev/kernel/src/FS/HeFS+FileSystemParser.cc b/dev/kernel/src/FS/HeFS+FileSystemParser.cc index b2e894d0..8092f53b 100644 --- a/dev/kernel/src/FS/HeFS+FileSystemParser.cc +++ b/dev/kernel/src/FS/HeFS+FileSystemParser.cc @@ -799,7 +799,7 @@ _Output Bool HeFileSystemParser::Format(_Input _Output DriveTrait* mnt, _Input c } rt_copy_memory_safe((VoidPtr) "fs/hefs-packet", mnt->fPacket.fPacketMime, - rt_string_len("fs/hefs-packet"), sizeof(mnt->fPacket.fPacketMime)); + rt_string_len("fs/hefs-packet"), sizeof(mnt->fPacket.fPacketMime)); urt_copy_memory((VoidPtr) vol_name, boot->fVolName, urt_string_len(vol_name) + 1); rt_copy_memory_safe((VoidPtr) kHeFSMagic, boot->fMagic, kHeFSMagicLen - 1, sizeof(boot->fMagic)); @@ -907,7 +907,7 @@ _Output Bool HeFileSystemParser::INodeDirectoryCtlManip(_Input DriveTrait* mnt, HEFS_BOOT_NODE* boot = (HEFS_BOOT_NODE*) mm_alloc_ptr(sizeof(HEFS_BOOT_NODE), Yes, No); rt_copy_memory_safe((VoidPtr) "fs/hefs-packet", mnt->fPacket.fPacketMime, - rt_string_len("fs/hefs-packet"), sizeof(mnt->fPacket.fPacketMime)); + rt_string_len("fs/hefs-packet"), sizeof(mnt->fPacket.fPacketMime)); mnt->fPacket.fPacketLba = mnt->fLbaStart; mnt->fPacket.fPacketSize = sizeof(HEFS_BOOT_NODE); @@ -993,7 +993,7 @@ _Output Bool HeFileSystemParser::INodeManip(_Input DriveTrait* mnt, VoidPtr bloc } rt_copy_memory_safe((VoidPtr) "fs/hefs-packet", mnt->fPacket.fPacketMime, - rt_string_len("fs/hefs-packet"), sizeof(mnt->fPacket.fPacketMime)); + rt_string_len("fs/hefs-packet"), sizeof(mnt->fPacket.fPacketMime)); mnt->fPacket.fPacketLba = mnt->fLbaStart; mnt->fPacket.fPacketSize = sizeof(HEFS_BOOT_NODE); @@ -1079,7 +1079,7 @@ _Output Bool HeFileSystemParser::INodeCtlManip(_Input DriveTrait* mnt, _Input co } rt_copy_memory_safe((VoidPtr) "fs/hefs-packet", mnt->fPacket.fPacketMime, - rt_string_len("fs/hefs-packet"), sizeof(mnt->fPacket.fPacketMime)); + rt_string_len("fs/hefs-packet"), sizeof(mnt->fPacket.fPacketMime)); mnt->fPacket.fPacketLba = mnt->fLbaStart; mnt->fPacket.fPacketSize = sizeof(HEFS_BOOT_NODE); diff --git a/dev/kernel/src/FS/NeFS+FileSystemParser.cc b/dev/kernel/src/FS/NeFS+FileSystemParser.cc index 0bee64a8..14e0b974 100644 --- a/dev/kernel/src/FS/NeFS+FileSystemParser.cc +++ b/dev/kernel/src/FS/NeFS+FileSystemParser.cc @@ -168,7 +168,7 @@ _Output NEFS_FORK_STRUCT* NeFileSystemParser::FindFork(_Input NEFS_CATALOG_STRUC drive.fPacket.fPacketContent = reinterpret_cast<VoidPtr>(&local_buf); rt_copy_memory_safe((VoidPtr) "fs/nefs-packet", drive.fPacket.fPacketMime, - rt_string_len("fs/nefs-packet"), sizeof(drive.fPacket.fPacketMime)); + rt_string_len("fs/nefs-packet"), sizeof(drive.fPacket.fPacketMime)); if (auto res = fs_ifs_read(&kMountpoint, drive, this->mDriveIndex); res) { switch (res) { @@ -312,13 +312,14 @@ _Output NEFS_CATALOG_STRUCT* NeFileSystemParser::CreateCatalog(_Input const Char --i; if (kind == kNeFSCatalogKindDir) --i; while (name[i] != '/') --i; - rt_copy_memory_safe((VoidPtr) (name + i), (VoidPtr) child_catalog->Name, rt_string_len(name) - i, kNeFSCatalogNameLen); + rt_copy_memory_safe((VoidPtr) (name + i), (VoidPtr) child_catalog->Name, rt_string_len(name) - i, + kNeFSCatalogNameLen); NEFS_CATALOG_STRUCT temporary_catalog{}; Lba start_free = out_lba; rt_copy_memory_safe((VoidPtr) "fs/nefs-packet", drive.fPacket.fPacketMime, - rt_string_len("fs/nefs-packet"), sizeof(drive.fPacket.fPacketMime)); + rt_string_len("fs/nefs-packet"), sizeof(drive.fPacket.fPacketMime)); Char buf_part_block[sizeof(NEFS_ROOT_PARTITION_BLOCK)] = {0}; drive.fPacket.fPacketContent = reinterpret_cast<VoidPtr>(buf_part_block); @@ -380,13 +381,15 @@ _Output NEFS_CATALOG_STRUCT* NeFileSystemParser::CreateCatalog(_Input const Char delete catalog; NEFS_CATALOG_STRUCT* found_catalog = new NEFS_CATALOG_STRUCT(); - rt_copy_memory_safe(&temporary_catalog, found_catalog, sizeof(NEFS_CATALOG_STRUCT), sizeof(NEFS_CATALOG_STRUCT)); + rt_copy_memory_safe(&temporary_catalog, found_catalog, sizeof(NEFS_CATALOG_STRUCT), + sizeof(NEFS_CATALOG_STRUCT)); delete child_catalog; return found_catalog; } else if ((temporary_catalog.Flags & kNeFSFlagCreated) && KStringBuilder::Equals(temporary_catalog.Name, name)) { - rt_copy_memory_safe(&temporary_catalog, child_catalog, sizeof(NEFS_CATALOG_STRUCT), sizeof(NEFS_CATALOG_STRUCT)); + rt_copy_memory_safe(&temporary_catalog, child_catalog, sizeof(NEFS_CATALOG_STRUCT), + sizeof(NEFS_CATALOG_STRUCT)); delete catalog; return child_catalog; } @@ -412,7 +415,7 @@ bool NeFileSystemParser::Format(_Input _Output DriveTrait* drive, _Input const I // verify disk. drive->fVerify(drive->fPacket); rt_copy_memory_safe((VoidPtr) "fs/nefs-packet", drive->fPacket.fPacketMime, - rt_string_len("fs/nefs-packet"), sizeof(drive->fPacket.fPacketMime)); + rt_string_len("fs/nefs-packet"), sizeof(drive->fPacket.fPacketMime)); if (!drive->fPacket.fPacketGood) { err_global_get() = kErrorDiskIsCorrupted; return false; @@ -430,9 +433,10 @@ bool NeFileSystemParser::Format(_Input _Output DriveTrait* drive, _Input const I if (rt_string_cmp(kNeFSIdent, part_block->Ident, kNeFSIdentLen) == 0) return true; const auto kNeFSUntitledHD = part_name; - rt_copy_memory_safe((VoidPtr) kNeFSIdent, (VoidPtr) part_block->Ident, kNeFSIdentLen, sizeof(part_block->Ident)); + rt_copy_memory_safe((VoidPtr) kNeFSIdent, (VoidPtr) part_block->Ident, kNeFSIdentLen, + sizeof(part_block->Ident)); rt_copy_memory_safe((VoidPtr) kNeFSUntitledHD, (VoidPtr) part_block->PartitionName, - rt_string_len(kNeFSUntitledHD), sizeof(part_block->PartitionName)); + rt_string_len(kNeFSUntitledHD), sizeof(part_block->PartitionName)); SizeT sectorCount = drv_std_get_sector_count(); SizeT sectorSize = drive->fSectorSz; @@ -515,7 +519,7 @@ bool NeFileSystemParser::WriteCatalog(_Input const Char* catalog_name, Bool is_r rt_set_memory(buf, 0, size_of_data); rt_copy_memory_safe(data, buf, size_of_data, size_of_data); rt_copy_memory_safe((VoidPtr) "fs/nefs-packet", drive.fPacket.fPacketMime, - rt_string_len("fs/nefs-packet"), sizeof(drive.fPacket.fPacketMime)); + rt_string_len("fs/nefs-packet"), sizeof(drive.fPacket.fPacketMime)); NEFS_FORK_STRUCT* fork_data_input = new NEFS_FORK_STRUCT(); NEFS_FORK_STRUCT prev_fork{}; @@ -578,7 +582,7 @@ _Output NEFS_CATALOG_STRUCT* NeFileSystemParser::FindCatalog(_Input const Char* auto& drive = kMountpoint.A(); rt_copy_memory_safe((VoidPtr) "fs/nefs-packet", drive.fPacket.fPacketMime, - rt_string_len("fs/nefs-packet"), sizeof(drive.fPacket.fPacketMime)); + rt_string_len("fs/nefs-packet"), sizeof(drive.fPacket.fPacketMime)); drive.fPacket.fPacketContent = reinterpret_cast<VoidPtr>(&part); drive.fPacket.fPacketSize = sizeof(NEFS_ROOT_PARTITION_BLOCK); drive.fPacket.fPacketLba = kNeFSRootCatalogStartAddress; @@ -607,7 +611,8 @@ _Output NEFS_CATALOG_STRUCT* NeFileSystemParser::FindCatalog(_Input const Char* return nullptr; } NEFS_CATALOG_STRUCT* catalog_ptr = new NEFS_CATALOG_STRUCT(); - rt_copy_memory_safe(&tmp, catalog_ptr, sizeof(NEFS_CATALOG_STRUCT), sizeof(NEFS_CATALOG_STRUCT)); + rt_copy_memory_safe(&tmp, catalog_ptr, sizeof(NEFS_CATALOG_STRUCT), + sizeof(NEFS_CATALOG_STRUCT)); out_lba = cursor; return catalog_ptr; } @@ -619,7 +624,8 @@ _Output NEFS_CATALOG_STRUCT* NeFileSystemParser::FindCatalog(_Input const Char* if (!KStringBuilder::Equals(catalog_name, NeFileSystemHelper::Root()) && local_search) { Char parent_name[kNeFSCatalogNameLen] = {0}; SizeT nameLen = rt_string_len(catalog_name); - rt_copy_memory_safe(const_cast<Char*>(catalog_name), parent_name, nameLen + 1, kNeFSCatalogNameLen); + rt_copy_memory_safe(const_cast<Char*>(catalog_name), parent_name, nameLen + 1, + kNeFSCatalogNameLen); SizeT indexReverseCopy = nameLen - 1; if (parent_name[indexReverseCopy] == NeFileSystemHelper::Separator()) { @@ -728,7 +734,7 @@ _Output Boolean NeFileSystemParser::RemoveCatalog(_Input const Char* catalog_nam catalog->Flags |= kNeFSFlagDeleted; rt_copy_memory_safe((VoidPtr) "fs/nefs-packet", drive.fPacket.fPacketMime, - rt_string_len("fs/nefs-packet"), sizeof(drive.fPacket.fPacketMime)); + rt_string_len("fs/nefs-packet"), sizeof(drive.fPacket.fPacketMime)); drive.fPacket.fPacketLba = out_lba; drive.fPacket.fPacketSize = sizeof(NEFS_CATALOG_STRUCT); drive.fPacket.fPacketContent = reinterpret_cast<VoidPtr>(catalog); @@ -796,7 +802,7 @@ VoidPtr NeFileSystemParser::ReadCatalog(_Input _Output NEFS_CATALOG_STRUCT* cata auto* fs_buf = new NEFS_FORK_STRUCT(); rt_copy_memory_safe((VoidPtr) "fs/nefs-packet", drive.fPacket.fPacketMime, - rt_string_len("fs/nefs-packet"), sizeof(drive.fPacket.fPacketMime)); + rt_string_len("fs/nefs-packet"), sizeof(drive.fPacket.fPacketMime)); NEFS_FORK_STRUCT* fs_fork_data = nullptr; while (dataForkLba >= kNeFSCatalogStartAddress) { |
