summaryrefslogtreecommitdiffhomepage
path: root/Private/Source
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-04-08 21:13:11 +0200
committerAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-04-08 21:14:33 +0200
commit9be360bd9cce8a28fb4626fcc47b31b169e3b47c (patch)
treeed4db4592826d91c2fac7ecc5e24a5f99763ce90 /Private/Source
parent79886caeb4bf17b01fcc42c0891a61bcd5863a75 (diff)
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 <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'Private/Source')
-rw-r--r--Private/Source/DriveManager.cxx9
-rw-r--r--Private/Source/FS/NewFS.cxx13
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