From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1OeWav-0007La-4N for mharc-grub-devel@gnu.org; Thu, 29 Jul 2010 13:08:33 -0400 Received: from [140.186.70.92] (port=55868 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OeWaq-0007KY-Ec for grub-devel@gnu.org; Thu, 29 Jul 2010 13:08:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OeWag-0000TR-Cz for grub-devel@gnu.org; Thu, 29 Jul 2010 13:08:19 -0400 Received: from mail-gw0-f41.google.com ([74.125.83.41]:47798) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OeWag-0000TE-8T for grub-devel@gnu.org; Thu, 29 Jul 2010 13:08:18 -0400 Received: by gwj16 with SMTP id 16so281088gwj.0 for ; Thu, 29 Jul 2010 10:08:17 -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 :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type; bh=M0Bm7gjxUfBEYM2X/0hS/FRhkN+/5D8LrOq76/v/l3A=; b=FTrQRJdblzFy+2+zCobJdbMdWI8Oa+ZGVEIVjXcQ2TXJM8gXnQ8jpJegX9z7qrsqdN /krWoisJCIHEgZe8o8YQ5Vch9lDcDsu8kknDKxp36N6oMkmsT/L9znjKCnDZgcEr2Eks wcHZc8iD6A1nBciGzklCn7UUk/jofw1X47X8I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type; b=lvHT8/4QWuhNkNC8L2UELa2O6v1CjsBqmAo7Vvo4TUOP62QNcgXQjmVZ/j66xreUly hDMUjbhwbzgsyfsqHhvqPDiQQFxQflH2lG6JtsV86woVYQ2nC2dDJii6tpBzJ4O9u/Ox OTQwNsDV/fxoMh0EY9DFV36xqYUbeY0pycl2U= Received: by 10.100.86.4 with SMTP id j4mr439051anb.230.1280423297731; Thu, 29 Jul 2010 10:08:17 -0700 (PDT) Received: from [192.168.21.179] (bas1-toronto05-1177663517.dsl.bell.ca [70.49.184.29]) by mx.google.com with ESMTPS id h5sm1837451anb.8.2010.07.29.10.08.16 (version=SSLv3 cipher=RC4-MD5); Thu, 29 Jul 2010 10:08:16 -0700 (PDT) Message-ID: <4C51B57F.4020405@gmail.com> Date: Thu, 29 Jul 2010 13:08:15 -0400 From: Doug Nazar User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.7) Gecko/20100713 Thunderbird/3.1.1 MIME-Version: 1.0 To: Lennart Sorensen References: <4C511DF0.3080306@gmail.com> <20100729153641.GO2632@caffeine.csclub.uwaterloo.ca> In-Reply-To: <20100729153641.GO2632@caffeine.csclub.uwaterloo.ca> Content-Type: multipart/mixed; boundary="------------020700010008080105070901" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: grub-devel@gnu.org 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:08:31 -0000 This is a multi-part message in MIME format. --------------020700010008080105070901 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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". :-) Doug --------------020700010008080105070901 Content-Type: text/plain; name="grub-escape-of-path.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="grub-escape-of-path.diff" === 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; } --------------020700010008080105070901--