From 08cd285ca67249c023b02cd58f3cdace82e5ac62 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Wed, 19 Jul 2023 23:50:57 +0300 Subject: [PATCH] Kernel: move Device.h to its own directory --- kernel/CMakeLists.txt | 2 +- kernel/include/kernel/{ => Device}/Device.h | 8 +++++--- kernel/include/kernel/FS/DevFS/FileSystem.h | 2 +- kernel/include/kernel/Input/PS2Controller.h | 2 +- kernel/include/kernel/Storage/StorageDevice.h | 2 +- kernel/include/kernel/Terminal/TTY.h | 2 +- kernel/kernel/{ => Device}/Device.cpp | 2 +- 7 files changed, 11 insertions(+), 9 deletions(-) rename kernel/include/kernel/{ => Device}/Device.h (95%) rename kernel/kernel/{ => Device}/Device.cpp (82%) diff --git a/kernel/CMakeLists.txt b/kernel/CMakeLists.txt index 1bfaec8160..f70bd36091 100644 --- a/kernel/CMakeLists.txt +++ b/kernel/CMakeLists.txt @@ -14,7 +14,7 @@ set(KERNEL_SOURCES kernel/APIC.cpp kernel/CPUID.cpp kernel/Debug.cpp - kernel/Device.cpp + kernel/Device/Device.cpp kernel/Errors.cpp kernel/Font.cpp kernel/FS/DevFS/FileSystem.cpp diff --git a/kernel/include/kernel/Device.h b/kernel/include/kernel/Device/Device.h similarity index 95% rename from kernel/include/kernel/Device.h rename to kernel/include/kernel/Device/Device.h index 7a2a0f9b55..f05f4be939 100644 --- a/kernel/include/kernel/Device.h +++ b/kernel/include/kernel/Device/Device.h @@ -8,7 +8,6 @@ namespace Kernel class Device : public RamInode { public: - Device(mode_t, uid_t, gid_t); virtual ~Device() = default; virtual void update() {} @@ -16,11 +15,14 @@ namespace Kernel virtual bool is_partition() const { return false; } virtual dev_t rdev() const override = 0; + + protected: + Device(mode_t, uid_t, gid_t); }; class BlockDevice : public Device { - public: + protected: BlockDevice(mode_t mode, uid_t uid, gid_t gid) : Device(Mode::IFBLK | mode, uid, gid) { @@ -30,7 +32,7 @@ namespace Kernel class CharacterDevice : public Device { - public: + protected: CharacterDevice(mode_t mode, uid_t uid, gid_t gid) : Device(Mode::IFCHR | mode, uid, gid) { diff --git a/kernel/include/kernel/FS/DevFS/FileSystem.h b/kernel/include/kernel/FS/DevFS/FileSystem.h index 232810c3e1..97ec1fa1de 100644 --- a/kernel/include/kernel/FS/DevFS/FileSystem.h +++ b/kernel/include/kernel/FS/DevFS/FileSystem.h @@ -1,6 +1,6 @@ #pragma once -#include +#include #include namespace Kernel diff --git a/kernel/include/kernel/Input/PS2Controller.h b/kernel/include/kernel/Input/PS2Controller.h index 5c4e149586..9a2dc030b9 100644 --- a/kernel/include/kernel/Input/PS2Controller.h +++ b/kernel/include/kernel/Input/PS2Controller.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace Kernel::Input { diff --git a/kernel/include/kernel/Storage/StorageDevice.h b/kernel/include/kernel/Storage/StorageDevice.h index 0b3f77f561..78ec699f2a 100644 --- a/kernel/include/kernel/Storage/StorageDevice.h +++ b/kernel/include/kernel/Storage/StorageDevice.h @@ -1,7 +1,7 @@ #pragma once #include -#include +#include #include namespace Kernel diff --git a/kernel/include/kernel/Terminal/TTY.h b/kernel/include/kernel/Terminal/TTY.h index 3ddaadcc80..29cddf3db1 100644 --- a/kernel/include/kernel/Terminal/TTY.h +++ b/kernel/include/kernel/Terminal/TTY.h @@ -1,7 +1,7 @@ #pragma once #include -#include +#include #include #include #include diff --git a/kernel/kernel/Device.cpp b/kernel/kernel/Device/Device.cpp similarity index 82% rename from kernel/kernel/Device.cpp rename to kernel/kernel/Device/Device.cpp index d35250622a..f79ac05b2f 100644 --- a/kernel/kernel/Device.cpp +++ b/kernel/kernel/Device/Device.cpp @@ -1,4 +1,4 @@ -#include +#include #include namespace Kernel