* util/getroot.c (grub_util_get_dm_node_linear_info): Fix memory leak.
* grub-core/disk/cryptodisk.c (cryptodisk_cleanup): Disable for now to avoid double free. * grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_dev): Rename to hostdisk. * include/grub/disk.h (grub_disk_dev_id): New id HOSTDISK. * util/grub-probe.c (escape_of_path): Always return a new copy. (print_full_name): Escape path. (probe): Don't call grub_util_devname_to_ofpath on NULL. Fix hints on abstractions.
This commit is contained in:
parent
ebe2c96154
commit
63fe43f3c3
6 changed files with 60 additions and 18 deletions
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
|||
2012-01-29 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* util/getroot.c (grub_util_get_dm_node_linear_info): Fix memory leak.
|
||||
* grub-core/disk/cryptodisk.c (cryptodisk_cleanup): Disable for
|
||||
now to avoid double free.
|
||||
* grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_dev): Rename to
|
||||
hostdisk.
|
||||
* include/grub/disk.h (grub_disk_dev_id): New id HOSTDISK.
|
||||
* util/grub-probe.c (escape_of_path): Always return a new copy.
|
||||
(print_full_name): Escape path.
|
||||
(probe): Don't call grub_util_devname_to_ofpath on NULL.
|
||||
Fix hints on abstractions.
|
||||
|
||||
2012-01-29 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* util/grub-mkconfig_lib.in (prepare_grub_to_access_device):
|
||||
|
|
|
@ -658,6 +658,7 @@ grub_cryptodisk_memberlist (grub_disk_t disk)
|
|||
static void
|
||||
cryptodisk_cleanup (void)
|
||||
{
|
||||
#if 0
|
||||
grub_cryptodisk_t dev = cryptodisk_list;
|
||||
grub_cryptodisk_t tmp;
|
||||
|
||||
|
@ -671,6 +672,7 @@ cryptodisk_cleanup (void)
|
|||
grub_free (dev);
|
||||
dev = tmp;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
|
|
|
@ -1107,8 +1107,8 @@ grub_util_biosdisk_close (struct grub_disk *disk)
|
|||
|
||||
static struct grub_disk_dev grub_util_biosdisk_dev =
|
||||
{
|
||||
.name = "biosdisk",
|
||||
.id = GRUB_DISK_DEVICE_BIOSDISK_ID,
|
||||
.name = "hostdisk",
|
||||
.id = GRUB_DISK_DEVICE_HOSTDISK_ID,
|
||||
.iterate = grub_util_biosdisk_iterate,
|
||||
.open = grub_util_biosdisk_open,
|
||||
.close = grub_util_biosdisk_close,
|
||||
|
|
|
@ -40,6 +40,7 @@ enum grub_disk_dev_id
|
|||
GRUB_DISK_DEVICE_SCSI_ID,
|
||||
GRUB_DISK_DEVICE_CRYPTODISK_ID,
|
||||
GRUB_DISK_DEVICE_ARCDISK_ID,
|
||||
GRUB_DISK_DEVICE_HOSTDISK_ID,
|
||||
};
|
||||
|
||||
struct grub_disk;
|
||||
|
|
|
@ -1246,33 +1246,48 @@ grub_util_get_dm_node_linear_info (const char *dev,
|
|||
return 0;
|
||||
|
||||
if (!dm_task_set_name(dmt, dev))
|
||||
return 0;
|
||||
{
|
||||
dm_task_destroy (dmt);
|
||||
return 0;
|
||||
}
|
||||
dm_task_no_open_count(dmt);
|
||||
if (!dm_task_run(dmt))
|
||||
return 0;
|
||||
{
|
||||
dm_task_destroy (dmt);
|
||||
return 0;
|
||||
}
|
||||
next = dm_get_next_target(dmt, next, &start, &length,
|
||||
&target, ¶ms);
|
||||
if (grub_strcmp (target, "linear") != 0)
|
||||
return 0;
|
||||
{
|
||||
dm_task_destroy (dmt);
|
||||
return 0;
|
||||
}
|
||||
major = grub_strtoul (params, &ptr, 10);
|
||||
if (grub_errno)
|
||||
{
|
||||
dm_task_destroy (dmt);
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
return 0;
|
||||
}
|
||||
if (*ptr != ':')
|
||||
return 0;
|
||||
{
|
||||
dm_task_destroy (dmt);
|
||||
return 0;
|
||||
}
|
||||
ptr++;
|
||||
minor = grub_strtoul (ptr, 0, 10);
|
||||
if (grub_errno)
|
||||
{
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
dm_task_destroy (dmt);
|
||||
return 0;
|
||||
}
|
||||
if (maj)
|
||||
*maj = major;
|
||||
if (min)
|
||||
*min = minor;
|
||||
dm_task_destroy (dmt);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -149,7 +149,7 @@ escape_of_path (const char *orig_path)
|
|||
const char *p;
|
||||
|
||||
if (!strchr (orig_path, ','))
|
||||
return (char *) orig_path;
|
||||
return (char *) xstrdup (orig_path);
|
||||
|
||||
new_path = xmalloc (strlen (orig_path) * 2 + sizeof ("ieee1275/"));
|
||||
|
||||
|
@ -259,14 +259,16 @@ guess_baremetal_drive (const char *orig_path)
|
|||
static void
|
||||
print_full_name (const char *drive, grub_device_t dev)
|
||||
{
|
||||
char *dname = escape_of_path (drive);
|
||||
if (dev->disk->partition)
|
||||
{
|
||||
char *pname = grub_partition_get_name (dev->disk->partition);
|
||||
printf ("%s,%s", drive, pname);
|
||||
printf ("%s,%s", dname, pname);
|
||||
free (pname);
|
||||
}
|
||||
else
|
||||
printf ("%s", drive);
|
||||
printf ("%s", dname);
|
||||
free (dname);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -363,17 +365,15 @@ probe (const char *path, char *device_name)
|
|||
if (print == PRINT_HINT_STR)
|
||||
{
|
||||
const char *osdev = grub_util_biosdisk_get_osdev (dev->disk);
|
||||
const char *orig_path = grub_util_devname_to_ofpath (osdev);
|
||||
const char *ofpath = osdev ? grub_util_devname_to_ofpath (osdev) : 0;
|
||||
char *biosname, *bare, *efi;
|
||||
const char *map;
|
||||
|
||||
if (orig_path)
|
||||
if (ofpath)
|
||||
{
|
||||
char *ofpath = escape_of_path (orig_path);
|
||||
printf ("--hint-ieee1275='");
|
||||
print_full_name (ofpath, dev);
|
||||
printf ("' ");
|
||||
free (ofpath);
|
||||
}
|
||||
|
||||
biosname = guess_bios_drive (device_name);
|
||||
|
@ -417,6 +417,16 @@ probe (const char *path, char *device_name)
|
|||
goto end;
|
||||
}
|
||||
|
||||
if ((print == PRINT_COMPATIBILITY_HINT || print == PRINT_BIOS_HINT
|
||||
|| print == PRINT_IEEE1275_HINT || print == PRINT_BAREMETAL_HINT
|
||||
|| print == PRINT_EFI_HINT || print == PRINT_ARC_HINT)
|
||||
&& dev->disk->dev->id != GRUB_DISK_DEVICE_HOSTDISK_ID)
|
||||
{
|
||||
print_full_name (dev->disk->name, dev);
|
||||
printf ("\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (print == PRINT_COMPATIBILITY_HINT)
|
||||
{
|
||||
const char *map;
|
||||
|
@ -449,8 +459,7 @@ probe (const char *path, char *device_name)
|
|||
if (print == PRINT_IEEE1275_HINT)
|
||||
{
|
||||
const char *osdev = grub_util_biosdisk_get_osdev (dev->disk);
|
||||
const char *orig_path = grub_util_devname_to_ofpath (osdev);
|
||||
char *ofpath = escape_of_path (orig_path);
|
||||
const char *ofpath = grub_util_devname_to_ofpath (osdev);
|
||||
const char *map;
|
||||
|
||||
map = grub_util_biosdisk_get_compatibility_hint (dev->disk);
|
||||
|
@ -460,11 +469,13 @@ probe (const char *path, char *device_name)
|
|||
print_full_name (map, dev);
|
||||
}
|
||||
|
||||
printf (" ");
|
||||
print_full_name (ofpath, dev);
|
||||
if (ofpath)
|
||||
{
|
||||
printf (" ");
|
||||
print_full_name (ofpath, dev);
|
||||
}
|
||||
|
||||
printf ("\n");
|
||||
free (ofpath);
|
||||
goto end;
|
||||
}
|
||||
if (print == PRINT_EFI_HINT)
|
||||
|
|
Loading…
Reference in a new issue