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.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-01-12 11:26:28 +01:00
parent 51fa856c58
commit b44a558c9a
2 changed files with 31 additions and 10 deletions

View file

@ -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> 2011-01-11 Colin Watson <cjwatson@ubuntu.com>
* configure.ac: Fall back to `true' if `makeinfo' does not exist. * configure.ac: Fall back to `true' if `makeinfo' does not exist.

View file

@ -62,11 +62,10 @@ ofdisk_hash_find (const char *devpath)
} }
static struct ofdisk_hash_ent * 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 **head = &ofdisk_hash[ofdisk_hash_fn(devpath)];
struct ofdisk_hash_ent *p, *pcan;
char *curcan;
p = grub_malloc(sizeof (*p)); p = grub_malloc(sizeof (*p));
if (!p) if (!p)
@ -76,17 +75,27 @@ ofdisk_hash_add (char *devpath)
p->next = *head; p->next = *head;
p->shortest = 0; p->shortest = 0;
*head = p; *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) if (!curcan)
{ {
grub_errno = GRUB_ERR_NONE; p->shortest = devpath;
return p; return p;
} }
pcan = ofdisk_hash_find (curcan); pcan = ofdisk_hash_find (curcan);
if (!pcan) if (!pcan)
pcan = ofdisk_hash_add (curcan); pcan = ofdisk_hash_add_real (curcan);
else else
grub_free (curcan); grub_free (curcan);
@ -118,17 +127,22 @@ scan (void)
return 0; return 0;
grub_dprintf ("disk", "disk name = %s\n", alias->name); 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) if (!op)
{ {
char *name = grub_strdup (alias->name); char *name = grub_strdup (alias->name);
if (!name) char *can = grub_strdup (alias->path);
if (!name || !can)
{ {
grub_errno = GRUB_ERR_NONE; grub_errno = GRUB_ERR_NONE;
grub_free (name);
grub_free (can);
return 0; return 0;
} }
op = ofdisk_hash_add (name); op = ofdisk_hash_add (name, can);
} }
return 0; return 0;
} }
@ -247,7 +261,7 @@ grub_ofdisk_open (const char *name, grub_disk_t disk)
struct ofdisk_hash_ent *op; struct ofdisk_hash_ent *op;
op = ofdisk_hash_find (devpath); op = ofdisk_hash_find (devpath);
if (!op) if (!op)
op = ofdisk_hash_add (devpath); op = ofdisk_hash_add (devpath, NULL);
else else
grub_free (devpath); grub_free (devpath);
if (!op) if (!op)