From: Anthony Liguori <anthony@codemonkey.ws>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/4] QemuOpts: dump config.
Date: Wed, 14 Oct 2009 13:56:34 -0500 [thread overview]
Message-ID: <4AD61EE2.1030700@codemonkey.ws> (raw)
In-Reply-To: <1255509568-10635-3-git-send-email-kraxel@redhat.com>
Gerd Hoffmann wrote:
> Add a function to write the QemuOpts configuration to a git-style
> config file.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
> 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
next prev parent reply other threads:[~2009-10-14 18:56 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-14 8:39 [Qemu-devel] [PATCH 0/4] QemuOpts: config file support Gerd Hoffmann
2009-10-14 8:39 ` [Qemu-devel] [PATCH 1/4] QemuOpts: add find_list() Gerd Hoffmann
2009-10-14 8:39 ` [Qemu-devel] [PATCH 2/4] QemuOpts: dump config Gerd Hoffmann
2009-10-14 18:56 ` Anthony Liguori [this message]
2009-10-14 8:39 ` [Qemu-devel] [PATCH 3/4] QemuOpts: parse config from file Gerd Hoffmann
2009-10-14 18:55 ` Anthony Liguori
2009-10-14 8:39 ` [Qemu-devel] [PATCH 4/4] QemuOpts: command line switches for the config file Gerd Hoffmann
2009-10-16 18:39 ` Nathan Baum
2009-10-16 19:29 ` Gerd Hoffmann
2009-10-16 18:48 ` Nathan Baum
2009-10-16 19:33 ` Gerd Hoffmann
2009-10-14 18:53 ` [Qemu-devel] [PATCH 0/4] QemuOpts: config file support Anthony Liguori
2009-10-14 19:01 ` Anthony Liguori
2009-10-16 10:16 ` Gerd Hoffmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4AD61EE2.1030700@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).