From 9be360bd9cce8a28fb4626fcc47b31b169e3b47c Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Mon, 8 Apr 2024 21:13:11 +0200 Subject: Kernel: Don't forget to set drives inside DriveManager. Kernel: Start implement Format method for NewFS, it needs to verify the disk first. Kernel: Add kErrorDiskIsCorrupted (Error 54). Kernel: Add __NEWOS_AMD64__ and __NEWOS_PPC__. Kernel: Rename builtin RJ45 to IEE802 Signed-off-by: Amlal El Mahrouss --- Private/Source/DriveManager.cxx | 9 ++++++++- Private/Source/FS/NewFS.cxx | 13 ++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) (limited to 'Private/Source') diff --git a/Private/Source/DriveManager.cxx b/Private/Source/DriveManager.cxx index 45b3c09a..46c6f150 100644 --- a/Private/Source/DriveManager.cxx +++ b/Private/Source/DriveManager.cxx @@ -8,6 +8,7 @@ #include #include #include +#include /// @file DriveManager.cxx /// @brief Kernel drive manager. @@ -91,6 +92,9 @@ Void ke_drv_unimplemented(DriveTrait::DrivePacket* pckt) {} DriveTrait construct_drive() noexcept { DriveTrait trait; + rt_copy_memory((VoidPtr)"/Mount/Null", trait.fName, rt_string_len("/Mount/Null")); + trait.fKind = kInvalidDrive; + trait.fInput = ke_drv_unimplemented; trait.fOutput = ke_drv_unimplemented; trait.fVerify = ke_drv_unimplemented; @@ -100,9 +104,12 @@ DriveTrait construct_drive() noexcept { /// @brief Fetches the main drive. /// @return the new drive. -DriveTrait main_drive() noexcept { +DriveTrait construct_main_drive() noexcept { DriveTrait trait; + rt_copy_memory((VoidPtr)"/Mount/Disk/0", trait.fName, rt_string_len("/Mount/Disk/0")); + trait.fKind = kMassStorage | kEPMDrive; + trait.fInput = ke_drv_input; trait.fOutput = ke_drv_output; trait.fVerify = ke_drv_check_disk; diff --git a/Private/Source/FS/NewFS.cxx b/Private/Source/FS/NewFS.cxx index 012cb3d2..1d7d3621 100644 --- a/Private/Source/FS/NewFS.cxx +++ b/Private/Source/FS/NewFS.cxx @@ -151,7 +151,18 @@ _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(). -bool NewFSParser::Format(_Input _Output DriveTrait* drive) { return false; } +bool NewFSParser::Format(_Input _Output DriveTrait* drive) { + /// verify disk. + drive->fVerify(&drive->fPacket); + + /// if disk isn't good, then error out. + if (false == drive->fPacket.fPacketGood) { + DbgLastError() = kErrorDiskIsCorrupted; + return false; + } + + return true; +} /// @brief /// @param catalog -- cgit v1.2.3