2008-05-07 Robert Millan <rmh@aybabtu.com>

* 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 <rdreier@cisco.com>
This commit is contained in:
robertmh 2008-05-07 20:28:26 +00:00
parent 7f8866edc1
commit b56c4eaa3f
3 changed files with 62 additions and 1 deletions

View file

@ -1,3 +1,11 @@
2008-05-07 Robert Millan <rmh@aybabtu.com>
* 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 <rdreier@cisco.com>
2008-05-07 Robert Millan <rmh@aybabtu.com>
* disk/lvm.c (grub_lvm_scan_device): Detect errors in an additional

View file

@ -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)

View file

@ -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/c<controller>d<logical drive>p<partition>. */
{
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<logical drive><partition> */
{
char unit;