1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-30 21:58:10 +00:00

Kernel: Add distinct InodeIndex type

Use the DistinctNumeric mechanism to make InodeIndex a strongly typed
integer type.
This commit is contained in:
Andreas Kling 2021-02-12 09:18:47 +01:00
parent c8a90a31b6
commit e44c1792a7
17 changed files with 63 additions and 56 deletions

View file

@ -83,14 +83,12 @@ private:
bool populate_lookup_cache() const;
KResult resize(u64);
static u8 file_type_for_directory_entry(const ext2_dir_entry_2&);
Ext2FS& fs();
const Ext2FS& fs() const;
Ext2FSInode(Ext2FS&, unsigned index);
Ext2FSInode(Ext2FS&, InodeIndex);
mutable Vector<unsigned> m_block_list;
mutable HashMap<String, unsigned> m_lookup_cache;
mutable HashMap<String, InodeIndex> m_lookup_cache;
ext2_inode m_raw_inode;
};
@ -98,8 +96,6 @@ class Ext2FS final : public BlockBasedFS {
friend class Ext2FSInode;
public:
using InodeIndex = u32;
static NonnullRefPtr<Ext2FS> create(FileDescription&);
virtual ~Ext2FS() override;
@ -132,7 +128,7 @@ private:
unsigned inode_size() const;
bool write_ext2_inode(InodeIndex, const ext2_inode&);
bool find_block_containing_inode(InodeIndex inode, BlockIndex& block_index, unsigned& offset) const;
bool find_block_containing_inode(InodeIndex, BlockIndex& block_index, unsigned& offset) const;
bool flush_super_block();