Kernel: Use the system boot time as default timestamp in /sys and /dev

This commit is contained in:
Andreas Kling 2022-06-14 14:02:04 +02:00
parent adaaea4c9a
commit 4e4a930b13
Notes: sideshowbarker 2024-07-17 10:14:05 +09:00
4 changed files with 6 additions and 8 deletions

View File

@ -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;
}

View File

@ -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() };

View File

@ -18,8 +18,6 @@
namespace Kernel {
static constexpr u32 mepoch = 476763780;
class FileSystem : public RefCounted<FileSystem> {
friend class Inode;

View File

@ -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