1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 11:34:59 +00:00

Kernel+LibC: Implement fsync

This commit is contained in:
TheFightingCatfish 2021-09-11 23:28:59 -04:00 committed by Andreas Kling
parent fd3735199b
commit a81b21c1a7
13 changed files with 51 additions and 6 deletions

View file

@ -29,7 +29,7 @@ SpinlockProtected<Inode::AllInstancesList>& Inode::all_instances()
return s_all_instances;
}
void Inode::sync()
void Inode::sync_all()
{
NonnullRefPtrVector<Inode, 32> inodes;
Inode::all_instances().with([&](auto& all_inodes) {
@ -45,6 +45,13 @@ void Inode::sync()
}
}
void Inode::sync()
{
if (is_metadata_dirty())
flush_metadata();
fs().flush_writes();
}
KResultOr<NonnullOwnPtr<KBuffer>> Inode::read_entire(OpenFileDescription* description) const
{
auto builder = TRY(KBufferBuilder::try_create());