diff --git a/ChangeLog b/ChangeLog index 4edcc69e2..551fb879a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2012-02-26 Vladimir Serbinenko + + Make nand a prefix for nand devices. + + * grub-core/disk/ieee1275/nand.c (grub_nand_open): Use prefix nand. + 2012-02-26 Vladimir Serbinenko * grub-core/kern/misc.c (grub_stpcpy): Move from here ... diff --git a/docs/grub.texi b/docs/grub.texi index d6fc1186c..2dafec3db 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -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/. 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) diff --git a/grub-core/disk/ieee1275/nand.c b/grub-core/disk/ieee1275/nand.c index 7e24cfbd9..ad30852ec 100644 --- a/grub-core/disk/ieee1275/nand.c +++ b/grub-core/disk/ieee1275/nand.c @@ -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");