`disk` level IO: how it works?
Quoted 6 lines
Quoted 6 lines
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
Quoted 31 lines
Quoted 31 lines
trying to understand some principals of low level IO :) */
file =
grub_file_open(FILE);fs_data= (structgrub_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);
Quoted 1 line
Quoted 1 line
grub_ext2_read_block_wrapperits my exported wrapper fromext2.cthat
calls
Quoted 3 lines
Quoted 1 line
original
grub_ext2_read_blockwith the same parameters.I find this very confusing. Could you rephrase your >question to make it
more
Quoted 5 lines
specific? Like, what are you trying to do or which function >you don't understand.
Quoted 2 lines
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
Quoted 3 lines
Quoted 1 line
If I place FILE on (hd0,6) i get
out of partitionatgrub_disk_read.Did you check if debug options give you anything useful? > Try "set
debug=disk",
and maybe also "set debug=fs".
Quoted 9 lines
What's the size of your disk, and your partitions?
Quoted 2 lines
P.S. I'm right thatdiskrepresents one partition (logical or primary), not a group?I think
grub_disk_tcan either be a partition or a disk.--
Robert Millan
Thanks Robert, I'll try to find my fault with debug option