summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--daemon/actions.h1
-rw-r--r--daemon/stubs.c34
-rw-r--r--fish/cmds.c26
-rw-r--r--fish/completion.c1
-rw-r--r--guestfish-actions.pod12
-rw-r--r--guestfs-actions.pod17
-rw-r--r--java/com/redhat/et/libguestfs/GuestFS.java23
-rw-r--r--java/com_redhat_et_libguestfs_GuestFS.c36
-rw-r--r--ocaml/guestfs.ml1
-rw-r--r--ocaml/guestfs.mli3
-rw-r--r--ocaml/guestfs_c_actions.c26
-rw-r--r--perl/Guestfs.xs17
-rw-r--r--perl/lib/Sys/Guestfs.pm10
-rw-r--r--python/guestfs-py.c31
-rw-r--r--python/guestfs.py11
-rw-r--r--ruby/ext/guestfs/_guestfs.c35
-rw-r--r--src/guestfs-actions.c88
-rw-r--r--src/guestfs-actions.h1
-rw-r--r--src/guestfs_protocol.c23
-rw-r--r--src/guestfs_protocol.h21
-rw-r--r--src/guestfs_protocol.x10
-rw-r--r--tests.c1
22 files changed, 427 insertions, 1 deletions
diff --git a/daemon/actions.h b/daemon/actions.h
index 2cd7f3dd..dafbca76 100644
--- a/daemon/actions.h
+++ b/daemon/actions.h
@@ -96,3 +96,4 @@ extern int do_tgz_out (const char *directory);
extern int do_mount_ro (const char *device, const char *mountpoint);
extern int do_mount_options (const char *options, const char *device, const char *mountpoint);
extern int do_mount_vfs (const char *options, const char *vfstype, const char *device, const char *mountpoint);
+extern char *do_debug (const char *subcmd, char * const* const extraargs);
diff --git a/daemon/stubs.c b/daemon/stubs.c
index e9d9f594..526a8617 100644
--- a/daemon/stubs.c
+++ b/daemon/stubs.c
@@ -1841,6 +1841,37 @@ done:
xdr_free ((xdrproc_t) xdr_guestfs_mount_vfs_args, (char *) &args);
}
+static void debug_stub (XDR *xdr_in)
+{
+ char *r;
+ struct guestfs_debug_args args;
+ const char *subcmd;
+ char **extraargs;
+
+ memset (&args, 0, sizeof args);
+
+ if (!xdr_guestfs_debug_args (xdr_in, &args)) {
+ reply_with_error ("%s: daemon failed to decode procedure arguments", "debug");
+ return;
+ }
+ subcmd = args.subcmd;
+ args.extraargs.extraargs_val = realloc (args.extraargs.extraargs_val, sizeof (char *) * (args.extraargs.extraargs_len+1));
+ args.extraargs.extraargs_val[args.extraargs.extraargs_len] = NULL;
+ extraargs = args.extraargs.extraargs_val;
+
+ r = do_debug (subcmd, extraargs);
+ if (r == NULL)
+ /* do_debug has already called reply_with_error */
+ goto done;
+
+ struct guestfs_debug_ret ret;
+ ret.result = r;
+ reply ((xdrproc_t) &xdr_guestfs_debug_ret, (char *) &ret);
+ free (r);
+done:
+ xdr_free ((xdrproc_t) xdr_guestfs_debug_args, (char *) &args);
+}
+
void dispatch_incoming_message (XDR *xdr_in)
{
switch (proc_nr) {
@@ -2069,6 +2100,9 @@ void dispatch_incoming_message (XDR *xdr_in)
case GUESTFS_PROC_MOUNT_VFS:
mount_vfs_stub (xdr_in);
break;
+ case GUESTFS_PROC_DEBUG:
+ debug_stub (xdr_in);
+ break;
default:
reply_with_error ("dispatch_incoming_message: unknown procedure number %d", proc_nr);
}
diff --git a/fish/cmds.c b/fish/cmds.c
index ff20c824..7b1386fa 100644
--- a/fish/cmds.c
+++ b/fish/cmds.c
@@ -63,6 +63,7 @@ void list_commands (void)
printf ("%-20s %s\n", "command", "run a command from the guest filesystem");
printf ("%-20s %s\n", "command-lines", "run a command, returning lines");
printf ("%-20s %s\n", "config", "add qemu parameters");
+ printf ("%-20s %s\n", "debug", "debugging and internals");
printf ("%-20s %s\n", "download", "download a file to the local machine");
printf ("%-20s %s\n", "exists", "test if file or directory exists");
printf ("%-20s %s\n", "file", "determine file type");
@@ -408,6 +409,9 @@ void display_command (const char *cmd)
if (strcasecmp (cmd, "mount_vfs") == 0 || strcasecmp (cmd, "mount-vfs") == 0)
pod2text ("mount-vfs - mount a guest disk with mount options and vfstype", " mount-vfs <options> <vfstype> <device> <mountpoint>\n\nThis is the same as the C<mount> command, but it\nallows you to set both the mount options and the vfstype\nas for the L<mount(8)> I<-o> and I<-t> flags.");
else
+ if (strcasecmp (cmd, "debug") == 0)
+ pod2text ("debug - debugging and internals", " debug <subcmd> <extraargs>\n\nThe C<debug> command exposes some internals of\nC<guestfsd> (the guestfs daemon) that runs inside the\nqemu subprocess.\n\nThere is no comprehensive help for this command. You have\nto look at the file C<daemon/debug.c> in the libguestfs source\nto find out what you can do.");
+ else
display_builtin_command (cmd);
}
@@ -1983,6 +1987,25 @@ static int run_mount_vfs (const char *cmd, int argc, char *argv[])
return r;
}
+static int run_debug (const char *cmd, int argc, char *argv[])
+{
+ char *r;
+ const char *subcmd;
+ char **extraargs;
+ 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;
+ }
+ subcmd = argv[0];
+ extraargs = parse_string_list (argv[1]);
+ r = guestfs_debug (g, subcmd, extraargs);
+ if (r == NULL) return -1;
+ printf ("%s\n", r);
+ free (r);
+ return 0;
+}
+
int run_action (const char *cmd, int argc, char *argv[])
{
if (strcasecmp (cmd, "launch") == 0 || strcasecmp (cmd, "run") == 0)
@@ -2264,6 +2287,9 @@ int run_action (const char *cmd, int argc, char *argv[])
if (strcasecmp (cmd, "mount_vfs") == 0 || strcasecmp (cmd, "mount-vfs") == 0)
return run_mount_vfs (cmd, argc, argv);
else
+ if (strcasecmp (cmd, "debug") == 0)
+ return run_debug (cmd, argc, argv);
+ else
{
fprintf (stderr, "%s: unknown command\n", cmd);
return -1;
diff --git a/fish/completion.c b/fish/completion.c
index 8c4f3ad3..8e529810 100644
--- a/fish/completion.c
+++ b/fish/completion.c
@@ -69,6 +69,7 @@ static const char *commands[] = {
"command",
"command-lines",
"config",
+ "debug",
"download",
"exists",
"file",
diff --git a/guestfish-actions.pod b/guestfish-actions.pod
index 87ba0181..a79e3363 100644
--- a/guestfish-actions.pod
+++ b/guestfish-actions.pod
@@ -403,6 +403,18 @@ The first character of C<param> string must be a C<-> (dash).
C<value> can be NULL.
+=head2 debug
+
+ debug subcmd 'extraargs ...'
+
+The C<debug> command exposes some internals of
+C<guestfsd> (the guestfs daemon) that runs inside the
+qemu subprocess.
+
+There is no comprehensive help for this command. You have
+to look at the file C<daemon/debug.c> in the libguestfs source
+to find out what you can do.
+
=head2 download
download remotefilename (filename|-)
diff --git a/guestfs-actions.pod b/guestfs-actions.pod
index dcc8b50d..b945454a 100644
--- a/guestfs-actions.pod
+++ b/guestfs-actions.pod
@@ -522,6 +522,23 @@ C<value> can be NULL.
This function returns 0 on success or -1 on error.
+=head2 guestfs_debug
+
+ char *guestfs_debug (guestfs_h *handle,
+ const char *subcmd,
+ char * const* const extraargs);
+
+The C<guestfs_debug> command exposes some internals of
+C<guestfsd> (the guestfs daemon) that runs inside the
+qemu subprocess.
+
+There is no comprehensive help for this command. You have
+to look at the file C<daemon/debug.c> in the libguestfs source
+to find out what you can do.
+
+This function returns a string, or NULL on error.
+I<The caller must free the returned string after use>.
+
=head2 guestfs_download
int guestfs_download (guestfs_h *handle,
diff --git a/java/com/redhat/et/libguestfs/GuestFS.java b/java/com/redhat/et/libguestfs/GuestFS.java
index bb6c8d70..f1cd508b 100644
--- a/java/com/redhat/et/libguestfs/GuestFS.java
+++ b/java/com/redhat/et/libguestfs/GuestFS.java
@@ -2186,4 +2186,27 @@ public class GuestFS {
private native void _mount_vfs (long g, String options, String vfstype, String device, String mountpoint)
throws LibGuestFSException;
+ /**
+ * debugging and internals
+ *
+ * The "g.debug" command exposes some internals of
+ * "guestfsd" (the guestfs daemon) that runs inside the
+ * qemu subprocess.
+ *
+ * There is no comprehensive help for this command. You
+ * have to look at the file "daemon/debug.c" in the
+ * libguestfs source to find out what you can do.
+ *
+ * @throws LibGuestFSException
+ */
+ public String debug (String subcmd, String[] extraargs)
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("debug: handle is closed");
+ return _debug (g, subcmd, extraargs);
+ }
+ private native String _debug (long g, String subcmd, String[] extraargs)
+ throws LibGuestFSException;
+
}
diff --git a/java/com_redhat_et_libguestfs_GuestFS.c b/java/com_redhat_et_libguestfs_GuestFS.c
index 81435d90..4b96c262 100644
--- a/java/com_redhat_et_libguestfs_GuestFS.c
+++ b/java/com_redhat_et_libguestfs_GuestFS.c
@@ -2230,3 +2230,39 @@ Java_com_redhat_et_libguestfs_GuestFS__1mount_1vfs
}
}
+JNIEXPORT jstring JNICALL
+Java_com_redhat_et_libguestfs_GuestFS__1debug
+ (JNIEnv *env, jobject obj, jlong jg, jstring jsubcmd, jobjectArray jextraargs)
+{
+ guestfs_h *g = (guestfs_h *) (long) jg;
+ jstring jr;
+ char *r;
+ const char *subcmd;
+ int extraargs_len;
+ const char **extraargs;
+ int i;
+
+ subcmd = (*env)->GetStringUTFChars (env, jsubcmd, NULL);
+ extraargs_len = (*env)->GetArrayLength (env, jextraargs);
+ extraargs = malloc (sizeof (char *) * (extraargs_len+1));
+ for (i = 0; i < extraargs_len; ++i) {
+ jobject o = (*env)->GetObjectArrayElement (env, jextraargs, i);
+ extraargs[i] = (*env)->GetStringUTFChars (env, o, NULL);
+ }
+ extraargs[extraargs_len] = NULL;
+ r = guestfs_debug (g, subcmd, extraargs);
+ (*env)->ReleaseStringUTFChars (env, jsubcmd, subcmd);
+ for (i = 0; i < extraargs_len; ++i) {
+ jobject o = (*env)->GetObjectArrayElement (env, jextraargs, i);
+ (*env)->ReleaseStringUTFChars (env, o, extraargs[i]);
+ }
+ free (extraargs);
+ if (r == NULL) {
+ throw_exception (env, guestfs_last_error (g));
+ return NULL;
+ }
+ jr = (*env)->NewStringUTF (env, r);
+ free (r);
+ return jr;
+}
+
diff --git a/ocaml/guestfs.ml b/ocaml/guestfs.ml
index 96ec6e39..c3305e45 100644
--- a/ocaml/guestfs.ml
+++ b/ocaml/guestfs.ml
@@ -211,3 +211,4 @@ external tgz_out : t -> string -> string -> unit = "ocaml_guestfs_tgz_out"
external mount_ro : t -> string -> string -> unit = "ocaml_guestfs_mount_ro"
external mount_options : t -> string -> string -> string -> unit = "ocaml_guestfs_mount_options"
external mount_vfs : t -> string -> string -> string -> string -> unit = "ocaml_guestfs_mount_vfs"
+external debug : t -> string -> string array -> string = "ocaml_guestfs_debug"
diff --git a/ocaml/guestfs.mli b/ocaml/guestfs.mli
index a332f0b4..846332ca 100644
--- a/ocaml/guestfs.mli
+++ b/ocaml/guestfs.mli
@@ -412,3 +412,6 @@ val mount_options : t -> string -> string -> string -> unit
val mount_vfs : t -> string -> string -> string -> string -> unit
(** mount a guest disk with mount options and vfstype *)
+val debug : t -> string -> string array -> string
+(** debugging and internals *)
+
diff --git a/ocaml/guestfs_c_actions.c b/ocaml/guestfs_c_actions.c
index acf8f922..c396a8a8 100644
--- a/ocaml/guestfs_c_actions.c
+++ b/ocaml/guestfs_c_actions.c
@@ -2608,3 +2608,29 @@ ocaml_guestfs_mount_vfs (value gv, value optionsv, value vfstypev, value devicev
CAMLreturn (rv);
}
+CAMLprim value
+ocaml_guestfs_debug (value gv, value subcmdv, value extraargsv)
+{
+ CAMLparam3 (gv, subcmdv, extraargsv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("debug: used handle after closing it");
+
+ const char *subcmd = String_val (subcmdv);
+ char **extraargs = ocaml_guestfs_strings_val (extraargsv);
+ char *r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_debug (g, subcmd, extraargs);
+ caml_leave_blocking_section ();
+ ocaml_guestfs_free_strings (extraargs);
+ if (r == NULL)
+ ocaml_guestfs_raise_error (g, "debug");
+
+ rv = caml_copy_string (r);
+ free (r);
+ CAMLreturn (rv);
+}
+
diff --git a/perl/Guestfs.xs b/perl/Guestfs.xs
index fe2c81c9..be13fcde 100644
--- a/perl/Guestfs.xs
+++ b/perl/Guestfs.xs
@@ -1468,3 +1468,20 @@ PREINIT:
if (r == -1)
croak ("mount_vfs: %s", guestfs_last_error (g));
+SV *
+debug (g, subcmd, extraargs)
+ guestfs_h *g;
+ char *subcmd;
+ char **extraargs;
+PREINIT:
+ char *result;
+ CODE:
+ result = guestfs_debug (g, subcmd, extraargs);
+ free (extraargs);
+ if (result == NULL)
+ croak ("debug: %s", guestfs_last_error (g));
+ RETVAL = newSVpv (result, 0);
+ free (result);
+ OUTPUT:
+ RETVAL
+
diff --git a/perl/lib/Sys/Guestfs.pm b/perl/lib/Sys/Guestfs.pm
index ea826592..3d1493b5 100644
--- a/perl/lib/Sys/Guestfs.pm
+++ b/perl/lib/Sys/Guestfs.pm
@@ -432,6 +432,16 @@ The first character of C<param> string must be a C<-> (dash).
C<value> can be NULL.
+=item $result = $h->debug ($subcmd, \@extraargs);
+
+The C<$h-E<gt>debug> command exposes some internals of
+C<guestfsd> (the guestfs daemon) that runs inside the
+qemu subprocess.
+
+There is no comprehensive help for this command. You have
+to look at the file C<daemon/debug.c> in the libguestfs source
+to find out what you can do.
+
=item $h->download ($remotefilename, $filename);
Download file C<remotefilename> and save it as C<filename>
diff --git a/python/guestfs-py.c b/python/guestfs-py.c
index 59f0b6e4..0022b5b5 100644
--- a/python/guestfs-py.c
+++ b/python/guestfs-py.c
@@ -2795,6 +2795,36 @@ py_guestfs_mount_vfs (PyObject *self, PyObject *args)
return py_r;
}
+static PyObject *
+py_guestfs_debug (PyObject *self, PyObject *args)
+{
+ PyObject *py_g;
+ guestfs_h *g;
+ PyObject *py_r;
+ char *r;
+ const char *subcmd;
+ PyObject *py_extraargs;
+ const char **extraargs;
+
+ if (!PyArg_ParseTuple (args, (char *) "OsO:guestfs_debug",
+ &py_g, &subcmd, &py_extraargs))
+ return NULL;
+ g = get_handle (py_g);
+ extraargs = get_string_list (py_extraargs);
+ if (!extraargs) return NULL;
+
+ r = guestfs_debug (g, subcmd, extraargs);
+ free (extraargs);
+ if (r == NULL) {
+ PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
+ return NULL;
+ }
+
+ py_r = PyString_FromString (r);
+ free (r);
+ return py_r;
+}
+
static PyMethodDef methods[] = {
{ (char *) "create", py_guestfs_create, METH_VARARGS, NULL },
{ (char *) "close", py_guestfs_close, METH_VARARGS, NULL },
@@ -2894,6 +2924,7 @@ static PyMethodDef methods[] = {
{ (char *) "mount_ro", py_guestfs_mount_ro, METH_VARARGS, NULL },
{ (char *) "mount_options", py_guestfs_mount_options, METH_VARARGS, NULL },
{ (char *) "mount_vfs", py_guestfs_mount_vfs, METH_VARARGS, NULL },
+ { (char *) "debug", py_guestfs_debug, METH_VARARGS, NULL },
{ NULL, NULL, 0, NULL }
};
diff --git a/python/guestfs.py b/python/guestfs.py
index 7515aa75..b2c3e49a 100644
--- a/python/guestfs.py
+++ b/python/guestfs.py
@@ -1075,3 +1075,14 @@ class GuestFS:
"""
return libguestfsmod.mount_vfs (self._o, options, vfstype, device, mountpoint)
+ def debug (self, subcmd, extraargs):
+ u"""The "g.debug" command exposes some internals of
+ "guestfsd" (the guestfs daemon) that runs inside the
+ qemu subprocess.
+
+ There is no comprehensive help for this command. You
+ have to look at the file "daemon/debug.c" in the
+ libguestfs source to find out what you can do.
+ """
+ return libguestfsmod.debug (self._o, subcmd, extraargs)
+
diff --git a/ruby/ext/guestfs/_guestfs.c b/ruby/ext/guestfs/_guestfs.c
index 89eb6afd..07b02287 100644
--- a/ruby/ext/guestfs/_guestfs.c
+++ b/ruby/ext/guestfs/_guestfs.c
@@ -2318,6 +2318,39 @@ static VALUE ruby_guestfs_mount_vfs (VALUE gv, VALUE optionsv, VALUE vfstypev, V
return Qnil;
}
+static VALUE ruby_guestfs_debug (VALUE gv, VALUE subcmdv, VALUE extraargsv)
+{
+ guestfs_h *g;
+ Data_Get_Struct (gv, guestfs_h, g);
+ if (!g)
+ rb_raise (rb_eArgError, "%s: used handle after closing it", "debug");
+
+ const char *subcmd = StringValueCStr (subcmdv);
+ if (!subcmd)
+ rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
+ "subcmd", "debug");
+ char **extraargs; {
+ int i, len;
+ len = RARRAY_LEN (extraargsv);
+ extraargs = malloc (sizeof (char *) * (len+1));
+ for (i = 0; i < len; ++i) {
+ VALUE v = rb_ary_entry (extraargsv, i);
+ extraargs[i] = StringValueCStr (v);
+ }
+ }
+
+ char *r;
+
+ r = guestfs_debug (g, subcmd, extraargs);
+ free (extraargs);
+ if (r == NULL)
+ rb_raise (e_Error, "%s", guestfs_last_error (g));
+
+ VALUE rv = rb_str_new2 (r);
+ free (r);
+ return rv;
+}
+
/* Initialize the module. */
void Init__guestfs ()
{
@@ -2520,4 +2553,6 @@ void Init__guestfs ()
ruby_guestfs_mount_options, 3);
rb_define_method (c_guestfs, "mount_vfs",
ruby_guestfs_mount_vfs, 4);
+ rb_define_method (c_guestfs, "debug",
+ ruby_guestfs_debug, 2);
}
diff --git a/src/guestfs-actions.c b/src/guestfs-actions.c
index ae8afcfc..e143c27b 100644
--- a/src/guestfs-actions.c
+++ b/src/guestfs-actions.c
@@ -6389,3 +6389,91 @@ int guestfs_mount_vfs (guestfs_h *g,
return 0;
}
+struct debug_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 = send called,
+ * 1001 = reply called.
+ */
+ int cb_sequence;
+ struct guestfs_message_header hdr;
+ struct guestfs_message_error err;
+ struct guestfs_debug_ret ret;
+};
+
+static void debug_reply_cb (guestfs_h *g, void *data, XDR *xdr)
+{
+ guestfs_main_loop *ml = guestfs_get_main_loop (g);
+ struct debug_ctx *ctx = (struct debug_ctx *) data;
+
+ ml->main_loop_quit (ml, g);
+
+ if (!xdr_guestfs_message_header (xdr, &ctx->hdr)) {
+ error (g, "%s: failed to parse reply header", "guestfs_debug");
+ 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_debug");
+ return;
+ }
+ goto done;
+ }
+ if (!xdr_guestfs_debug_ret (xdr, &ctx->ret)) {
+ error (g, "%s: failed to parse reply", "guestfs_debug");
+ return;
+ }
+ done:
+ ctx->cb_sequence = 1001;
+}
+
+char *guestfs_debug (guestfs_h *g,
+ const char *subcmd,
+ char * const* const extraargs)
+{
+ struct guestfs_debug_args args;
+ struct debug_ctx ctx;
+ guestfs_main_loop *ml = guestfs_get_main_loop (g);
+ int serial;
+
+ if (check_state (g, "guestfs_debug") == -1) return NULL;
+ guestfs_set_busy (g);
+
+ memset (&ctx, 0, sizeof ctx);
+
+ args.subcmd = (char *) subcmd;
+ args.extraargs.extraargs_val = (char **) extraargs;
+ for (args.extraargs.extraargs_len = 0; extraargs[args.extraargs.extraargs_len]; args.extraargs.extraargs_len++) ;
+ serial = guestfs__send_sync (g, GUESTFS_PROC_DEBUG,
+ (xdrproc_t) xdr_guestfs_debug_args, (char *) &args);
+ if (serial == -1) {
+ guestfs_set_ready (g);
+ return NULL;
+ }
+
+ guestfs__switch_to_receiving (g);
+ ctx.cb_sequence = 0;
+ guestfs_set_reply_callback (g, debug_reply_cb, &ctx);
+ (void) ml->main_loop_run (ml, g);
+ guestfs_set_reply_callback (g, NULL, NULL);
+ if (ctx.cb_sequence != 1001) {
+ error (g, "%s reply failed, see earlier error messages", "guestfs_debug");
+ guestfs_set_ready (g);
+ return NULL;
+ }
+
+ if (check_reply_header (g, &ctx.hdr, GUESTFS_PROC_DEBUG, serial) == -1) {
+ guestfs_set_ready (g);
+ return NULL;
+ }
+
+ if (ctx.hdr.status == GUESTFS_STATUS_ERROR) {
+ error (g, "%s", ctx.err.error_message);
+ guestfs_set_ready (g);
+ return NULL;
+ }
+
+ guestfs_set_ready (g);
+ return ctx.ret.result; /* caller will free */
+}
+
diff --git a/src/guestfs-actions.h b/src/guestfs-actions.h
index 756b678f..51905285 100644
--- a/src/guestfs-actions.h
+++ b/src/guestfs-actions.h
@@ -115,3 +115,4 @@ extern int guestfs_tgz_out (guestfs_h *handle, const char *directory, const char
extern int guestfs_mount_ro (guestfs_h *handle, const char *device, const char *mountpoint);
extern int guestfs_mount_options (guestfs_h *handle, const char *options, const char *device, const char *mountpoint);
extern int guestfs_mount_vfs (guestfs_h *handle, const char *options, const char *vfstype, const char *device, const char *mountpoint);
+extern char *guestfs_debug (guestfs_h *handle, const char *subcmd, char * const* const extraargs);
diff --git a/src/guestfs_protocol.c b/src/guestfs_protocol.c
index 65eb5fca..5bde2b97 100644
--- a/src/guestfs_protocol.c
+++ b/src/guestfs_protocol.c
@@ -1311,6 +1311,29 @@ xdr_guestfs_mount_vfs_args (XDR *xdrs, guestfs_mount_vfs_args *objp)
}
bool_t
+xdr_guestfs_debug_args (XDR *xdrs, guestfs_debug_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, &objp->subcmd, ~0))
+ return FALSE;
+ if (!xdr_array (xdrs, (char **)&objp->extraargs.extraargs_val, (u_int *) &objp->extraargs.extraargs_len, ~0,
+ sizeof (str), (xdrproc_t) xdr_str))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_guestfs_debug_ret (XDR *xdrs, guestfs_debug_ret *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, &objp->result, ~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 8803b3d7..2a8d9194 100644
--- a/src/guestfs_protocol.h
+++ b/src/guestfs_protocol.h
@@ -678,6 +678,20 @@ struct guestfs_mount_vfs_args {
};
typedef struct guestfs_mount_vfs_args guestfs_mount_vfs_args;
+struct guestfs_debug_args {
+ char *subcmd;
+ struct {
+ u_int extraargs_len;
+ str *extraargs_val;
+ } extraargs;
+};
+typedef struct guestfs_debug_args guestfs_debug_args;
+
+struct guestfs_debug_ret {
+ char *result;
+};
+typedef struct guestfs_debug_ret guestfs_debug_ret;
+
enum guestfs_procedure {
GUESTFS_PROC_MOUNT = 1,
GUESTFS_PROC_SYNC = 2,
@@ -754,7 +768,8 @@ enum guestfs_procedure {
GUESTFS_PROC_MOUNT_RO = 73,
GUESTFS_PROC_MOUNT_OPTIONS = 74,
GUESTFS_PROC_MOUNT_VFS = 75,
- GUESTFS_PROC_NR_PROCS = 75 + 1,
+ GUESTFS_PROC_DEBUG = 76,
+ GUESTFS_PROC_NR_PROCS = 76 + 1,
};
typedef enum guestfs_procedure guestfs_procedure;
#define GUESTFS_MESSAGE_MAX 4194304
@@ -908,6 +923,8 @@ extern bool_t xdr_guestfs_tgz_out_args (XDR *, guestfs_tgz_out_args*);
extern bool_t xdr_guestfs_mount_ro_args (XDR *, guestfs_mount_ro_args*);
extern bool_t xdr_guestfs_mount_options_args (XDR *, guestfs_mount_options_args*);
extern bool_t xdr_guestfs_mount_vfs_args (XDR *, guestfs_mount_vfs_args*);
+extern bool_t xdr_guestfs_debug_args (XDR *, guestfs_debug_args*);
+extern bool_t xdr_guestfs_debug_ret (XDR *, guestfs_debug_ret*);
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*);
@@ -1020,6 +1037,8 @@ extern bool_t xdr_guestfs_tgz_out_args ();
extern bool_t xdr_guestfs_mount_ro_args ();
extern bool_t xdr_guestfs_mount_options_args ();
extern bool_t xdr_guestfs_mount_vfs_args ();
+extern bool_t xdr_guestfs_debug_args ();
+extern bool_t xdr_guestfs_debug_ret ();
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 3cf4df34..7f0793f4 100644
--- a/src/guestfs_protocol.x
+++ b/src/guestfs_protocol.x
@@ -526,6 +526,15 @@ struct guestfs_mount_vfs_args {
string mountpoint<>;
};
+struct guestfs_debug_args {
+ string subcmd<>;
+ str extraargs<>;
+};
+
+struct guestfs_debug_ret {
+ string result<>;
+};
+
enum guestfs_procedure {
GUESTFS_PROC_MOUNT = 1,
GUESTFS_PROC_SYNC = 2,
@@ -602,6 +611,7 @@ enum guestfs_procedure {
GUESTFS_PROC_MOUNT_RO = 73,
GUESTFS_PROC_MOUNT_OPTIONS = 74,
GUESTFS_PROC_MOUNT_VFS = 75,
+ GUESTFS_PROC_DEBUG = 76,
GUESTFS_PROC_NR_PROCS
};
diff --git a/tests.c b/tests.c
index 9c102cdf..be32e668 100644
--- a/tests.c
+++ b/tests.c
@@ -107,6 +107,7 @@ static void no_test_warnings (void)
fprintf (stderr, "warning: \"guestfs_tgz_out\" has no tests\n");
fprintf (stderr, "warning: \"guestfs_mount_options\" has no tests\n");
fprintf (stderr, "warning: \"guestfs_mount_vfs\" has no tests\n");
+ fprintf (stderr, "warning: \"guestfs_debug\" has no tests\n");
}
static int test_mount_ro_0 (void)