summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2009-06-29 16:05:22 +0100
committerRichard W.M. Jones <rjones@redhat.com>2009-06-29 16:05:22 +0100
commit5d6b6a3fbbfea19c606b984bac9cf64b6b81cafe (patch)
treeb1d34b141b935fc6acc46930acd0496dfcc0df8b
parenta548d51b703f5385797594a37287f4532af289a2 (diff)
downloadlibguestfs-5d6b6a3fbbfea19c606b984bac9cf64b6b81cafe.tar.gz
libguestfs-5d6b6a3fbbfea19c606b984bac9cf64b6b81cafe.tar.xz
libguestfs-5d6b6a3fbbfea19c606b984bac9cf64b6b81cafe.zip
Generated code for mount-loop command.
-rw-r--r--capitests/tests.c1
-rw-r--r--daemon/actions.h1
-rw-r--r--daemon/stubs.c29
-rw-r--r--fish/cmds.c23
-rw-r--r--fish/completion.c1
-rw-r--r--guestfish-actions.pod8
-rw-r--r--guestfs-actions.pod12
-rw-r--r--haskell/Guestfs.hs15
-rw-r--r--java/com/redhat/et/libguestfs/GuestFS.java19
-rw-r--r--java/com_redhat_et_libguestfs_GuestFS.c20
-rw-r--r--ocaml/guestfs.ml1
-rw-r--r--ocaml/guestfs.mli3
-rw-r--r--ocaml/guestfs_c_actions.c24
-rw-r--r--perl/Guestfs.xs12
-rw-r--r--perl/lib/Sys/Guestfs.pm6
-rw-r--r--python/guestfs-py.c27
-rw-r--r--python/guestfs.py7
-rw-r--r--ruby/ext/guestfs/_guestfs.c29
-rw-r--r--src/MAX_PROC_NR2
-rw-r--r--src/guestfs-actions.c89
-rw-r--r--src/guestfs-actions.h1
-rw-r--r--src/guestfs_protocol.c12
-rw-r--r--src/guestfs_protocol.h11
-rw-r--r--src/guestfs_protocol.x6
24 files changed, 356 insertions, 3 deletions
diff --git a/capitests/tests.c b/capitests/tests.c
index ba2e806d..455c20e3 100644
--- a/capitests/tests.c
+++ b/capitests/tests.c
@@ -153,6 +153,7 @@ static void no_test_warnings (void)
fprintf (stderr, "warning: \"guestfs_scrub_freespace\" has no tests\n");
fprintf (stderr, "warning: \"guestfs_df\" has no tests\n");
fprintf (stderr, "warning: \"guestfs_df_h\" has no tests\n");
+ fprintf (stderr, "warning: \"guestfs_mount_loop\" has no tests\n");
}
static int test_initrd_list_0_skip (void)
diff --git a/daemon/actions.h b/daemon/actions.h
index 8c3c5fe0..1d412dcc 100644
--- a/daemon/actions.h
+++ b/daemon/actions.h
@@ -149,3 +149,4 @@ extern char *do_df (void);
extern char *do_df_h (void);
extern int64_t do_du (char *path);
extern char **do_initrd_list (char *path);
+extern int do_mount_loop (char *file, char *mountpoint);
diff --git a/daemon/stubs.c b/daemon/stubs.c
index 294d9e68..6d7cb0e7 100644
--- a/daemon/stubs.c
+++ b/daemon/stubs.c
@@ -3233,6 +3233,32 @@ done:
xdr_free ((xdrproc_t) xdr_guestfs_initrd_list_args, (char *) &args);
}
+static void mount_loop_stub (XDR *xdr_in)
+{
+ int r;
+ struct guestfs_mount_loop_args args;
+ char *file;
+ char *mountpoint;
+
+ memset (&args, 0, sizeof args);
+
+ if (!xdr_guestfs_mount_loop_args (xdr_in, &args)) {
+ reply_with_error ("%s: daemon failed to decode procedure arguments", "mount_loop");
+ return;
+ }
+ file = args.file;
+ mountpoint = args.mountpoint;
+
+ r = do_mount_loop (file, mountpoint);
+ if (r == -1)
+ /* do_mount_loop has already called reply_with_error */
+ goto done;
+
+ reply (NULL, NULL);
+done:
+ xdr_free ((xdrproc_t) xdr_guestfs_mount_loop_args, (char *) &args);
+}
+
void dispatch_incoming_message (XDR *xdr_in)
{
switch (proc_nr) {
@@ -3620,6 +3646,9 @@ void dispatch_incoming_message (XDR *xdr_in)
case GUESTFS_PROC_INITRD_LIST:
initrd_list_stub (xdr_in);
break;
+ case GUESTFS_PROC_MOUNT_LOOP:
+ mount_loop_stub (xdr_in);
+ break;
default:
reply_with_error ("dispatch_incoming_message: unknown procedure number %d, set LIBGUESTFS_PATH to point to the matching libguestfs appliance directory", proc_nr);
}
diff --git a/fish/cmds.c b/fish/cmds.c
index ed59804b..c9c05158 100644
--- a/fish/cmds.c
+++ b/fish/cmds.c
@@ -117,6 +117,7 @@ void list_commands (void)
printf ("%-20s %s\n", "mkdtemp", "create a temporary directory");
printf ("%-20s %s\n", "mkfs", "make a filesystem");
printf ("%-20s %s\n", "mount", "mount a guest disk at a position in the filesystem");
+ printf ("%-20s %s\n", "mount-loop", "mount a file using the loop device");
printf ("%-20s %s\n", "mount-options", "mount a guest disk with mount options");
printf ("%-20s %s\n", "mount-ro", "mount a guest disk, read-only");
printf ("%-20s %s\n", "mount-vfs", "mount a guest disk with mount options and vfstype");
@@ -632,6 +633,9 @@ void display_command (const char *cmd)
if (strcasecmp (cmd, "initrd_list") == 0 || strcasecmp (cmd, "initrd-list") == 0)
pod2text ("initrd-list - list files in an initrd", " initrd-list <path>\n\nThis command lists out files contained in an initrd.\n\nThe files are listed without any initial C</> character. The\nfiles are listed in the order they appear (not necessarily\nalphabetical). Directory names are listed as separate items.\n\nOld Linux kernels (2.4 and earlier) used a compressed ext2\nfilesystem as initrd. We I<only> support the newer initramfs\nformat (compressed cpio files).");
else
+ if (strcasecmp (cmd, "mount_loop") == 0 || strcasecmp (cmd, "mount-loop") == 0)
+ pod2text ("mount-loop - mount a file using the loop device", " mount-loop <file> <mountpoint>\n\nThis command lets you mount C<file> (a filesystem image\nin a file) on a mount point. It is entirely equivalent to\nthe command C<mount -o loop file mountpoint>.");
+ else
display_builtin_command (cmd);
}
@@ -3103,6 +3107,22 @@ static int run_initrd_list (const char *cmd, int argc, char *argv[])
return 0;
}
+static int run_mount_loop (const char *cmd, int argc, char *argv[])
+{
+ int r;
+ const char *file;
+ const char *mountpoint;
+ if (argc != 2) {
+ fprintf (stderr, "%s should have 2 parameter(s)\n", cmd);
+ fprintf (stderr, "type 'help %s' for help on %s\n", cmd, cmd);
+ return -1;
+ }
+ file = argv[0];
+ mountpoint = argv[1];
+ r = guestfs_mount_loop (g, file, mountpoint);
+ return r;
+}
+
int run_action (const char *cmd, int argc, char *argv[])
{
if (strcasecmp (cmd, "launch") == 0 || strcasecmp (cmd, "run") == 0)
@@ -3552,6 +3572,9 @@ int run_action (const char *cmd, int argc, char *argv[])
if (strcasecmp (cmd, "initrd_list") == 0 || strcasecmp (cmd, "initrd-list") == 0)
return run_initrd_list (cmd, argc, argv);
else
+ if (strcasecmp (cmd, "mount_loop") == 0 || strcasecmp (cmd, "mount-loop") == 0)
+ return run_mount_loop (cmd, argc, argv);
+ else
{
fprintf (stderr, "%s: unknown command\n", cmd);
return -1;
diff --git a/fish/completion.c b/fish/completion.c
index ea75362d..2ddfb433 100644
--- a/fish/completion.c
+++ b/fish/completion.c
@@ -195,6 +195,7 @@ static const char *const commands[] = {
"df-h",
"du",
"initrd-list",
+ "mount-loop",
NULL
};
diff --git a/guestfish-actions.pod b/guestfish-actions.pod
index 2b4e99e6..a3592ad4 100644
--- a/guestfish-actions.pod
+++ b/guestfish-actions.pod
@@ -1035,6 +1035,14 @@ on the underlying device.
The filesystem options C<sync> and C<noatime> are set with this
call, in order to improve reliability.
+=head2 mount-loop
+
+ mount-loop file mountpoint
+
+This command lets you mount C<file> (a filesystem image
+in a file) on a mount point. It is entirely equivalent to
+the command C<mount -o loop file mountpoint>.
+
=head2 mount-options
mount-options options device mountpoint
diff --git a/guestfs-actions.pod b/guestfs-actions.pod
index 18c3910c..56949faa 100644
--- a/guestfs-actions.pod
+++ b/guestfs-actions.pod
@@ -1356,6 +1356,18 @@ call, in order to improve reliability.
This function returns 0 on success or -1 on error.
+=head2 guestfs_mount_loop
+
+ int guestfs_mount_loop (guestfs_h *handle,
+ const char *file,
+ const char *mountpoint);
+
+This command lets you mount C<file> (a filesystem image
+in a file) on a mount point. It is entirely equivalent to
+the command C<mount -o loop file mountpoint>.
+
+This function returns 0 on success or -1 on error.
+
=head2 guestfs_mount_options
int guestfs_mount_options (guestfs_h *handle,
diff --git a/haskell/Guestfs.hs b/haskell/Guestfs.hs
index 9eefda11..32e7aedd 100644
--- a/haskell/Guestfs.hs
+++ b/haskell/Guestfs.hs
@@ -120,7 +120,8 @@ module Guestfs (
wc_l,
wc_w,
wc_c,
- du
+ du,
+ mount_loop
) where
import Foreign
import Foreign.C
@@ -1335,3 +1336,15 @@ du h path = do
fail err
else return (fromIntegral r)
+foreign import ccall unsafe "guestfs_mount_loop" c_mount_loop
+ :: GuestfsP -> CString -> CString -> IO (CInt)
+
+mount_loop :: GuestfsH -> String -> String -> IO ()
+mount_loop h file mountpoint = do
+ r <- withCString file $ \file -> withCString mountpoint $ \mountpoint -> withForeignPtr h (\p -> c_mount_loop p file mountpoint)
+ if (r == -1)
+ then do
+ err <- last_error h
+ fail err
+ else return ()
+
diff --git a/java/com/redhat/et/libguestfs/GuestFS.java b/java/com/redhat/et/libguestfs/GuestFS.java
index 8ab3a4fe..f2901497 100644
--- a/java/com/redhat/et/libguestfs/GuestFS.java
+++ b/java/com/redhat/et/libguestfs/GuestFS.java
@@ -3820,4 +3820,23 @@ public HashMap<String,String> test0rhashtableerr ()
private native String[] _initrd_list (long g, String path)
throws LibGuestFSException;
+ /**
+ * mount a file using the loop device
+ * <p>
+ * This command lets you mount "file" (a filesystem image
+ * in a file) on a mount point. It is entirely equivalent
+ * to the command "mount -o loop file mountpoint".
+ * <p>
+ * @throws LibGuestFSException
+ */
+ public void mount_loop (String file, String mountpoint)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("mount_loop: handle is closed");
+ _mount_loop (g, file, mountpoint);
+ }
+ private native void _mount_loop (long g, String file, String mountpoint)
+ throws LibGuestFSException;
+
}
diff --git a/java/com_redhat_et_libguestfs_GuestFS.c b/java/com_redhat_et_libguestfs_GuestFS.c
index 6d101a68..a58b489a 100644
--- a/java/com_redhat_et_libguestfs_GuestFS.c
+++ b/java/com_redhat_et_libguestfs_GuestFS.c
@@ -4422,3 +4422,23 @@ Java_com_redhat_et_libguestfs_GuestFS__1initrd_1list
return jr;
}
+JNIEXPORT void JNICALL
+Java_com_redhat_et_libguestfs_GuestFS__1mount_1loop
+ (JNIEnv *env, jobject obj, jlong jg, jstring jfile, jstring jmountpoint)
+{
+ guestfs_h *g = (guestfs_h *) (long) jg;
+ int r;
+ const char *file;
+ const char *mountpoint;
+
+ file = (*env)->GetStringUTFChars (env, jfile, NULL);
+ mountpoint = (*env)->GetStringUTFChars (env, jmountpoint, NULL);
+ r = guestfs_mount_loop (g, file, mountpoint);
+ (*env)->ReleaseStringUTFChars (env, jfile, file);
+ (*env)->ReleaseStringUTFChars (env, jmountpoint, mountpoint);
+ if (r == -1) {
+ throw_exception (env, guestfs_last_error (g));
+ return ;
+ }
+}
+
diff --git a/ocaml/guestfs.ml b/ocaml/guestfs.ml
index 33c0276e..d9b652b7 100644
--- a/ocaml/guestfs.ml
+++ b/ocaml/guestfs.ml
@@ -295,3 +295,4 @@ external df : t -> string = "ocaml_guestfs_df"
external df_h : t -> string = "ocaml_guestfs_df_h"
external du : t -> string -> int64 = "ocaml_guestfs_du"
external initrd_list : t -> string -> string array = "ocaml_guestfs_initrd_list"
+external mount_loop : t -> string -> string -> unit = "ocaml_guestfs_mount_loop"
diff --git a/ocaml/guestfs.mli b/ocaml/guestfs.mli
index 988d9de6..612d0022 100644
--- a/ocaml/guestfs.mli
+++ b/ocaml/guestfs.mli
@@ -664,3 +664,6 @@ val du : t -> string -> int64
val initrd_list : t -> string -> string array
(** list files in an initrd *)
+val mount_loop : t -> string -> string -> unit
+(** mount a file using the loop device *)
+
diff --git a/ocaml/guestfs_c_actions.c b/ocaml/guestfs_c_actions.c
index 6385e806..8b018f6e 100644
--- a/ocaml/guestfs_c_actions.c
+++ b/ocaml/guestfs_c_actions.c
@@ -4637,3 +4637,27 @@ ocaml_guestfs_initrd_list (value gv, value pathv)
CAMLreturn (rv);
}
+CAMLprim value
+ocaml_guestfs_mount_loop (value gv, value filev, value mountpointv)
+{
+ CAMLparam3 (gv, filev, mountpointv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("mount_loop: used handle after closing it");
+
+ const char *file = String_val (filev);
+ const char *mountpoint = String_val (mountpointv);
+ int r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_mount_loop (g, file, mountpoint);
+ caml_leave_blocking_section ();
+ if (r == -1)
+ ocaml_guestfs_raise_error (g, "mount_loop");
+
+ rv = Val_unit;
+ CAMLreturn (rv);
+}
+
diff --git a/perl/Guestfs.xs b/perl/Guestfs.xs
index c0846d8f..f19ea1a1 100644
--- a/perl/Guestfs.xs
+++ b/perl/Guestfs.xs
@@ -2831,3 +2831,15 @@ PREINIT:
}
free (filenames);
+void
+mount_loop (g, file, mountpoint)
+ guestfs_h *g;
+ char *file;
+ char *mountpoint;
+PREINIT:
+ int r;
+ PPCODE:
+ r = guestfs_mount_loop (g, file, mountpoint);
+ if (r == -1)
+ croak ("mount_loop: %s", guestfs_last_error (g));
+
diff --git a/perl/lib/Sys/Guestfs.pm b/perl/lib/Sys/Guestfs.pm
index 144e127e..f0eb6a0f 100644
--- a/perl/lib/Sys/Guestfs.pm
+++ b/perl/lib/Sys/Guestfs.pm
@@ -962,6 +962,12 @@ on the underlying device.
The filesystem options C<sync> and C<noatime> are set with this
call, in order to improve reliability.
+=item $h->mount_loop ($file, $mountpoint);
+
+This command lets you mount C<file> (a filesystem image
+in a file) on a mount point. It is entirely equivalent to
+the command C<mount -o loop file mountpoint>.
+
=item $h->mount_options ($options, $device, $mountpoint);
This is the same as the C<$h-E<gt>mount> command, but it
diff --git a/python/guestfs-py.c b/python/guestfs-py.c
index d2682f9c..6a81349b 100644
--- a/python/guestfs-py.c
+++ b/python/guestfs-py.c
@@ -4902,6 +4902,32 @@ py_guestfs_initrd_list (PyObject *self, PyObject *args)
return py_r;
}
+static PyObject *
+py_guestfs_mount_loop (PyObject *self, PyObject *args)
+{
+ PyObject *py_g;
+ guestfs_h *g;
+ PyObject *py_r;
+ int r;
+ const char *file;
+ const char *mountpoint;
+
+ if (!PyArg_ParseTuple (args, (char *) "Oss:guestfs_mount_loop",
+ &py_g, &file, &mountpoint))
+ return NULL;
+ g = get_handle (py_g);
+
+ r = guestfs_mount_loop (g, file, mountpoint);
+ if (r == -1) {
+ PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
+ return NULL;
+ }
+
+ Py_INCREF (Py_None);
+ py_r = Py_None;
+ return py_r;
+}
+
static PyMethodDef methods[] = {
{ (char *) "create", py_guestfs_create, METH_VARARGS, NULL },
{ (char *) "close", py_guestfs_close, METH_VARARGS, NULL },
@@ -5085,6 +5111,7 @@ static PyMethodDef methods[] = {
{ (char *) "df_h", py_guestfs_df_h, METH_VARARGS, NULL },
{ (char *) "du", py_guestfs_du, METH_VARARGS, NULL },
{ (char *) "initrd_list", py_guestfs_initrd_list, METH_VARARGS, NULL },
+ { (char *) "mount_loop", py_guestfs_mount_loop, METH_VARARGS, NULL },
{ NULL, NULL, 0, NULL }
};
diff --git a/python/guestfs.py b/python/guestfs.py
index 0f6fc3a8..46b02a48 100644
--- a/python/guestfs.py
+++ b/python/guestfs.py
@@ -1856,3 +1856,10 @@ class GuestFS:
"""
return libguestfsmod.initrd_list (self._o, path)
+ def mount_loop (self, file, mountpoint):
+ u"""This command lets you mount "file" (a filesystem image
+ in a file) on a mount point. It is entirely equivalent
+ to the command "mount -o loop file mountpoint".
+ """
+ return libguestfsmod.mount_loop (self._o, file, mountpoint)
+
diff --git a/ruby/ext/guestfs/_guestfs.c b/ruby/ext/guestfs/_guestfs.c
index 0d4c6dc7..40654f9b 100644
--- a/ruby/ext/guestfs/_guestfs.c
+++ b/ruby/ext/guestfs/_guestfs.c
@@ -4611,6 +4611,33 @@ static VALUE ruby_guestfs_initrd_list (VALUE gv, VALUE pathv)
return rv;
}
+static VALUE ruby_guestfs_mount_loop (VALUE gv, VALUE filev, VALUE mountpointv)
+{
+ guestfs_h *g;
+ Data_Get_Struct (gv, guestfs_h, g);
+ if (!g)
+ rb_raise (rb_eArgError, "%s: used handle after closing it", "mount_loop");
+
+ Check_Type (filev, T_STRING);
+ const char *file = StringValueCStr (filev);
+ if (!file)
+ rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
+ "file", "mount_loop");
+ Check_Type (mountpointv, T_STRING);
+ const char *mountpoint = StringValueCStr (mountpointv);
+ if (!mountpoint)
+ rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
+ "mountpoint", "mount_loop");
+
+ int r;
+
+ r = guestfs_mount_loop (g, file, mountpoint);
+ if (r == -1)
+ rb_raise (e_Error, "%s", guestfs_last_error (g));
+
+ return Qnil;
+}
+
/* Initialize the module. */
void Init__guestfs ()
{
@@ -4981,4 +5008,6 @@ void Init__guestfs ()
ruby_guestfs_du, 1);
rb_define_method (c_guestfs, "initrd_list",
ruby_guestfs_initrd_list, 1);
+ rb_define_method (c_guestfs, "mount_loop",
+ ruby_guestfs_mount_loop, 2);
}
diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR
index a949a93d..b0d73241 100644
--- a/src/MAX_PROC_NR
+++ b/src/MAX_PROC_NR
@@ -1 +1 @@
-128
+129
diff --git a/src/guestfs-actions.c b/src/guestfs-actions.c
index 93fdee6a..94a08629 100644
--- a/src/guestfs-actions.c
+++ b/src/guestfs-actions.c
@@ -11746,3 +11746,92 @@ char **guestfs_initrd_list (guestfs_h *g,
return ctx.ret.filenames.filenames_val;
}
+struct mount_loop_ctx {
+ /* This flag is set by the callbacks, so we know we've done
+ * the callbacks as expected, and in the right sequence.
+ * 0 = not called, 1 = reply_cb called.
+ */
+ int cb_sequence;
+ struct guestfs_message_header hdr;
+ struct guestfs_message_error err;
+};
+
+static void mount_loop_reply_cb (guestfs_h *g, void *data, XDR *xdr)
+{
+ guestfs_main_loop *ml = guestfs_get_main_loop (g);
+ struct mount_loop_ctx *ctx = (struct mount_loop_ctx *) data;
+
+ /* This should definitely not happen. */
+ if (ctx->cb_sequence != 0) {
+ ctx->cb_sequence = 9999;
+ error (g, "%s: internal error: reply callback called twice", "guestfs_mount_loop");
+ return;
+ }
+
+ ml->main_loop_quit (ml, g);
+
+ if (!xdr_guestfs_message_header (xdr, &ctx->hdr)) {
+ error (g, "%s: failed to parse reply header", "guestfs_mount_loop");
+ return;
+ }
+ if (ctx->hdr.status == GUESTFS_STATUS_ERROR) {
+ if (!xdr_guestfs_message_error (xdr, &ctx->err)) {
+ error (g, "%s: failed to parse reply error", "guestfs_mount_loop");
+ return;
+ }
+ goto done;
+ }
+ done:
+ ctx->cb_sequence = 1;
+}
+
+int guestfs_mount_loop (guestfs_h *g,
+ const char *file,
+ const char *mountpoint)
+{
+ struct guestfs_mount_loop_args args;
+ struct mount_loop_ctx ctx;
+ guestfs_main_loop *ml = guestfs_get_main_loop (g);
+ int serial;
+
+ if (check_state (g, "guestfs_mount_loop") == -1) return -1;
+ guestfs_set_busy (g);
+
+ memset (&ctx, 0, sizeof ctx);
+
+ args.file = (char *) file;
+ args.mountpoint = (char *) mountpoint;
+ serial = guestfs__send_sync (g, GUESTFS_PROC_MOUNT_LOOP,
+ (xdrproc_t) xdr_guestfs_mount_loop_args, (char *) &args);
+ if (serial == -1) {
+ guestfs_end_busy (g);
+ return -1;
+ }
+
+ guestfs__switch_to_receiving (g);
+ ctx.cb_sequence = 0;
+ guestfs_set_reply_callback (g, mount_loop_reply_cb, &ctx);
+ (void) ml->main_loop_run (ml, g);
+ guestfs_set_reply_callback (g, NULL, NULL);
+ if (ctx.cb_sequence != 1) {
+ error (g, "%s reply failed, see earlier error messages", "guestfs_mount_loop");
+ guestfs_end_busy (g);
+ return -1;
+ }
+
+ if (check_reply_header (g, &ctx.hdr, GUESTFS_PROC_MOUNT_LOOP, serial) == -1) {
+ guestfs_end_busy (g);
+ return -1;
+ }
+
+ if (ctx.hdr.status == GUESTFS_STATUS_ERROR) {
+ error (g, "%s", ctx.err.error_message);
+ free (ctx.err.error_message);
+ guestfs_end_busy (g);
+ return -1;
+ }
+
+ guestfs_end_busy (g);
+ return 0;
+}
+
diff --git a/src/guestfs-actions.h b/src/guestfs-actions.h
index 43570bbe..c0002662 100644
--- a/src/guestfs-actions.h
+++ b/src/guestfs-actions.h
@@ -199,3 +199,4 @@ extern char *guestfs_df (guestfs_h *handle);
extern char *guestfs_df_h (guestfs_h *handle);
extern int64_t guestfs_du (guestfs_h *handle, const char *path);
extern char **guestfs_initrd_list (guestfs_h *handle, const char *path);
+extern int guestfs_mount_loop (guestfs_h *handle, const char *file, const char *mountpoint);
diff --git a/src/guestfs_protocol.c b/src/guestfs_protocol.c
index 6f135dbe..9b12986c 100644
--- a/src/guestfs_protocol.c
+++ b/src/guestfs_protocol.c
@@ -2192,6 +2192,18 @@ xdr_guestfs_initrd_list_ret (XDR *xdrs, guestfs_initrd_list_ret *objp)
}
bool_t
+xdr_guestfs_mount_loop_args (XDR *xdrs, guestfs_mount_loop_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, &objp->file, ~0))
+ return FALSE;
+ if (!xdr_string (xdrs, &objp->mountpoint, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
xdr_guestfs_procedure (XDR *xdrs, guestfs_procedure *objp)
{
register int32_t *buf;
diff --git a/src/guestfs_protocol.h b/src/guestfs_protocol.h
index b850f9f8..d127b884 100644
--- a/src/guestfs_protocol.h
+++ b/src/guestfs_protocol.h
@@ -1124,6 +1124,12 @@ struct guestfs_initrd_list_ret {
};
typedef struct guestfs_initrd_list_ret guestfs_initrd_list_ret;
+struct guestfs_mount_loop_args {
+ char *file;
+ char *mountpoint;
+};
+typedef struct guestfs_mount_loop_args guestfs_mount_loop_args;
+
enum guestfs_procedure {
GUESTFS_PROC_MOUNT = 1,
GUESTFS_PROC_SYNC = 2,
@@ -1253,7 +1259,8 @@ enum guestfs_procedure {
GUESTFS_PROC_DF_H = 126,
GUESTFS_PROC_DU = 127,
GUESTFS_PROC_INITRD_LIST = 128,
- GUESTFS_PROC_NR_PROCS = 128 + 1,
+ GUESTFS_PROC_MOUNT_LOOP = 129,
+ GUESTFS_PROC_NR_PROCS = 129 + 1,
};
typedef enum guestfs_procedure guestfs_procedure;
#define GUESTFS_MESSAGE_MAX 4194304
@@ -1485,6 +1492,7 @@ extern bool_t xdr_guestfs_du_args (XDR *, guestfs_du_args*);
extern bool_t xdr_guestfs_du_ret (XDR *, guestfs_du_ret*);
extern bool_t xdr_guestfs_initrd_list_args (XDR *, guestfs_initrd_list_args*);
extern bool_t xdr_guestfs_initrd_list_ret (XDR *, guestfs_initrd_list_ret*);
+extern bool_t xdr_guestfs_mount_loop_args (XDR *, guestfs_mount_loop_args*);
extern bool_t xdr_guestfs_procedure (XDR *, guestfs_procedure*);
extern bool_t xdr_guestfs_message_direction (XDR *, guestfs_message_direction*);
extern bool_t xdr_guestfs_message_status (XDR *, guestfs_message_status*);
@@ -1675,6 +1683,7 @@ extern bool_t xdr_guestfs_du_args ();
extern bool_t xdr_guestfs_du_ret ();
extern bool_t xdr_guestfs_initrd_list_args ();
extern bool_t xdr_guestfs_initrd_list_ret ();
+extern bool_t xdr_guestfs_mount_loop_args ();
extern bool_t xdr_guestfs_procedure ();
extern bool_t xdr_guestfs_message_direction ();
extern bool_t xdr_guestfs_message_status ();
diff --git a/src/guestfs_protocol.x b/src/guestfs_protocol.x
index 42040ac4..fdc67c15 100644
--- a/src/guestfs_protocol.x
+++ b/src/guestfs_protocol.x
@@ -858,6 +858,11 @@ struct guestfs_initrd_list_ret {
str filenames<>;
};
+struct guestfs_mount_loop_args {
+ string file<>;
+ string mountpoint<>;
+};
+
enum guestfs_procedure {
GUESTFS_PROC_MOUNT = 1,
GUESTFS_PROC_SYNC = 2,
@@ -987,6 +992,7 @@ enum guestfs_procedure {
GUESTFS_PROC_DF_H = 126,
GUESTFS_PROC_DU = 127,
GUESTFS_PROC_INITRD_LIST = 128,
+ GUESTFS_PROC_MOUNT_LOOP = 129,
GUESTFS_PROC_NR_PROCS
};