summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2009-05-01 11:27:52 +0100
committerRichard W.M. Jones <rjones@redhat.com>2009-05-01 11:27:52 +0100
commit24bee20ce4196d45891925332a47a05aa5e40938 (patch)
tree434b56343dde38ae0c877cab236ada753e2f8549
parent8c60f5c681b5d7cf90bc798fcaf94cd4e242e27f (diff)
downloadlibguestfs-24bee20ce4196d45891925332a47a05aa5e40938.tar.gz
libguestfs-24bee20ce4196d45891925332a47a05aa5e40938.tar.xz
libguestfs-24bee20ce4196d45891925332a47a05aa5e40938.zip
Generated code for dmesg command.
-rw-r--r--daemon/actions.h1
-rw-r--r--daemon/stubs.c19
-rw-r--r--fish/cmds.c22
-rw-r--r--fish/completion.c1
-rw-r--r--guestfish-actions.pod13
-rw-r--r--guestfs-actions.pod16
-rw-r--r--java/com/redhat/et/libguestfs/GuestFS.java24
-rw-r--r--java/com_redhat_et_libguestfs_GuestFS.c18
-rw-r--r--ocaml/guestfs.ml1
-rw-r--r--ocaml/guestfs.mli3
-rw-r--r--ocaml/guestfs_c_actions.c23
-rw-r--r--perl/Guestfs.xs14
-rw-r--r--perl/lib/Sys/Guestfs.pm11
-rw-r--r--python/guestfs-py.c25
-rw-r--r--python/guestfs.py12
-rw-r--r--ruby/ext/guestfs/_guestfs.c21
-rw-r--r--src/guestfs-actions.c87
-rw-r--r--src/guestfs-actions.h1
-rw-r--r--src/guestfs_protocol.c10
-rw-r--r--src/guestfs_protocol.h10
-rw-r--r--src/guestfs_protocol.x5
-rw-r--r--tests.c37
22 files changed, 372 insertions, 2 deletions
diff --git a/daemon/actions.h b/daemon/actions.h
index 11253f8e..dbc2bbd0 100644
--- a/daemon/actions.h
+++ b/daemon/actions.h
@@ -111,3 +111,4 @@ extern int do_cp (const char *src, const char *dest);
extern int do_cp_a (const char *src, const char *dest);
extern int do_mv (const char *src, const char *dest);
extern int do_drop_caches (int whattodrop);
+extern char *do_dmesg (void);
diff --git a/daemon/stubs.c b/daemon/stubs.c
index 64d66a96..c21eecf6 100644
--- a/daemon/stubs.c
+++ b/daemon/stubs.c
@@ -2255,6 +2255,22 @@ done:
xdr_free ((xdrproc_t) xdr_guestfs_drop_caches_args, (char *) &args);
}
+static void dmesg_stub (XDR *xdr_in)
+{
+ char *r;
+
+ r = do_dmesg ();
+ if (r == NULL)
+ /* do_dmesg has already called reply_with_error */
+ goto done;
+
+ struct guestfs_dmesg_ret ret;
+ ret.kmsgs = r;
+ reply ((xdrproc_t) &xdr_guestfs_dmesg_ret, (char *) &ret);
+ free (r);
+done: ;
+}
+
void dispatch_incoming_message (XDR *xdr_in)
{
switch (proc_nr) {
@@ -2528,6 +2544,9 @@ void dispatch_incoming_message (XDR *xdr_in)
case GUESTFS_PROC_DROP_CACHES:
drop_caches_stub (xdr_in);
break;
+ case GUESTFS_PROC_DMESG:
+ dmesg_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 4529d291..561018ab 100644
--- a/fish/cmds.c
+++ b/fish/cmds.c
@@ -66,6 +66,7 @@ void list_commands (void)
printf ("%-20s %s\n", "cp", "copy a file");
printf ("%-20s %s\n", "cp-a", "copy a file or directory recursively");
printf ("%-20s %s\n", "debug", "debugging and internals");
+ printf ("%-20s %s\n", "dmesg", "return kernel messages");
printf ("%-20s %s\n", "download", "download a file to the local machine");
printf ("%-20s %s\n", "drop-caches", "drop kernel page cache, dentries and inodes");
printf ("%-20s %s\n", "exists", "test if file or directory exists");
@@ -468,6 +469,9 @@ void display_command (const char *cmd)
if (strcasecmp (cmd, "drop_caches") == 0 || strcasecmp (cmd, "drop-caches") == 0)
pod2text ("drop-caches - drop kernel page cache, dentries and inodes", " drop-caches <whattodrop>\n\nThis instructs the guest kernel to drop its page cache,\nand/or dentries and inode caches. The parameter C<whattodrop>\ntells the kernel what precisely to drop, see\nL<http://linux-mm.org/Drop_Caches>\n\nSetting C<whattodrop> to 3 should drop everything.\n\nThis automatically calls L<sync(2)> before the operation,\nso that the maximum guest memory is freed.");
else
+ if (strcasecmp (cmd, "dmesg") == 0)
+ pod2text ("dmesg - return kernel messages", " dmesg\n\nThis returns the kernel messages (C<dmesg> output) from\nthe guest kernel. This is sometimes useful for extended\ndebugging of problems.\n\nAnother way to get the same information is to enable\nverbose messages with C<set_verbose> or by setting\nthe environment variable C<LIBGUESTFS_DEBUG=1> before\nrunning the program.");
+ else
display_builtin_command (cmd);
}
@@ -2280,6 +2284,21 @@ static int run_drop_caches (const char *cmd, int argc, char *argv[])
return r;
}
+static int run_dmesg (const char *cmd, int argc, char *argv[])
+{
+ char *r;
+ if (argc != 0) {
+ fprintf (stderr, "%s should have 0 parameter(s)\n", cmd);
+ fprintf (stderr, "type 'help %s' for help on %s\n", cmd, cmd);
+ return -1;
+ }
+ r = guestfs_dmesg (g);
+ 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)
@@ -2606,6 +2625,9 @@ int run_action (const char *cmd, int argc, char *argv[])
if (strcasecmp (cmd, "drop_caches") == 0 || strcasecmp (cmd, "drop-caches") == 0)
return run_drop_caches (cmd, argc, argv);
else
+ if (strcasecmp (cmd, "dmesg") == 0)
+ return run_dmesg (cmd, argc, argv);
+ else
{
fprintf (stderr, "%s: unknown command\n", cmd);
return -1;
diff --git a/fish/completion.c b/fish/completion.c
index e2c97805..f1abc0ba 100644
--- a/fish/completion.c
+++ b/fish/completion.c
@@ -72,6 +72,7 @@ static const char *const commands[] = {
"cp",
"cp-a",
"debug",
+ "dmesg",
"download",
"drop-caches",
"exists",
diff --git a/guestfish-actions.pod b/guestfish-actions.pod
index c31905a9..d04a6633 100644
--- a/guestfish-actions.pod
+++ b/guestfish-actions.pod
@@ -429,6 +429,19 @@ 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 dmesg
+
+ dmesg
+
+This returns the kernel messages (C<dmesg> output) from
+the guest kernel. This is sometimes useful for extended
+debugging of problems.
+
+Another way to get the same information is to enable
+verbose messages with C<set-verbose> or by setting
+the environment variable C<LIBGUESTFS_DEBUG=1> before
+running the program.
+
=head2 download
download remotefilename (filename|-)
diff --git a/guestfs-actions.pod b/guestfs-actions.pod
index b3daa054..f1b59649 100644
--- a/guestfs-actions.pod
+++ b/guestfs-actions.pod
@@ -561,6 +561,22 @@ 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_dmesg
+
+ char *guestfs_dmesg (guestfs_h *handle);
+
+This returns the kernel messages (C<dmesg> output) from
+the guest kernel. This is sometimes useful for extended
+debugging of problems.
+
+Another way to get the same information is to enable
+verbose messages with C<guestfs_set_verbose> or by setting
+the environment variable C<LIBGUESTFS_DEBUG=1> before
+running the program.
+
+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 c29789c0..f56ae415 100644
--- a/java/com/redhat/et/libguestfs/GuestFS.java
+++ b/java/com/redhat/et/libguestfs/GuestFS.java
@@ -2512,4 +2512,28 @@ public class GuestFS {
private native void _drop_caches (long g, int whattodrop)
throws LibGuestFSException;
+ /**
+ * return kernel messages
+ *
+ * This returns the kernel messages ("dmesg" output) from
+ * the guest kernel. This is sometimes useful for extended
+ * debugging of problems.
+ *
+ * Another way to get the same information is to enable
+ * verbose messages with "g.set_verbose" or by setting the
+ * environment variable "LIBGUESTFS_DEBUG=1" before running
+ * the program.
+ *
+ * @throws LibGuestFSException
+ */
+ public String dmesg ()
+ throws LibGuestFSException
+ {
+ if (g == 0)
+ throw new LibGuestFSException ("dmesg: handle is closed");
+ return _dmesg (g);
+ }
+ private native String _dmesg (long g)
+ throws LibGuestFSException;
+
}
diff --git a/java/com_redhat_et_libguestfs_GuestFS.c b/java/com_redhat_et_libguestfs_GuestFS.c
index ae6ff863..323402d8 100644
--- a/java/com_redhat_et_libguestfs_GuestFS.c
+++ b/java/com_redhat_et_libguestfs_GuestFS.c
@@ -2533,3 +2533,21 @@ Java_com_redhat_et_libguestfs_GuestFS__1drop_1caches
}
}
+JNIEXPORT jstring JNICALL
+Java_com_redhat_et_libguestfs_GuestFS__1dmesg
+ (JNIEnv *env, jobject obj, jlong jg)
+{
+ guestfs_h *g = (guestfs_h *) (long) jg;
+ jstring jr;
+ char *r;
+
+ r = guestfs_dmesg (g);
+ 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 e79a076b..80e1d399 100644
--- a/ocaml/guestfs.ml
+++ b/ocaml/guestfs.ml
@@ -226,3 +226,4 @@ external cp : t -> string -> string -> unit = "ocaml_guestfs_cp"
external cp_a : t -> string -> string -> unit = "ocaml_guestfs_cp_a"
external mv : t -> string -> string -> unit = "ocaml_guestfs_mv"
external drop_caches : t -> int -> unit = "ocaml_guestfs_drop_caches"
+external dmesg : t -> string = "ocaml_guestfs_dmesg"
diff --git a/ocaml/guestfs.mli b/ocaml/guestfs.mli
index 5baf9955..810c49a4 100644
--- a/ocaml/guestfs.mli
+++ b/ocaml/guestfs.mli
@@ -457,3 +457,6 @@ val mv : t -> string -> string -> unit
val drop_caches : t -> int -> unit
(** drop kernel page cache, dentries and inodes *)
+val dmesg : t -> string
+(** return kernel messages *)
+
diff --git a/ocaml/guestfs_c_actions.c b/ocaml/guestfs_c_actions.c
index d6d13053..20cb3271 100644
--- a/ocaml/guestfs_c_actions.c
+++ b/ocaml/guestfs_c_actions.c
@@ -2965,3 +2965,26 @@ ocaml_guestfs_drop_caches (value gv, value whattodropv)
CAMLreturn (rv);
}
+CAMLprim value
+ocaml_guestfs_dmesg (value gv)
+{
+ CAMLparam1 (gv);
+ CAMLlocal1 (rv);
+
+ guestfs_h *g = Guestfs_val (gv);
+ if (g == NULL)
+ caml_failwith ("dmesg: used handle after closing it");
+
+ char *r;
+
+ caml_enter_blocking_section ();
+ r = guestfs_dmesg (g);
+ caml_leave_blocking_section ();
+ if (r == NULL)
+ ocaml_guestfs_raise_error (g, "dmesg");
+
+ rv = caml_copy_string (r);
+ free (r);
+ CAMLreturn (rv);
+}
+
diff --git a/perl/Guestfs.xs b/perl/Guestfs.xs
index 1a45c796..ed8e6700 100644
--- a/perl/Guestfs.xs
+++ b/perl/Guestfs.xs
@@ -1658,3 +1658,17 @@ PREINIT:
if (r == -1)
croak ("drop_caches: %s", guestfs_last_error (g));
+SV *
+dmesg (g)
+ guestfs_h *g;
+PREINIT:
+ char *kmsgs;
+ CODE:
+ kmsgs = guestfs_dmesg (g);
+ if (kmsgs == NULL)
+ croak ("dmesg: %s", guestfs_last_error (g));
+ RETVAL = newSVpv (kmsgs, 0);
+ free (kmsgs);
+ OUTPUT:
+ RETVAL
+
diff --git a/perl/lib/Sys/Guestfs.pm b/perl/lib/Sys/Guestfs.pm
index 63a49259..01d81a6f 100644
--- a/perl/lib/Sys/Guestfs.pm
+++ b/perl/lib/Sys/Guestfs.pm
@@ -452,6 +452,17 @@ 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 $kmsgs = $h->dmesg ();
+
+This returns the kernel messages (C<dmesg> output) from
+the guest kernel. This is sometimes useful for extended
+debugging of problems.
+
+Another way to get the same information is to enable
+verbose messages with C<$h-E<gt>set_verbose> or by setting
+the environment variable C<LIBGUESTFS_DEBUG=1> before
+running the program.
+
=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 24f9ff8b..dd9f4ca3 100644
--- a/python/guestfs-py.c
+++ b/python/guestfs-py.c
@@ -3181,6 +3181,30 @@ py_guestfs_drop_caches (PyObject *self, PyObject *args)
return py_r;
}
+static PyObject *
+py_guestfs_dmesg (PyObject *self, PyObject *args)
+{
+ PyObject *py_g;
+ guestfs_h *g;
+ PyObject *py_r;
+ char *r;
+
+ if (!PyArg_ParseTuple (args, (char *) "O:guestfs_dmesg",
+ &py_g))
+ return NULL;
+ g = get_handle (py_g);
+
+ r = guestfs_dmesg (g);
+ 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 },
@@ -3295,6 +3319,7 @@ static PyMethodDef methods[] = {
{ (char *) "cp_a", py_guestfs_cp_a, METH_VARARGS, NULL },
{ (char *) "mv", py_guestfs_mv, METH_VARARGS, NULL },
{ (char *) "drop_caches", py_guestfs_drop_caches, METH_VARARGS, NULL },
+ { (char *) "dmesg", py_guestfs_dmesg, METH_VARARGS, NULL },
{ NULL, NULL, 0, NULL }
};
diff --git a/python/guestfs.py b/python/guestfs.py
index 6c425bc2..e2989223 100644
--- a/python/guestfs.py
+++ b/python/guestfs.py
@@ -1221,3 +1221,15 @@ class GuestFS:
"""
return libguestfsmod.drop_caches (self._o, whattodrop)
+ def dmesg (self):
+ u"""This returns the kernel messages ("dmesg" output) from
+ the guest kernel. This is sometimes useful for extended
+ debugging of problems.
+
+ Another way to get the same information is to enable
+ verbose messages with "g.set_verbose" or by setting the
+ environment variable "LIBGUESTFS_DEBUG=1" before running
+ the program.
+ """
+ return libguestfsmod.dmesg (self._o)
+
diff --git a/ruby/ext/guestfs/_guestfs.c b/ruby/ext/guestfs/_guestfs.c
index 12ca6ded..c0fc1804 100644
--- a/ruby/ext/guestfs/_guestfs.c
+++ b/ruby/ext/guestfs/_guestfs.c
@@ -2679,6 +2679,25 @@ static VALUE ruby_guestfs_drop_caches (VALUE gv, VALUE whattodropv)
return Qnil;
}
+static VALUE ruby_guestfs_dmesg (VALUE gv)
+{
+ guestfs_h *g;
+ Data_Get_Struct (gv, guestfs_h, g);
+ if (!g)
+ rb_raise (rb_eArgError, "%s: used handle after closing it", "dmesg");
+
+
+ char *r;
+
+ r = guestfs_dmesg (g);
+ 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 ()
{
@@ -2911,4 +2930,6 @@ void Init__guestfs ()
ruby_guestfs_mv, 2);
rb_define_method (c_guestfs, "drop_caches",
ruby_guestfs_drop_caches, 1);
+ rb_define_method (c_guestfs, "dmesg",
+ ruby_guestfs_dmesg, 0);
}
diff --git a/src/guestfs-actions.c b/src/guestfs-actions.c
index 99f8a446..94963ff0 100644
--- a/src/guestfs-actions.c
+++ b/src/guestfs-actions.c
@@ -8166,3 +8166,90 @@ int guestfs_drop_caches (guestfs_h *g,
return 0;
}
+struct dmesg_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;
+ struct guestfs_dmesg_ret ret;
+};
+
+static void dmesg_reply_cb (guestfs_h *g, void *data, XDR *xdr)
+{
+ guestfs_main_loop *ml = guestfs_get_main_loop (g);
+ struct dmesg_ctx *ctx = (struct dmesg_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_dmesg");
+ return;
+ }
+
+ ml->main_loop_quit (ml, g);
+
+ if (!xdr_guestfs_message_header (xdr, &ctx->hdr)) {
+ error (g, "%s: failed to parse reply header", "guestfs_dmesg");
+ 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_dmesg");
+ return;
+ }
+ goto done;
+ }
+ if (!xdr_guestfs_dmesg_ret (xdr, &ctx->ret)) {
+ error (g, "%s: failed to parse reply", "guestfs_dmesg");
+ return;
+ }
+ done:
+ ctx->cb_sequence = 1;
+}
+
+char *guestfs_dmesg (guestfs_h *g)
+{
+ struct dmesg_ctx ctx;
+ guestfs_main_loop *ml = guestfs_get_main_loop (g);
+ int serial;
+
+ if (check_state (g, "guestfs_dmesg") == -1) return NULL;
+ guestfs_set_busy (g);
+
+ memset (&ctx, 0, sizeof ctx);
+
+ serial = guestfs__send_sync (g, GUESTFS_PROC_DMESG, NULL, NULL);
+ if (serial == -1) {
+ guestfs_set_ready (g);
+ return NULL;
+ }
+
+ guestfs__switch_to_receiving (g);
+ ctx.cb_sequence = 0;
+ guestfs_set_reply_callback (g, dmesg_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_dmesg");
+ guestfs_set_ready (g);
+ return NULL;
+ }
+
+ if (check_reply_header (g, &ctx.hdr, GUESTFS_PROC_DMESG, 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.kmsgs; /* caller will free */
+}
+
diff --git a/src/guestfs-actions.h b/src/guestfs-actions.h
index ef4e775c..b14840c9 100644
--- a/src/guestfs-actions.h
+++ b/src/guestfs-actions.h
@@ -130,3 +130,4 @@ extern int guestfs_cp (guestfs_h *handle, const char *src, const char *dest);
extern int guestfs_cp_a (guestfs_h *handle, const char *src, const char *dest);
extern int guestfs_mv (guestfs_h *handle, const char *src, const char *dest);
extern int guestfs_drop_caches (guestfs_h *handle, int whattodrop);
+extern char *guestfs_dmesg (guestfs_h *handle);
diff --git a/src/guestfs_protocol.c b/src/guestfs_protocol.c
index 395e710f..7a40e14e 100644
--- a/src/guestfs_protocol.c
+++ b/src/guestfs_protocol.c
@@ -1518,6 +1518,16 @@ xdr_guestfs_drop_caches_args (XDR *xdrs, guestfs_drop_caches_args *objp)
}
bool_t
+xdr_guestfs_dmesg_ret (XDR *xdrs, guestfs_dmesg_ret *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, &objp->kmsgs, ~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 a3bf1855..40c84eea 100644
--- a/src/guestfs_protocol.h
+++ b/src/guestfs_protocol.h
@@ -784,6 +784,11 @@ struct guestfs_drop_caches_args {
};
typedef struct guestfs_drop_caches_args guestfs_drop_caches_args;
+struct guestfs_dmesg_ret {
+ char *kmsgs;
+};
+typedef struct guestfs_dmesg_ret guestfs_dmesg_ret;
+
enum guestfs_procedure {
GUESTFS_PROC_MOUNT = 1,
GUESTFS_PROC_SYNC = 2,
@@ -875,7 +880,8 @@ enum guestfs_procedure {
GUESTFS_PROC_CP_A = 88,
GUESTFS_PROC_MV = 89,
GUESTFS_PROC_DROP_CACHES = 90,
- GUESTFS_PROC_NR_PROCS = 90 + 1,
+ GUESTFS_PROC_DMESG = 91,
+ GUESTFS_PROC_NR_PROCS = 91 + 1,
};
typedef enum guestfs_procedure guestfs_procedure;
#define GUESTFS_MESSAGE_MAX 4194304
@@ -1048,6 +1054,7 @@ extern bool_t xdr_guestfs_cp_args (XDR *, guestfs_cp_args*);
extern bool_t xdr_guestfs_cp_a_args (XDR *, guestfs_cp_a_args*);
extern bool_t xdr_guestfs_mv_args (XDR *, guestfs_mv_args*);
extern bool_t xdr_guestfs_drop_caches_args (XDR *, guestfs_drop_caches_args*);
+extern bool_t xdr_guestfs_dmesg_ret (XDR *, guestfs_dmesg_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*);
@@ -1179,6 +1186,7 @@ extern bool_t xdr_guestfs_cp_args ();
extern bool_t xdr_guestfs_cp_a_args ();
extern bool_t xdr_guestfs_mv_args ();
extern bool_t xdr_guestfs_drop_caches_args ();
+extern bool_t xdr_guestfs_dmesg_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 68b0ac4d..4bf42be9 100644
--- a/src/guestfs_protocol.x
+++ b/src/guestfs_protocol.x
@@ -610,6 +610,10 @@ struct guestfs_drop_caches_args {
int whattodrop;
};
+struct guestfs_dmesg_ret {
+ string kmsgs<>;
+};
+
enum guestfs_procedure {
GUESTFS_PROC_MOUNT = 1,
GUESTFS_PROC_SYNC = 2,
@@ -701,6 +705,7 @@ enum guestfs_procedure {
GUESTFS_PROC_CP_A = 88,
GUESTFS_PROC_MV = 89,
GUESTFS_PROC_DROP_CACHES = 90,
+ GUESTFS_PROC_DMESG = 91,
GUESTFS_PROC_NR_PROCS
};
diff --git a/tests.c b/tests.c
index 082068a3..e494d9c3 100644
--- a/tests.c
+++ b/tests.c
@@ -112,6 +112,35 @@ static void no_test_warnings (void)
fprintf (stderr, "warning: \"guestfs_get_e2uuid\" has no tests\n");
}
+static int test_dmesg_0 (void)
+{
+ /* InitEmpty for dmesg (0) */
+ {
+ int r;
+ suppress_error = 0;
+ r = guestfs_umount_all (g);
+ if (r == -1)
+ return -1;
+ }
+ {
+ int r;
+ suppress_error = 0;
+ r = guestfs_lvm_remove_all (g);
+ if (r == -1)
+ return -1;
+ }
+ /* TestRun for dmesg (0) */
+ {
+ char *r;
+ suppress_error = 0;
+ r = guestfs_dmesg (g);
+ if (r == NULL)
+ return -1;
+ free (r);
+ }
+ return 0;
+}
+
static int test_drop_caches_0 (void)
{
/* InitEmpty for drop_caches (0) */
@@ -7263,9 +7292,15 @@ int main (int argc, char *argv[])
exit (1);
}
- nr_tests = 102;
+ nr_tests = 103;
test_num++;
+ printf ("%3d/%3d test_dmesg_0\n", test_num, nr_tests);
+ if (test_dmesg_0 () == -1) {
+ printf ("test_dmesg_0 FAILED\n");
+ failed++;
+ }
+ test_num++;
printf ("%3d/%3d test_drop_caches_0\n", test_num, nr_tests);
if (test_drop_caches_0 () == -1) {
printf ("test_drop_caches_0 FAILED\n");