Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1K7bSx-0005Uq-BR for mharc-grub-devel@gnu.org; Sat, 14 Jun 2008 15:31:11 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K7bSu-0005Th-83 for grub-devel@gnu.org; Sat, 14 Jun 2008 15:31:08 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K7bSt-0005TA-8x for grub-devel@gnu.org; Sat, 14 Jun 2008 15:31:07 -0400 Received: from [199.232.76.173] (port=33889 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K7bSs-0005T2-WB for grub-devel@gnu.org; Sat, 14 Jun 2008 15:31:07 -0400 Received: from aybabtu.com ([69.60.117.155]:52002) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1K7bSs-0000dY-B1 for grub-devel@gnu.org; Sat, 14 Jun 2008 15:31:06 -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 1K7bQp-0001LB-Ke for grub-devel@gnu.org; Sat, 14 Jun 2008 21:29:02 +0200 Received: from rmh by thorin with local (Exim 4.63) (envelope-from ) id 1K7bSG-0000MR-5K for grub-devel@gnu.org; Sat, 14 Jun 2008 21:30:28 +0200 Date: Sat, 14 Jun 2008 21:30:28 +0200 From: Robert Millan To: The development of GRUB 2 Message-ID: <20080614193028.GB840@thorin> References: 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] Save/Load environment variable support 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, 14 Jun 2008 19:31:08 -0000 On Fri, Jun 13, 2008 at 03:07:54PM +0800, Bean wrote: > # Misc. > -pkglib_MODULES += gzio.mod elf.mod > +pkglib_MODULES += gzio.mod elf.mod findroot.mod > > [...] > +# For findroot.mod. > +findroot_mod_SOURCES = kern/findroot.c > +findroot_mod_CFLAGS = $(COMMON_CFLAGS) > +findroot_mod_LDFLAGS = $(COMMON_LDFLAGS) Some findroot bits were mixed up in the patch. > +/* Names of important environment variables. */ > +#define GRUB_ENVBLK_RDIR "rdir" > +#define GRUB_ENVBLK_UUID "uuid" > +#define GRUB_ENVBLK_LABEL "label" > +#define GRUB_ENVBLK_IDFILE "idfile" I'd prefer if the envblk part was agnostic about which variables have a meaning. > +++ b/util/envblk.c > @@ -0,0 +1,171 @@ > +/* envblk.c - Common function for environment block. */ > [...] > + > +#ifdef GRUB_UTIL Files that are meant to be used both by grub and util are usually put in the non-util dir (I'm not sure which non-util dir would fit, though, as it depends on what you want to do next). > +#include > + > +#define grub_strlen strlen > +#define grub_strcpy strcpy > +#define grub_strchr strchr > +#define grub_memcmp memcmp > +#define grub_memcpy memcpy Uhm can we avoid this? The rest of non-util code just calls the grub_* functions (linking with kern/misc.c in this case). > +grub_envblk_t > +grub_envblk_find (char *buf) > +{ > + grub_uint32_t *pd; > + int len; > + > + pd = (grub_uint32_t *) buf; > + > + for (len = GRUB_ENVBLK_MAXLEN - 6; len > 0; len -= 4, pd++) > + if (*pd == GRUB_ENVBLK_SIGNATURE) I wonder if this would be dangerous when run on files where env block presence is optional, like core.img (though we can always think about this later when that option is added). -- 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 /.)