]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Make nand a prefix for nand devices.
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sun, 26 Feb 2012 22:59:00 +0000 (23:59 +0100)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sun, 26 Feb 2012 22:59:00 +0000 (23:59 +0100)
* grub-core/disk/ieee1275/nand.c (grub_nand_open): Use prefix nand.

ChangeLog
docs/grub.texi
grub-core/disk/ieee1275/nand.c

index 4edcc69e295c4114e2623520ab4909545a056ea4..551fb879af0694dd5d6fef9fbdaf379eb76a2568 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-02-26  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       Make nand a prefix for nand devices.
+
+       * grub-core/disk/ieee1275/nand.c (grub_nand_open): Use prefix nand.
+
 2012-02-26  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * grub-core/kern/misc.c (grub_stpcpy): Move from here ...
index d6fc1186c35064d6982dae554b52ca0dc756ad79..2dafec3dbc8217f75bee1cfb2628ff3cc180d559 100644 (file)
@@ -2250,9 +2250,11 @@ by a digit, like @samp{fd0}, or @samp{cd}.
 AHCI, PATA (ata), crypto, USB use the name of driver followed by a number.
 Memdisk and host are limited to one disk and so it's refered just by driver
 name.
-RAID (md), ofdisk (ieee1275), LVM (lv) and arcdisk (arc) use intrinsic name
-of disk prefixed by driver name. Conflicts are solved by suffixing a number
-if necessarry. Commas need to be escaped.
+RAID (md), ofdisk (ieee1275 and nand), LVM (lv) and arcdisk (arc) use
+intrinsic name of disk prefixed by driver name. Additionally just ``nand''
+refers to the disk aliased as ``nand''.
+Conflicts are solved by suffixing a number if necessarry.
+Commas need to be escaped.
 Loopback uses whatever name specified to @command{loopback} command.
 Hostdisk uses names specified in device.map or hostdisk/<OS NAME>.
 For crypto and RAID (md) additionally you can use the syntax
@@ -2273,6 +2275,7 @@ For crypto and RAID (md) additionally you can use the syntax
 (md/0)
 (ieee1275/disk2)
 (ieee1275//pci@@1f\,0/ide@@d/disk@@2)
+(nand)
 (memdisk)
 (host)
 (myloop)
index 7e24cfbd9f95f83c430f40fbbab93b812220d9bd..ad30852ec932993ee0d2f120435d4eb86dc78249 100644 (file)
@@ -38,15 +38,15 @@ grub_nand_iterate (int (*hook) (const char *name),
 {
   auto int dev_iterate (struct grub_ieee1275_devalias *alias);
   int dev_iterate (struct grub_ieee1275_devalias *alias)
-    {
-      if (! grub_strcmp (alias->name, "nand"))
-        {
-          hook (alias->name);
-          return 1;
-        }
-
-      return 0;
-    }
+  {
+    if (grub_strcmp (alias->name, "nand") == 0)
+      {
+       hook (alias->name);
+       return 1;
+      }
+    
+    return 0;
+  }
 
   if (pull != GRUB_DISK_PULL_NONE)
     return 0;
@@ -63,6 +63,7 @@ grub_nand_open (const char *name, grub_disk_t disk)
 {
   grub_ieee1275_ihandle_t dev_ihandle = 0;
   struct grub_nand_data *data = 0;
+  const char *devname;
   struct size_args
     {
       struct grub_ieee1275_common_hdr common;
@@ -73,14 +74,18 @@ grub_nand_open (const char *name, grub_disk_t disk)
       grub_ieee1275_cell_t size2;
     } args;
 
-  if (! grub_strstr (name, "nand"))
-    return  grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a NAND device");
+  if (grub_memcmp (name, "nand/", sizeof ("nand/") - 1) == 0)
+    devname = name + sizeof ("nand/") - 1;
+  else if (grub_strcmp (name, "nand") == 0)
+    devname = name;
+  else
+    return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a NAND device");
 
   data = grub_malloc (sizeof (*data));
   if (! data)
     goto fail;
 
-  grub_ieee1275_open (name, &dev_ihandle);
+  grub_ieee1275_open (devname, &dev_ihandle);
   if (! dev_ihandle)
     {
       grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't open device");