diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-01-28 11:04:21 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-01-28 11:04:21 +0100 |
| commit | 93079836948ce3832f3690167e4aa9b9bb8795fc (patch) | |
| tree | 334697452ba826b8656d7effc969f7b24c85883c /Private/KernelKit/DriveManager.hpp | |
| parent | c6c908167e37e0f82e272f6f9fd6462c0dd4502c (diff) | |
Kernel: refactoring stuff.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private/KernelKit/DriveManager.hpp')
| -rw-r--r-- | Private/KernelKit/DriveManager.hpp | 121 |
1 files changed, 60 insertions, 61 deletions
diff --git a/Private/KernelKit/DriveManager.hpp b/Private/KernelKit/DriveManager.hpp index 9951c9cf..b5c0ad0c 100644 --- a/Private/KernelKit/DriveManager.hpp +++ b/Private/KernelKit/DriveManager.hpp @@ -20,68 +20,67 @@ namespace hCore { - enum - { - kInvalidDrive = -1, - kBlockDevice = 0xAD, - kMassStorage = 0xDA, - kFloppyDisc = 0xCD, - kOpticalDisc = 0xDC, // CD-ROM/DVD-ROM/Blu-Ray - kReadOnly = 0x10, // Read only drive - kXPMDrive = 0x11, // eXplicit Partition Map. - kXPTDrive = 0x12, // GPT w/ XPM partition. - kMBRDrive = 0x13, // IBM PC classic partition scheme - }; - - typedef Int64 DriveID; - - // Mounted drive. - struct DriveTraits final +enum +{ + kInvalidDrive = -1, + kBlockDevice = 0xAD, + kMassStorage = 0xDA, + kFloppyDisc = 0xCD, + kOpticalDisc = 0xDC, // CD-ROM/DVD-ROM/Blu-Ray + kReadOnly = 0x10, // Read only drive + kXPMDrive = 0x11, // eXplicit Partition Map. + kXPTDrive = 0x12, // GPT w/ XPM partition. + kMBRDrive = 0x13, // IBM PC classic partition scheme +}; + +typedef Int64 DriveID; + +// Mounted drive. +struct DriveTraits final +{ + char fName[kDriveNameLen]; // /system, /boot... + Int32 fKind; // fMassStorage, fFloppy, fOpticalDisc. + 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? + + //! for StorageKit. + struct DrivePacket final { - char fName[kDriveNameLen]; // /system, /boot... - Int32 fKind; // fMassStorage, fFloppy, fOpticalDisc. - 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? - - //! for StorageKit. - struct - { - voidPtr fPacketContent; // packet body. - Char fPacketMime[32]; //! identify what we're sending. - SizeT fPacketSize; // packet size - } fPacket; - }; + voidPtr fPacketContent; // packet body. + Char fPacketMime[32]; //! identify what we're sending. + SizeT fPacketSize; // packet size + } fPacket; +}; #define kPacketBinary "file/x-binary" #define kPacketSource "file/x-source" -#define kPacketASCII "file/x-ascii" -#define kPacketZip "file/x-zip" - - //! drive as a device. - typedef DeviceInterface<DriveTraits> Drive; - typedef Drive* DrivePtr; - - class DriveSelector final - { - public: - explicit DriveSelector(); - ~DriveSelector(); - - public: - HCORE_COPY_DEFAULT(DriveSelector); - - DriveTraits& GetMounted(); - bool Mount(DriveTraits* drive); - DriveTraits* Unmount(); - - private: - DriveTraits* fDrive; - - }; -} +#define kPacketASCII "file/x-ascii" +#define kPacketZip "file/x-zip" + +//! drive as a device. +typedef DeviceInterface<DriveTraits> Drive; +typedef Drive *DrivePtr; + +class DriveSelector final +{ + public: + explicit DriveSelector(); + ~DriveSelector(); + + public: + HCORE_COPY_DEFAULT(DriveSelector); + + DriveTraits &GetMounted(); + bool Mount(DriveTraits *drive); + DriveTraits *Unmount(); + + private: + DriveTraits *fDrive; +}; +} // namespace hCore |
