summaryrefslogtreecommitdiffhomepage
path: root/dev/kernel/src/Storage/AHCIDeviceInterface.cc
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/src/Storage/AHCIDeviceInterface.cc
parent63a2d92c5dfe976175cda024ec01905d11b43738 (diff)
dev: better .clang-format, ran format command.
Signed-off-by: Amlal <amlal@nekernel.org>
Diffstat (limited to 'dev/kernel/src/Storage/AHCIDeviceInterface.cc')
-rw-r--r--dev/kernel/src/Storage/AHCIDeviceInterface.cc119
1 files changed, 51 insertions, 68 deletions
diff --git a/dev/kernel/src/Storage/AHCIDeviceInterface.cc b/dev/kernel/src/Storage/AHCIDeviceInterface.cc
index c5f43bf6..d5c1e5c6 100644
--- a/dev/kernel/src/Storage/AHCIDeviceInterface.cc
+++ b/dev/kernel/src/Storage/AHCIDeviceInterface.cc
@@ -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,95 +12,78 @@ using namespace Kernel;
/// @param Out Drive output
/// @param In Drive input
/// @param Cleanup Drive cleanup.
-AHCIDeviceInterface::AHCIDeviceInterface(void (*out)(IDeviceObject* self, MountpointInterface* outpacket),
- void (*in)(IDeviceObject* self, MountpointInterface* inpacket))
- : IDeviceObject(out, in)
-{
-}
+AHCIDeviceInterface::AHCIDeviceInterface(void (*out)(IDeviceObject* self,
+ MountpointInterface* outpacket),
+ void (*in)(IDeviceObject* self,
+ MountpointInterface* inpacket))
+ : IDeviceObject(out, in) {}
/// @brief Class desctructor
AHCIDeviceInterface::~AHCIDeviceInterface() = default;
/// @brief Returns the name of the device interface.
/// @return it's name as a string.
-const Char* AHCIDeviceInterface::Name() const
-{
- return "/dev/sda{}";
+const Char* AHCIDeviceInterface::Name() const {
+ return "/dev/sda{}";
}
/// @brief Output operator.
/// @param mnt the disk mountpoint.
/// @return the class itself after operation.
-AHCIDeviceInterface& AHCIDeviceInterface::operator<<(MountpointInterface* mnt)
-{
- if (!mnt)
- return *this;
-
- for (SizeT driveCount = 0; driveCount < kDriveMaxCount; ++driveCount)
- {
- auto interface = mnt->GetAddressOf(driveCount);
-
- if ((interface) && rt_string_cmp((interface)->fProtocol(), "AHCI", rt_string_len("AHCI")) == 0)
- {
- continue;
- }
- else if ((interface) &&
- rt_string_cmp((interface)->fProtocol(), "AHCI", rt_string_len("AHCI")) != 0)
- {
- return *this;
- }
- }
-
- return (AHCIDeviceInterface&)IDeviceObject<MountpointInterface*>::operator<<(
- mnt);
+AHCIDeviceInterface& AHCIDeviceInterface::operator<<(MountpointInterface* mnt) {
+ if (!mnt) return *this;
+
+ for (SizeT driveCount = 0; driveCount < kDriveMaxCount; ++driveCount) {
+ auto interface = mnt->GetAddressOf(driveCount);
+
+ if ((interface) &&
+ rt_string_cmp((interface)->fProtocol(), "AHCI", rt_string_len("AHCI")) == 0) {
+ continue;
+ } else if ((interface) &&
+ rt_string_cmp((interface)->fProtocol(), "AHCI", rt_string_len("AHCI")) != 0) {
+ return *this;
+ }
+ }
+
+ return (AHCIDeviceInterface&) IDeviceObject<MountpointInterface*>::operator<<(mnt);
}
/// @brief Input operator.
/// @param mnt the disk mountpoint.
/// @return the class itself after operation.
-AHCIDeviceInterface& AHCIDeviceInterface::operator>>(MountpointInterface* mnt)
-{
- if (!mnt)
- return *this;
-
- for (SizeT driveCount = 0; driveCount < kDriveMaxCount; ++driveCount)
- {
- auto interface = mnt->GetAddressOf(driveCount);
-
- // really check if it's ATA.
- if ((interface) && rt_string_cmp((interface)->fProtocol(), "AHCI", rt_string_len("AHCI")) == 0)
- {
- continue;
- }
- else if ((interface) &&
- rt_string_cmp((interface)->fProtocol(), "AHCI", rt_string_len("AHCI")) != 0)
- {
- return *this;
- }
- }
-
- return (AHCIDeviceInterface&)IDeviceObject<MountpointInterface*>::operator>>(
- mnt);
+AHCIDeviceInterface& AHCIDeviceInterface::operator>>(MountpointInterface* mnt) {
+ if (!mnt) return *this;
+
+ for (SizeT driveCount = 0; driveCount < kDriveMaxCount; ++driveCount) {
+ auto interface = mnt->GetAddressOf(driveCount);
+
+ // really check if it's ATA.
+ if ((interface) &&
+ rt_string_cmp((interface)->fProtocol(), "AHCI", rt_string_len("AHCI")) == 0) {
+ continue;
+ } else if ((interface) &&
+ rt_string_cmp((interface)->fProtocol(), "AHCI", rt_string_len("AHCI")) != 0) {
+ return *this;
+ }
+ }
+
+ return (AHCIDeviceInterface&) IDeviceObject<MountpointInterface*>::operator>>(mnt);
}
-const UInt16& AHCIDeviceInterface::GetPortsImplemented()
-{
- return this->fPortsImplemented;
+const UInt16& AHCIDeviceInterface::GetPortsImplemented() {
+ return this->fPortsImplemented;
}
-Void AHCIDeviceInterface::SetPortsImplemented(const UInt16& pi)
-{
- MUST_PASS(pi > 0);
- this->fPortsImplemented = pi;
+Void AHCIDeviceInterface::SetPortsImplemented(const UInt16& pi) {
+ MUST_PASS(pi > 0);
+ this->fPortsImplemented = pi;
}
-const UInt32& AHCIDeviceInterface::GetIndex()
-{
- return this->fDriveIndex;
+const UInt32& AHCIDeviceInterface::GetIndex() {
+ return this->fDriveIndex;
}
-Void AHCIDeviceInterface::SetIndex(const UInt32& drv)
-{
- MUST_PASS(MountpointInterface::kDriveIndexInvalid != drv);
- this->fDriveIndex = drv;
+Void AHCIDeviceInterface::SetIndex(const UInt32& drv) {
+ MUST_PASS(MountpointInterface::kDriveIndexInvalid != drv);
+ this->fDriveIndex = drv;
} \ No newline at end of file