summaryrefslogtreecommitdiff
path: root/Kernel/FileSystem
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-06-14 14:02:04 +0200
committerAndreas Kling <kling@serenityos.org>2022-06-15 17:15:04 +0200
commit4e4a930b13f0f874f0ad7c368f1adb7fa5cb1e0b (patch)
tree0a35d9dfb8c67a5a2b0db2d641ecd87ae755a5d3 /Kernel/FileSystem
parentadaaea4c9a8e05a178fd0ee9f9c8a1852c7820ab (diff)
downloadserenity-4e4a930b13f0f874f0ad7c368f1adb7fa5cb1e0b.zip
Kernel: Use the system boot time as default timestamp in /sys and /dev
Diffstat (limited to 'Kernel/FileSystem')
-rw-r--r--Kernel/FileSystem/DevPtsFS.cpp4
-rw-r--r--Kernel/FileSystem/DevTmpFS.cpp4
-rw-r--r--Kernel/FileSystem/FileSystem.h2
-rw-r--r--Kernel/FileSystem/SysFS.cpp4
4 files changed, 6 insertions, 8 deletions
diff --git a/Kernel/FileSystem/DevPtsFS.cpp b/Kernel/FileSystem/DevPtsFS.cpp
index 02df952b62..ffb1d21013 100644
--- a/Kernel/FileSystem/DevPtsFS.cpp
+++ b/Kernel/FileSystem/DevPtsFS.cpp
@@ -28,7 +28,7 @@ ErrorOr<void> DevPtsFS::initialize()
m_root_inode->m_metadata.uid = 0;
m_root_inode->m_metadata.gid = 0;
m_root_inode->m_metadata.size = 0;
- m_root_inode->m_metadata.mtime = mepoch;
+ m_root_inode->m_metadata.mtime = TimeManagement::boot_time();
return {};
}
@@ -65,7 +65,7 @@ ErrorOr<NonnullRefPtr<Inode>> DevPtsFS::get_inode(InodeIdentifier inode_id) cons
inode->m_metadata.mode = 0020600;
inode->m_metadata.major_device = device->major();
inode->m_metadata.minor_device = device->minor();
- inode->m_metadata.mtime = mepoch;
+ inode->m_metadata.mtime = TimeManagement::boot_time();
return inode;
}
diff --git a/Kernel/FileSystem/DevTmpFS.cpp b/Kernel/FileSystem/DevTmpFS.cpp
index f6d0e81dc5..e6fff851aa 100644
--- a/Kernel/FileSystem/DevTmpFS.cpp
+++ b/Kernel/FileSystem/DevTmpFS.cpp
@@ -94,7 +94,7 @@ InodeMetadata DevTmpFSInode::metadata() const
metadata.uid = m_uid;
metadata.gid = m_gid;
metadata.size = 0;
- metadata.mtime = mepoch;
+ metadata.mtime = TimeManagement::boot_time();
switch (node_type()) {
case Type::RootDirectory:
metadata.inode = { fsid(), 1 };
@@ -102,7 +102,7 @@ InodeMetadata DevTmpFSInode::metadata() const
metadata.uid = 0;
metadata.gid = 0;
metadata.size = 0;
- metadata.mtime = mepoch;
+ metadata.mtime = TimeManagement::boot_time();
break;
case Type::Directory:
metadata.inode = { fsid(), index() };
diff --git a/Kernel/FileSystem/FileSystem.h b/Kernel/FileSystem/FileSystem.h
index f7f5e1a188..ef50f87c05 100644
--- a/Kernel/FileSystem/FileSystem.h
+++ b/Kernel/FileSystem/FileSystem.h
@@ -18,8 +18,6 @@
namespace Kernel {
-static constexpr u32 mepoch = 476763780;
-
class FileSystem : public RefCounted<FileSystem> {
friend class Inode;
diff --git a/Kernel/FileSystem/SysFS.cpp b/Kernel/FileSystem/SysFS.cpp
index 3875597531..ff1726be40 100644
--- a/Kernel/FileSystem/SysFS.cpp
+++ b/Kernel/FileSystem/SysFS.cpp
@@ -138,7 +138,7 @@ InodeMetadata SysFSInode::metadata() const
metadata.uid = 0;
metadata.gid = 0;
metadata.size = m_associated_component->size();
- metadata.mtime = mepoch;
+ metadata.mtime = TimeManagement::boot_time();
return metadata;
}
@@ -208,7 +208,7 @@ InodeMetadata SysFSDirectoryInode::metadata() const
metadata.uid = 0;
metadata.gid = 0;
metadata.size = 0;
- metadata.mtime = mepoch;
+ metadata.mtime = TimeManagement::boot_time();
return metadata;
}
ErrorOr<void> SysFSDirectoryInode::traverse_as_directory(Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const