All of lore.kernel.org
 help / color / mirror / Atom feed
From: Doug Nazar <nazard.michi@gmail.com>
To: Lennart Sorensen <lsorense@csclub.uwaterloo.ca>
Cc: grub-devel@gnu.org
Subject: Re: Fallback to scanning OF tree if no devaliases
Date: Thu, 29 Jul 2010 13:08:15 -0400	[thread overview]
Message-ID: <4C51B57F.4020405@gmail.com> (raw)
In-Reply-To: <20100729153641.GO2632@caffeine.csclub.uwaterloo.ca>

[-- Attachment #1: Type: text/plain, Size: 458 bytes --]

  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


[-- Attachment #2: grub-escape-of-path.diff --]
[-- Type: text/plain, Size: 1178 bytes --]

=== 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;
     }


  parent reply	other threads:[~2010-07-29 17:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-29  6:21 Fallback to scanning OF tree if no devaliases Doug Nazar
2010-07-29 15:36 ` Lennart Sorensen
2010-07-29 15:57   ` Doug Nazar
2010-07-29 16:52     ` David Miller
2010-07-29 16:59       ` Lennart Sorensen
2010-07-29 17:28         ` David Miller
2010-07-29 16:57     ` Lennart Sorensen
2010-07-29 17:08   ` Doug Nazar [this message]
2010-07-29 17:37     ` Lennart Sorensen
2010-07-29 19:11       ` Doug Nazar
2010-08-01 14:48 ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-08-09 15:41   ` Lennart Sorensen
2010-08-09 16:09     ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-08-09 17:01       ` Lennart Sorensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C51B57F.4020405@gmail.com \
    --to=nazard.michi@gmail.com \
    --cc=grub-devel@gnu.org \
    --cc=lsorense@csclub.uwaterloo.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.