[Libguestfs] [PATCH 3/7] New API: debug-cmdline for printing QEMU command line (internal only).
Richard W.M. Jones
rjones at redhat.com
Wed Nov 10 11:45:58 UTC 2010
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top
-------------- next part --------------
>From eaedf025f5c45a4e05cbf25e145215d48bea8f8d Mon Sep 17 00:00:00 2001
From: Richard W.M. Jones <rjones at redhat.com>
Date: Wed, 10 Nov 2010 10:32:33 +0000
Subject: [PATCH 3/7] New API: debug-cmdline for printing QEMU command line (internal only).
This is an internal-only debugging API so may be changed or
removed at any time in the future.
---
generator/generator_actions.ml | 7 +++++++
src/launch.c | 24 ++++++++++++++++++++++++
2 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/generator/generator_actions.ml b/generator/generator_actions.ml
index b8937d0..a0a337b 100644
--- a/generator/generator_actions.ml
+++ b/generator/generator_actions.ml
@@ -1051,6 +1051,13 @@ found or the caller has not called C<guestfs_inspect_os>.
Please read L<guestfs(3)/INSPECTION> for more details.");
+ ("debug_cmdline", (RStringList "cmdline", [], []), -1, [NotInDocs],
+ [],
+ "debug the QEMU command line (internal use only)",
+ "\
+This returns the internal QEMU command line. 'debug' commands are
+not part of the formal API and can be removed or changed at any time.");
+
]
(* daemon_functions are any functions which cause some action
diff --git a/src/launch.c b/src/launch.c
index 48ddb8d..e4f4728 100644
--- a/src/launch.c
+++ b/src/launch.c
@@ -120,6 +120,30 @@ guestfs___rollback_cmdline (guestfs_h *g, int pos)
g->cmdline_size = pos;
}
+/* Internal command to return the command line. */
+char **
+guestfs__debug_cmdline (guestfs_h *g)
+{
+ int i;
+ char **r;
+
+ if (g->cmdline == NULL) {
+ r = safe_malloc (g, sizeof (char *) * 1);
+ r[0] = NULL;
+ return r;
+ }
+
+ r = safe_malloc (g, sizeof (char *) * (g->cmdline_size + 1));
+ r[0] = safe_strdup (g, g->qemu); /* g->cmdline[0] is always NULL */
+
+ for (i = 1; i < g->cmdline_size; ++i)
+ r[i] = safe_strdup (g, g->cmdline[i]);
+
+ r[g->cmdline_size] = NULL;
+
+ return r; /* caller frees */
+}
+
int
guestfs__config (guestfs_h *g,
const char *qemu_param, const char *qemu_value)
--
1.7.3.2
More information about the Libguestfs
mailing list