blob: 3379139dfa087cca7be42499c1eb754242797bd1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <Kernel/Devices/CharacterDevice.h>
#include <Kernel/FileSystem/SysFS/Subsystems/DeviceIdentifiers/CharacterDevicesDirectory.h>
namespace Kernel {
CharacterDevice::~CharacterDevice() = default;
void CharacterDevice::after_inserting_add_symlink_to_device_identifier_directory()
{
VERIFY(m_symlink_sysfs_component);
SysFSCharacterDevicesDirectory::the().devices_list({}).with([&](auto& list) -> void {
list.append(*m_symlink_sysfs_component);
});
}
void CharacterDevice::before_will_be_destroyed_remove_symlink_from_device_identifier_directory()
{
VERIFY(m_symlink_sysfs_component);
SysFSCharacterDevicesDirectory::the().devices_list({}).with([&](auto& list) -> void {
list.remove(*m_symlink_sysfs_component);
});
}
// FIXME: This method will be eventually removed after all nodes in /sys/dev/char/ are symlinks
void CharacterDevice::after_inserting_add_to_device_identifier_directory()
{
VERIFY(m_sysfs_component);
SysFSCharacterDevicesDirectory::the().devices_list({}).with([&](auto& list) -> void {
list.append(*m_sysfs_component);
});
}
// FIXME: This method will be eventually removed after all nodes in /sys/dev/char/ are symlinks
void CharacterDevice::before_will_be_destroyed_remove_from_device_identifier_directory()
{
VERIFY(m_sysfs_component);
SysFSCharacterDevicesDirectory::the().devices_list({}).with([&](auto& list) -> void {
list.remove(*m_sysfs_component);
});
}
}
|