Good day! I'm trying to look into grub low-level disk IO. I've started exploration with my own low-level FS block reader, but it works too strange:
/* I know that such code is incorrect due to low-level FS operations but i'm trying to understand some principals of low level IO :) */ file = grub_file_open (FILE); fs_data = (struct grub_ext2_data *) file->data; disk = fs_data->disk; fsize = grub_file_size(file); block_num = (fsize >> LOG2_BLOCK_SIZE (fs_data)); if (((grub_off_t) block_num << LOG2_BLOCK_SIZE (fs_data)) != fsize) block_num++; log2_blksz = LOG2_EXT2_BLOCK_SIZE (fs_data); blocks = grub_malloc (sizeof (int) * block_num); fshelp_node = &fs_data->diropen; for (i = 0; i < block_num; i++) { blocks[i] = grub_ext2_read_block_wrapper (fshelp_node, i); } grub_disk_read(fs_data->disk, \ grub_le_to_cpu32 (blocks[i]) << log2_blksz, \ 0, \ sizeof (struct my_entry), \ (char *) entry); grub_ext2_read_block_wrapper its my exported wrapper from ext2.c that calls original grub_ext2_read_block with the same parameters. Problem: I have extended partition with two logical (hd0,5) & (hd0,6) If I place FILE on (hd0,5) (at the begining of my physical disk) - all is OK If I place FILE on (hd0,6) i get `out of partition` at grub_disk_read. I run grub2 using qemu and gdb block num seems to be correct (smth like 4500), but i don't pass grub_ext_read_block range check :( P.S. I'm right that `disk` represents one partition (logical or primary), not a group? Thanks!
_______________________________________________ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel