Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JHYvi-0007a0-6C for mharc-grub-devel@gnu.org; Wed, 23 Jan 2008 01:17:46 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JHYvg-0007Wq-1A for grub-devel@gnu.org; Wed, 23 Jan 2008 01:17:44 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JHYve-0007T2-7V for grub-devel@gnu.org; Wed, 23 Jan 2008 01:17:43 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JHYvd-0007Sk-Ft for grub-devel@gnu.org; Wed, 23 Jan 2008 01:17:41 -0500 Received: from wa-out-1112.google.com ([209.85.146.183]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JHYvd-0000hQ-2T for grub-devel@gnu.org; Wed, 23 Jan 2008 01:17:41 -0500 Received: by wa-out-1112.google.com with SMTP id k34so4843122wah.10 for ; Tue, 22 Jan 2008 22:17:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type; bh=9QlFDxMyEri2gOtR5JOB1dvh3MJZ26P+fHq221cyoXI=; b=wquhdwS1ianm2Rhg7bDMBnmZIf3FgOEUpke4gLfEIYzdHUGEgOUVCDgpo9wtEqCKw+0VIzLEZvlkyXaooQwUq+/YA2izYozlTKuWvYAvjqyRXibxGAyWWlbE4o4ivVPCm1KPx3j8m7RrnO5W14gDbeyB5UCujLHRRg8qezyihYY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=E1/SqsPJmyKvfZpinuDWE1r9SUeLkGNJnISFPbMeKEXZwZVeW4+xfZfNy6AieQ7g8lu8gBA62M8Qi5yu8CS0c6nlBg4346MgL6qJxXkGUykIWIKFq14eql2SzXC4XXr1gvIbvOBJa9spVBiNqBJQu/XZRdPlRGF4pdCgFC/VRsk= Received: by 10.114.169.2 with SMTP id r2mr8172274wae.30.1201069058715; Tue, 22 Jan 2008 22:17:38 -0800 (PST) Received: by 10.114.254.10 with HTTP; Tue, 22 Jan 2008 22:17:38 -0800 (PST) Message-ID: <94a0ccbc0801222217q1cab3cb3mbb94392f44b4caca@mail.gmail.com> Date: Wed, 23 Jan 2008 06:17:38 +0000 From: "Oleg Strikov" To: grub-devel@gnu.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_31184_9545167.1201069058706" X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) Subject: Re: Re: `disk` level IO: how it works? X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Jan 2008 06:17:44 -0000 ------=_Part_31184_9545167.1201069058706 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline >> 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. >I find this very confusing. Could you rephrase your >question to make it more >specific? Like, what are you trying to do or which function >you don't >understand. >> 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. >Did you check if debug options give you anything useful? > Try "set debug=disk", and maybe also "set debug=fs". >What's the size of your disk, and your partitions? >> P.S. I'm right that `disk` represents one partition (logical or primary), >> not a group? >I think grub_disk_t can either be a partition or a disk. >-- >Robert Millan Thanks Robert, I'll try to find my fault with debug option ------=_Part_31184_9545167.1201069058706 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline >> 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.

>I find this very confusing.  Could you rephrase your >question to make it more
>specific?  Like, what are you trying to do or which function >you don't
>understand.

>> 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.

>Did you check if debug options give you anything useful? > Try "set debug=disk",
and maybe also "set debug=fs".

>What's the size of your disk, and your partitions?

>> P.S. I'm right that `disk` represents one partition (logical or primary),
>> not a group?

>I think grub_disk_t can either be a partition or a disk.

>--
>Robert Millan

Thanks Robert, I'll try to find my fault with debug option
------=_Part_31184_9545167.1201069058706--