* disk/ieee1275/ofdisk.c (compute_dev_path): New.

(grub_ofdisk_open): Use it to un-escape "," characters.
	* kern/disk.c (find_part_sep): New.
	(grub_disk_open): Use it to find the first non-escaped ','
	character in the disk name.
	* util/ieee1275/devicemap.c (escape_of_path): New.
	(grub_util_emit_devicemap_entry): Use it.
	* util/sparc64/ieee1275/grub-install.in: Update script to
	strip partition specifiers properly by not triggering on
	'\' escaped ',' characters.
This commit is contained in:
davem 2009-05-04 23:13:53 +00:00
parent 9554b15eac
commit 67e23c9004
6 changed files with 130 additions and 14 deletions

View file

@ -215,10 +215,28 @@ grub_disk_dev_iterate (int (*hook) (const char *name))
return 0;
}
/* Return the location of the first ',', if any, which is not
escaped by a '\'. */
static const char *
find_part_sep (const char *name)
{
const char *p = name;
char c;
while ((c = *p++) != '\0')
{
if (c == '\\' && *p == ',')
p++;
else if (c == ',')
return p - 1;
}
return NULL;
}
grub_disk_t
grub_disk_open (const char *name)
{
char *p;
const char *p;
grub_disk_t disk;
grub_disk_dev_t dev;
char *raw = (char *) name;
@ -238,7 +256,7 @@ grub_disk_open (const char *name)
if (! disk->name)
goto fail;
p = grub_strchr (name, ',');
p = find_part_sep (name);
if (p)
{
grub_size_t len = p - name;