forked from Bananymous/banan-os
Kernel: Don't crash the kernel if ext2 encounters disk error
This will most likely result in a corrupted filesystem, but crashing the kernel is too much :D
This commit is contained in:
@@ -61,17 +61,17 @@ namespace Kernel
|
||||
BAN::ErrorOr<void> initialize_root_inode();
|
||||
|
||||
BAN::ErrorOr<uint32_t> create_inode(const Ext2::Inode&);
|
||||
void delete_inode(uint32_t ino);
|
||||
BAN::ErrorOr<void> delete_inode(uint32_t ino);
|
||||
BAN::ErrorOr<void> resize_inode(uint32_t, size_t);
|
||||
|
||||
void read_block(uint32_t, BlockBufferWrapper&);
|
||||
void write_block(uint32_t, const BlockBufferWrapper&);
|
||||
void sync_superblock();
|
||||
BAN::ErrorOr<void> read_block(uint32_t, BlockBufferWrapper&);
|
||||
BAN::ErrorOr<void> write_block(uint32_t, const BlockBufferWrapper&);
|
||||
BAN::ErrorOr<void> sync_superblock();
|
||||
|
||||
BlockBufferWrapper get_block_buffer();
|
||||
|
||||
BAN::ErrorOr<uint32_t> reserve_free_block(uint32_t primary_bgd);
|
||||
void release_block(uint32_t block);
|
||||
BAN::ErrorOr<void> release_block(uint32_t block);
|
||||
|
||||
BAN::HashMap<ino_t, BAN::RefPtr<Ext2Inode>>& inode_cache() { return m_inode_cache; }
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace Kernel
|
||||
uint32_t block;
|
||||
uint32_t offset;
|
||||
};
|
||||
BlockLocation locate_inode(uint32_t);
|
||||
BAN::ErrorOr<BlockLocation> locate_inode(uint32_t);
|
||||
BlockLocation locate_block_group_descriptior(uint32_t);
|
||||
|
||||
uint32_t block_size() const { return 1024 << superblock().log_block_size; }
|
||||
|
||||
@@ -52,19 +52,19 @@ namespace Kernel
|
||||
// NOTE: the inode might have more blocks than what this suggests if it has been shrinked
|
||||
uint32_t max_used_data_block_count() const { return size() / blksize(); }
|
||||
|
||||
BAN::Optional<uint32_t> block_from_indirect_block(uint32_t block, uint32_t index, uint32_t depth);
|
||||
BAN::Optional<uint32_t> fs_block_of_data_block_index(uint32_t data_block_index);
|
||||
BAN::ErrorOr<BAN::Optional<uint32_t>> block_from_indirect_block(uint32_t block, uint32_t index, uint32_t depth);
|
||||
BAN::ErrorOr<BAN::Optional<uint32_t>> fs_block_of_data_block_index(uint32_t data_block_index);
|
||||
|
||||
BAN::ErrorOr<void> link_inode_to_directory(Ext2Inode&, BAN::StringView name);
|
||||
BAN::ErrorOr<bool> is_directory_empty();
|
||||
|
||||
void cleanup_indirect_block(uint32_t block, uint32_t depth);
|
||||
BAN::ErrorOr<void> cleanup_indirect_block(uint32_t block, uint32_t depth);
|
||||
BAN::ErrorOr<void> cleanup_default_links();
|
||||
void cleanup_from_fs();
|
||||
BAN::ErrorOr<void> cleanup_from_fs();
|
||||
|
||||
BAN::ErrorOr<uint32_t> allocate_new_block_to_indirect_block(uint32_t& block, uint32_t index, uint32_t depth);
|
||||
BAN::ErrorOr<uint32_t> allocate_new_block(uint32_t data_block_index);
|
||||
void sync();
|
||||
BAN::ErrorOr<void> sync();
|
||||
|
||||
uint32_t block_group() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user