summaryrefslogtreecommitdiff
path: root/Kernel/Devices
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-09-07 13:39:11 +0200
committerAndreas Kling <kling@serenityos.org>2021-09-07 13:53:14 +0200
commit4a9c18afb9b9c7fde698e93700e661d66e3ed34d (patch)
treebe50cd7629139e1c3d6c7df5bcffa7a0d5a1e898 /Kernel/Devices
parentdbd639a2d8d288691e6cffd29e4ff2ec0bae6982 (diff)
downloadserenity-4a9c18afb9b9c7fde698e93700e661d66e3ed34d.zip
Kernel: Rename FileDescription => OpenFileDescription
Dr. POSIX really calls these "open file description", not just "file description", so let's call them exactly that. :^)
Diffstat (limited to 'Kernel/Devices')
-rw-r--r--Kernel/Devices/Device.cpp2
-rw-r--r--Kernel/Devices/Device.h2
-rw-r--r--Kernel/Devices/FullDevice.cpp6
-rw-r--r--Kernel/Devices/FullDevice.h8
-rw-r--r--Kernel/Devices/HID/KeyboardDevice.cpp8
-rw-r--r--Kernel/Devices/HID/KeyboardDevice.h10
-rw-r--r--Kernel/Devices/HID/MouseDevice.cpp6
-rw-r--r--Kernel/Devices/HID/MouseDevice.h8
-rw-r--r--Kernel/Devices/KCOVDevice.cpp8
-rw-r--r--Kernel/Devices/KCOVDevice.h14
-rw-r--r--Kernel/Devices/MemoryDevice.cpp6
-rw-r--r--Kernel/Devices/MemoryDevice.h12
-rw-r--r--Kernel/Devices/NullDevice.cpp6
-rw-r--r--Kernel/Devices/NullDevice.h8
-rw-r--r--Kernel/Devices/RandomDevice.cpp6
-rw-r--r--Kernel/Devices/RandomDevice.h8
-rw-r--r--Kernel/Devices/SB16.cpp8
-rw-r--r--Kernel/Devices/SB16.h10
-rw-r--r--Kernel/Devices/SerialDevice.cpp8
-rw-r--r--Kernel/Devices/SerialDevice.h8
-rw-r--r--Kernel/Devices/ZeroDevice.cpp6
-rw-r--r--Kernel/Devices/ZeroDevice.h8
22 files changed, 83 insertions, 83 deletions
diff --git a/Kernel/Devices/Device.cpp b/Kernel/Devices/Device.cpp
index 4880f332f3..38da7d3790 100644
--- a/Kernel/Devices/Device.cpp
+++ b/Kernel/Devices/Device.cpp
@@ -55,7 +55,7 @@ String Device::absolute_path() const
return String::formatted("/dev/{}", device_name());
}
-String Device::absolute_path(const FileDescription&) const
+String Device::absolute_path(const OpenFileDescription&) const
{
return absolute_path();
}
diff --git a/Kernel/Devices/Device.h b/Kernel/Devices/Device.h
index 0011f4636e..e39b4e80e4 100644
--- a/Kernel/Devices/Device.h
+++ b/Kernel/Devices/Device.h
@@ -31,7 +31,7 @@ public:
unsigned major() const { return m_major; }
unsigned minor() const { return m_minor; }
- virtual String absolute_path(const FileDescription&) const override;
+ virtual String absolute_path(const OpenFileDescription&) const override;
virtual String absolute_path() const;
UserID uid() const { return m_uid; }
diff --git a/Kernel/Devices/FullDevice.cpp b/Kernel/Devices/FullDevice.cpp
index de5aa9c344..b8b0488722 100644
--- a/Kernel/Devices/FullDevice.cpp
+++ b/Kernel/Devices/FullDevice.cpp
@@ -25,18 +25,18 @@ UNMAP_AFTER_INIT FullDevice::~FullDevice()
{
}
-bool FullDevice::can_read(const FileDescription&, size_t) const
+bool FullDevice::can_read(const OpenFileDescription&, size_t) const
{
return true;
}
-KResultOr<size_t> FullDevice::read(FileDescription&, u64, UserOrKernelBuffer& buffer, size_t size)
+KResultOr<size_t> FullDevice::read(OpenFileDescription&, u64, UserOrKernelBuffer& buffer, size_t size)
{
TRY(buffer.memset(0, size));
return size;
}
-KResultOr<size_t> FullDevice::write(FileDescription&, u64, const UserOrKernelBuffer&, size_t size)
+KResultOr<size_t> FullDevice::write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t size)
{
if (size == 0)
return 0;
diff --git a/Kernel/Devices/FullDevice.h b/Kernel/Devices/FullDevice.h
index 06b5fdc58c..10bde83ac2 100644
--- a/Kernel/Devices/FullDevice.h
+++ b/Kernel/Devices/FullDevice.h
@@ -24,10 +24,10 @@ private:
FullDevice();
// ^CharacterDevice
- virtual KResultOr<size_t> read(FileDescription&, u64, UserOrKernelBuffer&, size_t) override;
- virtual KResultOr<size_t> write(FileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
- virtual bool can_read(const FileDescription&, size_t) const override;
- virtual bool can_write(const FileDescription&, size_t) const override { return true; }
+ virtual KResultOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
+ virtual KResultOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
+ virtual bool can_read(const OpenFileDescription&, size_t) const override;
+ virtual bool can_write(const OpenFileDescription&, size_t) const override { return true; }
virtual StringView class_name() const override { return "FullDevice"; }
};
diff --git a/Kernel/Devices/HID/KeyboardDevice.cpp b/Kernel/Devices/HID/KeyboardDevice.cpp
index b7b374cc3c..68a5efedc2 100644
--- a/Kernel/Devices/HID/KeyboardDevice.cpp
+++ b/Kernel/Devices/HID/KeyboardDevice.cpp
@@ -273,12 +273,12 @@ UNMAP_AFTER_INIT KeyboardDevice::~KeyboardDevice()
{
}
-bool KeyboardDevice::can_read(const FileDescription&, size_t) const
+bool KeyboardDevice::can_read(const OpenFileDescription&, size_t) const
{
return !m_queue.is_empty();
}
-KResultOr<size_t> KeyboardDevice::read(FileDescription&, u64, UserOrKernelBuffer& buffer, size_t size)
+KResultOr<size_t> KeyboardDevice::read(OpenFileDescription&, u64, UserOrKernelBuffer& buffer, size_t size)
{
size_t nread = 0;
SpinlockLocker lock(m_queue_lock);
@@ -306,12 +306,12 @@ KResultOr<size_t> KeyboardDevice::read(FileDescription&, u64, UserOrKernelBuffer
return nread;
}
-KResultOr<size_t> KeyboardDevice::write(FileDescription&, u64, const UserOrKernelBuffer&, size_t)
+KResultOr<size_t> KeyboardDevice::write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t)
{
return 0;
}
-KResult KeyboardDevice::ioctl(FileDescription&, unsigned request, Userspace<void*> arg)
+KResult KeyboardDevice::ioctl(OpenFileDescription&, unsigned request, Userspace<void*> arg)
{
switch (request) {
case KEYBOARD_IOCTL_GET_NUM_LOCK: {
diff --git a/Kernel/Devices/HID/KeyboardDevice.h b/Kernel/Devices/HID/KeyboardDevice.h
index cbb705b605..6065474523 100644
--- a/Kernel/Devices/HID/KeyboardDevice.h
+++ b/Kernel/Devices/HID/KeyboardDevice.h
@@ -25,10 +25,10 @@ public:
virtual ~KeyboardDevice() override;
// ^CharacterDevice
- virtual KResultOr<size_t> read(FileDescription&, u64, UserOrKernelBuffer&, size_t) override;
- virtual bool can_read(const FileDescription&, size_t) const override;
- virtual KResultOr<size_t> write(FileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
- virtual bool can_write(const FileDescription&, size_t) const override { return true; }
+ virtual KResultOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
+ virtual bool can_read(const OpenFileDescription&, size_t) const override;
+ virtual KResultOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
+ virtual bool can_write(const OpenFileDescription&, size_t) const override { return true; }
// ^HIDDevice
virtual Type instrument_type() const override { return Type::Keyboard; }
@@ -37,7 +37,7 @@ public:
virtual mode_t required_mode() const override { return 0440; }
// ^File
- virtual KResult ioctl(FileDescription&, unsigned request, Userspace<void*> arg) override;
+ virtual KResult ioctl(OpenFileDescription&, unsigned request, Userspace<void*> arg) override;
virtual String device_name() const override { return String::formatted("keyboard{}", minor()); }
diff --git a/Kernel/Devices/HID/MouseDevice.cpp b/Kernel/Devices/HID/MouseDevice.cpp
index 6ad5658900..a3c263d570 100644
--- a/Kernel/Devices/HID/MouseDevice.cpp
+++ b/Kernel/Devices/HID/MouseDevice.cpp
@@ -18,13 +18,13 @@ MouseDevice::~MouseDevice()
{
}
-bool MouseDevice::can_read(const FileDescription&, size_t) const
+bool MouseDevice::can_read(const OpenFileDescription&, size_t) const
{
SpinlockLocker lock(m_queue_lock);
return !m_queue.is_empty();
}
-KResultOr<size_t> MouseDevice::read(FileDescription&, u64, UserOrKernelBuffer& buffer, size_t size)
+KResultOr<size_t> MouseDevice::read(OpenFileDescription&, u64, UserOrKernelBuffer& buffer, size_t size)
{
VERIFY(size > 0);
size_t nread = 0;
@@ -48,7 +48,7 @@ KResultOr<size_t> MouseDevice::read(FileDescription&, u64, UserOrKernelBuffer& b
return nread;
}
-KResultOr<size_t> MouseDevice::write(FileDescription&, u64, const UserOrKernelBuffer&, size_t)
+KResultOr<size_t> MouseDevice::write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t)
{
return 0;
}
diff --git a/Kernel/Devices/HID/MouseDevice.h b/Kernel/Devices/HID/MouseDevice.h
index ad1c94cbe6..73105f9e89 100644
--- a/Kernel/Devices/HID/MouseDevice.h
+++ b/Kernel/Devices/HID/MouseDevice.h
@@ -23,10 +23,10 @@ public:
virtual ~MouseDevice() override;
// ^CharacterDevice
- virtual KResultOr<size_t> read(FileDescription&, u64, UserOrKernelBuffer&, size_t) override;
- virtual bool can_read(const FileDescription&, size_t) const override;
- virtual KResultOr<size_t> write(FileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
- virtual bool can_write(const FileDescription&, size_t) const override { return true; }
+ virtual KResultOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
+ virtual bool can_read(const OpenFileDescription&, size_t) const override;
+ virtual KResultOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
+ virtual bool can_write(const OpenFileDescription&, size_t) const override { return true; }
// ^HIDDevice
virtual Type instrument_type() const override { return Type::Mouse; }
diff --git a/Kernel/Devices/KCOVDevice.cpp b/Kernel/Devices/KCOVDevice.cpp
index 82d433bda2..3dbf1fcf71 100644
--- a/Kernel/Devices/KCOVDevice.cpp
+++ b/Kernel/Devices/KCOVDevice.cpp
@@ -8,7 +8,7 @@
#include <AK/NonnullOwnPtr.h>
#include <Kernel/Devices/KCOVDevice.h>
#include <Kernel/Devices/KCOVInstance.h>
-#include <Kernel/FileSystem/FileDescription.h>
+#include <Kernel/FileSystem/OpenFileDescription.h>
#include <LibC/sys/ioctl_numbers.h>
#include <Kernel/Panic.h>
@@ -61,7 +61,7 @@ void KCOVDevice::free_process()
delete kcov_instance;
}
-KResultOr<NonnullRefPtr<FileDescription>> KCOVDevice::open(int options)
+KResultOr<NonnullRefPtr<OpenFileDescription>> KCOVDevice::open(int options)
{
auto pid = Process::current().pid();
if (proc_instance->get(pid).has_value())
@@ -73,7 +73,7 @@ KResultOr<NonnullRefPtr<FileDescription>> KCOVDevice::open(int options)
return File::open(options);
}
-KResult KCOVDevice::ioctl(FileDescription&, unsigned request, Userspace<void*> arg)
+KResult KCOVDevice::ioctl(OpenFileDescription&, unsigned request, Userspace<void*> arg)
{
KResult return_value = KSuccess;
auto thread = Thread::current();
@@ -127,7 +127,7 @@ KResult KCOVDevice::ioctl(FileDescription&, unsigned request, Userspace<void*> a
return return_value;
}
-KResultOr<Memory::Region*> KCOVDevice::mmap(Process& process, FileDescription&, Memory::VirtualRange const& range, u64 offset, int prot, bool shared)
+KResultOr<Memory::Region*> KCOVDevice::mmap(Process& process, OpenFileDescription&, Memory::VirtualRange const& range, u64 offset, int prot, bool shared)
{
auto pid = process.pid();
auto maybe_kcov_instance = proc_instance->get(pid);
diff --git a/Kernel/Devices/KCOVDevice.h b/Kernel/Devices/KCOVDevice.h
index f2492797c7..bde9f3ce24 100644
--- a/Kernel/Devices/KCOVDevice.h
+++ b/Kernel/Devices/KCOVDevice.h
@@ -22,8 +22,8 @@ public:
static void free_process();
// ^File
- KResultOr<Memory::Region*> mmap(Process&, FileDescription&, Memory::VirtualRange const&, u64 offset, int prot, bool shared) override;
- KResultOr<NonnullRefPtr<FileDescription>> open(int options) override;
+ KResultOr<Memory::Region*> mmap(Process&, OpenFileDescription&, Memory::VirtualRange const&, u64 offset, int prot, bool shared) override;
+ KResultOr<NonnullRefPtr<OpenFileDescription>> open(int options) override;
// ^Device
virtual mode_t required_mode() const override { return 0660; }
@@ -32,12 +32,12 @@ public:
protected:
virtual StringView class_name() const override { return "KCOVDevice"; }
- virtual bool can_read(const FileDescription&, size_t) const override final { return true; }
- virtual bool can_write(const FileDescription&, size_t) const override final { return true; }
+ virtual bool can_read(const OpenFileDescription&, size_t) const override final { return true; }
+ virtual bool can_write(const OpenFileDescription&, size_t) const override final { return true; }
virtual void start_request(AsyncBlockDeviceRequest& request) override final { request.complete(AsyncDeviceRequest::Failure); }
- virtual KResultOr<size_t> read(FileDescription&, u64, UserOrKernelBuffer&, size_t) override { return EINVAL; }
- virtual KResultOr<size_t> write(FileDescription&, u64, const UserOrKernelBuffer&, size_t) override { return EINVAL; }
- virtual KResult ioctl(FileDescription&, unsigned request, Userspace<void*> arg) override;
+ virtual KResultOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override { return EINVAL; }
+ virtual KResultOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override { return EINVAL; }
+ virtual KResult ioctl(OpenFileDescription&, unsigned request, Userspace<void*> arg) override;
private:
KCOVDevice();
diff --git a/Kernel/Devices/MemoryDevice.cpp b/Kernel/Devices/MemoryDevice.cpp
index d62b10a3ae..eb5df7ea02 100644
--- a/Kernel/Devices/MemoryDevice.cpp
+++ b/Kernel/Devices/MemoryDevice.cpp
@@ -27,17 +27,17 @@ UNMAP_AFTER_INIT MemoryDevice::~MemoryDevice()
{
}
-KResultOr<size_t> MemoryDevice::read(FileDescription&, u64, UserOrKernelBuffer&, size_t)
+KResultOr<size_t> MemoryDevice::read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t)
{
TODO();
}
-void MemoryDevice::did_seek(FileDescription&, off_t)
+void MemoryDevice::did_seek(OpenFileDescription&, off_t)
{
TODO();
}
-KResultOr<Memory::Region*> MemoryDevice::mmap(Process& process, FileDescription&, Memory::VirtualRange const& range, u64 offset, int prot, bool shared)
+KResultOr<Memory::Region*> MemoryDevice::mmap(Process& process, OpenFileDescription&, Memory::VirtualRange const& range, u64 offset, int prot, bool shared)
{
auto viewed_address = PhysicalAddress(offset);
diff --git a/Kernel/Devices/MemoryDevice.h b/Kernel/Devices/MemoryDevice.h
index e688390600..4c4b14acab 100644
--- a/Kernel/Devices/MemoryDevice.h
+++ b/Kernel/Devices/MemoryDevice.h
@@ -19,7 +19,7 @@ public:
static NonnullRefPtr<MemoryDevice> must_create();
~MemoryDevice();
- virtual KResultOr<Memory::Region*> mmap(Process&, FileDescription&, Memory::VirtualRange const&, u64 offset, int prot, bool shared) override;
+ virtual KResultOr<Memory::Region*> mmap(Process&, OpenFileDescription&, Memory::VirtualRange const&, u64 offset, int prot, bool shared) override;
// ^Device
virtual mode_t required_mode() const override { return 0660; }
@@ -28,13 +28,13 @@ public:
private:
MemoryDevice();
virtual StringView class_name() const override { return "MemoryDevice"; }
- virtual bool can_read(const FileDescription&, size_t) const override { return true; }
- virtual bool can_write(const FileDescription&, size_t) const override { return false; }
+ virtual bool can_read(const OpenFileDescription&, size_t) const override { return true; }
+ virtual bool can_write(const OpenFileDescription&, size_t) const override { return false; }
virtual bool is_seekable() const override { return true; }
- virtual KResultOr<size_t> read(FileDescription&, u64, UserOrKernelBuffer&, size_t) override;
- virtual KResultOr<size_t> write(FileDescription&, u64, const UserOrKernelBuffer&, size_t) override { return EINVAL; }
+ virtual KResultOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
+ virtual KResultOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override { return EINVAL; }
- virtual void did_seek(FileDescription&, off_t) override;
+ virtual void did_seek(OpenFileDescription&, off_t) override;
bool is_allowed_range(PhysicalAddress, Memory::VirtualRange const&) const;
};
diff --git a/Kernel/Devices/NullDevice.cpp b/Kernel/Devices/NullDevice.cpp
index f7093c4bb8..240f90d3f0 100644
--- a/Kernel/Devices/NullDevice.cpp
+++ b/Kernel/Devices/NullDevice.cpp
@@ -31,17 +31,17 @@ UNMAP_AFTER_INIT NullDevice::~NullDevice()
{
}
-bool NullDevice::can_read(const FileDescription&, size_t) const
+bool NullDevice::can_read(const OpenFileDescription&, size_t) const
{
return true;
}
-KResultOr<size_t> NullDevice::read(FileDescription&, u64, UserOrKernelBuffer&, size_t)
+KResultOr<size_t> NullDevice::read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t)
{
return 0;
}
-KResultOr<size_t> NullDevice::write(FileDescription&, u64, const UserOrKernelBuffer&, size_t buffer_size)
+KResultOr<size_t> NullDevice::write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t buffer_size)
{
return buffer_size;
}
diff --git a/Kernel/Devices/NullDevice.h b/Kernel/Devices/NullDevice.h
index dc4b8df1d4..143e31b4f2 100644
--- a/Kernel/Devices/NullDevice.h
+++ b/Kernel/Devices/NullDevice.h
@@ -25,10 +25,10 @@ public:
private:
// ^CharacterDevice
- virtual KResultOr<size_t> read(FileDescription&, u64, UserOrKernelBuffer&, size_t) override;
- virtual KResultOr<size_t> write(FileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
- virtual bool can_write(const FileDescription&, size_t) const override { return true; }
- virtual bool can_read(const FileDescription&, size_t) const override;
+ virtual KResultOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
+ virtual KResultOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
+ virtual bool can_write(const OpenFileDescription&, size_t) const override { return true; }
+ virtual bool can_read(const OpenFileDescription&, size_t) const override;
virtual StringView class_name() const override { return "NullDevice"; }
virtual bool is_seekable() const override { return true; }
};
diff --git a/Kernel/Devices/RandomDevice.cpp b/Kernel/Devices/RandomDevice.cpp
index 9c4503d7bc..d8116ca0dc 100644
--- a/Kernel/Devices/RandomDevice.cpp
+++ b/Kernel/Devices/RandomDevice.cpp
@@ -24,12 +24,12 @@ UNMAP_AFTER_INIT RandomDevice::~RandomDevice()
{
}
-bool RandomDevice::can_read(const FileDescription&, size_t) const
+bool RandomDevice::can_read(const OpenFileDescription&, size_t) const
{
return true;
}
-KResultOr<size_t> RandomDevice::read(FileDescription&, u64, UserOrKernelBuffer& buffer, size_t size)
+KResultOr<size_t> RandomDevice::read(OpenFileDescription&, u64, UserOrKernelBuffer& buffer, size_t size)
{
return buffer.write_buffered<256>(size, [&](Bytes bytes) {
get_good_random_bytes(bytes);
@@ -37,7 +37,7 @@ KResultOr<size_t> RandomDevice::read(FileDescription&, u64, UserOrKernelBuffer&
});
}
-KResultOr<size_t> RandomDevice::write(FileDescription&, u64, const UserOrKernelBuffer&, size_t size)
+KResultOr<size_t> RandomDevice::write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t size)
{
// FIXME: Use input for entropy? I guess that could be a neat feature?
return size;
diff --git a/Kernel/Devices/RandomDevice.h b/Kernel/Devices/RandomDevice.h
index f7c66b36cb..29986d30ba 100644
--- a/Kernel/Devices/RandomDevice.h
+++ b/Kernel/Devices/RandomDevice.h
@@ -24,10 +24,10 @@ private:
RandomDevice();
// ^CharacterDevice
- virtual KResultOr<size_t> read(FileDescription&, u64, UserOrKernelBuffer&, size_t) override;
- virtual KResultOr<size_t> write(FileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
- virtual bool can_read(const FileDescription&, size_t) const override;
- virtual bool can_write(const FileDescription&, size_t) const override { return true; }
+ virtual KResultOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
+ virtual KResultOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
+ virtual bool can_read(const OpenFileDescription&, size_t) const override;
+ virtual bool can_write(const OpenFileDescription&, size_t) const override { return true; }
virtual StringView class_name() const override { return "RandomDevice"; }
};
diff --git a/Kernel/Devices/SB16.cpp b/Kernel/Devices/SB16.cpp
index a22571f1a8..b0ef199a13 100644
--- a/Kernel/Devices/SB16.cpp
+++ b/Kernel/Devices/SB16.cpp
@@ -122,7 +122,7 @@ UNMAP_AFTER_INIT void SB16::initialize()
set_sample_rate(m_sample_rate);
}
-KResult SB16::ioctl(FileDescription&, unsigned request, Userspace<void*> arg)
+KResult SB16::ioctl(OpenFileDescription&, unsigned request, Userspace<void*> arg)
{
switch (request) {
case SOUNDCARD_IOCTL_GET_SAMPLE_RATE: {
@@ -190,12 +190,12 @@ void SB16::set_irq_line(u8 irq_number)
change_irq_number(irq_number);
}
-bool SB16::can_read(FileDescription const&, size_t) const
+bool SB16::can_read(OpenFileDescription const&, size_t) const
{
return false;
}
-KResultOr<size_t> SB16::read(FileDescription&, u64, UserOrKernelBuffer&, size_t)
+KResultOr<size_t> SB16::read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t)
{
return 0;
}
@@ -255,7 +255,7 @@ void SB16::wait_for_irq()
disable_irq();
}
-KResultOr<size_t> SB16::write(FileDescription&, u64, UserOrKernelBuffer const& data, size_t length)
+KResultOr<size_t> SB16::write(OpenFileDescription&, u64, UserOrKernelBuffer const& data, size_t length)
{
if (!m_dma_region) {
auto page = MM.allocate_supervisor_physical_page();
diff --git a/Kernel/Devices/SB16.h b/Kernel/Devices/SB16.h
index 0d8597eb72..c886c0ef16 100644
--- a/Kernel/Devices/SB16.h
+++ b/Kernel/Devices/SB16.h
@@ -27,10 +27,10 @@ public:
static SB16& the();
// ^CharacterDevice
- virtual bool can_read(const FileDescription&, size_t) const override;
- virtual KResultOr<size_t> read(FileDescription&, u64, UserOrKernelBuffer&, size_t) override;
- virtual KResultOr<size_t> write(FileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
- virtual bool can_write(const FileDescription&, size_t) const override { return true; }
+ virtual bool can_read(const OpenFileDescription&, size_t) const override;
+ virtual KResultOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
+ virtual KResultOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
+ virtual bool can_write(const OpenFileDescription&, size_t) const override { return true; }
virtual StringView purpose() const override { return class_name(); }
@@ -38,7 +38,7 @@ public:
virtual mode_t required_mode() const override { return 0220; }
virtual String device_name() const override { return "audio"; }
- virtual KResult ioctl(FileDescription&, unsigned, Userspace<void*>) override;
+ virtual KResult ioctl(OpenFileDescription&, unsigned, Userspace<void*>) override;
private:
// ^IRQHandler
diff --git a/Kernel/Devices/SerialDevice.cpp b/Kernel/Devices/SerialDevice.cpp
index a84491f538..1fb506d8b7 100644
--- a/Kernel/Devices/SerialDevice.cpp
+++ b/Kernel/Devices/SerialDevice.cpp
@@ -49,12 +49,12 @@ UNMAP_AFTER_INIT SerialDevice::~SerialDevice()
{
}
-bool SerialDevice::can_read(const FileDescription&, size_t) const
+bool SerialDevice::can_read(const OpenFileDescription&, size_t) const
{
return (get_line_status() & DataReady) != 0;
}
-KResultOr<size_t> SerialDevice::read(FileDescription&, u64, UserOrKernelBuffer& buffer, size_t size)
+KResultOr<size_t> SerialDevice::read(OpenFileDescription&, u64, UserOrKernelBuffer& buffer, size_t size)
{
if (!size)
return 0;
@@ -70,12 +70,12 @@ KResultOr<size_t> SerialDevice::read(FileDescription&, u64, UserOrKernelBuffer&
});
}
-bool SerialDevice::can_write(const FileDescription&, size_t) const
+bool SerialDevice::can_write(const OpenFileDescription&, size_t) const
{
return (get_line_status() & EmptyTransmitterHoldingRegister) != 0;
}
-KResultOr<size_t> SerialDevice::write(FileDescription& description, u64, const UserOrKernelBuffer& buffer, size_t size)
+KResultOr<size_t> SerialDevice::write(OpenFileDescription& description, u64, const UserOrKernelBuffer& buffer, size_t size)
{
if (!size)
return 0;
diff --git a/Kernel/Devices/SerialDevice.h b/Kernel/Devices/SerialDevice.h
index 81aedfd8ce..48c1091a95 100644
--- a/Kernel/Devices/SerialDevice.h
+++ b/Kernel/Devices/SerialDevice.h
@@ -19,10 +19,10 @@ public:
virtual ~SerialDevice() override;
// ^CharacterDevice
- virtual bool can_read(const FileDescription&, size_t) const override;
- virtual KResultOr<size_t> read(FileDescription&, u64, UserOrKernelBuffer&, size_t) override;
- virtual bool can_write(const FileDescription&, size_t) const override;
- virtual KResultOr<size_t> write(FileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
+ virtual bool can_read(const OpenFileDescription&, size_t) const override;
+ virtual KResultOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
+ virtual bool can_write(const OpenFileDescription&, size_t) const override;
+ virtual KResultOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
void put_char(char);
diff --git a/Kernel/Devices/ZeroDevice.cpp b/Kernel/Devices/ZeroDevice.cpp
index 2e2d7af96f..880db84502 100644
--- a/Kernel/Devices/ZeroDevice.cpp
+++ b/Kernel/Devices/ZeroDevice.cpp
@@ -24,18 +24,18 @@ UNMAP_AFTER_INIT ZeroDevice::~ZeroDevice()
{
}
-bool ZeroDevice::can_read(const FileDescription&, size_t) const
+bool ZeroDevice::can_read(const OpenFileDescription&, size_t) const
{
return true;
}
-KResultOr<size_t> ZeroDevice::read(FileDescription&, u64, UserOrKernelBuffer& buffer, size_t size)
+KResultOr<size_t> ZeroDevice::read(OpenFileDescription&, u64, UserOrKernelBuffer& buffer, size_t size)
{
TRY(buffer.memset(0, size));
return size;
}
-KResultOr<size_t> ZeroDevice::write(FileDescription&, u64, const UserOrKernelBuffer&, size_t size)
+KResultOr<size_t> ZeroDevice::write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t size)
{
return size;
}
diff --git a/Kernel/Devices/ZeroDevice.h b/Kernel/Devices/ZeroDevice.h
index 69b2d377cc..46cdbd04d0 100644
--- a/Kernel/Devices/ZeroDevice.h
+++ b/Kernel/Devices/ZeroDevice.h
@@ -23,10 +23,10 @@ public:
private:
ZeroDevice();
// ^CharacterDevice
- virtual KResultOr<size_t> read(FileDescription&, u64, UserOrKernelBuffer&, size_t) override;
- virtual KResultOr<size_t> write(FileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
- virtual bool can_read(const FileDescription&, size_t) const override;
- virtual bool can_write(const FileDescription&, size_t) const override { return true; }
+ virtual KResultOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
+ virtual KResultOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
+ virtual bool can_read(const OpenFileDescription&, size_t) const override;
+ virtual bool can_write(const OpenFileDescription&, size_t) const override { return true; }
virtual StringView class_name() const override { return "ZeroDevice"; }
};