qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/4] QemuOpts: dump config.


From: Anthony Liguori
Subject: Re: [Qemu-devel] [PATCH 2/4] QemuOpts: dump config.
Date: Wed, 14 Oct 2009 13:56:34 -0500
User-agent: Thunderbird 2.0.0.23 (X11/20090825)

Gerd Hoffmann wrote:
Add a function to write the QemuOpts configuration to a git-style
config file.

Signed-off-by: Gerd Hoffmann <address@hidden>
---
 qemu-config.c |   39 +++++++++++++++++++++++++++++++++++++++
 qemu-config.h |    2 ++
 2 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/qemu-config.c b/qemu-config.c
index f02dd42..fa236e9 100644
--- a/qemu-config.c
+++ b/qemu-config.c
@@ -238,3 +238,42 @@ int qemu_set_option(const char *str)
     return 0;
 }
+struct ConfigWriteData {
+    QemuOptsList *list;
+    FILE *fp;
+};
+
+static int config_write_opt(const char *name, const char *value, void *opaque)
+{
+    struct ConfigWriteData *data = opaque;
+
+    fprintf(data->fp, "  %s = \"%s\"\n", name, value);
+    return 0;
+}
+
+static int config_write_opts(QemuOpts *opts, void *opaque)
+{
+    struct ConfigWriteData *data = opaque;
+    const char *id = qemu_opts_id(opts);
+
+    if (id) {
+        fprintf(data->fp, "[%s \"%s\"]\n", data->list->name, id);

This id syntax is a good idea.

Regards,

Anthony Liguori




reply via email to

[Prev in Thread] Current Thread [Next in Thread]