On 2010-07-29 11:36 AM, Lennart Sorensen wrote:

I removed the nvalias's and got:

0>  boot /p...@800000020000200/pci1014,0...@1/sas/d...@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

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

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to