Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1K7sup-0000su-8D for mharc-grub-devel@gnu.org; Sun, 15 Jun 2008 10:09:07 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K7suo-0000sp-88 for grub-devel@gnu.org; Sun, 15 Jun 2008 10:09:06 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K7sun-0000sd-8j for grub-devel@gnu.org; Sun, 15 Jun 2008 10:09:05 -0400 Received: from [199.232.76.173] (port=38117 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K7sun-0000sa-6I for grub-devel@gnu.org; Sun, 15 Jun 2008 10:09:05 -0400 Received: from po-out-1718.google.com ([72.14.252.155]:45759) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K7sum-0004rX-Mo for grub-devel@gnu.org; Sun, 15 Jun 2008 10:09:04 -0400 Received: by po-out-1718.google.com with SMTP id c31so9300345poi.1 for ; Sun, 15 Jun 2008 07:09:03 -0700 (PDT) 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:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=iTR0djZNkmlJX/lSJzk6+QUBZQIFCGgiq5spUD7rKV0=; b=URY/N450OGKLPkqZVihwxYCZGpFgzj7O8Xf8oQfQnCmQHV0zeZ+YAF/vN90Kp1r2eF 7JkKd2Nk8bRrdsS4lGP9INSx9HjlmzqMZVqJynbQLW7AjmgxZnAwrMkRER1HLeKocCZe A7G0hLd0CosdHWA00WDiH9IUQxy+kSln/sayw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=UAIu0VvC8/egaC+9hW2hOMf5MmyaKioh+Bw++W1V/k3qW0WEQYO92mwadXl+G3bDcP mIQb7yERsvRXy0Nxgm5uinJw269J/qmeP5gSv3ChmUEjeKjIw2jD5ijTshfAA0msrvZs Dt/B/N9NBdybUOtlbQgr9dTyMzOEHAwQBgHUQ= Received: by 10.110.41.17 with SMTP id o17mr3466673tio.18.1213538943084; Sun, 15 Jun 2008 07:09:03 -0700 (PDT) Received: by 10.110.16.5 with HTTP; Sun, 15 Jun 2008 07:09:02 -0700 (PDT) Message-ID: Date: Sun, 15 Jun 2008 22:09:02 +0800 From: Bean To: "The development of GRUB 2" In-Reply-To: <20080615132552.GA17222@thorin> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20080614193028.GB840@thorin> <20080615132552.GA17222@thorin> X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) 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: Sun, 15 Jun 2008 14:09:06 -0000 On Sun, Jun 15, 2008 at 9:25 PM, Robert Millan wrote: > On Sun, Jun 15, 2008 at 03:44:56AM +0800, Bean wrote: >> >> +#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). >> >> I fount out that if I use grub_*, I end up adding quite a few of extra >> modules that serve no purpose other than string manipulation. Perhaps >> we should separate those routines from kern/misc.c ? > > Which modules? If these functions are part of kernel, they shouldn't be > dragging modules in, AFAICT. Oh, I actually means the files, in kern/misc.c, there is reference to other function, which requires other unrelated files to be included. > >> >> + 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). >> >> Yes, perhaps we should store a pointer to environment block so that we >> don't need to scan for it. > > If the env block could have variable length (in core.img, not the filesystem > one), then maybe a zero-length block could be embedded unconditionaly. It can have zero length. The len variable is used to count the distant to the end of buffer. -- Bean