summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/Devices/Device.cpp16
-rw-r--r--Kernel/Devices/Device.h3
2 files changed, 16 insertions, 3 deletions
diff --git a/Kernel/Devices/Device.cpp b/Kernel/Devices/Device.cpp
index 34df75f350..25b727ce96 100644
--- a/Kernel/Devices/Device.cpp
+++ b/Kernel/Devices/Device.cpp
@@ -21,9 +21,20 @@ Device::Device(MajorNumber major, MinorNumber minor)
{
}
-void Device::after_inserting()
+void Device::before_will_be_destroyed_remove_from_device_management()
+{
+ DeviceManagement::the().before_device_removal({}, *this);
+ m_state = State::BeingRemoved;
+}
+
+void Device::after_inserting_add_to_device_management()
{
DeviceManagement::the().after_inserting_device({}, *this);
+}
+
+void Device::after_inserting()
+{
+ after_inserting_add_to_device_management();
VERIFY(!m_sysfs_component);
auto sys_fs_component = SysFSDeviceComponent::must_create(*this);
m_sysfs_component = sys_fs_component;
@@ -52,8 +63,7 @@ void Device::will_be_destroyed()
list.remove(*m_sysfs_component);
});
}
- DeviceManagement::the().before_device_removal({}, *this);
- m_state = State::BeingRemoved;
+ before_will_be_destroyed_remove_from_device_management();
}
Device::~Device()
diff --git a/Kernel/Devices/Device.h b/Kernel/Devices/Device.h
index b6c9e53d61..f968fe7253 100644
--- a/Kernel/Devices/Device.h
+++ b/Kernel/Devices/Device.h
@@ -68,6 +68,9 @@ protected:
void set_uid(UserID uid) { m_uid = uid; }
void set_gid(GroupID gid) { m_gid = gid; }
+ void after_inserting_add_to_device_management();
+ void before_will_be_destroyed_remove_from_device_management();
+
private:
MajorNumber const m_major { 0 };
MinorNumber const m_minor { 0 };