/* Get the device path of the Open Firmware node name `path'. */ static char * grub_ieee1275_get_devname (const char *path) { char *colon = grub_strchr (path, ':'); char *newpath = 0; int pathlen = grub_strlen (path); auto int match_alias (struct grub_ieee1275_devalias *alias); int match_alias (struct grub_ieee1275_devalias *curalias) { /* briQ firmware can change capitalization in /chosen/bootpath. */ if (! grub_strncasecmp (curalias->path, path, pathlen)) { newpath = grub_strdup (curalias->name); return 1; } return 0; } if (colon) pathlen = (int)(colon - path); /* Try to find an alias for this device. */ grub_devalias_iterate (match_alias); if (! newpath) newpath = grub_strndup (path, pathlen); return newpath; }
static int match_alias (struct grub_ieee1275_devalias *curalias, void *closure) { struct grub_ieee1275_get_devname_closure *c = closure; /* briQ firmware can change capitalization in /chosen/bootpath. */ if (! grub_strncasecmp (curalias->path, c->path, c->pathlen)) { c->newpath = grub_strdup (curalias->name); return 1; } return 0; }