fish: fuse: Add -m dev:mnt:opts to allow mount options to be specified.
[libguestfs.git] / fish / options.h
index 9cb7f4b..e0cad01 100644 (file)
@@ -1,5 +1,5 @@
 /* libguestfs - guestfish and guestmount shared option parsing
- * Copyright (C) 2010 Red Hat Inc.
+ * Copyright (C) 2010-2011 Red Hat Inc.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -67,6 +67,7 @@
 /* Provided by guestfish or guestmount. */
 extern guestfs_h *g;
 extern int read_only;
+extern int live;
 extern int verbose;
 extern int inspector;
 extern int keys_from_stdin;
@@ -77,6 +78,16 @@ extern const char *program_name;
 /* List of drives added via -a, -d or -N options. */
 struct drv {
   struct drv *next;
+
+  char *device;    /* Device name inside the appliance (eg. /dev/sda).
+                    * This is filled in when we add the drives in
+                    * add_drives.  Note that guests (-d option) may
+                    * have multiple drives, in which case this is the
+                    * first drive, and nr_drives is the number of
+                    * drives used.
+                    */
+  int nr_drives;   /* number of drives for this guest */
+
   enum { drv_a, drv_d, drv_N } type;
   union {
     struct {
@@ -90,7 +101,6 @@ struct drv {
       char *filename;       /* disk filename (testX.img) */
       void *data;           /* prepared type */
       void (*data_free)(void*); /* function to free 'data' */
-      char *device;         /* device inside the appliance */
     } N;
   };
 };
@@ -99,11 +109,15 @@ struct mp {
   struct mp *next;
   char *device;
   char *mountpoint;
+  char *options;
 };
 
 /* in inspect.c */
 extern void inspect_mount (void);
 extern void print_inspect_prompt (void);
+/* (low-level inspection functions, used by virt-inspector only) */
+extern void inspect_do_decrypt (void);
+extern void inspect_mount_root (const char *root);
 
 /* in key.c */
 extern char *read_key (const char *param);
@@ -128,6 +142,8 @@ extern int add_libvirt_drives (const char *guest);
     exit (EXIT_FAILURE);                        \
   }                                             \
   drv->type = drv_a;                            \
+  drv->device = NULL;                           \
+  drv->nr_drives = -1;                          \
   drv->a.filename = optarg;                     \
   drv->a.format = format;                       \
   drv->next = drvs;                             \
@@ -143,6 +159,8 @@ extern int add_libvirt_drives (const char *guest);
     exit (EXIT_FAILURE);                        \
   }                                             \
   drv->type = drv_d;                            \
+  drv->device = NULL;                           \
+  drv->nr_drives = -1;                          \
   drv->d.guest = optarg;                        \
   drv->next = drvs;                             \
   drvs = drv
@@ -156,12 +174,20 @@ extern int add_libvirt_drives (const char *guest);
     perror ("malloc");                          \
     exit (EXIT_FAILURE);                        \
   }                                             \
+  mp->options = NULL;                           \
+  mp->mountpoint = bad_cast ("/");              \
   p = strchr (optarg, ':');                     \
   if (p) {                                      \
     *p = '\0';                                  \
-    mp->mountpoint = p+1;                       \
-  } else                                        \
-    mp->mountpoint = bad_cast ("/");            \
+    p++;                                        \
+    mp->mountpoint = p;                         \
+    p = strchr (p, ':');                        \
+    if (p) {                                    \
+      *p = '\0';                                \
+      p++;                                      \
+      mp->options = p;                          \
+    }                                           \
+  }                                             \
   mp->device = optarg;                          \
   mp->next = mps;                               \
   mps = mp