summaryrefslogtreecommitdiffstats
path: root/fish
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-11-29 11:44:50 +0000
committerRichard W.M. Jones <rjones@redhat.com>2012-11-29 11:45:39 +0000
commit380ce2eeaab5d37e5343aa2ba1fcde755ecefa23 (patch)
tree53daa77e59a9db032cadbcf043fe8cc5669201d6 /fish
parent9e7daf2ee8f0a619440ca1c55dfe5ddcf61b4460 (diff)
downloadlibguestfs-380ce2eeaab5d37e5343aa2ba1fcde755ecefa23.tar.gz
libguestfs-380ce2eeaab5d37e5343aa2ba1fcde755ecefa23.tar.xz
libguestfs-380ce2eeaab5d37e5343aa2ba1fcde755ecefa23.zip
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.
Diffstat (limited to 'fish')
-rw-r--r--fish/Makefile.am1
-rw-r--r--fish/options.c4
-rw-r--r--fish/options.h8
3 files changed, 12 insertions, 1 deletions
diff --git a/fish/Makefile.am b/fish/Makefile.am
index aa1b0980..b0bf6581 100644
--- a/fish/Makefile.am
+++ b/fish/Makefile.am
@@ -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 \
diff --git a/fish/options.c b/fish/options.c
index 0db790e1..40671b5f 100644
--- a/fish/options.c
+++ b/fish/options.c
@@ -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);
diff --git a/fish/options.h b/fish/options.h
index 29117f64..137b2d72 100644
--- a/fish/options.h
+++ b/fish/options.h
@@ -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 */