thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
218e99
From 1201a6e29a7f8359588a3b635acbe12697325e66 Mon Sep 17 00:00:00 2001
218e99
From: Kevin Wolf <kwolf@redhat.com>
218e99
Date: Mon, 9 Sep 2013 14:28:18 +0200
218e99
Subject: [PATCH 27/38] QemuOpts: Add qemu_opt_unset()
218e99
218e99
RH-Author: Kevin Wolf <kwolf@redhat.com>
218e99
Message-id: <1378736903-18489-28-git-send-email-kwolf@redhat.com>
218e99
Patchwork-id: 54214
218e99
O-Subject: [RHEL-7.0 qemu-kvm PATCH 27/32] QemuOpts: Add qemu_opt_unset()
218e99
Bugzilla: 1005818
218e99
RH-Acked-by: Fam Zheng <famz@redhat.com>
218e99
RH-Acked-by: Max Reitz <mreitz@redhat.com>
218e99
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
218e99
Bugzilla: 1005818
218e99
218e99
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
218e99
Reviewed-by: Eric Blake <eblake@redhat.com>
218e99
(cherry picked from commit 0dd6c5266313c861cf36476da86599d368ec41fc)
218e99
218e99
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
218e99
---
218e99
 include/qemu/option.h |  1 +
218e99
 util/qemu-option.c    | 14 ++++++++++++++
218e99
 2 files changed, 15 insertions(+)
218e99
218e99
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
---
218e99
 include/qemu/option.h |    1 +
218e99
 util/qemu-option.c    |   14 ++++++++++++++
218e99
 2 files changed, 15 insertions(+), 0 deletions(-)
218e99
218e99
diff --git a/include/qemu/option.h b/include/qemu/option.h
218e99
index bdb6d21..9db74fb 100644
218e99
--- a/include/qemu/option.h
218e99
+++ b/include/qemu/option.h
218e99
@@ -122,6 +122,7 @@ bool qemu_opt_has_help_opt(QemuOpts *opts);
218e99
 bool qemu_opt_get_bool(QemuOpts *opts, const char *name, bool defval);
218e99
 uint64_t qemu_opt_get_number(QemuOpts *opts, const char *name, uint64_t defval);
218e99
 uint64_t qemu_opt_get_size(QemuOpts *opts, const char *name, uint64_t defval);
218e99
+int qemu_opt_unset(QemuOpts *opts, const char *name);
218e99
 int qemu_opt_set(QemuOpts *opts, const char *name, const char *value);
218e99
 void qemu_opt_set_err(QemuOpts *opts, const char *name, const char *value,
218e99
                       Error **errp);
218e99
diff --git a/util/qemu-option.c b/util/qemu-option.c
218e99
index bdfbdb4..37e7640 100644
218e99
--- a/util/qemu-option.c
218e99
+++ b/util/qemu-option.c
218e99
@@ -623,6 +623,20 @@ static const QemuOptDesc *find_desc_by_name(const QemuOptDesc *desc,
218e99
     return NULL;
218e99
 }
218e99
 
218e99
+int qemu_opt_unset(QemuOpts *opts, const char *name)
218e99
+{
218e99
+    QemuOpt *opt = qemu_opt_find(opts, name);
218e99
+
218e99
+    assert(opts_accepts_any(opts));
218e99
+
218e99
+    if (opt == NULL) {
218e99
+        return -1;
218e99
+    } else {
218e99
+        qemu_opt_del(opt);
218e99
+        return 0;
218e99
+    }
218e99
+}
218e99
+
218e99
 static void opt_set(QemuOpts *opts, const char *name, const char *value,
218e99
                     bool prepend, Error **errp)
218e99
 {
218e99
-- 
218e99
1.7.1
218e99