From f9cc114907d0448b6b6fa9ea36abb9e6c5a1edde Mon Sep 17 00:00:00 2001 From: Bananymous Date: Thu, 30 Mar 2023 12:09:37 +0300 Subject: [PATCH] Kernel: All devices have atime, mtime, ctime at their creation --- kernel/include/kernel/Device.h | 8 ++++++++ kernel/include/kernel/Input/PS2Controller.h | 4 ---- kernel/kernel/Input/PS2Controller.cpp | 1 - 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/kernel/include/kernel/Device.h b/kernel/include/kernel/Device.h index 40ff734444..de80dca45a 100644 --- a/kernel/include/kernel/Device.h +++ b/kernel/include/kernel/Device.h @@ -19,9 +19,17 @@ namespace Kernel DeviceController }; + Device(); virtual ~Device() {} virtual DeviceType device_type() const = 0; virtual void update() {} + + virtual timespec atime() const override { return m_create_time; } + virtual timespec mtime() const override { return m_create_time; } + virtual timespec ctime() const override { return m_create_time; } + + private: + timespec m_create_time; }; class BlockDevice : public Device diff --git a/kernel/include/kernel/Input/PS2Controller.h b/kernel/include/kernel/Input/PS2Controller.h index a3c236cbbc..4128c42eb6 100644 --- a/kernel/include/kernel/Input/PS2Controller.h +++ b/kernel/include/kernel/Input/PS2Controller.h @@ -19,14 +19,10 @@ namespace Kernel::Input virtual uid_t uid() const override { return 0; } virtual gid_t gid() const override { return 0; } virtual off_t size() const override { return 0; } - virtual timespec atime() const override { return m_time; } - virtual timespec mtime() const override { return m_time; } - virtual timespec ctime() const override { return m_time; } virtual blkcnt_t blocks() const override { return 0; } virtual dev_t dev() const override { return m_dev; } private: - timespec m_time; ino_t m_ino; dev_t m_dev; }; diff --git a/kernel/kernel/Input/PS2Controller.cpp b/kernel/kernel/Input/PS2Controller.cpp index 37b75393fd..a9d7fb4f2f 100644 --- a/kernel/kernel/Input/PS2Controller.cpp +++ b/kernel/kernel/Input/PS2Controller.cpp @@ -337,7 +337,6 @@ namespace Kernel::Input { m_dev = dev; m_ino = dev & 1; - m_time = { BAN::to_unix_time(RTC::get_current_time()), 0 }; } } \ No newline at end of file