kernel: Remove register_special_device()'s name parameter
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This is now duplicate information that can be queried using device->device_path().
This commit is contained in:
parent
ba46399bbd
commit
32d2e0e6b7
@ -733,8 +733,7 @@ Result<SharedPtr<Device>> ATADevice::create(SharedPtr<ATA::Drive> drive)
|
||||
auto device = TRY(adopt_shared_if_nonnull(new (std::nothrow) ATADevice()));
|
||||
device->m_drive = drive;
|
||||
device->m_device_path = TRY(ATA::Drive::create_drive_name(drive));
|
||||
TRY(DeviceRegistry::register_special_device(DeviceRegistry::Disk, next_minor++, device,
|
||||
device->m_device_path.chars(), 0400));
|
||||
TRY(DeviceRegistry::register_special_device(DeviceRegistry::Disk, next_minor++, device, 0400));
|
||||
return (SharedPtr<Device>)device;
|
||||
}
|
||||
|
||||
|
@ -24,8 +24,7 @@ namespace MBR
|
||||
device->m_start_offset = start_block * device->m_block_size;
|
||||
device->m_num_blocks = num_blocks;
|
||||
device->m_device_path = TRY(create_partition_name(host_device, partition_index));
|
||||
return DeviceRegistry::register_special_device(DeviceRegistry::DiskPartition, next_minor++, device,
|
||||
device->m_device_path.chars(), 0400);
|
||||
return DeviceRegistry::register_special_device(DeviceRegistry::DiskPartition, next_minor++, device, 0400);
|
||||
}
|
||||
|
||||
Result<usize> PartitionDevice::read(u8* buf, usize offset, usize length) const
|
||||
|
@ -18,7 +18,7 @@ static bool g_echo { true };
|
||||
Result<void> ConsoleDevice::create()
|
||||
{
|
||||
auto device = (SharedPtr<Device>)TRY(make_shared<ConsoleDevice>());
|
||||
return DeviceRegistry::register_special_device(DeviceRegistry::Console, 0, device, "console");
|
||||
return DeviceRegistry::register_special_device(DeviceRegistry::Console, 0, device);
|
||||
}
|
||||
|
||||
Result<usize> ConsoleDevice::read(u8* buf, usize, usize length) const
|
||||
|
@ -42,13 +42,15 @@ namespace DeviceRegistry
|
||||
return {};
|
||||
}
|
||||
|
||||
Result<void> register_special_device(u32 major, u32 minor, SharedPtr<Device> device, const char* name, mode_t mode)
|
||||
Result<void> register_special_device(u32 major, u32 minor, SharedPtr<Device> device, mode_t mode)
|
||||
{
|
||||
for (const auto& descriptor : g_available_devices)
|
||||
{
|
||||
if (descriptor.major == major && descriptor.minor == minor) return err(EEXIST);
|
||||
}
|
||||
|
||||
const char* name = device->device_path().chars();
|
||||
|
||||
kdbgln("DeviceRegistry: registered new device type %u:%u at path /%s in devfs", major, minor, name);
|
||||
|
||||
auto desc = DeviceDescriptor { .device = device, .major = major, .minor = minor, .name = name, .mode = mode };
|
||||
|
@ -19,8 +19,7 @@ namespace DeviceRegistry
|
||||
|
||||
Result<SharedPtr<Device>> fetch_special_device(u32 major, u32 minor);
|
||||
|
||||
Result<void> register_special_device(u32 major, u32 minor, SharedPtr<Device> device, const char* name,
|
||||
mode_t mode = 0666);
|
||||
Result<void> register_special_device(u32 major, u32 minor, SharedPtr<Device> device, mode_t mode = 0666);
|
||||
|
||||
Result<void> init();
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
Result<void> FramebufferDevice::create()
|
||||
{
|
||||
auto device = (SharedPtr<Device>)TRY(make_shared<FramebufferDevice>());
|
||||
return DeviceRegistry::register_special_device(DeviceRegistry::Framebuffer, 0, device, "fb0", 0600);
|
||||
return DeviceRegistry::register_special_device(DeviceRegistry::Framebuffer, 0, device, 0600);
|
||||
}
|
||||
|
||||
Result<usize> FramebufferDevice::read(u8*, usize, usize) const
|
||||
|
@ -3,5 +3,5 @@
|
||||
Result<void> FullDevice::create()
|
||||
{
|
||||
auto device = (SharedPtr<Device>)TRY(make_shared<FullDevice>());
|
||||
return DeviceRegistry::register_special_device(DeviceRegistry::Memory, 2, device, "full");
|
||||
return DeviceRegistry::register_special_device(DeviceRegistry::Memory, 2, device);
|
||||
}
|
||||
|
@ -3,5 +3,5 @@
|
||||
Result<void> NullDevice::create()
|
||||
{
|
||||
auto device = (SharedPtr<Device>)TRY(make_shared<NullDevice>());
|
||||
return DeviceRegistry::register_special_device(DeviceRegistry::Memory, 0, device, "null");
|
||||
return DeviceRegistry::register_special_device(DeviceRegistry::Memory, 0, device);
|
||||
}
|
||||
|
@ -3,5 +3,5 @@
|
||||
Result<void> ZeroDevice::create()
|
||||
{
|
||||
auto device = (SharedPtr<Device>)TRY(make_shared<ZeroDevice>());
|
||||
return DeviceRegistry::register_special_device(DeviceRegistry::Memory, 1, device, "zero");
|
||||
return DeviceRegistry::register_special_device(DeviceRegistry::Memory, 1, device);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user