diff --git a/ChangeLog b/ChangeLog index 8dfa07b21..7570f79b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-05-07 Robert Millan + + * util/biosdisk.c (linux_find_partition, get_os_disk): Handle CCISS + devices. + * util/grub-mkdevicemap.c (get_cciss_disk_name) + (make_device_map): Likewise. + Reported by Roland Dreier + 2008-05-07 Robert Millan * disk/lvm.c (grub_lvm_scan_device): Detect errors in an additional diff --git a/util/biosdisk.c b/util/biosdisk.c index e6e7f51ed..3b8b9e089 100644 --- a/util/biosdisk.c +++ b/util/biosdisk.c @@ -233,7 +233,7 @@ linux_find_partition (char *dev, unsigned long sector) p = real_dev + 8; format = "%d"; } - else if (strncmp (real_dev + 5, "rd/c", 4) == 0) + else if (strncmp (real_dev + 5, "rd/c", 4) == 0) /* dac960 */ { p = strchr (real_dev + 9, 'd'); if (! p) @@ -243,6 +243,18 @@ linux_find_partition (char *dev, unsigned long sector) while (*p && isdigit (*p)) p++; + format = "p%d"; + } + else if (strncmp (real_dev + 5, "cciss/c", sizeof("cciss/c")-1) == 0) + { + p = strchr (real_dev + 5 + sizeof("cciss/c")-1, 'd'); + if (! p) + return 0; + + p++; + while (*p && isdigit (*p)) + p++; + format = "p%d"; } else @@ -645,6 +657,17 @@ get_os_disk (const char *os_dev) return path; } + /* If this is a CCISS disk. */ + if (strncmp ("cciss/c", p, sizeof ("cciss/c") - 1) == 0) + { + /* /dev/cciss/c[0-9]+d[0-9]+(p[0-9]+)? */ + p = strchr (p, 'p'); + if (p) + *p = '\0'; + + return path; + } + /* If this is an IDE disk or a SCSI disk. */ if ((strncmp ("hd", p, 2) == 0 || strncmp ("sd", p, 2) == 0) diff --git a/util/grub-mkdevicemap.c b/util/grub-mkdevicemap.c index 174215efb..12729812a 100644 --- a/util/grub-mkdevicemap.c +++ b/util/grub-mkdevicemap.c @@ -283,6 +283,12 @@ get_i2o_disk_name (char *name, char unit) { sprintf (name, "/dev/i2o/hd%c", unit); } + +static void +get_cciss_disk_name (char *name, int controller, int drive) +{ + sprintf (name, "/dev/cciss/c%dd%d", controller, drive); +} #endif /* Check if DEVICE can be read. If an error occurs, return zero, @@ -504,6 +510,30 @@ make_device_map (const char *device_map, int floppy_disks) } } + /* This is for CCISS - we have + /dev/cciss/cdp. */ + { + int controller, drive; + + for (controller = 0; controller < 3; controller++) + { + for (drive = 0; drive < 10; drive++) + { + char name[24]; + + get_cciss_disk_name (name, controller, drive); + if (check_device (name)) + { + char *p; + p = grub_util_get_disk_name (num_hd, name); + fprintf (fp, "(%s)\t%s\n", p, name); + free (p); + num_hd++; + } + } + } + } + /* This is for I2O - we have /dev/i2o/hd */ { char unit;