mirror of
https://github.com/RGBCube/serenity
synced 2025-07-17 11:47:37 +00:00
Kernel: Remove type from StorageDevice class
This commit is contained in:
parent
9b75b1be5f
commit
a73bd0fff8
14 changed files with 1 additions and 47 deletions
|
@ -48,7 +48,6 @@ public:
|
|||
UNMAP_AFTER_INIT static NonnullRefPtr<AHCIController> initialize(PCI::Address address);
|
||||
virtual ~AHCIController() override;
|
||||
|
||||
virtual Type type() const override { return Type::AHCI; }
|
||||
virtual RefPtr<StorageDevice> device(u32 index) const override;
|
||||
virtual bool reset() override;
|
||||
virtual bool shutdown() override;
|
||||
|
|
|
@ -44,7 +44,6 @@ public:
|
|||
static NonnullRefPtr<IDEController> initialize(PCI::Address address, bool force_pio);
|
||||
virtual ~IDEController() override;
|
||||
|
||||
virtual Type type() const override { return Type::IDE; }
|
||||
virtual RefPtr<StorageDevice> device(u32 index) const override;
|
||||
virtual bool reset() override;
|
||||
virtual bool shutdown() override;
|
||||
|
|
|
@ -60,9 +60,6 @@ public:
|
|||
static NonnullRefPtr<PATADiskDevice> create(const IDEController&, IDEChannel&, DriveType, InterfaceType, u16, u64);
|
||||
virtual ~PATADiskDevice() override;
|
||||
|
||||
// ^StorageDevice
|
||||
virtual Type type() const override { return StorageDevice::Type::IDE; }
|
||||
|
||||
// ^BlockDevice
|
||||
virtual void start_request(AsyncBlockDeviceRequest&) override;
|
||||
virtual String device_name() const override;
|
||||
|
|
|
@ -43,7 +43,6 @@ public:
|
|||
static Result<NonnullOwnPtr<EBRPartitionTable>, PartitionTable::Error> try_to_initialize(const StorageDevice&);
|
||||
explicit EBRPartitionTable(const StorageDevice&);
|
||||
virtual bool is_valid() const override { return m_valid; };
|
||||
virtual Type type() const override { return Type::EBR; };
|
||||
|
||||
private:
|
||||
void search_extended_partition(const StorageDevice&, MBRPartitionTable&, u64, size_t limit);
|
||||
|
|
|
@ -43,7 +43,6 @@ public:
|
|||
static Result<NonnullOwnPtr<GUIDPartitionTable>, PartitionTable::Error> try_to_initialize(const StorageDevice&);
|
||||
explicit GUIDPartitionTable(const StorageDevice&);
|
||||
|
||||
virtual Type type() const override { return Type::GPT; };
|
||||
virtual bool is_valid() const override { return m_valid; };
|
||||
|
||||
private:
|
||||
|
|
|
@ -68,7 +68,6 @@ public:
|
|||
|
||||
bool is_protective_mbr() const;
|
||||
bool contains_ebr() const;
|
||||
virtual Type type() const override { return Type::MBR; };
|
||||
virtual bool is_valid() const override { return m_valid; };
|
||||
|
||||
protected:
|
||||
|
|
|
@ -36,12 +36,6 @@ namespace Kernel {
|
|||
|
||||
class PartitionTable {
|
||||
public:
|
||||
enum class Type {
|
||||
MBR,
|
||||
EBR,
|
||||
GPT,
|
||||
BSD
|
||||
};
|
||||
enum class Error {
|
||||
Invalid,
|
||||
MBRProtective,
|
||||
|
@ -51,7 +45,6 @@ public:
|
|||
public:
|
||||
Optional<DiskPartitionMetadata> partition(unsigned index);
|
||||
size_t partitions_count() const { return m_partitions.size(); }
|
||||
virtual Type type() const = 0;
|
||||
virtual ~PartitionTable() = default;
|
||||
virtual bool is_valid() const = 0;
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@ public:
|
|||
static NonnullRefPtr<RamdiskController> initialize();
|
||||
virtual ~RamdiskController() override;
|
||||
|
||||
virtual Type type() const override { return Type::Ramdisk; }
|
||||
virtual RefPtr<StorageDevice> device(u32 index) const override;
|
||||
virtual bool reset() override;
|
||||
virtual bool shutdown() override;
|
||||
|
|
|
@ -41,9 +41,6 @@ public:
|
|||
RamdiskDevice(const RamdiskController&, NonnullOwnPtr<Region>&&, int major, int minor);
|
||||
virtual ~RamdiskDevice() override;
|
||||
|
||||
// ^StorageDevice
|
||||
virtual Type type() const override { return StorageDevice::Type::Ramdisk; }
|
||||
|
||||
// ^BlockDevice
|
||||
virtual void start_request(AsyncBlockDeviceRequest&) override;
|
||||
|
||||
|
|
|
@ -48,7 +48,6 @@ public:
|
|||
virtual ~SATADiskDevice() override;
|
||||
|
||||
// ^StorageDevice
|
||||
virtual Type type() const override { return StorageDevice::Type::SATA; }
|
||||
// ^BlockDevice
|
||||
virtual void start_request(AsyncBlockDeviceRequest&) override;
|
||||
virtual String device_name() const override;
|
||||
|
|
|
@ -44,17 +44,10 @@ class AsyncBlockDeviceRequest;
|
|||
class StorageDevice;
|
||||
class StorageController : public RefCounted<StorageController> {
|
||||
AK_MAKE_ETERNAL
|
||||
public:
|
||||
enum class Type : u8 {
|
||||
Ramdisk,
|
||||
IDE,
|
||||
AHCI,
|
||||
NVMe
|
||||
};
|
||||
|
||||
public:
|
||||
virtual ~StorageController() = default;
|
||||
|
||||
virtual Type type() const = 0;
|
||||
virtual RefPtr<StorageDevice> device(u32 index) const = 0;
|
||||
virtual size_t devices_count() const = 0;
|
||||
|
||||
|
|
|
@ -37,16 +37,8 @@ namespace Kernel {
|
|||
class StorageDevice : public BlockDevice {
|
||||
friend class StorageManagement;
|
||||
AK_MAKE_ETERNAL
|
||||
public:
|
||||
enum class Type : u8 {
|
||||
Ramdisk,
|
||||
IDE,
|
||||
SATA,
|
||||
NVMe,
|
||||
};
|
||||
|
||||
public:
|
||||
virtual Type type() const = 0;
|
||||
virtual u64 max_addressable_block() const { return m_max_addressable_block; }
|
||||
|
||||
NonnullRefPtr<StorageController> controller() const;
|
||||
|
|
|
@ -225,13 +225,4 @@ StorageManagement& StorageManagement::the()
|
|||
return *s_the;
|
||||
}
|
||||
|
||||
NonnullRefPtrVector<StorageController> StorageManagement::ide_controllers() const
|
||||
{
|
||||
NonnullRefPtrVector<StorageController> ide_controllers;
|
||||
for (auto& controller : m_controllers) {
|
||||
if (controller.type() == StorageController::Type::IDE)
|
||||
ide_controllers.append(controller);
|
||||
}
|
||||
return ide_controllers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,8 +51,6 @@ public:
|
|||
static int major_number();
|
||||
static int minor_number();
|
||||
|
||||
NonnullRefPtrVector<StorageController> ide_controllers() const;
|
||||
|
||||
private:
|
||||
bool boot_argument_contains_partition_uuid();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue