summaryrefslogtreecommitdiffhomepage
path: root/Private/KernelKit/DriveManager.hpp
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/KernelKit/DriveManager.hpp
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/KernelKit/DriveManager.hpp')
-rw-r--r--Private/KernelKit/DriveManager.hpp53
1 files changed, 37 insertions, 16 deletions
diff --git a/Private/KernelKit/DriveManager.hpp b/Private/KernelKit/DriveManager.hpp
index 8e6aaefd..d48b8aae 100644
--- a/Private/KernelKit/DriveManager.hpp
+++ b/Private/KernelKit/DriveManager.hpp
@@ -11,7 +11,9 @@
#define __DRIVE_MANAGER__
#include <CompilerKit/CompilerKit.hpp>
+#include <KernelKit/DebugOutput.hpp>
#include <KernelKit/DeviceManager.hpp>
+#include <KernelKit/HError.hpp>
#include <NewKit/Defines.hpp>
#include <NewKit/String.hpp>
@@ -41,17 +43,15 @@ struct DriveTraits final {
DriveID fId; // Drive id.
Int32 fFlags; // fReadOnly, fXPMDrive, fXPTDrive
- //! disk mount, unmount operations
- void (*fMount)(void);
- void (*fUnmount)(void);
-
- bool (*fReady)(void); //! is drive ready?
+ Handle fDriveHandle;
//! for StorageKit.
struct DrivePacket final {
voidPtr fPacketContent; // packet body.
Char fPacketMime[32]; //! identify what we're sending.
SizeT fPacketSize; // packet size
+ UInt32 fPacketCRC32; // sanity crc, in case if good is set to false
+ Boolean fPacketGood;
} fPacket;
};
@@ -61,23 +61,44 @@ struct DriveTraits final {
#define kPacketZip "file/x-zip"
//! drive as a device.
-typedef DeviceInterface<DriveTraits> Drive;
-typedef Drive *DrivePtr;
+typedef DeviceInterface<DriveTraits> DriveDevice;
+typedef DriveDevice* DriveDevicePtr;
-class DriveSelector final {
+class Mountpoint final {
public:
- explicit DriveSelector();
- ~DriveSelector();
+ explicit Mountpoint() = default;
+ ~Mountpoint() = default;
- public:
- HCORE_COPY_DEFAULT(DriveSelector);
+ HCORE_COPY_DEFAULT(Mountpoint);
- DriveTraits &GetMounted();
- bool Mount(DriveTraits *drive);
- DriveTraits *Unmount();
+ public:
+ DriveDevicePtr A() { return mA; }
+ DriveDevicePtr B() { return mB; }
+ DriveDevicePtr C() { return mC; }
+ DriveDevicePtr D() { return mD; }
+
+ DriveDevicePtr* GetAddressOf(int index) {
+ switch (index) {
+ case 0:
+ return &mA;
+ case 1:
+ return &mB;
+ case 2:
+ return &mC;
+ case 3:
+ return &mD;
+ default: {
+ GetLastError() = kErrorNoSuchDisk;
+ kcout << "Krnl\\Mountpoint: Check HError.\n";
+ break;
+ }
+ }
+
+ return nullptr;
+ }
private:
- DriveTraits *fDrive;
+ DriveDevicePtr mA, mB, mC, mD;
};
} // namespace HCore