Kernel: All devices have atime, mtime, ctime at their creation

This commit is contained in:
Bananymous 2023-03-30 12:09:37 +03:00
parent 5d5487315f
commit a513bc5749
3 changed files with 8 additions and 5 deletions

View File

@ -19,9 +19,17 @@ namespace Kernel
DeviceController DeviceController
}; };
Device();
virtual ~Device() {} virtual ~Device() {}
virtual DeviceType device_type() const = 0; virtual DeviceType device_type() const = 0;
virtual void update() {} 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 class BlockDevice : public Device

View File

@ -19,14 +19,10 @@ namespace Kernel::Input
virtual uid_t uid() const override { return 0; } virtual uid_t uid() const override { return 0; }
virtual gid_t gid() const override { return 0; } virtual gid_t gid() const override { return 0; }
virtual off_t size() 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 blkcnt_t blocks() const override { return 0; }
virtual dev_t dev() const override { return m_dev; } virtual dev_t dev() const override { return m_dev; }
private: private:
timespec m_time;
ino_t m_ino; ino_t m_ino;
dev_t m_dev; dev_t m_dev;
}; };

View File

@ -337,7 +337,6 @@ namespace Kernel::Input
{ {
m_dev = dev; m_dev = dev;
m_ino = dev & 1; m_ino = dev & 1;
m_time = { BAN::to_unix_time(RTC::get_current_time()), 0 };
} }
} }