summaryrefslogtreecommitdiffhomepage
path: root/Private/Source
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-02-24 17:29:16 +0100
committerAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-02-24 17:29:16 +0100
commita481180f3bcb979fecdced3851506bf572327fcf (patch)
treece2f025d2057c94dd8766680be630766c77babd4 /Private/Source
parent3796780438de17a5da38f1d5a6845942c27c0e5c (diff)
Kernel: Important commit, see below.
- Rename EFIKit to FirmwareKit. - Reworked DriveManager, a mountpoint is a class which contains 4 disks at maximum, they act as virtual ones, their format doesn't matter. - Add KeHCFSRead, and KeHCFSWrite. Signed-off-by: Amlal El Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Private/Source')
-rw-r--r--Private/Source/DriveManager.cxx45
-rw-r--r--Private/Source/KernelMain.cxx2
-rw-r--r--Private/Source/NewFS+IO.cxx59
3 files changed, 59 insertions, 47 deletions
diff --git a/Private/Source/DriveManager.cxx b/Private/Source/DriveManager.cxx
index 371758b1..27f6cc42 100644
--- a/Private/Source/DriveManager.cxx
+++ b/Private/Source/DriveManager.cxx
@@ -10,47 +10,4 @@
#include <KernelKit/DebugOutput.hpp>
#include <KernelKit/DriveManager.hpp>
-namespace HCore {
-DriveSelector::DriveSelector() : fDrive(nullptr) {}
-
-DriveSelector::~DriveSelector() {
- if (fDrive) {
- this->Unmount();
- }
-}
-
-DriveTraits &DriveSelector::GetMounted() {
- MUST_PASS(fDrive != nullptr);
- return *fDrive;
-}
-
-bool DriveSelector::Mount(DriveTraits *drive) {
- if (drive && drive->fReady()) {
- if (fDrive != nullptr) {
- this->Unmount();
- }
-
- fDrive = drive;
- fDrive->fMount();
-
- kcout << "Mount: " << fDrive->fName << "\n";
-
- return true;
- }
-
- return false;
-}
-
-DriveTraits *DriveSelector::Unmount() {
- if (!fDrive) return nullptr;
-
- DriveTraits *drivePointer = fDrive;
-
- fDrive->fUnmount();
- fDrive = nullptr;
-
- kcout << "Unmount: " << fDrive->fName << "\n";
-
- return drivePointer;
-}
-} // namespace HCore
+namespace HCore {} // namespace HCore
diff --git a/Private/Source/KernelMain.cxx b/Private/Source/KernelMain.cxx
index e641c7e9..1b2698c4 100644
--- a/Private/Source/KernelMain.cxx
+++ b/Private/Source/KernelMain.cxx
@@ -8,7 +8,7 @@
*/
#include <ArchKit/ArchKit.hpp>
-#include <EFIKit/Handover.hxx>
+#include <FirmwareKit/Handover.hxx>
#include <KernelKit/FileManager.hpp>
#include <KernelKit/Framebuffer.hpp>
#include <KernelKit/PEFCodeManager.hxx>
diff --git a/Private/Source/NewFS+IO.cxx b/Private/Source/NewFS+IO.cxx
index 681b198a..2e6559c5 100644
--- a/Private/Source/NewFS+IO.cxx
+++ b/Private/Source/NewFS+IO.cxx
@@ -18,8 +18,63 @@
#ifdef __FSKIT_NEWFS__
-/// @brief This implements NewFS with Device Abstraction in mind.
+#include <FirmwareKit/EPM.hxx>
-/// BUGS: 0
+/// Useful macros.
+
+#define NEWFS_WRITE(DRV, TRAITS, MP) (*MP->DRV()) << TRAITS
+#define NEWFS_READ(DRV, TRAITS, MP) (*MP->DRV()) >> TRAITS
+
+using namespace HCore;
+
+Int32 KeHCFSRead(Mountpoint* Mnt, DriveTraits& DrvTraits, Int32 DrvIndex) {
+ if (!Mnt) return -1;
+
+ switch (DrvIndex) {
+ case 0: {
+ NEWFS_READ(A, DrvTraits, Mnt);
+ break;
+ }
+ case 1: {
+ NEWFS_READ(B, DrvTraits, Mnt);
+ break;
+ }
+ case 2: {
+ NEWFS_READ(C, DrvTraits, Mnt);
+ break;
+ }
+ case 3: {
+ NEWFS_READ(D, DrvTraits, Mnt);
+ break;
+ }
+ }
+
+ return DrvTraits.fPacket.fPacketGood;
+}
+
+Int32 KeHCFSWrite(Mountpoint* Mnt, DriveTraits& DrvTraits, Int32 DrvIndex) {
+ if (!Mnt) return -1;
+
+ switch (DrvIndex) {
+ case 0: {
+ NEWFS_WRITE(A, DrvTraits, Mnt);
+ break;
+ }
+ case 1: {
+ NEWFS_WRITE(B, DrvTraits, Mnt);
+ break;
+ }
+ case 2: {
+ NEWFS_WRITE(C, DrvTraits, Mnt);
+ break;
+ }
+ case 3: {
+ NEWFS_WRITE(D, DrvTraits, Mnt);
+ break;
+ }
+ }
+
+ return DrvTraits.fPacket.fPacketGood;
+}
#endif // ifdef __FSKIT_NEWFS__