summaryrefslogtreecommitdiffhomepage
path: root/Private/KernelKit/DriveManager.hxx
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-05-08 12:32:41 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-05-08 12:32:41 +0200
commit09dd11ddf800898c00ecb04a65fb5cd10fb481fa (patch)
treeeda0b4e23d6a71da7de3a78f0bb76ec3201dd2f9 /Private/KernelKit/DriveManager.hxx
parentca83108fd138cc0398f900e6a6c0a53ad51aee31 (diff)
MHR-23: :boom: changes, reworked project tree.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private/KernelKit/DriveManager.hxx')
-rw-r--r--Private/KernelKit/DriveManager.hxx146
1 files changed, 0 insertions, 146 deletions
diff --git a/Private/KernelKit/DriveManager.hxx b/Private/KernelKit/DriveManager.hxx
deleted file mode 100644
index 4f8bdd1d..00000000
--- a/Private/KernelKit/DriveManager.hxx
+++ /dev/null
@@ -1,146 +0,0 @@
-/* -------------------------------------------
-
- Copyright Mahrouss Logic
-
-------------------------------------------- */
-
-#ifndef __DRIVE_MANAGER__
-#define __DRIVE_MANAGER__
-
-#include <CompilerKit/CompilerKit.hxx>
-#include <KernelKit/DebugOutput.hpp>
-#include <KernelKit/DeviceManager.hpp>
-#include <KernelKit/HError.hpp>
-#include <NewKit/Defines.hpp>
-#include <NewKit/String.hpp>
-
-#define kDriveInvalidID -1
-#define kDriveNameLen 32
-
-namespace NewOS
-{
- enum
- {
- kInvalidDrive = -1,
- kBlockDevice = 0xAD,
- kMassStorage = 0xDA,
- kFloppyDisc = 0xCD,
- kOpticalDisc = 0xDC, // CD-ROM/DVD-ROM/Blu-Ray
- /// combine with below.
- kReadOnly = 0x10, // Read only drive
- kEPMDrive = 0x11, // Explicit Partition Map.
- kEPTDrive = 0x12, // ESP w/ EPM partition.
- kMBRDrive = 0x13, // IBM PC classic partition scheme
- kDriveCnt = 9,
- };
-
- typedef Int64 rt_drive_id_type;
-
- /// @brief Media drive trait type.
- struct DriveTrait final
- {
- Char fName[kDriveNameLen]; // /System, /Boot, //./Devices/USB...
- Int32 fKind; // fMassStorage, fFloppy, fOpticalDisc.
- rt_drive_id_type fId; // Drive id.
- Int32 fFlags; // fReadOnly, fXPMDrive, fXPTDrive
-
- /// @brief Packet drive (StorageKit compilant.)
- struct DrivePacket final
- {
- VoidPtr fPacketContent; //! packet body.
- Char fPacketMime[kDriveNameLen]; //! identify what we're sending.
- SizeT fPacketSize; //! packet size
- UInt32 fPacketCRC32; //! sanity crc, in case if good is set to false
- Boolean fPacketGood;
- Lba fLba;
- } fPacket;
-
- Void (*fInput)(DrivePacket* packetPtr);
- Void (*fOutput)(DrivePacket* packetPtr);
- Void (*fVerify)(DrivePacket* packetPtr);
- const Char* (*fDriveKind)(Void);
- };
-
- ///! drive as a device.
- typedef DriveTrait* DriveTraitPtr;
-
- /**
- * @brief Mounted drives interface.
- * @note This class has all of it's drive set to nullptr, allocate them using
- * GetAddressOf(index).
- */
- class MountpointInterface final
- {
- public:
- explicit MountpointInterface() = default;
- ~MountpointInterface() = default;
-
- NEWOS_COPY_DEFAULT(MountpointInterface);
-
- public:
- DriveTrait& A()
- {
- return mA;
- }
- DriveTrait& B()
- {
- return mB;
- }
- DriveTrait& C()
- {
- return mC;
- }
- DriveTrait& D()
- {
- return mD;
- }
-
- DriveTraitPtr GetAddressOf(Int32 index)
- {
- DbgLastError() = kErrorSuccess;
-
- switch (index)
- {
- case 0:
- return &mA;
- case 1:
- return &mB;
- case 2:
- return &mC;
- case 3:
- return &mD;
- default: {
- DbgLastError() = kErrorNoSuchDisk;
- kcout << "New OS: No such disk.\n";
-
- break;
- }
- }
-
- return nullptr;
- }
-
- private:
- DriveTrait mA, mB, mC, mD;
- };
-
- /// @brief Unimplemented drive.
- /// @param pckt
- /// @return
- Void ke_drv_unimplemented(DriveTrait::DrivePacket* pckt);
-
- /// @brief Gets the drive kind (ATA, SCSI, AHCI...)
- /// @param
- /// @return
- const Char* ke_drive_kind(Void);
-
- /// @brief Makes a new drive.
- /// @return the new drive.
- DriveTrait construct_drive(void) noexcept;
-
- /// @brief Fetches the main drive.
- /// @return the new drive.
- DriveTrait construct_main_drive(void) noexcept;
-} // namespace NewOS
-
-#endif /* ifndef __DRIVE_MANAGER__ */