diff options
| author | Amlal EL Mahrouss <amlalelmahrouss@icloud.com> | 2024-06-29 13:15:29 +0200 |
|---|---|---|
| committer | Amlal EL Mahrouss <amlalelmahrouss@icloud.com> | 2024-06-29 13:15:29 +0200 |
| commit | d9d42bcfeb444652ae198a6bd3481ce316549e55 (patch) | |
| tree | 238e88d868855c4ab6e1c6671bfc18a9930048fe /Kernel/Sources/FS | |
| parent | f562fbf39333925689d6fb704af15efe5f99ed28 (diff) | |
kernel: Use local error codes for kernel calls. So that we know which
process caused the error, and it's not global as well.
Signed-off-by: Amlal EL Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Kernel/Sources/FS')
| -rw-r--r-- | Kernel/Sources/FS/NewFS.cxx | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/Kernel/Sources/FS/NewFS.cxx b/Kernel/Sources/FS/NewFS.cxx index 4e212164..33857590 100644 --- a/Kernel/Sources/FS/NewFS.cxx +++ b/Kernel/Sources/FS/NewFS.cxx @@ -16,6 +16,7 @@ #include <NewKit/String.hpp> #include <NewKit/Utils.hpp> #include <FirmwareKit/EPM.hxx> +#include <KernelKit/ProcessScheduler.hxx> using namespace NewOS; @@ -167,12 +168,12 @@ _Output NewFork* NewFSParser::FindFork(_Input NewCatalog* catalog, switch (res) { case 1: - DbgLastError() = kErrorDiskReadOnly; + ErrLocal() = kErrorDiskReadOnly; break; case 2: - DbgLastError() = kErrorDiskIsFull; + ErrLocal() = kErrorDiskIsFull; break; - DbgLastError() = kErrorNoSuchDisk; + ErrLocal() = kErrorNoSuchDisk; break; default: @@ -241,7 +242,7 @@ _Output NewCatalog* NewFSParser::CreateCatalog(_Input const char* name, if (*parentName == 0) { - DbgLastError() = kErrorFileNotFound; + ErrLocal() = kErrorFileNotFound; return nullptr; } @@ -414,7 +415,7 @@ _Output NewCatalog* NewFSParser::CreateCatalog(_Input const char* name, /// @brief Make a EPM+NewFS drive out of the disk. /// @param drive The drive to write on. -/// @return If it was sucessful, see DbgLastError(). +/// @return If it was sucessful, see ErrLocal(). bool NewFSParser::Format(_Input _Output DriveTrait* drive) { /// verify disk. @@ -426,7 +427,7 @@ bool NewFSParser::Format(_Input _Output DriveTrait* drive) /// if disk isn't good, then error out. if (false == drive->fPacket.fPacketGood) { - DbgLastError() = kErrorDiskIsCorrupted; + ErrLocal() = kErrorDiskIsCorrupted; return false; } @@ -565,7 +566,7 @@ bool NewFSParser::WriteCatalog(_Input _Output NewCatalog* catalog, voidPtr data, /// sanity check the fork. if (forkData->DataOffset <= kNewFSCatalogStartAddress) { - DbgLastError() = kErrorDiskIsCorrupted; + ErrLocal() = kErrorDiskIsCorrupted; kcout << "newoskrnl: Invalid fork offset.\r"; @@ -771,7 +772,7 @@ Boolean NewFSParser::RemoveCatalog(_Input const Char* catalogName) if (!catalogName || StringBuilder::Equals(catalogName, NewFilesystemHelper::Root())) { - DbgLastError() = kErrorInternal; + ErrLocal() = kErrorInternal; return false; } @@ -835,7 +836,7 @@ VoidPtr NewFSParser::ReadCatalog(_Input _Output NewCatalog* catalog, { if (!catalog) { - DbgLastError() = kErrorFileNotFound; + ErrLocal() = kErrorFileNotFound; return nullptr; } @@ -913,11 +914,11 @@ bool NewFSParser::Seek(_Input _Output NewCatalog* catalog, SizeT off) { if (!catalog) { - DbgLastError() = kErrorFileNotFound; + ErrLocal() = kErrorFileNotFound; return false; } - DbgLastError() = kErrorUnimplemented; + ErrLocal() = kErrorUnimplemented; return false; } @@ -931,11 +932,11 @@ SizeT NewFSParser::Tell(_Input _Output NewCatalog* catalog) { if (!catalog) { - DbgLastError() = kErrorFileNotFound; + ErrLocal() = kErrorFileNotFound; return 0; } - DbgLastError() = kErrorUnimplemented; + ErrLocal() = kErrorUnimplemented; return 0; } |
