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