summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2022-07-09 10:10:21 +0300
committerAndreas Kling <kling@serenityos.org>2022-07-10 14:57:55 +0200
commit9dbec601b0fdfe18ec425a6dd6518740309fd78a (patch)
tree1e327698a18c441da13b45da8334e79079093f8f
parentb1ed151c9cefe37d6f668afb2411f93864ff1b5f (diff)
downloadserenity-9dbec601b0fdfe18ec425a6dd6518740309fd78a.zip
Kernel+SystemServer: Make KCOVDevice a character device
This device should not be a block device, as in Serenity, block devices represent an interface to either disk partitions or storage devices.
-rw-r--r--Kernel/Devices/KCOVDevice.cpp2
-rw-r--r--Kernel/Devices/KCOVDevice.h5
-rw-r--r--Userland/Services/SystemServer/main.cpp4
3 files changed, 5 insertions, 6 deletions
diff --git a/Kernel/Devices/KCOVDevice.cpp b/Kernel/Devices/KCOVDevice.cpp
index d621472ca3..d34475c92b 100644
--- a/Kernel/Devices/KCOVDevice.cpp
+++ b/Kernel/Devices/KCOVDevice.cpp
@@ -28,7 +28,7 @@ UNMAP_AFTER_INIT NonnullRefPtr<KCOVDevice> KCOVDevice::must_create()
}
UNMAP_AFTER_INIT KCOVDevice::KCOVDevice()
- : BlockDevice(30, 0)
+ : CharacterDevice(30, 0)
{
proc_instance = new HashMap<ProcessID, KCOVInstance*>();
thread_instance = new HashMap<ThreadID, KCOVInstance*>();
diff --git a/Kernel/Devices/KCOVDevice.h b/Kernel/Devices/KCOVDevice.h
index 5c1ae79c0f..fa7cb89c3d 100644
--- a/Kernel/Devices/KCOVDevice.h
+++ b/Kernel/Devices/KCOVDevice.h
@@ -6,11 +6,11 @@
#pragma once
-#include <Kernel/Devices/BlockDevice.h>
+#include <Kernel/Devices/CharacterDevice.h>
#include <Kernel/Devices/KCOVInstance.h>
namespace Kernel {
-class KCOVDevice final : public BlockDevice {
+class KCOVDevice final : public CharacterDevice {
friend class DeviceManagement;
public:
@@ -32,7 +32,6 @@ protected:
virtual bool can_read(OpenFileDescription const&, u64) const override final { return true; }
virtual bool can_write(OpenFileDescription const&, u64) const override final { return true; }
- virtual void start_request(AsyncBlockDeviceRequest& request) override final { request.complete(AsyncDeviceRequest::Failure); }
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override { return EINVAL; }
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, UserOrKernelBuffer const&, size_t) override { return EINVAL; }
virtual ErrorOr<void> ioctl(OpenFileDescription&, unsigned request, Userspace<void*> arg) override;
diff --git a/Userland/Services/SystemServer/main.cpp b/Userland/Services/SystemServer/main.cpp
index 5d0f767f02..795106df20 100644
--- a/Userland/Services/SystemServer/main.cpp
+++ b/Userland/Services/SystemServer/main.cpp
@@ -275,8 +275,8 @@ static void populate_devtmpfs_devices_based_on_devctl()
break;
}
case 30: {
- if (is_block_device) {
- create_devtmpfs_block_device(String::formatted("/dev/kcov{}", minor_number), 0666, 30, minor_number);
+ if (!is_block_device) {
+ create_devtmpfs_char_device(String::formatted("/dev/kcov{}", minor_number), 0666, 30, minor_number);
}
break;
}