From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1K2PQh-0001Qd-V7 for mharc-grub-devel@gnu.org; Sat, 31 May 2008 07:39:24 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K2PQg-0001QI-7x for grub-devel@gnu.org; Sat, 31 May 2008 07:39:22 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K2PQe-0001Q6-Pv for grub-devel@gnu.org; Sat, 31 May 2008 07:39:21 -0400 Received: from [199.232.76.173] (port=39348 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K2PQe-0001Q3-Jh for grub-devel@gnu.org; Sat, 31 May 2008 07:39:20 -0400 Received: from aybabtu.com ([69.60.117.155]:38471) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1K2PQe-0007Kq-Gm for grub-devel@gnu.org; Sat, 31 May 2008 07:39:20 -0400 Received: from [192.168.10.10] (helo=thorin) by aybabtu.com with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1K2PQ6-00052t-TH for grub-devel@gnu.org; Sat, 31 May 2008 13:38:47 +0200 Received: from rmh by thorin with local (Exim 4.63) (envelope-from ) id 1K2PQL-0005X4-Bu for grub-devel@gnu.org; Sat, 31 May 2008 13:39:01 +0200 Date: Sat, 31 May 2008 13:39:01 +0200 From: Robert Millan To: The development of GRUB 2 Message-ID: <20080531113901.GA20946@thorin> References: <20080531101042.GF6619@thorin> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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: [PATCH] Environment block support for grub2 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: Sat, 31 May 2008 11:39:22 -0000 On Sat, May 31, 2008 at 06:54:43PM +0800, Bean wrote: > > The root is assigned in the initialization phraze. Currently, it's > done this way: > > machine_machine_init -> calculate root device, then set variable > prefix using root and grub_prefix. > > modules initialization > > grub_set_root_dev -> Use variable prefix to get the root variable. > > Load normal.mod > > As you can see, it first create prefix, then split it to find root. At > the end of grub_set_root_dev, prefix and root will point to the same > device. This also make it different to change the root setting in > findroot, which is run in modules initialization stage. We must split > prefix to find the root directory, and use the new root to form a new > prefix. The prefix would later be split again to find root, what a > mess. > > The new method: > > machine_machine_init -> calculate root device, then set root variable directly. > > Load variable in the environment block > > modules initialization > > findroot > > more modules initialization > > grub_set_root_dev -> Use variable root to get the root prefix. > > Load normal.mod > > The end result would be the same, but the new method is cleaner, and > allows overwrite of the root and rdir variable using environment block > and findroot. I think the method is sound; what I'm complaining about (and it's not something specific to your patch) is that we're referring to two different things by the same name ("root"), and even put them in the same variable. In the initialization phase, "root" is the device that contains our GRUB directory. Afterwards, "root" is the device we're currently accessing (be it for loading fonts, backgrounds, Linux images, whatever). If "root" means "just a placeholder for whatever device we're acessing at the moment", then it would make sense, but in our code (i.e. in the names we're giving to commands and functions) it's assumed to mean "the device containing /boot/grub". So what do we want to do with this? Should we have different variables for each thing (and in that case, is "root" for initial stage or for grub.cfg) or should we use "root" as a placeholder for any path reference, and adjust our function names etc to reflect that? -- Robert Millan I know my rights; I want my phone call! What good is a phone call… if you are unable to speak? (as seen on /.)