diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-12-09 02:50:07 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-12-09 02:52:34 +0100 |
| commit | 4d192e629a07ae457134cb0063e0136e54b01008 (patch) | |
| tree | b933444d27c2b9ac22693e2e65bd294792c79d39 /src/boot/BootKit | |
| parent | f78c535aec66e02584e1b02995dc12c9e1bcb64c (diff) | |
chore: Codebase improvements and tweaks.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'src/boot/BootKit')
| -rw-r--r-- | src/boot/BootKit/BootKit.h | 7 | ||||
| -rw-r--r-- | src/boot/BootKit/Config.h | 16 | ||||
| -rw-r--r-- | src/boot/BootKit/Device.h | 20 | ||||
| -rw-r--r-- | src/boot/BootKit/EPM.h | 5 | ||||
| -rw-r--r-- | src/boot/BootKit/HW/ATA.h | 4 | ||||
| -rw-r--r-- | src/boot/BootKit/HW/SATA.h | 4 |
6 files changed, 43 insertions, 13 deletions
diff --git a/src/boot/BootKit/BootKit.h b/src/boot/BootKit/BootKit.h index fb8941e0..b00fd112 100644 --- a/src/boot/BootKit/BootKit.h +++ b/src/boot/BootKit/BootKit.h @@ -9,7 +9,10 @@ /// @brief Bootloader Application Programming Interface. /***********************************************************************************/ -#pragma once +#ifndef __BOOTKIT_H__ +#define __BOOTKIT_H__ + +#include <BootKit/Config.h> #include <BootKit/HW/ATA.h> #include <CompilerKit/Version.h> @@ -333,3 +336,5 @@ inline Boolean BDiskFormatFactory<BootDev>::Format(const Char* part_name) { return YES; } } // namespace Boot + +#endif // __BOOTKIT_H__
\ No newline at end of file diff --git a/src/boot/BootKit/Config.h b/src/boot/BootKit/Config.h new file mode 100644 index 00000000..b2641b24 --- /dev/null +++ b/src/boot/BootKit/Config.h @@ -0,0 +1,16 @@ +/* ======================================== + + Copyright (C) 2025, Amlal El Mahrouss, licensed under the Apache 2.0 license. + +======================================== */ + +#ifndef __BOOTKIT_CONFIG_H__ +#define __BOOTKIT_CONFIG_H__ + +#include <NeKit/Config.h> + +namespace Boot { + using namespace Kernel; +} + +#endif // ! __BOOTKIT_CONFIG_H__
\ No newline at end of file diff --git a/src/boot/BootKit/Device.h b/src/boot/BootKit/Device.h index 36e2b3d4..efe27659 100644 --- a/src/boot/BootKit/Device.h +++ b/src/boot/BootKit/Device.h @@ -4,13 +4,15 @@ ======================================== */ -#pragma once +#ifndef __BOOTKIT_DEVICE_H__ +#define __BOOTKIT_DEVICE_H__ +#include <BootKit/Config.h> #include <modules/AHCI/AHCI.h> #include <modules/ATA/ATA.h> -namespace Kernel { -/// @brief Device type. +namespace Boot { +/// @brief Physical/Virtual device type. class Device { public: explicit Device() = default; @@ -19,7 +21,7 @@ class Device { NE_MOVE_DEFAULT(Device) struct Trait { - SizeT mBase{0}; + Lba mBase{0}; SizeT mSize{0}; }; @@ -29,7 +31,9 @@ class Device { virtual Device& Write(Char* Buf, SizeT SecCount) = 0; }; -typedef Device BootDevice; -typedef Device NetworkDevice; -typedef Device DiskDevice; -} // namespace Kernel
\ No newline at end of file +using BootDevice = Device; +using NetworkDevice = Device; +using DiskDevice = Device; +} // namespace Boot + +#endif
\ No newline at end of file diff --git a/src/boot/BootKit/EPM.h b/src/boot/BootKit/EPM.h index cc82dd41..5657337a 100644 --- a/src/boot/BootKit/EPM.h +++ b/src/boot/BootKit/EPM.h @@ -4,6 +4,9 @@ ======================================== */ -#pragma once +#ifndef __BOOTKIT_EPM_H__ +#define __BOOTKIT_EPM_H__ #include <FirmwareKit/EPM.h> + +#endif
\ No newline at end of file diff --git a/src/boot/BootKit/HW/ATA.h b/src/boot/BootKit/HW/ATA.h index 7ebf296d..1842300b 100644 --- a/src/boot/BootKit/HW/ATA.h +++ b/src/boot/BootKit/HW/ATA.h @@ -9,8 +9,7 @@ #include <BootKit/Device.h> #include <modules/ATA/ATA.h> -using namespace Kernel; - +namespace Boot { class BootDeviceATA final : public Device { public: enum { @@ -45,3 +44,4 @@ class BootDeviceATA final : public Device { private: ATATrait mTrait; }; +} // namespace Boot
\ No newline at end of file diff --git a/src/boot/BootKit/HW/SATA.h b/src/boot/BootKit/HW/SATA.h index 68ed30c8..442ea399 100644 --- a/src/boot/BootKit/HW/SATA.h +++ b/src/boot/BootKit/HW/SATA.h @@ -12,6 +12,7 @@ #define kAHCISectorSz (512) +namespace Boot { class BootDeviceSATA final { public: explicit BootDeviceSATA(); @@ -23,7 +24,7 @@ class BootDeviceSATA final { Kernel::Boolean mErr{false}; Kernel::Boolean mDetected{false}; - operator bool() { return !this->mErr; } + explicit operator bool() { return !this->mErr; } }; operator bool() { return this->Leak().mDetected; } @@ -40,3 +41,4 @@ class BootDeviceSATA final { private: SATATrait mTrait; }; +} // namespace Boot
\ No newline at end of file |
