]> git.proxmox.com Git - grub2.git/commitdiff
Use alias->path rather than buggy "canon".
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Wed, 12 Jan 2011 10:26:28 +0000 (11:26 +0100)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Wed, 12 Jan 2011 10:26:28 +0000 (11:26 +0100)
* grub-core/disk/ieee1275/ofdisk.c (ofdisk_hash_add_real): New function.
(ofdisk_hash_add): New argument curcan. All users updated.

ChangeLog
grub-core/disk/ieee1275/ofdisk.c

index e14a339685b0c543743b571d40a7cb4dd165a683..9588504212f6b1971482633494f470d582791e68 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-01-12  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       Use alias->path rather than buggy "canon".
+
+       * grub-core/disk/ieee1275/ofdisk.c (ofdisk_hash_add_real): New function.
+       (ofdisk_hash_add): New argument curcan. All users updated.
+
 2011-01-11  Colin Watson  <cjwatson@ubuntu.com>
 
        * configure.ac: Fall back to `true' if `makeinfo' does not exist.
index 85c34609e8afa331ad46b5544b7b778e89d53521..0a935d5c2b8e5db3d955e28988b63c2a38cab3d3 100644 (file)
@@ -62,11 +62,10 @@ ofdisk_hash_find (const char *devpath)
 }
 
 static struct ofdisk_hash_ent *
-ofdisk_hash_add (char *devpath)
+ofdisk_hash_add_real (char *devpath)
 {
+  struct ofdisk_hash_ent *p;
   struct ofdisk_hash_ent **head = &ofdisk_hash[ofdisk_hash_fn(devpath)];
-  struct ofdisk_hash_ent *p, *pcan;
-  char *curcan;
 
   p = grub_malloc(sizeof (*p));
   if (!p)
@@ -76,17 +75,27 @@ ofdisk_hash_add (char *devpath)
   p->next = *head;
   p->shortest = 0;
   *head = p;
+  return p;
+}
+
+static struct ofdisk_hash_ent *
+ofdisk_hash_add (char *devpath, char *curcan)
+{
+  struct ofdisk_hash_ent *p, *pcan;
+
+  p = ofdisk_hash_add_real (devpath);
+
+  grub_dprintf ("disk", "devpath = %s, canonical = %s\n", devpath, curcan);
 
-  curcan = grub_ieee1275_canonicalise_devname (devpath);
   if (!curcan)
     {
-      grub_errno = GRUB_ERR_NONE;
+      p->shortest = devpath;
       return p;
     }
 
   pcan = ofdisk_hash_find (curcan);
   if (!pcan)
-    pcan = ofdisk_hash_add (curcan);
+    pcan = ofdisk_hash_add_real (curcan);
   else
     grub_free (curcan);
 
@@ -118,17 +127,22 @@ scan (void)
        return 0;
 
       grub_dprintf ("disk", "disk name = %s\n", alias->name);
+      grub_dprintf ("disk", "disk name = %s, path = %s\n", alias->name,
+                   alias->path);
 
-      op = ofdisk_hash_find (alias->path);
+      op = ofdisk_hash_find (alias->name);
       if (!op)
        {
          char *name = grub_strdup (alias->name);
-         if (!name)
+         char *can = grub_strdup (alias->path);
+         if (!name || !can)
            {
              grub_errno = GRUB_ERR_NONE;
+             grub_free (name);
+             grub_free (can);
              return 0;
            }
-         op = ofdisk_hash_add (name);
+         op = ofdisk_hash_add (name, can);
        }
       return 0;
     }
@@ -247,7 +261,7 @@ grub_ofdisk_open (const char *name, grub_disk_t disk)
     struct ofdisk_hash_ent *op;
     op = ofdisk_hash_find (devpath);
     if (!op)
-      op = ofdisk_hash_add (devpath);
+      op = ofdisk_hash_add (devpath, NULL);
     else
       grub_free (devpath);
     if (!op)