forked from SerenityOS/serenity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDeviceNodeFamily.h
52 lines (42 loc) · 1.63 KB
/
DeviceNodeFamily.h
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
49
50
51
52
/*
* Copyright (c) 2023, Liav A. <[email protected]>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include "RegisteredDeviceNode.h"
#include <AK/Bitmap.h>
#include <AK/HashTable.h>
#include <AK/Types.h>
#include <Kernel/API/DeviceFileTypes.h>
namespace DeviceMapper {
class DeviceNodeFamily : public RefCounted<DeviceNodeFamily> {
public:
enum class Type {
BlockDevice,
CharacterDevice,
};
DeviceNodeFamily(Bitmap devices_symbol_suffix_allocation_map, StringView literal_device_family, Type type, MajorNumber major, MinorNumber base_minor)
: m_literal_device_family(literal_device_family)
, m_type(type)
, m_major(major)
, m_base_minor(base_minor)
, m_devices_symbol_suffix_allocation_map(move(devices_symbol_suffix_allocation_map))
{
}
StringView literal_device_family() const { return m_literal_device_family; }
MajorNumber major_number() const { return m_major; }
MinorNumber base_minor_number() const { return m_base_minor; }
Type type() const { return m_type; }
HashTable<RegisteredDeviceNode>& registered_nodes() { return m_registered_nodes; }
Bitmap& devices_symbol_suffix_allocation_map() { return m_devices_symbol_suffix_allocation_map; }
Bitmap const& devices_symbol_suffix_allocation_map() const { return m_devices_symbol_suffix_allocation_map; }
private:
StringView m_literal_device_family;
Type m_type { Type::CharacterDevice };
MajorNumber m_major { 0 };
MinorNumber m_base_minor { 0 };
HashTable<RegisteredDeviceNode> m_registered_nodes;
Bitmap m_devices_symbol_suffix_allocation_map;
};
}