update main #1

Merged
Sinipelto merged 240 commits from Bananymous/banan-os:main into main 2023-11-20 13:20:51 +02:00
2 changed files with 6 additions and 9 deletions
Showing only changes of commit b767317a7a - Show all commits

View File

@ -28,7 +28,7 @@ namespace Kernel
uint64_t sector_count() const { return m_lba_count; } uint64_t sector_count() const { return m_lba_count; }
BAN::StringView model() const { return m_model; } 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; } virtual dev_t rdev() const override { return m_rdev; }
@ -46,6 +46,7 @@ namespace Kernel
uint32_t m_sector_words; uint32_t m_sector_words;
uint64_t m_lba_count; uint64_t m_lba_count;
char m_model[41]; char m_model[41];
char m_name[4] {};
const dev_t m_rdev; const dev_t m_rdev;
}; };

View File

@ -23,7 +23,10 @@ namespace Kernel
detail::ATABaseDevice::ATABaseDevice() detail::ATABaseDevice::ATABaseDevice()
: m_rdev(makedev(get_ata_dev_major(), get_ata_dev_minor())) : m_rdev(makedev(get_ata_dev_major(), get_ata_dev_minor()))
{ } {
strcpy(m_name, "sda");
m_name[2] += minor(m_rdev);
}
BAN::ErrorOr<void> detail::ATABaseDevice::initialize(BAN::Span<const uint16_t> identify_data) BAN::ErrorOr<void> detail::ATABaseDevice::initialize(BAN::Span<const uint16_t> identify_data)
{ {
@ -99,13 +102,6 @@ namespace Kernel
return bytes; return bytes;
} }
BAN::StringView detail::ATABaseDevice::name() const
{
static char device_name[] = "sda";
device_name[2] += minor(m_rdev);
return device_name;
}
BAN::ErrorOr<BAN::RefPtr<ATADevice>> ATADevice::create(BAN::RefPtr<ATABus> bus, ATABus::DeviceType type, bool is_secondary, BAN::Span<const uint16_t> identify_data) BAN::ErrorOr<BAN::RefPtr<ATADevice>> ATADevice::create(BAN::RefPtr<ATABus> bus, ATABus::DeviceType type, bool is_secondary, BAN::Span<const uint16_t> identify_data)
{ {
auto* device_ptr = new ATADevice(bus, type, is_secondary); auto* device_ptr = new ATADevice(bus, type, is_secondary);