diff options
Diffstat (limited to 'Private/Source')
| -rw-r--r-- | Private/Source/DriveManager.cxx | 9 | ||||
| -rw-r--r-- | Private/Source/FS/NewFS.cxx | 13 |
2 files changed, 20 insertions, 2 deletions
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 <KernelKit/DriveManager.hxx> #include <Builtins/ATA/Defines.hxx> #include <Builtins/AHCI/Defines.hxx> +#include <NewKit/Utils.hpp> /// @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 |
