Skip to content

Commit

Permalink
include: add qemu/keyval.h
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Daniel P. Berrangé <[email protected]>
Message-Id: <[email protected]>
  • Loading branch information
elmarco committed Apr 21, 2022
1 parent 282468c commit 9ca9c89
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 10 deletions.
14 changes: 14 additions & 0 deletions include/qemu/keyval.h
Original file line number Diff line number Diff line change
@@ -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_ */
6 changes: 0 additions & 6 deletions include/qemu/option.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion qapi/qobject-input-visitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
1 change: 1 addition & 0 deletions qom/object_interfaces.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
1 change: 1 addition & 0 deletions softmmu/vl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
1 change: 1 addition & 0 deletions tests/unit/check-qom-proplist.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test-forward-visitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test-keyval.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion util/keyval.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 9ca9c89

Please sign in to comment.