Kernel: Implement TmpFS Inode unlinking and deletion

This commit is contained in:
2023-11-06 21:14:39 +02:00
parent 3e33fc156b
commit b7771e95ac
4 changed files with 102 additions and 24 deletions

View File

@@ -40,7 +40,9 @@ namespace Kernel
virtual BAN::RefPtr<Inode> root_inode() override { return m_root_inode; }
BAN::ErrorOr<BAN::RefPtr<TmpInode>> open_inode(ino_t ino);
BAN::ErrorOr<void> add_to_cache(BAN::RefPtr<TmpInode>);
void remove_from_cache(BAN::RefPtr<TmpInode>);
// FIXME: read_block and write_block should not require external buffer
// probably some wrapper like PageTable::with_fast_page could work?

View File

@@ -40,12 +40,14 @@ namespace Kernel
public:
static BAN::ErrorOr<BAN::RefPtr<TmpInode>> create_from_existing(TmpFileSystem&, ino_t, const TmpInodeInfo&);
~TmpInode();
protected:
TmpInode(TmpFileSystem&, ino_t, const TmpInodeInfo&);
void sync();
void free_all_blocks();
virtual BAN::ErrorOr<void> prepare_unlink() { return {}; };
BAN::Optional<size_t> block_index(size_t data_block_index);
BAN::ErrorOr<size_t> block_index_with_allocation(size_t data_block_index);
@@ -95,6 +97,9 @@ namespace Kernel
~TmpDirectoryInode();
protected:
virtual BAN::ErrorOr<void> prepare_unlink() override;
protected:
virtual BAN::ErrorOr<BAN::RefPtr<Inode>> find_inode_impl(BAN::StringView) override final;
virtual BAN::ErrorOr<void> list_next_inodes_impl(off_t, DirectoryEntryList*, size_t) override final;