Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JHPJz-00088c-8g for mharc-grub-devel@gnu.org; Tue, 22 Jan 2008 15:02:11 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JHPJy-00086O-2b for grub-devel@gnu.org; Tue, 22 Jan 2008 15:02:10 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JHPJx-00084X-4Z for grub-devel@gnu.org; Tue, 22 Jan 2008 15:02:09 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JHPJw-00084P-So for grub-devel@gnu.org; Tue, 22 Jan 2008 15:02:08 -0500 Received: from aybabtu.com ([69.60.117.155]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JHPJw-000771-Bh for grub-devel@gnu.org; Tue, 22 Jan 2008 15:02:08 -0500 Received: from [192.168.10.6] (helo=thorin) by aybabtu.com with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1JHPJu-0003Fm-MO for grub-devel@gnu.org; Tue, 22 Jan 2008 21:02:07 +0100 Received: from rmh by thorin with local (Exim 4.63) (envelope-from ) id 1JHPIL-0005jU-Hh for grub-devel@gnu.org; Tue, 22 Jan 2008 21:00:29 +0100 Date: Tue, 22 Jan 2008 21:00:29 +0100 From: Robert Millan To: The development of GRUB 2 Message-ID: <20080122200029.GB21526@thorin> References: <94a0ccbc0801220001n440c95a0gb6431b1645b96136@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <94a0ccbc0801220001n440c95a0gb6431b1645b96136@mail.gmail.com> Organization: free as in freedom X-Message-Flag: Worried about Outlook viruses? Switch to Thunderbird! www.mozilla.com/thunderbird X-Debbugs-No-Ack: true User-Agent: Mutt/1.5.13 (2006-08-11) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Subject: 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: Tue, 22 Jan 2008 20:02:10 -0000 On Tue, Jan 22, 2008 at 08:01:56AM +0000, Oleg Strikov wrote: > 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 I know my rights; I want my phone call! What use is a phone call… if you are unable to speak? (as seen on /.)