Patchwork [02/22] QemuOpts: make qemu_opts_validate() store the description list for later use

login
register
mail settings
Submitter Anthony Liguori
Date June 7, 2010, 11:51 p.m.
Message ID <1275954730-8196-3-git-send-email-aliguori@us.ibm.com>
Download mbox | patch
Permalink /patch/54898/
State New
Headers show

Comments

Anthony Liguori - June 7, 2010, 11:51 p.m.
Otherwise qemu_opt_set doesn't work as expected after a validate call

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

Patch

diff --git a/qemu-option.c b/qemu-option.c
index e0cb91b..03b1ef7 100644
--- a/qemu-option.c
+++ b/qemu-option.c
@@ -525,6 +525,7 @@  struct QemuOpt {
 struct QemuOpts {
     char *id;
     QemuOptsList *list;
+    const QemuOptDesc *secondary_desc;
     Location loc;
     QTAILQ_HEAD(QemuOptHead, QemuOpt) head;
     QTAILQ_ENTRY(QemuOpts) next;
@@ -611,6 +612,10 @@  int qemu_opt_set(QemuOpts *opts, const char *name, const char *value)
     const QemuOptDesc *desc = opts->list->desc;
     int i;
 
+    if (desc[0].name == NULL && opts->secondary_desc) {
+        desc = opts->secondary_desc;
+    }
+
     for (i = 0; desc[i].name != NULL; i++) {
         if (strcmp(desc[i].name, name) == 0) {
             break;
@@ -927,6 +932,8 @@  int qemu_opts_validate(QemuOpts *opts, const QemuOptDesc *desc)
         }
     }
 
+    opts->secondary_desc = desc;
+
     return 0;
 }