All of lore.kernel.org
 help / color / mirror / Atom feed
* Fallback to scanning OF tree if no devaliases
@ 2010-07-29  6:21 Doug Nazar
  2010-07-29 15:36 ` Lennart Sorensen
  2010-08-01 14:48 ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 2 replies; 14+ messages in thread
From: Doug Nazar @ 2010-07-29  6:21 UTC (permalink / raw)
  To: grub-devel, Lennart Sorensen

[-- Attachment #1: Type: text/plain, Size: 741 bytes --]

  Lennart, try giving this patch a whirl. In the case after we scan the 
aliases list and we haven't found any block devices it will now try to 
scan the entire tree. It kinda worked under OpenBios although I ran into 
another bug where it can't open a device path that it gave me for the 
pci ide controller. It found the other 2 drives fine.

I think this maintains the correct balance of using short pretty names 
if available but working if they are not available.

There is a case where it will mess up however. If you only specify an 
alias for one device but need another device to build a raid or lvm it 
will fail. Although, thinking about it, this already would happen.

As always, you can specify the either path manually.

Doug


[-- Attachment #2: grub-fallback-to-scanning-of-tree.diff --]
[-- Type: text/plain, Size: 922 bytes --]

=== modified file 'disk/ieee1275/ofdisk.c'
--- disk/ieee1275/ofdisk.c	2010-07-29 03:58:16 +0000
+++ disk/ieee1275/ofdisk.c	2010-07-29 06:02:06 +0000
@@ -76,6 +76,9 @@
 grub_ofdisk_iterate (int (*hook) (const char *name))
 {
   auto int dev_iterate (struct grub_ieee1275_devalias *alias);
+  int disks_found = 0;
+  int use_path = 0;
+  int result;
 
   int dev_iterate (struct grub_ieee1275_devalias *alias)
     {
@@ -110,11 +113,20 @@
 
       if (! grub_strcmp (alias->type, "block") &&
 	  grub_strncmp (alias->name, "cdrom", 5))
-	ret = hook (alias->name);
+      {
+	disks_found++;
+	ret = hook (use_path ? alias->path : alias->name);
+      }
       return ret;
     }
 
-  return grub_devalias_iterate (dev_iterate);
+  result = grub_devalias_iterate (dev_iterate);
+  if (!disks_found)
+  {
+    use_path = 1;
+    result = grub_ieee1275_devices_iterate (dev_iterate);
+  }
+  return result;
 }
 
 static char *


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2010-08-09 17:01 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-29  6:21 Fallback to scanning OF tree if no devaliases Doug Nazar
2010-07-29 15:36 ` Lennart Sorensen
2010-07-29 15:57   ` Doug Nazar
2010-07-29 16:52     ` David Miller
2010-07-29 16:59       ` Lennart Sorensen
2010-07-29 17:28         ` David Miller
2010-07-29 16:57     ` Lennart Sorensen
2010-07-29 17:08   ` Doug Nazar
2010-07-29 17:37     ` Lennart Sorensen
2010-07-29 19:11       ` Doug Nazar
2010-08-01 14:48 ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-08-09 15:41   ` Lennart Sorensen
2010-08-09 16:09     ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-08-09 17:01       ` Lennart Sorensen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.