mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:27:35 +00:00
Kernel/Devices: Abstract SysFS Device add/remove methods more properly
It is starting to get a little messy with how each device can try to add or remove itself to either /sys/dev/block or /sys/dev/char directories. To better do this, we introduce 4 virtual methods to take care of that, so until we ensure all nodes in /sys/dev/block and /sys/dev/char are actual symlinks, we allow the Device base class to call virtual methods upon insertion or before being destroying, so it add itself elegantly to either of these directories or remove itself when needed. For special cases where we need to create symlinks, we have two virtual methods to be called otherwise to do almost the same thing mentioned before, but to use symlinks instead.
This commit is contained in:
parent
da8d18b263
commit
3af70cb0fc
10 changed files with 107 additions and 46 deletions
|
@ -41,7 +41,14 @@ protected:
|
|||
protected:
|
||||
virtual bool is_block_device() const final { return true; }
|
||||
|
||||
virtual void after_inserting_add_symlink_to_device_identifier_directory() override final;
|
||||
virtual void before_will_be_destroyed_remove_symlink_from_device_identifier_directory() override final;
|
||||
|
||||
private:
|
||||
// FIXME: These methods will be eventually removed after all nodes in /sys/dev/block/ are symlinks
|
||||
virtual void after_inserting_add_to_device_identifier_directory() override final;
|
||||
virtual void before_will_be_destroyed_remove_from_device_identifier_directory() override final;
|
||||
|
||||
size_t m_block_size { 0 };
|
||||
u8 m_block_size_log { 0 };
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue