diff --git a/kernel/include/kernel/Storage/ATA/ATADevice.h b/kernel/include/kernel/Storage/ATA/ATADevice.h index f9f7ce1e..38a67bd7 100644 --- a/kernel/include/kernel/Storage/ATA/ATADevice.h +++ b/kernel/include/kernel/Storage/ATA/ATADevice.h @@ -28,7 +28,7 @@ namespace Kernel uint64_t sector_count() const { return m_lba_count; } BAN::StringView model() const { return m_model; } - BAN::StringView name() const; + BAN::StringView name() const { return m_name; } virtual dev_t rdev() const override { return m_rdev; } @@ -46,6 +46,7 @@ namespace Kernel uint32_t m_sector_words; uint64_t m_lba_count; char m_model[41]; + char m_name[4] {}; const dev_t m_rdev; }; diff --git a/kernel/kernel/Storage/ATA/ATADevice.cpp b/kernel/kernel/Storage/ATA/ATADevice.cpp index 357018fa..81cced96 100644 --- a/kernel/kernel/Storage/ATA/ATADevice.cpp +++ b/kernel/kernel/Storage/ATA/ATADevice.cpp @@ -23,7 +23,10 @@ namespace Kernel detail::ATABaseDevice::ATABaseDevice() : m_rdev(makedev(get_ata_dev_major(), get_ata_dev_minor())) - { } + { + strcpy(m_name, "sda"); + m_name[2] += minor(m_rdev); + } BAN::ErrorOr detail::ATABaseDevice::initialize(BAN::Span identify_data) { @@ -99,13 +102,6 @@ namespace Kernel return bytes; } - BAN::StringView detail::ATABaseDevice::name() const - { - static char device_name[] = "sda"; - device_name[2] += minor(m_rdev); - return device_name; - } - BAN::ErrorOr> ATADevice::create(BAN::RefPtr bus, ATABus::DeviceType type, bool is_secondary, BAN::Span identify_data) { auto* device_ptr = new ATADevice(bus, type, is_secondary);