1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-19 00:35:06 +00:00

Kernel: Use AK::Time for InodeMetadata timestamps instead of time_t

Before this change, we were truncating the nanosecond part of file
timestamps in many different places.
This commit is contained in:
Andreas Kling 2022-11-22 21:01:45 +01:00
parent f8290e1ad4
commit 10fa72d451
23 changed files with 56 additions and 58 deletions

View file

@ -119,7 +119,7 @@ ErrorOr<size_t> Inode::read_bytes(off_t offset, size_t length, UserOrKernelBuffe
return read_bytes_locked(offset, length, buffer, open_description);
}
ErrorOr<void> Inode::update_timestamps([[maybe_unused]] Optional<time_t> atime, [[maybe_unused]] Optional<time_t> ctime, [[maybe_unused]] Optional<time_t> mtime)
ErrorOr<void> Inode::update_timestamps([[maybe_unused]] Optional<Time> atime, [[maybe_unused]] Optional<Time> ctime, [[maybe_unused]] Optional<Time> mtime)
{
return ENOTIMPL;
}
@ -238,8 +238,8 @@ void Inode::did_modify_contents()
{
// FIXME: What happens if this fails?
// ENOTIMPL would be a meaningless error to return here
auto time = kgettimeofday().to_truncated_seconds();
(void)update_timestamps({}, time, time);
auto now = kgettimeofday();
(void)update_timestamps({}, now, now);
m_watchers.for_each([&](auto& watcher) {
watcher->notify_inode_event({}, identifier(), InodeWatcherEvent::Type::ContentModified);