@@ -642,6 +642,19 @@ int qemu_opt_set(QemuOpts *opts, const char *name, const char *value)
return 0;
}
+QemuOpt *qemu_opt_next(QemuOpts *opts, QemuOpt *opt)
+{
+ if (!opt) {
+ return QTAILQ_FIRST(&opts->head);
+ }
+ return QTAILQ_NEXT(opt, next);
+}
+
+const char *qemu_opt_name(QemuOpt *opt)
+{
+ return opt->name;
+}
+
int qemu_opt_foreach(QemuOpts *opts, qemu_opt_loopfunc func, void *opaque,
int abort_on_failure)
{
@@ -109,6 +109,10 @@ int qemu_opt_get_bool(QemuOpts *opts, const char *name, int defval);
uint64_t qemu_opt_get_number(QemuOpts *opts, const char *name, uint64_t defval);
uint64_t qemu_opt_get_size(QemuOpts *opts, const char *name, uint64_t defval);
int qemu_opt_set(QemuOpts *opts, const char *name, const char *value);
+
+QemuOpt *qemu_opt_next(QemuOpts *opts, QemuOpt *opt);
+const char *qemu_opt_name(QemuOpt *opt);
+
typedef int (*qemu_opt_loopfunc)(const char *name, const char *value, void *opaque);
int qemu_opt_foreach(QemuOpts *opts, qemu_opt_loopfunc func, void *opaque,
int abort_on_failure);
This is a more flexible alternative to qemu_opt_foreach(). Signed-off-by: Markus Armbruster <armbru@redhat.com> --- qemu-option.c | 13 +++++++++++++ qemu-option.h | 4 ++++ 2 files changed, 17 insertions(+), 0 deletions(-)