mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-02 22:55:23 +00:00
Kernel: Update atime/ctime/mtime timestamps atomically
Instead of having three separate APIs (one for each timestamp), there's now only Inode::update_timestamps() and it takes 3x optional timestamps. The non-empty timestamps are updated while holding the inode mutex, and the outside world no longer has to look at intermediate timestamp states.
This commit is contained in:
@@ -106,17 +106,7 @@ void Inode::will_be_destroyed()
|
||||
(void)flush_metadata();
|
||||
}
|
||||
|
||||
ErrorOr<void> Inode::set_atime(time_t)
|
||||
{
|
||||
return ENOTIMPL;
|
||||
}
|
||||
|
||||
ErrorOr<void> Inode::set_ctime(time_t)
|
||||
{
|
||||
return ENOTIMPL;
|
||||
}
|
||||
|
||||
ErrorOr<void> Inode::set_mtime(time_t)
|
||||
ErrorOr<void> Inode::update_timestamps([[maybe_unused]] Optional<time_t> atime, [[maybe_unused]] Optional<time_t> ctime, [[maybe_unused]] Optional<time_t> mtime)
|
||||
{
|
||||
return ENOTIMPL;
|
||||
}
|
||||
@@ -236,8 +226,7 @@ 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)set_mtime(time);
|
||||
(void)set_ctime(time);
|
||||
(void)update_timestamps({}, time, time);
|
||||
|
||||
m_watchers.for_each([&](auto& watcher) {
|
||||
watcher->notify_inode_event({}, identifier(), InodeWatcherEvent::Type::ContentModified);
|
||||
|
||||
Reference in New Issue
Block a user