aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2022-04-20 17:26:06 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2022-04-21 17:03:51 +0400
commit9ca9c893b617c0c182f16331021c5ff8c64c5c00 (patch)
tree75996f4442dce66597a069c7d7cf8a0d4cbacb38
parent282468c7c4c84ce497e51d046f545badc320c154 (diff)
include: add qemu/keyval.h
Do not require the whole option machinery to handle keyval, as it is used by QAPI alone, without the option API. And match the associated unit name. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20220420132624.2439741-24-marcandre.lureau@redhat.com>
-rw-r--r--include/qemu/keyval.h14
-rw-r--r--include/qemu/option.h6
-rw-r--r--qapi/qobject-input-visitor.c2
-rw-r--r--qom/object_interfaces.c1
-rw-r--r--softmmu/vl.c1
-rw-r--r--tests/unit/check-qom-proplist.c1
-rw-r--r--tests/unit/test-forward-visitor.c2
-rw-r--r--tests/unit/test-keyval.c2
-rw-r--r--util/keyval.c2
9 files changed, 21 insertions, 10 deletions
diff --git a/include/qemu/keyval.h b/include/qemu/keyval.h
new file mode 100644
index 0000000000..2d263286d7
--- /dev/null
+++ b/include/qemu/keyval.h
@@ -0,0 +1,14 @@
+/*
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+#ifndef KEYVAL_H_
+#define KEYVAL_H_
+
+QDict *keyval_parse_into(QDict *qdict, const char *params, const char *implied_key,
+ bool *p_help, Error **errp);
+QDict *keyval_parse(const char *params, const char *implied_key,
+ bool *help, Error **errp);
+void keyval_merge(QDict *old, const QDict *new, Error **errp);
+
+#endif /* KEYVAL_H_ */
diff --git a/include/qemu/option.h b/include/qemu/option.h
index bbd86e1c4e..b349828782 100644
--- a/include/qemu/option.h
+++ b/include/qemu/option.h
@@ -144,12 +144,6 @@ void qemu_opts_print_help(QemuOptsList *list, bool print_caption);
void qemu_opts_free(QemuOptsList *list);
QemuOptsList *qemu_opts_append(QemuOptsList *dst, QemuOptsList *list);
-QDict *keyval_parse_into(QDict *qdict, const char *params, const char *implied_key,
- bool *p_help, Error **errp);
-QDict *keyval_parse(const char *params, const char *implied_key,
- bool *help, Error **errp);
-void keyval_merge(QDict *old, const QDict *new, Error **errp);
-
G_DEFINE_AUTOPTR_CLEANUP_FUNC(QemuOpts, qemu_opts_del)
#endif
diff --git a/qapi/qobject-input-visitor.c b/qapi/qobject-input-visitor.c
index f0b4c7ca9d..3e8aca6b15 100644
--- a/qapi/qobject-input-visitor.c
+++ b/qapi/qobject-input-visitor.c
@@ -28,7 +28,7 @@
#include "qapi/qmp/qnum.h"
#include "qapi/qmp/qstring.h"
#include "qemu/cutils.h"
-#include "qemu/option.h"
+#include "qemu/keyval.h"
typedef struct StackObject {
const char *name; /* Name of @obj in its parent, if any */
diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c
index 3b61c195c5..f94b6c3193 100644
--- a/qom/object_interfaces.c
+++ b/qom/object_interfaces.c
@@ -17,6 +17,7 @@
#include "qemu/qemu-print.h"
#include "qapi/opts-visitor.h"
#include "qemu/config-file.h"
+#include "qemu/keyval.h"
bool user_creatable_complete(UserCreatable *uc, Error **errp)
{
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 2a38ebe5fb..5312bd2564 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -128,6 +128,7 @@
#include "qapi/qmp/qerror.h"
#include "sysemu/iothread.h"
#include "qemu/guest-random.h"
+#include "qemu/keyval.h"
#include "config-host.h"
diff --git a/tests/unit/check-qom-proplist.c b/tests/unit/check-qom-proplist.c
index ed341088d3..79d4a8b89d 100644
--- a/tests/unit/check-qom-proplist.c
+++ b/tests/unit/check-qom-proplist.c
@@ -27,6 +27,7 @@
#include "qom/object.h"
#include "qemu/module.h"
#include "qemu/option.h"
+#include "qemu/keyval.h"
#include "qemu/config-file.h"
#include "qom/object_interfaces.h"
diff --git a/tests/unit/test-forward-visitor.c b/tests/unit/test-forward-visitor.c
index 01de155227..eea8ffc072 100644
--- a/tests/unit/test-forward-visitor.c
+++ b/tests/unit/test-forward-visitor.c
@@ -15,7 +15,7 @@
#include "qapi/qmp/qobject.h"
#include "qapi/qmp/qdict.h"
#include "test-qapi-visit.h"
-#include "qemu/option.h"
+#include "qemu/keyval.h"
typedef bool GenericVisitor (Visitor *, const char *, void **, Error **);
#define CAST_VISIT_TYPE(fn) ((GenericVisitor *)(fn))
diff --git a/tests/unit/test-keyval.c b/tests/unit/test-keyval.c
index af0581ae6c..4dc52c7a1a 100644
--- a/tests/unit/test-keyval.c
+++ b/tests/unit/test-keyval.c
@@ -19,7 +19,7 @@
#include "qapi/qobject-input-visitor.h"
#include "test-qapi-visit.h"
#include "qemu/cutils.h"
-#include "qemu/option.h"
+#include "qemu/keyval.h"
static void test_keyval_parse(void)
{
diff --git a/util/keyval.c b/util/keyval.c
index 0cf2e84dc8..66a5b4740f 100644
--- a/util/keyval.c
+++ b/util/keyval.c
@@ -95,8 +95,8 @@
#include "qapi/qmp/qlist.h"
#include "qapi/qmp/qstring.h"
#include "qemu/cutils.h"
+#include "qemu/keyval.h"
#include "qemu/help_option.h"
-#include "qemu/option.h"
/*
* Convert @key to a list index.