yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
0a122b
From 5902165e0f08a265b0bb422f13e161bd4de37eb3 Mon Sep 17 00:00:00 2001
0a122b
From: Max Reitz <mreitz@redhat.com>
0a122b
Date: Tue, 7 Jan 2014 21:57:06 +0100
0a122b
Subject: [PATCH 01/14] option: Add assigned flag to QEMUOptionParameter
0a122b
0a122b
RH-Author: Max Reitz <mreitz@redhat.com>
0a122b
Message-id: <1389131839-12920-2-git-send-email-mreitz@redhat.com>
0a122b
Patchwork-id: 56537
0a122b
O-Subject: [RHEL-7.0 qemu-kvm PATCH v2 01/14] option: Add assigned flag to QEMUOptionParameter
0a122b
Bugzilla: 1033490
0a122b
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
0a122b
RH-Acked-by: Fam Zheng <famz@redhat.com>
0a122b
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
0a122b
0a122b
BZ: 1033490
0a122b
0a122b
Adds an "assigned" flag to QEMUOptionParameter which is cleared at the
0a122b
beginning of parse_option_parameters and set on (successful)
0a122b
set_option_parameter and set_option_parameter_int.
0a122b
0a122b
Signed-off-by: Max Reitz <mreitz@redhat.com>
0a122b
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
0a122b
(cherry picked from commit d4ca092a423f1f853a99357bab01a168bb57d625)
0a122b
0a122b
Signed-off-by: Max Reitz <mreitz@redhat.com>
0a122b
---
0a122b
 include/qemu/option.h | 1 +
0a122b
 util/qemu-option.c    | 9 +++++++++
0a122b
 2 files changed, 10 insertions(+)
0a122b
0a122b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
---
0a122b
 include/qemu/option.h |    1 +
0a122b
 util/qemu-option.c    |    9 +++++++++
0a122b
 2 files changed, 10 insertions(+), 0 deletions(-)
0a122b
0a122b
diff --git a/include/qemu/option.h b/include/qemu/option.h
0a122b
index 96f70b6..5c0c6dd 100644
0a122b
--- a/include/qemu/option.h
0a122b
+++ b/include/qemu/option.h
0a122b
@@ -46,6 +46,7 @@ typedef struct QEMUOptionParameter {
0a122b
         char* s;
0a122b
     } value;
0a122b
     const char *help;
0a122b
+    bool assigned;
0a122b
 } QEMUOptionParameter;
0a122b
 
0a122b
 
0a122b
diff --git a/util/qemu-option.c b/util/qemu-option.c
0a122b
index 1cefbfe..2445406 100644
0a122b
--- a/util/qemu-option.c
0a122b
+++ b/util/qemu-option.c
0a122b
@@ -275,6 +275,8 @@ int set_option_parameter(QEMUOptionParameter *list, const char *name,
0a122b
         return -1;
0a122b
     }
0a122b
 
0a122b
+    list->assigned = true;
0a122b
+
0a122b
     return 0;
0a122b
 }
0a122b
 
0a122b
@@ -306,6 +308,8 @@ int set_option_parameter_int(QEMUOptionParameter *list, const char *name,
0a122b
         return -1;
0a122b
     }
0a122b
 
0a122b
+    list->assigned = true;
0a122b
+
0a122b
     return 0;
0a122b
 }
0a122b
 
0a122b
@@ -397,6 +401,7 @@ QEMUOptionParameter *parse_option_parameters(const char *param,
0a122b
     char value[256];
0a122b
     char *param_delim, *value_delim;
0a122b
     char next_delim;
0a122b
+    int i;
0a122b
 
0a122b
     if (list == NULL) {
0a122b
         return NULL;
0a122b
@@ -406,6 +411,10 @@ QEMUOptionParameter *parse_option_parameters(const char *param,
0a122b
         dest = allocated = append_option_parameters(NULL, list);
0a122b
     }
0a122b
 
0a122b
+    for (i = 0; dest[i].name; i++) {
0a122b
+        dest[i].assigned = false;
0a122b
+    }
0a122b
+
0a122b
     while (*param) {
0a122b
 
0a122b
         // Find parameter name and value in the string
0a122b
-- 
0a122b
1.7.1
0a122b