summaryrefslogtreecommitdiffhomepage
path: root/dev/kernel/StorageKit
diff options
context:
space:
mode:
authorAmlal <amlal@nekernel.org>2025-04-25 13:08:33 +0200
committerAmlal <amlal@nekernel.org>2025-04-25 13:08:33 +0200
commitfb790b07aeba8e22e4190cf3e1834d11ecde6c96 (patch)
tree4cec7d1b321307b1d5935577631dae116a658a37 /dev/kernel/StorageKit
parent63a2d92c5dfe976175cda024ec01905d11b43738 (diff)
dev: better .clang-format, ran format command.
Signed-off-by: Amlal <amlal@nekernel.org>
Diffstat (limited to 'dev/kernel/StorageKit')
-rw-r--r--dev/kernel/StorageKit/AHCI.h58
-rw-r--r--dev/kernel/StorageKit/ATA.h70
-rw-r--r--dev/kernel/StorageKit/NVME.h36
-rw-r--r--dev/kernel/StorageKit/PRDT.h43
-rw-r--r--dev/kernel/StorageKit/SCSI.h6
-rw-r--r--dev/kernel/StorageKit/StorageKit.h23
6 files changed, 112 insertions, 124 deletions
diff --git a/dev/kernel/StorageKit/AHCI.h b/dev/kernel/StorageKit/AHCI.h
index 68a42c46..d40feb36 100644
--- a/dev/kernel/StorageKit/AHCI.h
+++ b/dev/kernel/StorageKit/AHCI.h
@@ -1,6 +1,6 @@
/* -------------------------------------------
- Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.
+ Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.
------------------------------------------- */
@@ -10,42 +10,40 @@
#include <KernelKit/DriveMgr.h>
#include <NewKit/OwnPtr.h>
-namespace Kernel
-{
- /// @brief AHCIDeviceInterface class
- /// @details This class is used to send and receive data from the AHCI device.
- /// @note The class is derived from the IDeviceObject class.
- class AHCIDeviceInterface NE_DEVICE<MountpointInterface*>
- {
- public:
- explicit AHCIDeviceInterface(void (*out)(IDeviceObject* self, MountpointInterface* out),
- void (*in)(IDeviceObject* self, MountpointInterface* in));
+namespace Kernel {
+/// @brief AHCIDeviceInterface class
+/// @details This class is used to send and receive data from the AHCI device.
+/// @note The class is derived from the IDeviceObject class.
+class AHCIDeviceInterface NE_DEVICE<MountpointInterface*> {
+ public:
+ explicit AHCIDeviceInterface(void (*out)(IDeviceObject* self, MountpointInterface* out),
+ void (*in)(IDeviceObject* self, MountpointInterface* in));
- virtual ~AHCIDeviceInterface() override;
+ virtual ~AHCIDeviceInterface() override;
- public:
- AHCIDeviceInterface& operator=(const AHCIDeviceInterface&) = default;
- AHCIDeviceInterface(const AHCIDeviceInterface&) = default;
+ public:
+ AHCIDeviceInterface& operator=(const AHCIDeviceInterface&) = default;
+ AHCIDeviceInterface(const AHCIDeviceInterface&) = default;
- const Char* Name() const override;
+ const Char* Name() const override;
- const UInt16& GetPortsImplemented();
+ const UInt16& GetPortsImplemented();
- Void SetPortsImplemented(const UInt16& pi);
+ Void SetPortsImplemented(const UInt16& pi);
- const UInt32& GetIndex();
+ const UInt32& GetIndex();
- Void SetIndex(const UInt32& drv);
+ Void SetIndex(const UInt32& drv);
- public:
- AHCIDeviceInterface& operator<<(MountpointInterface* Data) override;
- AHCIDeviceInterface& operator>>(MountpointInterface* Data) override;
+ public:
+ AHCIDeviceInterface& operator<<(MountpointInterface* Data) override;
+ AHCIDeviceInterface& operator>>(MountpointInterface* Data) override;
- private:
- UInt16 fPortsImplemented{0U};
- UInt32 fDriveIndex{0U};
- };
+ private:
+ UInt16 fPortsImplemented{0U};
+ UInt32 fDriveIndex{0U};
+};
- UInt16 sk_init_ahci_device(BOOL atapi);
- ErrorOr<AHCIDeviceInterface> sk_acquire_ahci_device(Int32 drv_index);
-} // namespace Kernel
+UInt16 sk_init_ahci_device(BOOL atapi);
+ErrorOr<AHCIDeviceInterface> sk_acquire_ahci_device(Int32 drv_index);
+} // namespace Kernel
diff --git a/dev/kernel/StorageKit/ATA.h b/dev/kernel/StorageKit/ATA.h
index 04cf88d7..d2950228 100644
--- a/dev/kernel/StorageKit/ATA.h
+++ b/dev/kernel/StorageKit/ATA.h
@@ -1,6 +1,6 @@
/* -------------------------------------------
- Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.
+ Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.
------------------------------------------- */
@@ -11,48 +11,46 @@
#include <NewKit/OwnPtr.h>
#include <NewKit/Utils.h>
-namespace Kernel
-{
- /// @brief ATA device interface class.
- class ATADeviceInterface : public IDeviceObject<MountpointInterface*>
- {
- public:
- explicit ATADeviceInterface(void (*Out)(IDeviceObject*, MountpointInterface* outpacket),
- void (*In)(IDeviceObject*, MountpointInterface* inpacket));
+namespace Kernel {
+/// @brief ATA device interface class.
+class ATADeviceInterface : public IDeviceObject<MountpointInterface*> {
+ public:
+ explicit ATADeviceInterface(void (*Out)(IDeviceObject*, MountpointInterface* outpacket),
+ void (*In)(IDeviceObject*, MountpointInterface* inpacket));
- virtual ~ATADeviceInterface();
+ virtual ~ATADeviceInterface();
- public:
- ATADeviceInterface& operator<<(MountpointInterface* Data) override;
- ATADeviceInterface& operator>>(MountpointInterface* Data) override;
+ public:
+ ATADeviceInterface& operator<<(MountpointInterface* Data) override;
+ ATADeviceInterface& operator>>(MountpointInterface* Data) override;
- public:
- ATADeviceInterface& operator=(const ATADeviceInterface&) = default;
- ATADeviceInterface(const ATADeviceInterface&) = default;
+ public:
+ ATADeviceInterface& operator=(const ATADeviceInterface&) = default;
+ ATADeviceInterface(const ATADeviceInterface&) = default;
- const Char* Name() const override;
+ const Char* Name() const override;
- const UInt16& GetIO();
- Void SetIO(const UInt16& io);
+ const UInt16& GetIO();
+ Void SetIO(const UInt16& io);
- const UInt16& GetMaster();
- Void SetMaster(const UInt16& master);
+ const UInt16& GetMaster();
+ Void SetMaster(const UInt16& master);
- const UInt32& GetIndex();
- Void SetIndex(const UInt32& drv);
+ const UInt32& GetIndex();
+ Void SetIndex(const UInt32& drv);
- private:
- UInt32 fDriveIndex{0U};
- UInt16 fIO, fMaster{0U};
- };
+ private:
+ UInt32 fDriveIndex{0U};
+ UInt16 fIO, fMaster{0U};
+};
- /// @brief Initialize an PIO device (StorageKit function)
- /// @param is_master is the current PIO master?
- /// @return [io:master] for PIO device.
- BOOL sk_init_pio_device(BOOL is_master, UInt16& io, UInt8& master);
+/// @brief Initialize an PIO device (StorageKit function)
+/// @param is_master is the current PIO master?
+/// @return [io:master] for PIO device.
+BOOL sk_init_pio_device(BOOL is_master, UInt16& io, UInt8& master);
- /// @brief Acquires a new PIO device with drv_index in mind.
- /// @param drv_index The drive index to assign.
- /// @return A wrapped device interface if successful, or error code.
- ErrorOr<ATADeviceInterface> sk_acquire_pio_device(Int32 drv_index);
-} // namespace Kernel
+/// @brief Acquires a new PIO device with drv_index in mind.
+/// @param drv_index The drive index to assign.
+/// @return A wrapped device interface if successful, or error code.
+ErrorOr<ATADeviceInterface> sk_acquire_pio_device(Int32 drv_index);
+} // namespace Kernel
diff --git a/dev/kernel/StorageKit/NVME.h b/dev/kernel/StorageKit/NVME.h
index c86135d0..aae36a94 100644
--- a/dev/kernel/StorageKit/NVME.h
+++ b/dev/kernel/StorageKit/NVME.h
@@ -1,6 +1,6 @@
/* -------------------------------------------
- Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.
+ Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.
------------------------------------------- */
@@ -9,26 +9,24 @@
#include <KernelKit/DeviceMgr.h>
#include <KernelKit/DriveMgr.h>
-namespace Kernel
-{
- class NVMEDeviceInterface final NE_DEVICE<MountpointInterface*>
- {
- public:
- explicit NVMEDeviceInterface(Void (*out)(IDeviceObject*, MountpointInterface* out_packet),
- Void (*in)(IDeviceObject*, MountpointInterface* in_packet),
- Void (*cleanup)(Void));
+namespace Kernel {
+class NVMEDeviceInterface final NE_DEVICE<MountpointInterface*> {
+ public:
+ explicit NVMEDeviceInterface(Void (*out)(IDeviceObject*, MountpointInterface* out_packet),
+ Void (*in)(IDeviceObject*, MountpointInterface* in_packet),
+ Void (*cleanup)(Void));
- ~NVMEDeviceInterface() override;
+ ~NVMEDeviceInterface() override;
- public:
- NE_COPY_DEFAULT(NVMEDeviceInterface)
+ public:
+ NE_COPY_DEFAULT(NVMEDeviceInterface)
- const Char* Name() const override;
+ const Char* Name() const override;
- public:
- OwnPtr<MountpointInterface*> operator()(UInt32 dma_low, UInt32 dma_high, SizeT dma_sz);
+ public:
+ OwnPtr<MountpointInterface*> operator()(UInt32 dma_low, UInt32 dma_high, SizeT dma_sz);
- private:
- Void (*fCleanup)(Void) = {nullptr};
- };
-} // namespace Kernel
+ private:
+ Void (*fCleanup)(Void) = {nullptr};
+};
+} // namespace Kernel
diff --git a/dev/kernel/StorageKit/PRDT.h b/dev/kernel/StorageKit/PRDT.h
index dde9c208..f67cad05 100644
--- a/dev/kernel/StorageKit/PRDT.h
+++ b/dev/kernel/StorageKit/PRDT.h
@@ -1,6 +1,6 @@
/* -------------------------------------------
- Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.
+ Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.
------------------------------------------- */
@@ -12,25 +12,22 @@
#define kPrdtTransferSize (sizeof(Kernel::UShort))
-namespace Kernel
-{
- /// @brief Tranfer information about PRD.
- enum
- {
- kPRDTTransferInProgress,
- kPRDTTransferIsDone,
- kPRDTTransferCount,
- };
-
- /// @brief Physical Region Descriptor Table.
- struct PRDT final
- {
- UInt32 fPhysAddress;
- UInt32 fSectorCount;
- UInt8 fEndBit;
- };
-
- void construct_prdt(Ref<PRDT>& prd);
-
- EXTERN_C Int32 kPRDTTransferStatus;
-} // namespace Kernel
+namespace Kernel {
+/// @brief Tranfer information about PRD.
+enum {
+ kPRDTTransferInProgress,
+ kPRDTTransferIsDone,
+ kPRDTTransferCount,
+};
+
+/// @brief Physical Region Descriptor Table.
+struct PRDT final {
+ UInt32 fPhysAddress;
+ UInt32 fSectorCount;
+ UInt8 fEndBit;
+};
+
+void construct_prdt(Ref<PRDT>& prd);
+
+EXTERN_C Int32 kPRDTTransferStatus;
+} // namespace Kernel
diff --git a/dev/kernel/StorageKit/SCSI.h b/dev/kernel/StorageKit/SCSI.h
index 2a4c2393..25e11716 100644
--- a/dev/kernel/StorageKit/SCSI.h
+++ b/dev/kernel/StorageKit/SCSI.h
@@ -1,6 +1,6 @@
/* -------------------------------------------
- Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.
+ Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.
------------------------------------------- */
@@ -8,6 +8,4 @@
#include <modules/SCSI/SCSI.h>
-namespace Kernel
-{
-} // namespace Kernel \ No newline at end of file
+namespace Kernel {} // namespace Kernel \ No newline at end of file
diff --git a/dev/kernel/StorageKit/StorageKit.h b/dev/kernel/StorageKit/StorageKit.h
index bbd34476..9dbb014d 100644
--- a/dev/kernel/StorageKit/StorageKit.h
+++ b/dev/kernel/StorageKit/StorageKit.h
@@ -1,22 +1,21 @@
/* -------------------------------------------
- Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.
+ Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.
------------------------------------------- */
#pragma once
-#define kDriveSectorSizeHDD (512U)
-#define kDriveSectorSizeSSD (512U)
+#define kDriveSectorSizeHDD (512U)
+#define kDriveSectorSizeSSD (512U)
#define kDriveSectorSizeOptical (2048)
-namespace Kernel
-{
- template <typename T>
- class IDeviceObject;
+namespace Kernel {
+template <typename T>
+class IDeviceObject;
- class NVMEDeviceInterface;
- class AHCIDeviceInterface;
- class ATADeviceInterface;
- class SCSIDeviceInterface;
-} // namespace Kernel
+class NVMEDeviceInterface;
+class AHCIDeviceInterface;
+class ATADeviceInterface;
+class SCSIDeviceInterface;
+} // namespace Kernel