mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +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:
@@ -362,7 +362,7 @@ main (int argc, char *argv[])
|
||||
unsigned errors = 0;
|
||||
|
||||
/* Mount up first guest. */
|
||||
add_drives (drvs, 'a');
|
||||
add_drives (drvs);
|
||||
|
||||
if (guestfs_launch (g) == -1)
|
||||
exit (EXIT_FAILURE);
|
||||
@@ -373,7 +373,7 @@ main (int argc, char *argv[])
|
||||
errors++;
|
||||
|
||||
/* Mount up second guest. */
|
||||
add_drives_handle (g2, drvs2, 'a');
|
||||
add_drives_handle (g2, drvs2, 0);
|
||||
|
||||
if (guestfs_launch (g2) == -1)
|
||||
exit (EXIT_FAILURE);
|
||||
|
||||
Reference in New Issue
Block a user