grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fallback to scanning OF tree if no devaliases


From: Lennart Sorensen
Subject: Re: Fallback to scanning OF tree if no devaliases
Date: Thu, 29 Jul 2010 13:37:02 -0400
User-agent: Mutt/1.5.18 (2008-05-17)

On Thu, Jul 29, 2010 at 01:08:15PM -0400, Doug Nazar wrote:
>  On 2010-07-29 11:36 AM, Lennart Sorensen wrote:
>>
>> I removed the nvalias's and got:
>>
>> 0>  boot /address@hidden/pci1014,address@hidden/sas/address@hidden |
>
> 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". :-)

I will try to test it soon, but I just put the machine into production
use, so rebooting a lot won't be popular.  I will try to test it in
the evening.  Unfortunately I am going on vacation for a week, so it
probably won't be until after that.

Thanks for trying to fix it though.

-- 
Len Sorensen

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]