summaryrefslogtreecommitdiffhomepage
path: root/dev/kernel/src/DriveMgr.cc
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-11-17 10:05:07 +0100
committerGitHub <noreply@github.com>2025-11-17 10:05:07 +0100
commit062c4bb508bf6ec7334d374fef2e0e10623b2df9 (patch)
tree137a91eb22d1a9207fd4322ced08c3b6388c5eb5 /dev/kernel/src/DriveMgr.cc
parent36269e57831e560df6a0da9c9d02c00671b0163d (diff)
parent791fcd646503f05617f22e6006c115095746da26 (diff)
Merge pull request #69 from nekernel-org/dev
release: NeKernel v0.0.7
Diffstat (limited to 'dev/kernel/src/DriveMgr.cc')
-rw-r--r--dev/kernel/src/DriveMgr.cc19
1 files changed, 8 insertions, 11 deletions
diff --git a/dev/kernel/src/DriveMgr.cc b/dev/kernel/src/DriveMgr.cc
index 9f107e97..a0f7bb77 100644
--- a/dev/kernel/src/DriveMgr.cc
+++ b/dev/kernel/src/DriveMgr.cc
@@ -1,6 +1,6 @@
/* -------------------------------------------
- Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.
+ Copyright (C) 2024-2025, Amlal El Mahrouss, licensed under the Apache 2.0 license.
------------------------------------------- */
@@ -152,10 +152,8 @@ DriveTrait io_construct_blank_drive() noexcept {
return trait;
}
-namespace Detail {
+namespace Probe {
Void io_detect_drive(DriveTrait& trait) {
- trait.fInit(trait.fPacket);
-
EPM_PART_BLOCK block_struct;
trait.fPacket.fPacketLba = kEPMBootBlockLba;
@@ -165,6 +163,8 @@ namespace Detail {
rt_copy_memory((VoidPtr) "fs/detect-packet", trait.fPacket.fPacketMime,
rt_string_len("fs/detect-packet"));
+ trait.fInit(trait.fPacket);
+
trait.fInput(trait.fPacket);
if (rt_string_cmp(block_struct.Magic, kEPMMagic, kEPMMagicLength) == 0) {
@@ -220,12 +220,11 @@ namespace Detail {
/// @brief Fetches the main drive.
/// @return the new drive. (returns kEPMDrive if EPM formatted)
DriveTrait io_construct_main_drive() noexcept {
- DriveTrait trait;
-
constexpr auto kMainDrive = "/media/main/";
- rt_copy_memory((VoidPtr) kMainDrive, trait.fName, rt_string_len(kMainDrive));
+ DriveTrait trait{};
+ rt_copy_memory((VoidPtr) kMainDrive, trait.fName, rt_string_len(kMainDrive));
MUST_PASS(trait.fName[0] != 0);
trait.fVerify = io_drv_unimplemented;
@@ -233,10 +232,8 @@ DriveTrait io_construct_main_drive() noexcept {
trait.fInput = io_drv_input;
trait.fInit = io_drv_init;
trait.fProtocol = io_drv_kind;
-
- kout << "DriveMgr: Detecting partition scheme of: " << trait.fName << ".\r";
-
- Detail::io_detect_drive(trait);
+
+ Probe::io_detect_drive(trait);
return trait;
}