Change to disk->name being raw name. It makes less hidden issues
This commit is contained in:
parent
f256469360
commit
43de930c20
5 changed files with 27 additions and 20 deletions
|
@ -805,10 +805,11 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle)
|
|||
return 0;
|
||||
}
|
||||
|
||||
device_name = grub_xasprintf ("%s,%s%d", parent->name,
|
||||
tpart->partmap->name,
|
||||
tpart->number + 1);
|
||||
{
|
||||
char *partition_name = grub_partition_get_name (tpart);
|
||||
device_name = grub_xasprintf ("%s,%s", parent->name, partition_name);
|
||||
grub_free (partition_name);
|
||||
}
|
||||
grub_disk_close (parent);
|
||||
|
||||
return device_name;
|
||||
|
|
|
@ -136,7 +136,7 @@ grub_device_iterate (int (*hook) (const char *name))
|
|||
int iterate_partition (grub_disk_t disk, const grub_partition_t partition)
|
||||
{
|
||||
struct part_ent *p;
|
||||
|
||||
char *part_name;
|
||||
|
||||
p = grub_malloc (sizeof (*p));
|
||||
if (!p)
|
||||
|
@ -144,8 +144,14 @@ grub_device_iterate (int (*hook) (const char *name))
|
|||
return 1;
|
||||
}
|
||||
|
||||
p->name = grub_xasprintf ("%s,%s%d", disk->name, partition->partmap->name,
|
||||
partition->number + 1);
|
||||
part_name = grub_partition_get_name (partition);
|
||||
if (!part_name)
|
||||
{
|
||||
grub_free (p);
|
||||
return 1;
|
||||
}
|
||||
p->name = grub_xasprintf ("%s,%s", disk->name, part_name);
|
||||
grub_free (part_name);
|
||||
if (!p->name)
|
||||
{
|
||||
grub_free (p);
|
||||
|
|
|
@ -248,10 +248,6 @@ grub_disk_open (const char *name)
|
|||
if (! disk)
|
||||
return 0;
|
||||
|
||||
disk->name = grub_strdup (name);
|
||||
if (! disk->name)
|
||||
goto fail;
|
||||
|
||||
p = find_part_sep (name);
|
||||
if (p)
|
||||
{
|
||||
|
@ -263,7 +259,13 @@ grub_disk_open (const char *name)
|
|||
|
||||
grub_memcpy (raw, name, len);
|
||||
raw[len] = '\0';
|
||||
disk->name = grub_strdup (raw);
|
||||
}
|
||||
else
|
||||
disk->name = grub_strdup (name);
|
||||
if (! disk->name)
|
||||
goto fail;
|
||||
|
||||
|
||||
for (dev = grub_disk_dev_list; dev; dev = dev->next)
|
||||
{
|
||||
|
|
|
@ -188,13 +188,7 @@ grub_partition_iterate (struct grub_disk *disk,
|
|||
if (p.start != 0)
|
||||
{
|
||||
const struct grub_partition_map *partmap;
|
||||
const char *name;
|
||||
char *newname;
|
||||
dsk->partition = &p;
|
||||
name = dsk->name;
|
||||
dsk->name = newname = grub_xasprintf ("%s,%s%d", dsk->name,
|
||||
p.partmap->name,
|
||||
p.number + 1);
|
||||
FOR_PARTITION_MAPS(partmap)
|
||||
{
|
||||
grub_err_t err;
|
||||
|
@ -204,8 +198,6 @@ grub_partition_iterate (struct grub_disk *disk,
|
|||
if (ret)
|
||||
break;
|
||||
}
|
||||
grub_free (newname);
|
||||
dsk->name = name;
|
||||
}
|
||||
dsk->partition = p.parent;
|
||||
return ret;
|
||||
|
|
|
@ -102,8 +102,14 @@ iterate_partition (grub_disk_t disk, const grub_partition_t p)
|
|||
const char *disk_name = disk->name;
|
||||
char *name;
|
||||
int ret;
|
||||
char *part_name;
|
||||
|
||||
name = grub_xasprintf ("%s,%s%d", disk_name, p->partmap->name, p->number + 1);
|
||||
part_name = grub_partition_get_name (p);
|
||||
if (! part_name)
|
||||
return 1;
|
||||
|
||||
name = grub_xasprintf ("%s,%s", disk_name, part_name);
|
||||
grub_free (part_name);
|
||||
|
||||
if (! name)
|
||||
return 1;
|
||||
|
|
Loading…
Reference in a new issue