1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:07:46 +00:00

Kernel: Export both interface type and command set of a StorageDevice

This commit is contained in:
Liav A 2022-04-22 16:15:41 +03:00 committed by Andreas Kling
parent 6ff1aeb64d
commit 7db6b77e75
6 changed files with 54 additions and 0 deletions

View file

@ -27,6 +27,40 @@ StringView StorageDevice::class_name() const
return "StorageDevice"sv;
}
StringView StorageDevice::command_set_to_string_view() const
{
switch (command_set()) {
case CommandSet::PlainMemory:
return "memory"sv;
case CommandSet::SCSI:
return "scsi"sv;
case CommandSet::ATA:
return "ata"sv;
case CommandSet::NVMe:
return "nvme"sv;
default:
break;
}
VERIFY_NOT_REACHED();
}
StringView StorageDevice::interface_type_to_string_view() const
{
switch (interface_type()) {
case InterfaceType::PlainMemory:
return "memory"sv;
case InterfaceType::SCSI:
return "scsi"sv;
case InterfaceType::ATA:
return "ata"sv;
case InterfaceType::NVMe:
return "nvme"sv;
default:
break;
}
VERIFY_NOT_REACHED();
}
ErrorOr<size_t> StorageDevice::read(OpenFileDescription&, u64 offset, UserOrKernelBuffer& outbuf, size_t len)
{
u64 index = offset >> block_size_log();