mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 10:38:13 +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
|
@ -141,4 +141,9 @@ String MasterPTY::absolute_path(const FileDescription&) const
|
|||
return String::formatted("ptm:{}", m_pts_name);
|
||||
}
|
||||
|
||||
String MasterPTY::device_name() const
|
||||
{
|
||||
return String::formatted("{}", minor());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@ public:
|
|||
|
||||
// ^Device
|
||||
virtual mode_t required_mode() const override { return 0640; }
|
||||
virtual String device_name() const override;
|
||||
|
||||
private:
|
||||
// ^CharacterDevice
|
||||
|
|
|
@ -57,6 +57,7 @@ public:
|
|||
|
||||
// ^Device
|
||||
virtual mode_t required_mode() const override { return 0666; }
|
||||
virtual String device_name() const override { return "ptmx"; }
|
||||
|
||||
private:
|
||||
// ^CharacterDevice
|
||||
|
|
|
@ -106,6 +106,11 @@ KResult SlavePTY::close()
|
|||
return KSuccess;
|
||||
}
|
||||
|
||||
String SlavePTY::device_name() const
|
||||
{
|
||||
return String::formatted("{}", minor());
|
||||
}
|
||||
|
||||
FileBlockCondition& SlavePTY::block_condition()
|
||||
{
|
||||
return m_master->block_condition();
|
||||
|
|
|
@ -57,6 +57,9 @@ private:
|
|||
virtual const char* class_name() const override { return "SlavePTY"; }
|
||||
virtual KResult close() override;
|
||||
|
||||
// ^Device
|
||||
virtual String device_name() const override;
|
||||
|
||||
friend class MasterPTY;
|
||||
SlavePTY(MasterPTY&, unsigned index);
|
||||
|
||||
|
|
|
@ -338,6 +338,11 @@ void VirtualConsole::emit(const u8* data, size_t size)
|
|||
TTY::emit(data[i]);
|
||||
}
|
||||
|
||||
String VirtualConsole::device_name() const
|
||||
{
|
||||
return String::formatted("tty{}", minor());
|
||||
}
|
||||
|
||||
void VirtualConsole::echo(u8 ch)
|
||||
{
|
||||
if (should_echo_input()) {
|
||||
|
|
|
@ -69,6 +69,9 @@ private:
|
|||
// ^CharacterDevice
|
||||
virtual const char* class_name() const override { return "VirtualConsole"; }
|
||||
|
||||
// ^Device
|
||||
virtual String device_name() const override;
|
||||
|
||||
void set_active(bool);
|
||||
|
||||
void flush_vga_cursor();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue