From: Markus Armbruster <armbru@redhat.com>
To: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>
Cc: qemu-devel@nongnu.org, lcapitulino@redhat.com, afaerber@suse.de,
kwolf@redhat.com, pbonzini@redhat.com, arei.gonglei@huawei.com
Subject: Re: [Qemu-devel] [PATCH 1/2] qapi: Stub out StringOutputVisitor struct support
Date: Mon, 19 Sep 2016 15:11:07 +0200 [thread overview]
Message-ID: <87wpi8f310.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <1472117833-10236-2-git-send-email-dgilbert@redhat.com> (David Alan Gilbert's message of "Thu, 25 Aug 2016 10:37:12 +0100")
"Dr. David Alan Gilbert (git)" <dgilbert@redhat.com> writes:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>
> 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 <afaerber@suse.de>
>
> Updated for changed interface:
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
> 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;
> }
next prev parent reply other threads:[~2016-09-19 13:11 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-25 9:37 [Qemu-devel] [PATCH 0/2] qom-get [for 2.8] Dr. David Alan Gilbert (git)
2016-08-25 9:37 ` [Qemu-devel] [PATCH 1/2] qapi: Stub out StringOutputVisitor struct support Dr. David Alan Gilbert (git)
2016-09-19 13:11 ` Markus Armbruster [this message]
2016-09-19 13:47 ` Dr. David Alan Gilbert
2016-09-19 14:14 ` Markus Armbruster
2016-09-19 14:21 ` Dr. David Alan Gilbert
2016-09-19 15:27 ` Markus Armbruster
2016-09-19 15:38 ` Dr. David Alan Gilbert
2016-09-19 16:52 ` Markus Armbruster
2016-09-19 17:39 ` Dr. David Alan Gilbert
2016-08-25 9:37 ` [Qemu-devel] [PATCH 2/2] qom: Implement qom-get HMP command Dr. David Alan Gilbert (git)
2016-09-19 13:30 ` Markus Armbruster
2016-08-30 10:59 ` [Qemu-devel] [PATCH 0/2] qom-get [for 2.8] Paolo Bonzini
2016-09-05 18:50 ` Dr. David Alan Gilbert
2016-09-06 7:22 ` Paolo Bonzini
2016-09-06 10:10 ` Dr. David Alan Gilbert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wpi8f310.fsf@dusky.pond.sub.org \
--to=armbru@redhat.com \
--cc=afaerber@suse.de \
--cc=arei.gonglei@huawei.com \
--cc=dgilbert@redhat.com \
--cc=kwolf@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.