From 7b1b5d191385ca52e96caae2a05c64f3a63855d9 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 17 Dec 2012 18:19:43 +0100 Subject: qapi: move include files to include/qobject/ Signed-off-by: Paolo Bonzini --- qapi/opts-visitor.c | 6 ++--- qapi/opts-visitor.h | 31 ---------------------- qapi/qapi-dealloc-visitor.c | 6 ++--- qapi/qapi-dealloc-visitor.h | 26 ------------------ qapi/qapi-visit-core.c | 6 ++--- qapi/qapi-visit-core.h | 55 -------------------------------------- qapi/qapi-visit-impl.h | 63 -------------------------------------------- qapi/qmp-core.h | 55 -------------------------------------- qapi/qmp-dispatch.c | 10 +++---- qapi/qmp-input-visitor.c | 8 +++--- qapi/qmp-input-visitor.h | 29 -------------------- qapi/qmp-output-visitor.c | 8 +++--- qapi/qmp-output-visitor.h | 28 -------------------- qapi/qmp-registry.c | 2 +- qapi/string-input-visitor.c | 6 ++--- qapi/string-input-visitor.h | 25 ------------------ qapi/string-output-visitor.c | 6 ++--- qapi/string-output-visitor.h | 26 ------------------ 18 files changed, 29 insertions(+), 367 deletions(-) delete mode 100644 qapi/opts-visitor.h delete mode 100644 qapi/qapi-dealloc-visitor.h delete mode 100644 qapi/qapi-visit-core.h delete mode 100644 qapi/qapi-visit-impl.h delete mode 100644 qapi/qmp-core.h delete mode 100644 qapi/qmp-input-visitor.h delete mode 100644 qapi/qmp-output-visitor.h delete mode 100644 qapi/string-input-visitor.h delete mode 100644 qapi/string-output-visitor.h (limited to 'qapi') diff --git a/qapi/opts-visitor.c b/qapi/opts-visitor.c index 6ccb8a1c33..f8149ce455 100644 --- a/qapi/opts-visitor.c +++ b/qapi/opts-visitor.c @@ -11,11 +11,11 @@ */ #include "qemu-common.h" -#include "qerror.h" -#include "opts-visitor.h" +#include "qapi/qmp/qerror.h" +#include "qapi/opts-visitor.h" #include "qemu-queue.h" #include "qemu-option-internal.h" -#include "qapi-visit-impl.h" +#include "qapi/visitor-impl.h" struct OptsVisitor diff --git a/qapi/opts-visitor.h b/qapi/opts-visitor.h deleted file mode 100644 index ea1a395573..0000000000 --- a/qapi/opts-visitor.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Options Visitor - * - * Copyright Red Hat, Inc. 2012 - * - * Author: Laszlo Ersek - * - * 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 OPTS_VISITOR_H -#define OPTS_VISITOR_H - -#include "qapi-visit-core.h" -#include "qemu-option.h" - -typedef struct OptsVisitor OptsVisitor; - -/* Contrarily to qemu-option.c::parse_option_number(), OptsVisitor's "int" - * parser relies on strtoll() instead of strtoull(). Consequences: - * - string representations of negative numbers yield negative values, - * - values below INT64_MIN or LLONG_MIN are rejected, - * - values above INT64_MAX or LLONG_MAX are rejected. - */ -OptsVisitor *opts_visitor_new(const QemuOpts *opts); -void opts_visitor_cleanup(OptsVisitor *nv); -Visitor *opts_get_visitor(OptsVisitor *nv); - -#endif diff --git a/qapi/qapi-dealloc-visitor.c b/qapi/qapi-dealloc-visitor.c index 7c44042619..98f2a58efd 100644 --- a/qapi/qapi-dealloc-visitor.c +++ b/qapi/qapi-dealloc-visitor.c @@ -11,11 +11,11 @@ * */ -#include "qapi-dealloc-visitor.h" +#include "qapi/dealloc-visitor.h" #include "qemu-queue.h" #include "qemu-common.h" -#include "qemu-objects.h" -#include "qapi-visit-impl.h" +#include "qapi/qmp/types.h" +#include "qapi/visitor-impl.h" typedef struct StackEntry { diff --git a/qapi/qapi-dealloc-visitor.h b/qapi/qapi-dealloc-visitor.h deleted file mode 100644 index 5842bc79bd..0000000000 --- a/qapi/qapi-dealloc-visitor.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Dealloc Visitor - * - * Copyright IBM, Corp. 2011 - * - * Authors: - * Michael Roth - * - * 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_DEALLOC_VISITOR_H -#define QAPI_DEALLOC_VISITOR_H - -#include "qapi-visit-core.h" - -typedef struct QapiDeallocVisitor QapiDeallocVisitor; - -QapiDeallocVisitor *qapi_dealloc_visitor_new(void); -void qapi_dealloc_visitor_cleanup(QapiDeallocVisitor *d); - -Visitor *qapi_dealloc_get_visitor(QapiDeallocVisitor *v); - -#endif diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c index 4649fb71b7..401ee6e597 100644 --- a/qapi/qapi-visit-core.c +++ b/qapi/qapi-visit-core.c @@ -12,9 +12,9 @@ */ #include "qemu-common.h" -#include "qerror.h" -#include "qapi/qapi-visit-core.h" -#include "qapi/qapi-visit-impl.h" +#include "qapi/qmp/qerror.h" +#include "qapi/visitor.h" +#include "qapi/visitor-impl.h" void visit_start_handle(Visitor *v, void **obj, const char *kind, const char *name, Error **errp) diff --git a/qapi/qapi-visit-core.h b/qapi/qapi-visit-core.h deleted file mode 100644 index 602debe753..0000000000 --- a/qapi/qapi-visit-core.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Core Definitions for QAPI Visitor Classes - * - * Copyright IBM, Corp. 2011 - * - * Authors: - * Anthony Liguori - * - * 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_VISITOR_CORE_H -#define QAPI_VISITOR_CORE_H - -#include "error.h" -#include - -typedef struct GenericList -{ - void *value; - struct GenericList *next; -} GenericList; - -typedef struct Visitor Visitor; - -void visit_start_handle(Visitor *v, void **obj, const char *kind, - const char *name, Error **errp); -void visit_end_handle(Visitor *v, Error **errp); -void visit_start_struct(Visitor *v, void **obj, const char *kind, - const char *name, size_t size, Error **errp); -void visit_end_struct(Visitor *v, Error **errp); -void visit_start_list(Visitor *v, const char *name, Error **errp); -GenericList *visit_next_list(Visitor *v, GenericList **list, Error **errp); -void visit_end_list(Visitor *v, Error **errp); -void visit_start_optional(Visitor *v, bool *present, const char *name, - Error **errp); -void visit_end_optional(Visitor *v, Error **errp); -void visit_type_enum(Visitor *v, int *obj, const char *strings[], - const char *kind, const char *name, Error **errp); -void visit_type_int(Visitor *v, int64_t *obj, const char *name, Error **errp); -void visit_type_uint8(Visitor *v, uint8_t *obj, const char *name, Error **errp); -void visit_type_uint16(Visitor *v, uint16_t *obj, const char *name, Error **errp); -void visit_type_uint32(Visitor *v, uint32_t *obj, const char *name, Error **errp); -void visit_type_uint64(Visitor *v, uint64_t *obj, const char *name, Error **errp); -void visit_type_int8(Visitor *v, int8_t *obj, const char *name, Error **errp); -void visit_type_int16(Visitor *v, int16_t *obj, const char *name, Error **errp); -void visit_type_int32(Visitor *v, int32_t *obj, const char *name, Error **errp); -void visit_type_int64(Visitor *v, int64_t *obj, const char *name, Error **errp); -void visit_type_size(Visitor *v, uint64_t *obj, const char *name, Error **errp); -void visit_type_bool(Visitor *v, bool *obj, const char *name, Error **errp); -void visit_type_str(Visitor *v, char **obj, const char *name, Error **errp); -void visit_type_number(Visitor *v, double *obj, const char *name, Error **errp); - -#endif diff --git a/qapi/qapi-visit-impl.h b/qapi/qapi-visit-impl.h deleted file mode 100644 index 9337d62e75..0000000000 --- a/qapi/qapi-visit-impl.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Core Definitions for QAPI Visitor implementations - * - * Copyright (C) 2012 Red Hat, Inc. - * - * Author: Paolo Bonizni - * - * 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_VISITOR_IMPL_H -#define QAPI_VISITOR_IMPL_H - -#include "error.h" -#include "qapi/qapi-visit-core.h" - -struct Visitor -{ - /* Must be set */ - void (*start_struct)(Visitor *v, void **obj, const char *kind, - const char *name, size_t size, Error **errp); - void (*end_struct)(Visitor *v, Error **errp); - - void (*start_list)(Visitor *v, const char *name, Error **errp); - GenericList *(*next_list)(Visitor *v, GenericList **list, Error **errp); - void (*end_list)(Visitor *v, Error **errp); - - void (*type_enum)(Visitor *v, int *obj, const char *strings[], - const char *kind, const char *name, Error **errp); - - void (*type_int)(Visitor *v, int64_t *obj, const char *name, Error **errp); - void (*type_bool)(Visitor *v, bool *obj, const char *name, Error **errp); - void (*type_str)(Visitor *v, char **obj, const char *name, Error **errp); - void (*type_number)(Visitor *v, double *obj, const char *name, - Error **errp); - - /* May be NULL */ - void (*start_optional)(Visitor *v, bool *present, const char *name, - Error **errp); - void (*end_optional)(Visitor *v, Error **errp); - - void (*start_handle)(Visitor *v, void **obj, const char *kind, - const char *name, Error **errp); - void (*end_handle)(Visitor *v, Error **errp); - void (*type_uint8)(Visitor *v, uint8_t *obj, const char *name, Error **errp); - void (*type_uint16)(Visitor *v, uint16_t *obj, const char *name, Error **errp); - void (*type_uint32)(Visitor *v, uint32_t *obj, const char *name, Error **errp); - void (*type_uint64)(Visitor *v, uint64_t *obj, const char *name, Error **errp); - void (*type_int8)(Visitor *v, int8_t *obj, const char *name, Error **errp); - void (*type_int16)(Visitor *v, int16_t *obj, const char *name, Error **errp); - void (*type_int32)(Visitor *v, int32_t *obj, const char *name, Error **errp); - void (*type_int64)(Visitor *v, int64_t *obj, const char *name, Error **errp); - /* visit_type_size() falls back to (*type_uint64)() if type_size is unset */ - void (*type_size)(Visitor *v, uint64_t *obj, const char *name, Error **errp); -}; - -void input_type_enum(Visitor *v, int *obj, const char *strings[], - const char *kind, const char *name, Error **errp); -void output_type_enum(Visitor *v, int *obj, const char *strings[], - const char *kind, const char *name, Error **errp); - -#endif diff --git a/qapi/qmp-core.h b/qapi/qmp-core.h deleted file mode 100644 index 00446cff9b..0000000000 --- a/qapi/qmp-core.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Core Definitions for QAPI/QMP Dispatch - * - * Copyright IBM, Corp. 2011 - * - * Authors: - * Anthony Liguori - * - * 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 QMP_CORE_H -#define QMP_CORE_H - -#include "qobject.h" -#include "qdict.h" -#include "error.h" - -typedef void (QmpCommandFunc)(QDict *, QObject **, Error **); - -typedef enum QmpCommandType -{ - QCT_NORMAL, -} QmpCommandType; - -typedef enum QmpCommandOptions -{ - QCO_NO_OPTIONS = 0x0, - QCO_NO_SUCCESS_RESP = 0x1, -} QmpCommandOptions; - -typedef struct QmpCommand -{ - const char *name; - QmpCommandType type; - QmpCommandFunc *fn; - QmpCommandOptions options; - QTAILQ_ENTRY(QmpCommand) node; - bool enabled; -} QmpCommand; - -void qmp_register_command(const char *name, QmpCommandFunc *fn, - QmpCommandOptions options); -QmpCommand *qmp_find_command(const char *name); -QObject *qmp_dispatch(QObject *request); -void qmp_disable_command(const char *name); -void qmp_enable_command(const char *name); -bool qmp_command_is_enabled(const char *name); -char **qmp_get_command_list(void); -QObject *qmp_build_error_object(Error *errp); - -#endif - diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c index 4085994686..921de33bce 100644 --- a/qapi/qmp-dispatch.c +++ b/qapi/qmp-dispatch.c @@ -11,12 +11,12 @@ * */ -#include "qemu-objects.h" -#include "qapi/qmp-core.h" -#include "json-parser.h" +#include "qapi/qmp/types.h" +#include "qapi/qmp/dispatch.h" +#include "qapi/qmp/json-parser.h" #include "qapi-types.h" -#include "error.h" -#include "qerror.h" +#include "qapi/error.h" +#include "qapi/qmp/qerror.h" static QDict *qmp_dispatch_check_obj(const QObject *request, Error **errp) { diff --git a/qapi/qmp-input-visitor.c b/qapi/qmp-input-visitor.c index 107d8d361b..8087909036 100644 --- a/qapi/qmp-input-visitor.c +++ b/qapi/qmp-input-visitor.c @@ -11,12 +11,12 @@ * */ -#include "qmp-input-visitor.h" -#include "qapi/qapi-visit-impl.h" +#include "qapi/qmp-input-visitor.h" +#include "qapi/visitor-impl.h" #include "qemu-queue.h" #include "qemu-common.h" -#include "qemu-objects.h" -#include "qerror.h" +#include "qapi/qmp/types.h" +#include "qapi/qmp/qerror.h" #define QIV_STACK_SIZE 1024 diff --git a/qapi/qmp-input-visitor.h b/qapi/qmp-input-visitor.h deleted file mode 100644 index e0a48a5f3b..0000000000 --- a/qapi/qmp-input-visitor.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Input Visitor - * - * Copyright IBM, Corp. 2011 - * - * Authors: - * Anthony Liguori - * - * 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 QMP_INPUT_VISITOR_H -#define QMP_INPUT_VISITOR_H - -#include "qapi-visit-core.h" -#include "qobject.h" - -typedef struct QmpInputVisitor QmpInputVisitor; - -QmpInputVisitor *qmp_input_visitor_new(QObject *obj); -QmpInputVisitor *qmp_input_visitor_new_strict(QObject *obj); - -void qmp_input_visitor_cleanup(QmpInputVisitor *v); - -Visitor *qmp_input_get_visitor(QmpInputVisitor *v); - -#endif diff --git a/qapi/qmp-output-visitor.c b/qapi/qmp-output-visitor.c index 2bce9d5db1..8015e3f88d 100644 --- a/qapi/qmp-output-visitor.c +++ b/qapi/qmp-output-visitor.c @@ -11,12 +11,12 @@ * */ -#include "qmp-output-visitor.h" -#include "qapi/qapi-visit-impl.h" +#include "qapi/qmp-output-visitor.h" +#include "qapi/visitor-impl.h" #include "qemu-queue.h" #include "qemu-common.h" -#include "qemu-objects.h" -#include "qerror.h" +#include "qapi/qmp/types.h" +#include "qapi/qmp/qerror.h" typedef struct QStackEntry { diff --git a/qapi/qmp-output-visitor.h b/qapi/qmp-output-visitor.h deleted file mode 100644 index 4a649c2504..0000000000 --- a/qapi/qmp-output-visitor.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Output Visitor - * - * Copyright IBM, Corp. 2011 - * - * Authors: - * Anthony Liguori - * - * 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 QMP_OUTPUT_VISITOR_H -#define QMP_OUTPUT_VISITOR_H - -#include "qapi-visit-core.h" -#include "qobject.h" - -typedef struct QmpOutputVisitor QmpOutputVisitor; - -QmpOutputVisitor *qmp_output_visitor_new(void); -void qmp_output_visitor_cleanup(QmpOutputVisitor *v); - -QObject *qmp_output_get_qobject(QmpOutputVisitor *v); -Visitor *qmp_output_get_visitor(QmpOutputVisitor *v); - -#endif diff --git a/qapi/qmp-registry.c b/qapi/qmp-registry.c index c2c31b420d..70cdbca470 100644 --- a/qapi/qmp-registry.c +++ b/qapi/qmp-registry.c @@ -14,7 +14,7 @@ #include #include -#include "qapi/qmp-core.h" +#include "qapi/qmp/dispatch.h" static QTAILQ_HEAD(QmpCommandList, QmpCommand) qmp_commands = QTAILQ_HEAD_INITIALIZER(qmp_commands); diff --git a/qapi/string-input-visitor.c b/qapi/string-input-visitor.c index 497eb9a60a..8f1bc41333 100644 --- a/qapi/string-input-visitor.c +++ b/qapi/string-input-visitor.c @@ -11,9 +11,9 @@ */ #include "qemu-common.h" -#include "string-input-visitor.h" -#include "qapi/qapi-visit-impl.h" -#include "qerror.h" +#include "qapi/string-input-visitor.h" +#include "qapi/visitor-impl.h" +#include "qapi/qmp/qerror.h" struct StringInputVisitor { diff --git a/qapi/string-input-visitor.h b/qapi/string-input-visitor.h deleted file mode 100644 index d269d42cef..0000000000 --- a/qapi/string-input-visitor.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * String parsing Visitor - * - * Copyright Red Hat, Inc. 2012 - * - * Author: Paolo Bonzini - * - * 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 STRING_INPUT_VISITOR_H -#define STRING_INPUT_VISITOR_H - -#include "qapi-visit-core.h" - -typedef struct StringInputVisitor StringInputVisitor; - -StringInputVisitor *string_input_visitor_new(const char *str); -void string_input_visitor_cleanup(StringInputVisitor *v); - -Visitor *string_input_get_visitor(StringInputVisitor *v); - -#endif diff --git a/qapi/string-output-visitor.c b/qapi/string-output-visitor.c index 34e525eadd..921653d425 100644 --- a/qapi/string-output-visitor.c +++ b/qapi/string-output-visitor.c @@ -11,9 +11,9 @@ */ #include "qemu-common.h" -#include "string-output-visitor.h" -#include "qapi/qapi-visit-impl.h" -#include "qerror.h" +#include "qapi/string-output-visitor.h" +#include "qapi/visitor-impl.h" +#include "qapi/qmp/qerror.h" struct StringOutputVisitor { diff --git a/qapi/string-output-visitor.h b/qapi/string-output-visitor.h deleted file mode 100644 index 8868454110..0000000000 --- a/qapi/string-output-visitor.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * String printing Visitor - * - * Copyright Red Hat, Inc. 2012 - * - * Author: Paolo Bonzini - * - * 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 STRING_OUTPUT_VISITOR_H -#define STRING_OUTPUT_VISITOR_H - -#include "qapi-visit-core.h" - -typedef struct StringOutputVisitor StringOutputVisitor; - -StringOutputVisitor *string_output_visitor_new(void); -void string_output_visitor_cleanup(StringOutputVisitor *v); - -char *string_output_get_string(StringOutputVisitor *v); -Visitor *string_output_get_visitor(StringOutputVisitor *v); - -#endif -- cgit v1.2.3