mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:18:11 +00:00
Kernel: Make device generate their own names
Besides removing the monolithic DevFSDeviceInode::determine_name() method, being able to determine a device's name inside the /dev hierarchy outside of DevFS has its uses.
This commit is contained in:
parent
a2601e1308
commit
f64e287b82
29 changed files with 76 additions and 69 deletions
|
@ -102,6 +102,13 @@ bool DiskPartition::can_write(const FileDescription& fd, size_t offset) const
|
|||
return m_device->can_write(fd, offset + adjust);
|
||||
}
|
||||
|
||||
String DiskPartition::device_name() const
|
||||
{
|
||||
// FIXME: Try to not hardcode a maximum of 16 partitions per drive!
|
||||
size_t partition_index = minor() % 16;
|
||||
return String::formatted("{}{}", m_device->device_name(), partition_index + 1);
|
||||
}
|
||||
|
||||
const char* DiskPartition::class_name() const
|
||||
{
|
||||
return "DiskPartition";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue