summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-05-31 15:36:49 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-05-31 15:36:49 +0200
commitfa6446fc0dcc9ac5625a14dfffabdcc1a6e08629 (patch)
tree0d49573139ab1a6a7653a9b11c10d3926e03cf1a /Kernel
parenta1fdda3e20546d9d75e84752012daac99e07a675 (diff)
downloadserenity-fa6446fc0dcc9ac5625a14dfffabdcc1a6e08629.zip
FileSystem: VFS should require Badge<Device> for device registration.
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/Devices/Device.cpp4
-rw-r--r--Kernel/FileSystem/VirtualFileSystem.cpp4
-rw-r--r--Kernel/FileSystem/VirtualFileSystem.h11
3 files changed, 10 insertions, 9 deletions
diff --git a/Kernel/Devices/Device.cpp b/Kernel/Devices/Device.cpp
index ba7f28dadd..fb636d376f 100644
--- a/Kernel/Devices/Device.cpp
+++ b/Kernel/Devices/Device.cpp
@@ -6,12 +6,12 @@ Device::Device(unsigned major, unsigned minor)
: m_major(major)
, m_minor(minor)
{
- VFS::the().register_device(*this);
+ VFS::the().register_device({}, *this);
}
Device::~Device()
{
- VFS::the().unregister_device(*this);
+ VFS::the().unregister_device({}, *this);
}
String Device::absolute_path(FileDescriptor&) const
diff --git a/Kernel/FileSystem/VirtualFileSystem.cpp b/Kernel/FileSystem/VirtualFileSystem.cpp
index d1efa66a54..8aac09d211 100644
--- a/Kernel/FileSystem/VirtualFileSystem.cpp
+++ b/Kernel/FileSystem/VirtualFileSystem.cpp
@@ -584,12 +584,12 @@ InodeIdentifier VFS::Mount::host() const
return m_host_custody->inode().identifier();
}
-void VFS::register_device(Device& device)
+void VFS::register_device(Badge<Device>, Device& device)
{
m_devices.set(encoded_device(device.major(), device.minor()), &device);
}
-void VFS::unregister_device(Device& device)
+void VFS::unregister_device(Badge<Device>, Device& device)
{
m_devices.remove(encoded_device(device.major(), device.minor()));
}
diff --git a/Kernel/FileSystem/VirtualFileSystem.h b/Kernel/FileSystem/VirtualFileSystem.h
index aef45db562..0027cb408f 100644
--- a/Kernel/FileSystem/VirtualFileSystem.h
+++ b/Kernel/FileSystem/VirtualFileSystem.h
@@ -1,14 +1,15 @@
#pragma once
-#include "FileSystem.h"
-#include "InodeIdentifier.h"
-#include "InodeMetadata.h"
#include <AK/AKString.h>
+#include <AK/Badge.h>
#include <AK/Function.h>
#include <AK/HashMap.h>
#include <AK/OwnPtr.h>
#include <AK/RetainPtr.h>
#include <AK/Vector.h>
+#include <Kernel/FileSystem/FileSystem.h>
+#include <Kernel/FileSystem/InodeIdentifier.h>
+#include <Kernel/FileSystem/InodeMetadata.h>
#include <Kernel/KResult.h>
#define O_RDONLY 0
@@ -83,8 +84,8 @@ public:
KResult mknod(StringView path, mode_t, dev_t, Custody& base);
KResultOr<Retained<Custody>> open_directory(StringView path, Custody& base);
- void register_device(Device&);
- void unregister_device(Device&);
+ void register_device(Badge<Device>, Device&);
+ void unregister_device(Badge<Device>, Device&);
size_t mount_count() const { return m_mounts.size(); }
void for_each_mount(Function<void(const Mount&)>) const;