diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2018-02-09 14:39:09 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2018-02-09 14:39:09 +0000 |
commit | 7e0019a7196ebed177c95824875cf852e1a6f667 (patch) | |
tree | 0a4e5a411c80a56737354700bb15bf4f7262831d /include/qapi/qmp | |
parent | f31cd9e4e2172a4807f390194978c61e717791d2 (diff) | |
parent | 922a01a013d2270682a188258cbccacfecf8129c (diff) |
Merge remote-tracking branch 'remotes/armbru/tags/pull-misc-2018-02-07-v4' into staging
Miscellaneous patches for 2018-02-07
# gpg: Signature made Fri 09 Feb 2018 12:52:51 GMT
# gpg: using RSA key 3870B400EB918653
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
# gpg: aka "Markus Armbruster <armbru@pond.sub.org>"
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653
* remotes/armbru/tags/pull-misc-2018-02-07-v4:
Move include qemu/option.h from qemu-common.h to actual users
Drop superfluous includes of qapi/qmp/qjson.h
Drop superfluous includes of qapi/qmp/dispatch.h
Include qapi/qmp/qnull.h exactly where needed
Include qapi/qmp/qnum.h exactly where needed
Include qapi/qmp/qbool.h exactly where needed
Include qapi/qmp/qstring.h exactly where needed
Include qapi/qmp/qdict.h exactly where needed
Include qapi/qmp/qlist.h exactly where needed
Include qapi/qmp/qobject.h exactly where needed
qdict qlist: Make most helper macros functions
Eliminate qapi/qmp/types.h
Typedef the subtypes of QObject in qemu/typedefs.h, too
Include qmp-commands.h exactly where needed
Drop superfluous includes of qapi/qmp/qerror.h
Include qapi/error.h exactly where needed
Drop superfluous includes of qapi-types.h and test-qapi-types.h
Clean up includes
Use #include "..." for our own headers, <...> for others
vnc: use stubs for CONFIG_VNC=n dummy functions
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include/qapi/qmp')
-rw-r--r-- | include/qapi/qmp/dispatch.h | 3 | ||||
-rw-r--r-- | include/qapi/qmp/json-parser.h | 1 | ||||
-rw-r--r-- | include/qapi/qmp/qbool.h | 4 | ||||
-rw-r--r-- | include/qapi/qmp/qdict.h | 21 | ||||
-rw-r--r-- | include/qapi/qmp/qjson.h | 3 | ||||
-rw-r--r-- | include/qapi/qmp/qlist.h | 19 | ||||
-rw-r--r-- | include/qapi/qmp/qlit.h | 1 | ||||
-rw-r--r-- | include/qapi/qmp/qnum.h | 4 | ||||
-rw-r--r-- | include/qapi/qmp/qstring.h | 4 | ||||
-rw-r--r-- | include/qapi/qmp/types.h | 24 |
10 files changed, 19 insertions, 65 deletions
diff --git a/include/qapi/qmp/dispatch.h b/include/qapi/qmp/dispatch.h index 20578dcd48..1e694b5ecf 100644 --- a/include/qapi/qmp/dispatch.h +++ b/include/qapi/qmp/dispatch.h @@ -14,8 +14,7 @@ #ifndef QAPI_QMP_DISPATCH_H #define QAPI_QMP_DISPATCH_H -#include "qapi/qmp/qobject.h" -#include "qapi/qmp/qdict.h" +#include "qemu/queue.h" typedef void (QmpCommandFunc)(QDict *, QObject **, Error **); diff --git a/include/qapi/qmp/json-parser.h b/include/qapi/qmp/json-parser.h index 9987f8ca85..102f5c0068 100644 --- a/include/qapi/qmp/json-parser.h +++ b/include/qapi/qmp/json-parser.h @@ -15,7 +15,6 @@ #define QEMU_JSON_PARSER_H #include "qemu-common.h" -#include "qapi/qmp/qlist.h" QObject *json_parser_parse(GQueue *tokens, va_list *ap); QObject *json_parser_parse_err(GQueue *tokens, va_list *ap, Error **errp); diff --git a/include/qapi/qmp/qbool.h b/include/qapi/qmp/qbool.h index f77ea86c4e..629c508d34 100644 --- a/include/qapi/qmp/qbool.h +++ b/include/qapi/qmp/qbool.h @@ -16,10 +16,10 @@ #include "qapi/qmp/qobject.h" -typedef struct QBool { +struct QBool { QObject base; bool value; -} QBool; +}; QBool *qbool_from_bool(bool value); bool qbool_get_bool(const QBool *qb); diff --git a/include/qapi/qmp/qdict.h b/include/qapi/qmp/qdict.h index fc218e7be6..ff6f7842c3 100644 --- a/include/qapi/qmp/qdict.h +++ b/include/qapi/qmp/qdict.h @@ -14,9 +14,6 @@ #define QDICT_H #include "qapi/qmp/qobject.h" -#include "qapi/qmp/qlist.h" -#include "qapi/qmp/qnull.h" -#include "qapi/qmp/qnum.h" #include "qemu/queue.h" #define QDICT_BUCKET_MAX 512 @@ -27,11 +24,11 @@ typedef struct QDictEntry { QLIST_ENTRY(QDictEntry) next; } QDictEntry; -typedef struct QDict { +struct QDict { QObject base; size_t size; QLIST_HEAD(,QDictEntry) table[QDICT_BUCKET_MAX]; -} QDict; +}; /* Object API */ QDict *qdict_new(void); @@ -55,17 +52,11 @@ void qdict_destroy_obj(QObject *obj); #define qdict_put(qdict, key, obj) \ qdict_put_obj(qdict, key, QOBJECT(obj)) -/* Helpers for int, bool, null, and string */ -#define qdict_put_int(qdict, key, value) \ - qdict_put(qdict, key, qnum_from_int(value)) -#define qdict_put_bool(qdict, key, value) \ - qdict_put(qdict, key, qbool_from_bool(value)) -#define qdict_put_str(qdict, key, value) \ - qdict_put(qdict, key, qstring_from_str(value)) -#define qdict_put_null(qdict, key) \ - qdict_put(qdict, key, qnull()) +void qdict_put_bool(QDict *qdict, const char *key, bool value); +void qdict_put_int(QDict *qdict, const char *key, int64_t value); +void qdict_put_null(QDict *qdict, const char *key); +void qdict_put_str(QDict *qdict, const char *key, const char *value); -/* High level helpers */ double qdict_get_double(const QDict *qdict, const char *key); int64_t qdict_get_int(const QDict *qdict, const char *key); bool qdict_get_bool(const QDict *qdict, const char *key); diff --git a/include/qapi/qmp/qjson.h b/include/qapi/qmp/qjson.h index 6e84082d5f..b274ac3a86 100644 --- a/include/qapi/qmp/qjson.h +++ b/include/qapi/qmp/qjson.h @@ -14,9 +14,6 @@ #ifndef QJSON_H #define QJSON_H -#include "qapi/qmp/qobject.h" -#include "qapi/qmp/qstring.h" - QObject *qobject_from_json(const char *string, Error **errp); QObject *qobject_from_jsonf(const char *string, ...) GCC_FMT_ATTR(1, 2); QObject *qobject_from_jsonv(const char *string, va_list *ap, Error **errp) diff --git a/include/qapi/qmp/qlist.h b/include/qapi/qmp/qlist.h index ec3fcc1a4c..5fd976a398 100644 --- a/include/qapi/qmp/qlist.h +++ b/include/qapi/qmp/qlist.h @@ -14,8 +14,6 @@ #define QLIST_H #include "qapi/qmp/qobject.h" -#include "qapi/qmp/qnum.h" -#include "qapi/qmp/qnull.h" #include "qemu/queue.h" typedef struct QListEntry { @@ -23,23 +21,18 @@ typedef struct QListEntry { QTAILQ_ENTRY(QListEntry) next; } QListEntry; -typedef struct QList { +struct QList { QObject base; QTAILQ_HEAD(,QListEntry) head; -} QList; +}; #define qlist_append(qlist, obj) \ qlist_append_obj(qlist, QOBJECT(obj)) -/* Helpers for int, bool, and string */ -#define qlist_append_int(qlist, value) \ - qlist_append(qlist, qnum_from_int(value)) -#define qlist_append_bool(qlist, value) \ - qlist_append(qlist, qbool_from_bool(value)) -#define qlist_append_str(qlist, value) \ - qlist_append(qlist, qstring_from_str(value)) -#define qlist_append_null(qlist) \ - qlist_append(qlist, qnull()) +void qlist_append_bool(QList *qlist, bool value); +void qlist_append_int(QList *qlist, int64_t value); +void qlist_append_null(QList *qlist); +void qlist_append_str(QList *qlist, const char *value); #define QLIST_FOREACH_ENTRY(qlist, var) \ for ((var) = ((qlist)->head.tqh_first); \ diff --git a/include/qapi/qmp/qlit.h b/include/qapi/qmp/qlit.h index b18406bce9..56f9d97bd9 100644 --- a/include/qapi/qmp/qlit.h +++ b/include/qapi/qmp/qlit.h @@ -14,7 +14,6 @@ #ifndef QLIT_H #define QLIT_H -#include "qapi-types.h" #include "qobject.h" typedef struct QLitDictEntry QLitDictEntry; diff --git a/include/qapi/qmp/qnum.h b/include/qapi/qmp/qnum.h index c3d86794bb..15e3971c7f 100644 --- a/include/qapi/qmp/qnum.h +++ b/include/qapi/qmp/qnum.h @@ -44,7 +44,7 @@ typedef enum { * in range: qnum_get_try_int() / qnum_get_try_uint() check range and * convert under the hood. */ -typedef struct QNum { +struct QNum { QObject base; QNumKind kind; union { @@ -52,7 +52,7 @@ typedef struct QNum { uint64_t u64; double dbl; } u; -} QNum; +}; QNum *qnum_from_int(int64_t value); QNum *qnum_from_uint(uint64_t value); diff --git a/include/qapi/qmp/qstring.h b/include/qapi/qmp/qstring.h index 65c05a9be5..98070ef3d6 100644 --- a/include/qapi/qmp/qstring.h +++ b/include/qapi/qmp/qstring.h @@ -15,12 +15,12 @@ #include "qapi/qmp/qobject.h" -typedef struct QString { +struct QString { QObject base; char *string; size_t length; size_t capacity; -} QString; +}; QString *qstring_new(void); QString *qstring_from_str(const char *str); diff --git a/include/qapi/qmp/types.h b/include/qapi/qmp/types.h deleted file mode 100644 index 749ac44dcb..0000000000 --- a/include/qapi/qmp/types.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Include all QEMU objects. - * - * Copyright (C) 2009 Red Hat Inc. - * - * Authors: - * Luiz Capitulino <lcapitulino@redhat.com> - * - * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. - * See the COPYING.LIB file in the top-level directory. - */ - -#ifndef QAPI_QMP_TYPES_H -#define QAPI_QMP_TYPES_H - -#include "qapi/qmp/qobject.h" -#include "qapi/qmp/qnum.h" -#include "qapi/qmp/qbool.h" -#include "qapi/qmp/qstring.h" -#include "qapi/qmp/qdict.h" -#include "qapi/qmp/qlist.h" -#include "qapi/qmp/qnull.h" - -#endif /* QAPI_QMP_TYPES_H */ |