Kernel/FATFS: Implement a hacky replace_child

This is not a proper implementation, but it's good enough to get
the write support fully working.
This commit is contained in:
Undefine 2024-01-18 21:07:48 +01:00 committed by Tim Schumacher
parent 511b298a1d
commit 31174c43bf
Notes: sideshowbarker 2024-07-17 21:16:31 +09:00

View file

@ -180,10 +180,12 @@ ErrorOr<NonnullOwnPtr<KBuffer>> FATInode::read_block_list()
return blocks.release_nonnull();
}
ErrorOr<void> FATInode::replace_child(StringView, Inode&)
ErrorOr<void> FATInode::replace_child(StringView name, Inode& inode)
{
// TODO: Implement this once we have write support.
return Error::from_errno(EROFS);
// FIXME: Implement this properly
TRY(remove_child(name));
TRY(add_child(inode, name, inode.mode()));
return {};
}
ErrorOr<RefPtr<FATInode>> FATInode::traverse(Function<ErrorOr<bool>(RefPtr<FATInode>)> callback)