2008-05-30 Pavel Roskin <proski@gnu.org>

* util/biosdisk.c (linux_find_partition): Simplify logic and
	make the code more universal.  Keep special processing for
	devfs, but use a simple rule for all other devices.  If the
	device ends with a number, append 'p' and the partition number.
	Otherwise, append only the partition number.
This commit is contained in:
proski 2008-05-30 21:55:31 +00:00
parent 5786569b41
commit 520ae21bb7
2 changed files with 17 additions and 38 deletions

View file

@ -1,3 +1,11 @@
2008-05-30 Pavel Roskin <proski@gnu.org>
* util/biosdisk.c (linux_find_partition): Simplify logic and
make the code more universal. Keep special processing for
devfs, but use a simple rule for all other devices. If the
device ends with a number, append 'p' and the partition number.
Otherwise, append only the partition number.
2008-05-30 Robert Millan <rmh@aybabtu.com> 2008-05-30 Robert Millan <rmh@aybabtu.com>
* util/update-grub.in (GRUB_DISABLE_LINUX_UUID): Export variable. * util/update-grub.in (GRUB_DISABLE_LINUX_UUID): Export variable.

View file

@ -221,45 +221,16 @@ linux_find_partition (char *dev, unsigned long sector)
p = real_dev + len - 4; p = real_dev + len - 4;
format = "part%d"; format = "part%d";
} }
else if ((strncmp (real_dev + 5, "hd", 2) == 0 else if (real_dev[len - 1] >= '0' && real_dev[len - 1] <= '9')
|| strncmp (real_dev + 5, "vd", 2) == 0
|| strncmp (real_dev + 5, "sd", 2) == 0)
&& real_dev[7] >= 'a' && real_dev[7] <= 'z')
{ {
p = real_dev + sizeof("/dev/hda")-1; p = real_dev + len;
format = "%d";
}
else if (strncmp (real_dev + 5, "rd/c", 4) == 0) /* dac960 */
{
p = strchr (real_dev + 9, 'd');
if (! p)
return 0;
p++;
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 if (strncmp (real_dev + 5, "mmcblk", sizeof("mmcblk")-1) == 0)
{
p = real_dev + sizeof("/dev/mmcblk0")-1;
format = "p%d"; format = "p%d";
} }
else else
return 0; {
p = real_dev + len;
format = "%d";
}
for (i = 1; i < 10000; i++) for (i = 1; i < 10000; i++)
{ {