Procházet zdrojové kódy

Get rid of Ext2FS::is_directory_inode().

This was only used for assertions and will be factored out in favor of
Inode metadata checks eventually.
Andreas Kling před 6 roky
rodič
revize
1e07ead119

+ 0 - 9
VirtualFileSystem/Ext2FileSystem.cpp

@@ -650,13 +650,6 @@ bool Ext2FS::write_ext2_inode(unsigned inode, const ext2_inode& e2inode)
     return true;
 }
 
-bool Ext2FS::is_directory_inode(unsigned inode) const
-{
-    if (auto e2inode = lookup_ext2_inode(inode))
-        return isDirectory(e2inode->i_mode);
-    return false;
-}
-
 Vector<Ext2FS::BlockIndex> Ext2FS::allocate_blocks(unsigned group, unsigned count)
 {
     dbgprintf("Ext2FS: allocateBlocks(group: %u, count: %u)\n", group, count);
@@ -840,7 +833,6 @@ bool Ext2FS::set_block_allocation_state(GroupIndex group, BlockIndex bi, bool ne
 InodeIdentifier Ext2FS::create_directory(InodeIdentifier parentInode, const String& name, Unix::mode_t mode, int& error)
 {
     ASSERT(parentInode.fsid() == id());
-    ASSERT(is_directory_inode(parentInode.index()));
 
     // Fix up the mode to definitely be a directory.
     // FIXME: This is a bit on the hackish side.
@@ -880,7 +872,6 @@ InodeIdentifier Ext2FS::create_directory(InodeIdentifier parentInode, const Stri
 InodeIdentifier Ext2FS::create_inode(InodeIdentifier parentInode, const String& name, Unix::mode_t mode, unsigned size, int& error)
 {
     ASSERT(parentInode.fsid() == id());
-    ASSERT(is_directory_inode(parentInode.index()));
 
     dbgprintf("Ext2FS: Adding inode '%s' (mode %u) to parent directory %u:\n", name.characters(), mode, parentInode.index());
 

+ 0 - 1
VirtualFileSystem/Ext2FileSystem.h

@@ -77,7 +77,6 @@ private:
     virtual InodeIdentifier find_parent_of_inode(InodeIdentifier) const override;
     virtual RetainPtr<Inode> get_inode(InodeIdentifier) const override;
 
-    bool is_directory_inode(unsigned) const;
     unsigned allocate_inode(unsigned preferredGroup, unsigned expectedSize);
     Vector<BlockIndex> allocate_blocks(unsigned group, unsigned count);
     unsigned group_index_from_inode(unsigned) const;