Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1OeX2a-0001Mo-HO for mharc-grub-devel@gnu.org; Thu, 29 Jul 2010 13:37:08 -0400 Received: from [140.186.70.92] (port=54567 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OeX2X-0001Kb-Al for grub-devel@gnu.org; Thu, 29 Jul 2010 13:37:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OeX2V-0005pq-PX for grub-devel@gnu.org; Thu, 29 Jul 2010 13:37:05 -0400 Received: from caffeine.csclub.uwaterloo.ca ([129.97.134.17]:42574) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OeX2V-0005pj-LK for grub-devel@gnu.org; Thu, 29 Jul 2010 13:37:03 -0400 Received: from caffeine.csclub.uwaterloo.ca (localhost [127.0.0.1]) by caffeine.csclub.uwaterloo.ca (Postfix) with ESMTP id DF946CE9D; Thu, 29 Jul 2010 13:37:02 -0400 (EDT) Received: by caffeine.csclub.uwaterloo.ca (Postfix, from userid 20367) id D2FF4CE9F; Thu, 29 Jul 2010 13:37:02 -0400 (EDT) Date: Thu, 29 Jul 2010 13:37:02 -0400 To: The development of GNU GRUB Message-ID: <20100729173702.GS2632@caffeine.csclub.uwaterloo.ca> References: <4C511DF0.3080306@gmail.com> <20100729153641.GO2632@caffeine.csclub.uwaterloo.ca> <4C51B57F.4020405@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4C51B57F.4020405@gmail.com> User-Agent: Mutt/1.5.18 (2008-05-17) From: lsorense@csclub.uwaterloo.ca (Lennart Sorensen) X-Virus-Scanned: ClamAV using ClamSMTP X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: Lennart Sorensen Subject: Re: Fallback to scanning OF tree if no devaliases X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jul 2010 17:37:07 -0000 On Thu, Jul 29, 2010 at 01:08:15PM -0400, Doug Nazar wrote: > On 2010-07-29 11:36 AM, Lennart Sorensen wrote: >> >> I removed the nvalias's and got: >> >> 0> boot /pci@800000020000200/pci1014,02BD@1/sas/disk@20000 | > > Can you add this on top? Grub already has support to escape the commas. > Just needed to actually do it. I can't really test it here but it didn't > break anything. > > I'll let you guys decide if we should actually do this or not although > I'm of the philosophy of "it should just work, damn it". :-) I will try to test it soon, but I just put the machine into production use, so rebooting a lot won't be popular. I will try to test it in the evening. Unfortunately I am going on vacation for a week, so it probably won't be until after that. Thanks for trying to fix it though. -- Len Sorensen > === modified file 'disk/ieee1275/ofdisk.c' > --- disk/ieee1275/ofdisk.c 2010-07-29 06:04:55 +0000 > +++ disk/ieee1275/ofdisk.c 2010-07-29 17:00:01 +0000 > @@ -72,6 +72,39 @@ > return p; > } > > +static char * > +escape_of_path (const char *orig_path) > +{ > + char *new_path, *d, c; > + const char *p; > + int i; > + > + if (!grub_strchr (orig_path, ',')) > + return (char *) orig_path; > + > + new_path = grub_malloc (grub_strlen (orig_path) + 32); > + > + p = orig_path; > + d = new_path; > + i = 0; > + while ((c = *p++) != '\0') > + { > + if (c == ',') > + { > + if (++i == 32) > + { > + /* oops, too many commas */ > + break; > + } > + *d++ = '\\'; > + } > + *d++ = c; > + } > + > + return new_path; > +} > + > + > static int > grub_ofdisk_iterate (int (*hook) (const char *name)) > { > @@ -114,8 +147,11 @@ > if (! grub_strcmp (alias->type, "block") && > grub_strncmp (alias->name, "cdrom", 5)) > { > + char *name_path = use_path ? escape_of_path(alias->path) : alias->name; > disks_found++; > - ret = hook (use_path ? alias->path : alias->name); > + ret = hook (name_path); > + if (use_path && name_path != alias->path) > + grub_free(name_path); > } > return ret; > } >