diff options
Diffstat (limited to 'Private/Source')
| -rw-r--r-- | Private/Source/DriveManager.cxx | 45 | ||||
| -rw-r--r-- | Private/Source/KernelMain.cxx | 2 | ||||
| -rw-r--r-- | Private/Source/NewFS+IO.cxx | 59 |
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__ |
