mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 06:48:49 +00:00
Kernel: Promote various integers to 64 bits in storage layer
This commit is contained in:
parent
f3a3a63b68
commit
fdb5367da1
Notes:
sideshowbarker
2024-07-18 10:20:37 +09:00
Author: https://github.com/boricj
Commit: fdb5367da1
Pull-request: https://github.com/SerenityOS/serenity/pull/8473
8 changed files with 29 additions and 45 deletions
|
@ -124,7 +124,7 @@ bool Ext2FS::initialize()
|
|||
return false;
|
||||
}
|
||||
|
||||
unsigned blocks_to_read = ceil_div(m_block_group_count * sizeof(ext2_group_desc), block_size());
|
||||
auto blocks_to_read = ceil_div(m_block_group_count * sizeof(ext2_group_desc), block_size());
|
||||
BlockIndex first_block_of_bgdt = block_size() == 1024 ? 2 : 1;
|
||||
m_cached_group_descriptor_table = KBuffer::try_create_with_size(block_size() * blocks_to_read, Region::Access::Read | Region::Access::Write, "Ext2FS: Block group descriptors");
|
||||
if (!m_cached_group_descriptor_table) {
|
||||
|
@ -170,9 +170,9 @@ bool Ext2FS::find_block_containing_inode(InodeIndex inode, BlockIndex& block_ind
|
|||
|
||||
auto& bgd = group_descriptor(group_index_from_inode(inode));
|
||||
|
||||
offset = ((inode.value() - 1) % inodes_per_group()) * inode_size();
|
||||
block_index = bgd.bg_inode_table + (offset >> EXT2_BLOCK_SIZE_BITS(&super_block));
|
||||
offset &= block_size() - 1;
|
||||
u64 full_offset = ((inode.value() - 1) % inodes_per_group()) * inode_size();
|
||||
block_index = bgd.bg_inode_table + (full_offset >> EXT2_BLOCK_SIZE_BITS(&super_block));
|
||||
offset = full_offset & (block_size() - 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -679,8 +679,8 @@ void Ext2FS::free_inode(Ext2FSInode& inode)
|
|||
void Ext2FS::flush_block_group_descriptor_table()
|
||||
{
|
||||
Locker locker(m_lock);
|
||||
unsigned blocks_to_write = ceil_div(m_block_group_count * sizeof(ext2_group_desc), block_size());
|
||||
unsigned first_block_of_bgdt = block_size() == 1024 ? 2 : 1;
|
||||
auto blocks_to_write = ceil_div(m_block_group_count * sizeof(ext2_group_desc), block_size());
|
||||
auto first_block_of_bgdt = block_size() == 1024 ? 2 : 1;
|
||||
auto buffer = UserOrKernelBuffer::for_kernel_buffer((u8*)block_group_descriptors());
|
||||
if (auto result = write_blocks(first_block_of_bgdt, blocks_to_write, buffer); result.is_error())
|
||||
dbgln("Ext2FS[{}]::flush_block_group_descriptor_table(): Failed to write blocks: {}", fsid(), result.error());
|
||||
|
@ -1257,21 +1257,21 @@ KResult Ext2FSInode::remove_child(const StringView& name)
|
|||
return KSuccess;
|
||||
}
|
||||
|
||||
unsigned Ext2FS::inodes_per_block() const
|
||||
u64 Ext2FS::inodes_per_block() const
|
||||
{
|
||||
return EXT2_INODES_PER_BLOCK(&super_block());
|
||||
}
|
||||
|
||||
unsigned Ext2FS::inodes_per_group() const
|
||||
u64 Ext2FS::inodes_per_group() const
|
||||
{
|
||||
return EXT2_INODES_PER_GROUP(&super_block());
|
||||
}
|
||||
|
||||
unsigned Ext2FS::inode_size() const
|
||||
u64 Ext2FS::inode_size() const
|
||||
{
|
||||
return EXT2_INODE_SIZE(&super_block());
|
||||
}
|
||||
unsigned Ext2FS::blocks_per_group() const
|
||||
u64 Ext2FS::blocks_per_group() const
|
||||
{
|
||||
return EXT2_BLOCKS_PER_GROUP(&super_block());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue