File tree Expand file tree Collapse file tree 4 files changed +11
-24
lines changed Expand file tree Collapse file tree 4 files changed +11
-24
lines changed Original file line number Diff line number Diff line change 1
1
#include " CharacterDevice.h"
2
2
#include < LibC/errno_numbers.h>
3
3
4
+ Device::Device (unsigned major, unsigned minor)
5
+ : m_major(major)
6
+ , m_minor(minor)
7
+ {
8
+ VFS::the ().register_device (*this );
9
+ }
10
+
4
11
Device::~Device ()
5
12
{
13
+ VFS::the ().unregister_device (*this );
6
14
}
7
15
8
16
RetainPtr<FileDescriptor> Device::open (int & error, int options)
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ class Device : public Retainable<Device> {
39
39
virtual bool is_character_device () const { return false ; }
40
40
41
41
protected:
42
- Device (unsigned major, unsigned minor) : m_major(major), m_minor(minor) { }
42
+ Device (unsigned major, unsigned minor);
43
43
void set_uid (uid_t uid) { m_uid = uid; }
44
44
void set_gid (gid_t gid) { m_gid = gid; }
45
45
Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ SlavePTY::SlavePTY(MasterPTY& master, unsigned index)
10
10
{
11
11
set_uid (current->uid ());
12
12
set_gid (current->gid ());
13
- VFS::the ().register_device (*this );
14
13
DevPtsFS::the ().register_slave_pty (*this );
15
14
set_size (80 , 25 );
16
15
}
@@ -19,7 +18,6 @@ SlavePTY::~SlavePTY()
19
18
{
20
19
dbgprintf (" ~SlavePTY(%u)\n " , m_index);
21
20
DevPtsFS::the ().unregister_slave_pty (*this );
22
- VFS::the ().unregister_device (*this );
23
21
}
24
22
25
23
String SlavePTY::tty_name () const
Original file line number Diff line number Diff line change @@ -66,28 +66,9 @@ VFS* vfs;
66
66
Syscall::initialize ();
67
67
68
68
auto dev_zero = make<ZeroDevice>();
69
- vfs->register_device (*dev_zero);
70
-
71
- vfs->register_device (*dev_null);
72
-
73
69
auto dev_full = make<FullDevice>();
74
- vfs->register_device (*dev_full);
75
-
76
70
auto dev_random = make<RandomDevice>();
77
- vfs->register_device (*dev_random);
78
-
79
71
auto dev_ptmx = make<PTYMultiplexer>();
80
- vfs->register_device (*dev_ptmx);
81
-
82
- vfs->register_device (*keyboard);
83
- vfs->register_device (*ps2mouse);
84
- vfs->register_device (*tty0);
85
- vfs->register_device (*tty1);
86
- vfs->register_device (*tty2);
87
- vfs->register_device (*tty3);
88
-
89
- vfs->register_device (BXVGADevice::the ());
90
-
91
72
auto dev_hd0 = IDEDiskDevice::create ();
92
73
auto e2fs = Ext2FS::create (dev_hd0.copy_ref ());
93
74
e2fs->initialize ();
@@ -145,15 +126,15 @@ VFS* vfs;
145
126
kmalloc_init ();
146
127
init_ksyms ();
147
128
129
+ vfs = new VFS;
130
+
148
131
auto console = make<Console>();
149
132
150
133
RTC::initialize ();
151
134
PIC::initialize ();
152
135
gdt_init ();
153
136
idt_init ();
154
137
155
- vfs = new VFS;
156
-
157
138
keyboard = new KeyboardDevice;
158
139
ps2mouse = new PS2MouseDevice;
159
140
dev_null = new NullDevice;
You can’t perform that action at this time.
0 commit comments