mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
common/options: Change drv struct to store drive index instead of device name.
The device name is only used by guestfish (when using the -N option to
prepare drives). We constructed the device name very naively,
basically ‘sprintf ("/dev/sd%c", next_drive)’.
This stores the device index instead, and only constructs the device
name in guestfish. Also the device name is constructed properly using
guestfs_int_drive_name so it can cope with #drives > 26.
As a side effect of this change we can remove the extra parameter of
the add_drives macro.
Thanks: Pino Toscano
This commit is contained in:
@@ -372,7 +372,7 @@ main (int argc, char *argv[])
|
||||
exit (EXIT_FAILURE);
|
||||
|
||||
/* Do the guest drives and mountpoints. */
|
||||
add_drives (drvs, 'a');
|
||||
add_drives (drvs);
|
||||
if (guestfs_launch (g) == -1)
|
||||
exit (EXIT_FAILURE);
|
||||
if (inspector)
|
||||
@@ -673,7 +673,6 @@ add_scratch_disk (struct drv **drvs)
|
||||
if (!drv)
|
||||
error (EXIT_FAILURE, errno, "calloc");
|
||||
drv->type = drv_scratch;
|
||||
drv->nr_drives = -1;
|
||||
drv->scratch.size = INT64_C (10737418240);
|
||||
drv->next = *drvs;
|
||||
*drvs = drv;
|
||||
|
||||
@@ -54,7 +54,7 @@ do_suggestion (struct drv *drvs)
|
||||
read_only = 1;
|
||||
|
||||
/* Add drives. */
|
||||
add_drives (drvs, 'a');
|
||||
add_drives (drvs);
|
||||
|
||||
/* Free up data structures, no longer needed after this point. */
|
||||
free_drives (drvs);
|
||||
|
||||
Reference in New Issue
Block a user