[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/2] qapi: Stub out StringOutputVisitor struct s
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH 1/2] qapi: Stub out StringOutputVisitor struct support |
Date: |
Mon, 19 Sep 2016 15:11:07 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
"Dr. David Alan Gilbert (git)" <address@hidden> writes:
> From: "Dr. David Alan Gilbert" <address@hidden>
>
> Avoid a segfault when visiting, e.g., the QOM rtc-time property,
> by implementing the struct callbacks and raising an Error.
>
> Signed-off-by: Andreas Färber <address@hidden>
>
> Updated for changed interface:
> Signed-off-by: Dr. David Alan Gilbert <address@hidden>
> ---
> qapi/string-output-visitor.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/qapi/string-output-visitor.c b/qapi/string-output-visitor.c
> index 94ac821..4e7e97f 100644
> --- a/qapi/string-output-visitor.c
> +++ b/qapi/string-output-visitor.c
> @@ -12,6 +12,7 @@
>
> #include "qemu/osdep.h"
> #include "qemu-common.h"
> +#include "qapi/error.h"
> #include "qapi/string-output-visitor.h"
> #include "qapi/visitor-impl.h"
> #include "qemu/host-utils.h"
> @@ -266,6 +267,16 @@ static void print_type_number(Visitor *v, const char
> *name, double *obj,
> string_output_set(sov, g_strdup_printf("%f", *obj));
> }
>
> +static void start_struct(Visitor *v, const char *name, void **obj, size_t
> size,
> + Error **errp)
> +{
> + error_setg(errp, "struct type not implemented");
> +}
> +
> +static void end_struct(Visitor *v, void **obj)
> +{
> +}
> +
This is just one of the several things this visitor doesn't implement.
See the comment in string-output-visitor.h.
String input visitor and options visitor have similar holes; see the
comments in string-input-visitor.h and opts-visitor.h.
Should we change all of them together to report errors instead of crash?
With common "error out because this isn't implemented" methods?
> static void
> start_list(Visitor *v, const char *name, GenericList **list, size_t size,
> Error **errp)
> @@ -356,6 +367,8 @@ Visitor *string_output_visitor_new(bool human, char
> **result)
> v->visitor.end_list = end_list;
> v->visitor.complete = string_output_complete;
> v->visitor.free = string_output_free;
> + v->visitor.start_struct = start_struct;
> + v->visitor.end_struct = end_struct;
>
> return &v->visitor;
> }
- Re: [Qemu-devel] [PATCH 1/2] qapi: Stub out StringOutputVisitor struct support,
Markus Armbruster <=
- Re: [Qemu-devel] [PATCH 1/2] qapi: Stub out StringOutputVisitor struct support, Dr. David Alan Gilbert, 2016/09/19
- Re: [Qemu-devel] [PATCH 1/2] qapi: Stub out StringOutputVisitor struct support, Markus Armbruster, 2016/09/19
- Re: [Qemu-devel] [PATCH 1/2] qapi: Stub out StringOutputVisitor struct support, Dr. David Alan Gilbert, 2016/09/19
- Re: [Qemu-devel] [PATCH 1/2] qapi: Stub out StringOutputVisitor struct support, Markus Armbruster, 2016/09/19
- Re: [Qemu-devel] [PATCH 1/2] qapi: Stub out StringOutputVisitor struct support, Dr. David Alan Gilbert, 2016/09/19
- Re: [Qemu-devel] [PATCH 1/2] qapi: Stub out StringOutputVisitor struct support, Markus Armbruster, 2016/09/19
- Re: [Qemu-devel] [PATCH 1/2] qapi: Stub out StringOutputVisitor struct support, Dr. David Alan Gilbert, 2016/09/19