aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2009-07-31 12:25:32 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-08-10 13:05:25 -0500
commit48026075aeca1dc62599a4aaae844edff9679cb4 (patch)
tree7b95f12a30f74a4532f9c618d9e654b1aeb600d8 /qemu-option.c
parentFix symfind. (diff)
downloadqemu-kvm-48026075aeca1dc62599a4aaae844edff9679cb4.tar.gz
qemu-kvm-48026075aeca1dc62599a4aaae844edff9679cb4.tar.bz2
qemu-kvm-48026075aeca1dc62599a4aaae844edff9679cb4.zip
QemuOpts: add some functions
qemu_opt_foreach: loop over all QemuOpts entries. qemu_opts_id: return QemuOpts id. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Message-Id:
Diffstat (limited to 'qemu-option.c')
-rw-r--r--qemu-option.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/qemu-option.c b/qemu-option.c
index 591d17899..7164ee8da 100644
--- a/qemu-option.c
+++ b/qemu-option.c
@@ -607,6 +607,20 @@ int qemu_opt_set(QemuOpts *opts, const char *name, const char *value)
return 0;
}
+int qemu_opt_foreach(QemuOpts *opts, qemu_opt_loopfunc func, void *opaque,
+ int abort_on_failure)
+{
+ QemuOpt *opt;
+ int rc = 0;
+
+ TAILQ_FOREACH(opt, &opts->head, next) {
+ rc = func(opt->name, opt->str, opaque);
+ if (abort_on_failure && rc != 0)
+ break;
+ }
+ return rc;
+}
+
QemuOpts *qemu_opts_find(QemuOptsList *list, const char *id)
{
QemuOpts *opts;
@@ -663,6 +677,11 @@ int qemu_opts_set(QemuOptsList *list, const char *id,
return qemu_opt_set(opts, name, value);
}
+const char *qemu_opts_id(QemuOpts *opts)
+{
+ return opts->id;
+}
+
void qemu_opts_del(QemuOpts *opts)
{
QemuOpt *opt;