@@ -110,6 +110,8 @@ struct QemuOptsList {
};
const char *qemu_opt_get(QemuOpts *opts, const char *name);
+const char *qemu_opt_name_step(QemuOpts *opts, int num);
+const char *qemu_opt_step(QemuOpts *opts, int num);
/**
* qemu_opt_has_help_opt:
* @opts: options to search for a help request
@@ -541,6 +541,36 @@ void print_option_help(QEMUOptionParameter *list)
/* ------------------------------------------------------------------ */
+const char *qemu_opt_name_step(QemuOpts *opts, int num)
+{
+ QemuOpt *opt;
+ int i = 0;
+
+ QTAILQ_FOREACH_REVERSE(opt, &opts->head, QemuOptHead, next) {
+ if (i < num) {
+ i++;
+ continue;
+ }
+ return opt->name;
+ }
+ return NULL;
+}
+
+const char *qemu_opt_step(QemuOpts *opts, int num)
+{
+ QemuOpt *opt;
+ int i = 0;
+
+ QTAILQ_FOREACH_REVERSE(opt, &opts->head, QemuOptHead, next) {
+ if (i < num) {
+ i++;
+ continue;
+ }
+ return opt->str;
+ }
+ return NULL;
+}
+
static QemuOpt *qemu_opt_find(QemuOpts *opts, const char *name)
{
QemuOpt *opt;
This adds two functions, qemu_opt_step() and qemu_opt_name_step() which iterate over the comma separated stings in the QemuOpts* argument. This allows accessing multiple arguments with the same name by iterating over all of the arguments Signed-off-by: Alistair Francis <alistair.francis@xilinx.com> --- include/qemu/option.h | 2 ++ util/qemu-option.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 0 deletions(-)