From: Markus Armbruster <armbru@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/3] blkdebug: Free QemuOpts after having read the config
Date: Thu, 01 Jul 2010 08:47:09 +0200 [thread overview]
Message-ID: <m3zkyblmvm.fsf@blackfin.pond.sub.org> (raw)
In-Reply-To: <1277912914-21771-3-git-send-email-kwolf@redhat.com> (Kevin Wolf's message of "Wed, 30 Jun 2010 17:48:33 +0200")
Kevin Wolf <kwolf@redhat.com> writes:
> Forgetting to free them means that the next instance inherits all rules and
> gets its own rules only additionally.
I also found a use for freeing a complete QemuOptsList, here's my
solution. The code that needs it isn't ready, yet. If you'd like to
use it, I can push it to my repo.
diff --git a/qemu-option.c b/qemu-option.c
index 7f70d0f..30327d4 100644
--- a/qemu-option.c
+++ b/qemu-option.c
@@ -719,6 +719,15 @@ QemuOpts *qemu_opts_create(QemuOptsList *list, const char *id, int fail_if_exist
return opts;
}
+void qemu_opts_reset(QemuOptsList *list)
+{
+ QemuOpts *opts, *next_opts;
+
+ QTAILQ_FOREACH_SAFE(opts, &list->head, next, next_opts) {
+ qemu_opts_del(opts);
+ }
+}
+
int qemu_opts_set(QemuOptsList *list, const char *id,
const char *name, const char *value)
{
diff --git a/qemu-option.h b/qemu-option.h
index 4823219..9e2406c 100644
--- a/qemu-option.h
+++ b/qemu-option.h
@@ -115,6 +115,7 @@ int qemu_opt_foreach(QemuOpts *opts, qemu_opt_loopfunc func, void *opaque,
QemuOpts *qemu_opts_find(QemuOptsList *list, const char *id);
QemuOpts *qemu_opts_create(QemuOptsList *list, const char *id, int fail_if_exists);
+void qemu_opts_reset(QemuOptsList *list);
int qemu_opts_set(QemuOptsList *list, const char *id,
const char *name, const char *value);
const char *qemu_opts_id(QemuOpts *opts);
next prev parent reply other threads:[~2010-07-01 6:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-30 15:48 [Qemu-devel] [PATCH 0/3] blkdebug: Fix config with multiple states Kevin Wolf
2010-06-30 15:48 ` [Qemu-devel] [PATCH 1/3] blkdebug: Fix set_state_opts definition Kevin Wolf
2010-06-30 15:48 ` [Qemu-devel] [PATCH 2/3] blkdebug: Free QemuOpts after having read the config Kevin Wolf
2010-07-01 6:47 ` Markus Armbruster [this message]
2010-07-01 7:29 ` Kevin Wolf
2010-06-30 15:48 ` [Qemu-devel] [PATCH 3/3] blkdebug: Initialize state as 1 Kevin Wolf
2010-07-01 6:50 ` [Qemu-devel] [PATCH 0/3] blkdebug: Fix config with multiple states Markus Armbruster
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=m3zkyblmvm.fsf@blackfin.pond.sub.org \
--to=armbru@redhat.com \
--cc=kwolf@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.