|
我的真机自己开了ext2fs调试了,用的是2022年0723版本,更高版本会因为ext4问题卡booting界面 卡find 命令
输入ls (hd0,2)/
inode 2
dirname=/
ipg=8192,dpb=64
group_id=0 group_desc=1 desc=0
fsblock 1 buffer 3227612640
同一块硬盘,我在虚拟机中测试的结果
inode 2
dirname=/
ipg=8192,dpb=64
group_id=0 group_desc=1 desc=0
fsblock 1 buffer 1005987296
inode table fsblock =1065
fsblock 1065 buffer 1005991392
ipb=16, sizeof(inode)=256
inode=3bf635e0,raw_inode=3bf636e0
offset into inode table block=256
00 00 00 00 00 0 00 f3 44 3e 60 f3 44 3e 60
.........后面都是16进制的
查看源码?????
ext2_rdfsb (unsigned long long fsblock, int buffer)
{
#ifdef E2DEBUG
printf ("fsblock %d buffer %d\n", fsblock, buffer);
#endif /* E2DEBUG */
return devread (fsblock * (EXT2_BLOCK_SIZE (SUPERBLOCK) / DEV_BSIZE), 0,
EXT2_BLOCK_SIZE (SUPERBLOCK), (unsigned long long)(grub_size_t)(char *)(grub_size_t) buffer, 0xedde0d90);
}
while (1)
{
#ifdef E2DEBUG
printf ("inode %d\n", current_ino);
printf ("dirname=%s\n", dirname);
#endif /* E2DEBUG */
/* look up an inode */
group_id = tem = (current_ino - 1) / SUPERBLOCK->s_inodes_per_group;
if ((EXT4_HAS_INCOMPAT_FEATURE(SUPERBLOCK,EXT4_FEATURE_INCOMPAT_META))
&& (group_id >= (int)SUPERBLOCK->s_first_meta_bg))
{
group_id = (group_id - SUPERBLOCK->s_first_meta_bg)
% EXT4_META_GROUP_SIZE(SUPERBLOCK);
group_desc = (group_id >> log2_tmp (EXT2_DESC_PER_BLOCK (SUPERBLOCK)))
+ (tem - group_id) * SUPERBLOCK->s_blocks_per_group
+ (SUPERBLOCK->s_first_meta_bg == 0 ?
(WHICH_SUPER + SUPERBLOCK->s_first_data_block) : WHICH_SUPER);
}
else
{
group_desc = (group_id >> log2_tmp (EXT2_DESC_PER_BLOCK (SUPERBLOCK)))
+ WHICH_SUPER + SUPERBLOCK->s_first_data_block;
}
desc = group_id & (EXT2_DESC_PER_BLOCK (SUPERBLOCK) - 1);
#ifdef E2DEBUG
printf ("ipg=%d, dpb=%d\n", SUPERBLOCK->s_inodes_per_group,
EXT2_DESC_PER_BLOCK (SUPERBLOCK));
printf ("group_id=%d group_desc=%d desc=%d\n", group_id, group_desc, desc);
#endif /* E2DEBUG */
if (!ext2_rdfsb (group_desc,(grub_size_t) GROUP_DESC))
{
return 0;
}
ext4_gdp = (struct ext4_group_desc *)( (__u8*)GROUP_DESC +
desc * EXT2_DESC_SIZE(SUPERBLOCK));
ino_blk = (EXT4_HAS_INCOMPAT_FEATURE(SUPERBLOCK,EXT4_FEATURE_INCOMPAT_64BIT) ?
((unsigned long long)ext4_gdp->bg_inode_table_hi<<32) : 0) + ext4_gdp->bg_inode_table_lo +
(((current_ino - 1) % (SUPERBLOCK->s_inodes_per_group))
>> log2_tmp (EXT2_INODES_PER_BLOCK (SUPERBLOCK)));
#ifdef E2DEBUG
printf ("inode table fsblock=%d\n", ino_blk);
#endif /* E2DEBUG */
|
|