mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 10:18:13 +00:00
Reworked Inode to have a dirty bit and subclass-implemented flush_metadata().
This way we can defer disk writes as long as we like. There's no automatic flushing happening just yet.
This commit is contained in:
parent
d506c857ab
commit
1f44cd9dd9
11 changed files with 82 additions and 58 deletions
|
@ -1090,6 +1090,9 @@ int Process::sys$utime(const char* pathname, const Unix::utimbuf* buf)
|
|||
auto descriptor = VFS::the().open(move(path), error, 0, cwd_inode()->identifier());
|
||||
if (!descriptor)
|
||||
return error;
|
||||
auto& inode = *descriptor->inode();
|
||||
if (inode.fs().is_readonly())
|
||||
return -EROFS;
|
||||
Unix::time_t atime;
|
||||
Unix::time_t mtime;
|
||||
if (buf) {
|
||||
|
@ -1100,7 +1103,10 @@ int Process::sys$utime(const char* pathname, const Unix::utimbuf* buf)
|
|||
mtime = now;
|
||||
atime = now;
|
||||
}
|
||||
return descriptor->set_atime_and_mtime(atime, mtime);
|
||||
inode.set_atime(atime);
|
||||
inode.set_mtime(atime);
|
||||
inode.flush_metadata();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Process::sys$access(const char* pathname, int mode)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue