mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 12:47:45 +00:00
Kernel: Remove most String usage from storage_name() API
This change is another minor step towards removing `AK::String` from the Kernel. Instead of dynamically allocating the storage_name we can instead allocate it via a KString in the factory for each device, and then push the device name down into the StorageDevice base class. We don't have a way of doing `AK::String::formatted(..)` with a KString at the moment, so cleaning that up will be left for a later day.
This commit is contained in:
parent
3a945051fc
commit
70ad18fbcd
8 changed files with 45 additions and 40 deletions
|
@ -28,17 +28,14 @@ public:
|
|||
virtual bool can_read(const OpenFileDescription&, size_t) const override;
|
||||
virtual KResultOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
|
||||
virtual bool can_write(const OpenFileDescription&, size_t) const override;
|
||||
|
||||
// FIXME: This is being used only during early boot, find a better way to find devices...
|
||||
virtual String storage_name() const = 0;
|
||||
|
||||
virtual void prepare_for_unplug() { m_partitions.clear(); }
|
||||
|
||||
StringView storage_name() const;
|
||||
NonnullRefPtrVector<DiskPartition> partitions() const { return m_partitions; }
|
||||
|
||||
protected:
|
||||
StorageDevice(const StorageController&, size_t, u64);
|
||||
StorageDevice(const StorageController&, int, int, size_t, u64);
|
||||
StorageDevice(const StorageController&, size_t, u64, NonnullOwnPtr<KString>);
|
||||
StorageDevice(const StorageController&, int, int, size_t, u64, NonnullOwnPtr<KString>);
|
||||
// ^DiskDevice
|
||||
virtual StringView class_name() const override;
|
||||
|
||||
|
@ -46,6 +43,7 @@ private:
|
|||
mutable IntrusiveListNode<StorageDevice, RefPtr<StorageDevice>> m_list_node;
|
||||
NonnullRefPtr<StorageController> m_storage_controller;
|
||||
NonnullRefPtrVector<DiskPartition> m_partitions;
|
||||
NonnullOwnPtr<KString> m_storage_device_name;
|
||||
u64 m_max_addressable_block;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue