mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
fish: Make type == drv_N field private to guestfish.
The -N option / drv_N type only makes sense when we are compiling guestfish, and just serves to complicate non-guestfish code.
This commit is contained in:
@@ -325,7 +325,6 @@ single_drive_display_name (struct drv *drvs)
|
||||
case drv_d:
|
||||
name = drvs->d.guest;
|
||||
break;
|
||||
case drv_N:
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
@@ -120,6 +120,7 @@ cmds-gperf.c: cmds-gperf.gperf
|
||||
mv $@-t $@
|
||||
|
||||
guestfish_CFLAGS = \
|
||||
-DCOMPILING_GUESTFISH=1 \
|
||||
-DGUESTFS_WARN_DEPRECATED=1 \
|
||||
-I$(top_srcdir)/src -I$(top_builddir)/src \
|
||||
-I$(top_srcdir)/fish -I$(top_builddir)/fish \
|
||||
|
||||
@@ -79,6 +79,7 @@ add_drives (struct drv *drv, char next_drive)
|
||||
next_drive += r;
|
||||
break;
|
||||
|
||||
#if COMPILING_GUESTFISH
|
||||
case drv_N:
|
||||
/* guestfs_add_drive (ie. autodetecting) should be safe here
|
||||
* since we have just created the prepared disk. At the moment
|
||||
@@ -93,6 +94,7 @@ add_drives (struct drv *drv, char next_drive)
|
||||
drv->nr_drives = 1;
|
||||
next_drive++;
|
||||
break;
|
||||
#endif
|
||||
|
||||
default: /* keep GCC happy */
|
||||
abort ();
|
||||
@@ -181,10 +183,12 @@ free_drives (struct drv *drv)
|
||||
switch (drv->type) {
|
||||
case drv_a: /* a.filename and a.format are optargs, don't free them */ break;
|
||||
case drv_d: /* d.filename is optarg, don't free it */ break;
|
||||
#if COMPILING_GUESTFISH
|
||||
case drv_N:
|
||||
free (drv->N.filename);
|
||||
drv->N.data_free (drv->N.data);
|
||||
break;
|
||||
#endif
|
||||
default: ; /* keep GCC happy */
|
||||
}
|
||||
free (drv);
|
||||
|
||||
@@ -80,7 +80,13 @@ struct drv {
|
||||
*/
|
||||
int nr_drives; /* number of drives for this guest */
|
||||
|
||||
enum { drv_a, drv_d, drv_N } type;
|
||||
enum {
|
||||
drv_a, /* -a option */
|
||||
drv_d, /* -d option */
|
||||
#if COMPILING_GUESTFISH
|
||||
drv_N, /* -N option (guestfish only) */
|
||||
#endif
|
||||
} type;
|
||||
union {
|
||||
struct {
|
||||
char *filename; /* disk filename */
|
||||
|
||||
Reference in New Issue
Block a user