mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 14:58:46 +00:00
Ext2FS: Fix fetching of the major/minor device numbers for st_rdev.
This is how it seems to work: - If ext2_inode.i_blocks[0] is non-zero, it contains the major/minor. - Otherwise, it's in ext2_inode.i_blocks[1].
This commit is contained in:
parent
6b5fbad250
commit
ecb1b93d53
Notes:
sideshowbarker
2024-07-19 12:58:22 +09:00
Author: https://github.com/awesomekling
Commit: ecb1b93d53
1 changed files with 3 additions and 6 deletions
|
@ -422,13 +422,10 @@ InodeMetadata Ext2FSInode::metadata() const
|
|||
metadata.block_size = fs().block_size();
|
||||
metadata.block_count = m_raw_inode.i_blocks;
|
||||
|
||||
if (::is_character_device(m_raw_inode.i_mode)) {
|
||||
if (::is_character_device(m_raw_inode.i_mode) || ::is_block_device(m_raw_inode.i_mode)) {
|
||||
unsigned dev = m_raw_inode.i_block[0];
|
||||
metadata.major_device = (dev & 0xfff00) >> 8;
|
||||
metadata.minor_device = (dev & 0xff) | ((dev >> 12) & 0xfff00);
|
||||
}
|
||||
if (::is_block_device(m_raw_inode.i_mode)) {
|
||||
unsigned dev = m_raw_inode.i_block[1];
|
||||
if (!dev)
|
||||
dev = m_raw_inode.i_block[1];
|
||||
metadata.major_device = (dev & 0xfff00) >> 8;
|
||||
metadata.minor_device = (dev & 0xff) | ((dev >> 12) & 0xfff00);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue