Kernel: remove message from BAN::Error

We don't store the error message anymore in BAN::Error.
Instead we store a error code that can be mapped into a string.
This allows BAN::Error to only take 4 bytes instead of 128.

We should also make some kernel initialization just panic instead
of returning errors since they are required for succesfull boot
anyway.
This commit is contained in:
2023-04-11 23:25:21 +03:00
parent 2fabe1949c
commit 8d6db168d6
16 changed files with 258 additions and 123 deletions

View File

@@ -463,7 +463,7 @@ namespace Kernel
}
if (m_superblock.magic != 0xEF53)
return BAN::Error::from_c_string("Not an ext2 filesystem");
return BAN::Error::from_error_code(ErrorCode::Ext2_Invalid);
if (m_superblock.rev_level < 1)
{
@@ -475,7 +475,7 @@ namespace Kernel
uint32_t number_of_block_groups = BAN::Math::div_round_up(superblock().inodes_count, superblock().inodes_per_group);
uint32_t number_of_block_groups_check = BAN::Math::div_round_up(superblock().blocks_count, superblock().blocks_per_group);
if (number_of_block_groups != number_of_block_groups_check)
return BAN::Error::from_c_string("Ambiguous number of block groups");
return BAN::Error::from_error_code(ErrorCode::Ext2_Corrupted);
ASSERT(!(m_superblock.feature_incompat & Ext2::Enum::FEATURE_INCOMPAT_COMPRESSION));
//ASSERT(!(m_superblock.feature_incompat & Ext2::Enum::FEATURE_INCOMPAT_FILETYPE));
@@ -546,7 +546,7 @@ namespace Kernel
}
}
return BAN::Error::from_c_string("No free inodes available in the whole filesystem");
return BAN::Error::from_error_code(ErrorCode::Ext2_NoInodes);
}
void Ext2FS::read_block(uint32_t block, BAN::Span<uint8_t> buffer)