From: Eric Blake <eblake@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org, Michael Roth <mdroth@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH v4 05/10] qapi: Utilize implicit struct visits
Date: Tue, 8 Mar 2016 11:28:32 -0700 [thread overview]
Message-ID: <56DF19D0.4030504@redhat.com> (raw)
In-Reply-To: <87wppc3kpt.fsf@blackfin.pond.sub.org>
[-- Attachment #1: Type: text/plain, Size: 2523 bytes --]
On 03/08/2016 11:09 AM, Markus Armbruster wrote:
> This patch actually fixes a similar issue in the qmp_marshal_FOO()
> functions.
Indeed, and I didn't even realize it. I'll add that to the commit message :)
>
> To keep ignoring it in the qapi_event_send_BAR() functions is okay.
> It's fairly easy to fix now, though: split them into two, so that the
> outer half does nothing but parameter wrapping. For instance,
>
> void qapi_event_send_block_io_error(const char *device, IoOperationType operation, BlockErrorAction action, bool has_nospace, bool nospace, const char *reason, Error **errp)
> {
> QDict *qmp;
> Error *err = NULL;
> QMPEventFuncEmit emit;
> QmpOutputVisitor *qov;
> Visitor *v;
> QObject *obj;
> _obj_BLOCK_IO_ERROR_arg param = {
> (char *)device, operation, action, has_nospace, nospace, (char *)reason
> };
>
> [do stuff...]
> }
>
> becomes
>
> static inline void do_event_send_block_io_error(_obj_BLOCK_IO_ERROR_arg param, Error **errp)
> {
> QDict *qmp;
> Error *err = NULL;
> QMPEventFuncEmit emit;
> QmpOutputVisitor *qov;
> Visitor *v;
> QObject *obj;
>
> [do stuff...]
> }
>
> void qapi_event_send_block_io_error(const char *device, IoOperationType operation, BlockErrorAction action, bool has_nospace, bool nospace, const char *reason, Error **errp)
Still means we can't have 'errp' as a QMP member of the error, without
some sort of renaming. Again, not worth worrying about until we
actually want to avoid the collision.
> {
> do_event_send_block_io_error((_obj_BLOCK_IO_ERROR_arg){
> (char *)device, operation, action, has_nospace, nospace, (char *)reason
> }, errp);
> };
> }
>
> Feel free not to do that now, but mark the spot with a comment then.
> Since it's technically wrong, we could even mark it FIXME.
In fact, I have a patch in a later series [1] that WANTS to let the user
supply a boxed parameter - at which point, the difference between two
vs. one function would be whether the user requested boxing. Sounds
like I add the FIXME here, and then that series can take care of the
possible split.
[1] https://lists.gnu.org/archive/html/qemu-devel/2015-12/msg04394.html
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2016-03-08 18:28 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-05 16:16 [Qemu-devel] [PATCH v4 00/10] easier unboxed visits/qapi implicit types Eric Blake
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 01/10] qapi: Assert in places where variants are not handled Eric Blake
2016-03-08 10:12 ` Markus Armbruster
2016-03-08 15:49 ` Eric Blake
2016-03-08 17:46 ` Markus Armbruster
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 02/10] qapi: Fix command with named empty argument type Eric Blake
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 03/10] qapi: Make c_type() more OO-like Eric Blake
2016-03-08 10:54 ` Markus Armbruster
2016-03-08 15:50 ` Eric Blake
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 04/10] qapi: Emit implicit structs in generated C Eric Blake
2016-03-08 14:24 ` Markus Armbruster
2016-03-08 16:03 ` Eric Blake
2016-03-08 19:09 ` Markus Armbruster
2016-03-09 5:42 ` Eric Blake
2016-03-09 7:23 ` Markus Armbruster
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 05/10] qapi: Utilize implicit struct visits Eric Blake
2016-03-08 15:10 ` Markus Armbruster
2016-03-08 16:11 ` Eric Blake
2016-03-08 18:09 ` Markus Armbruster
2016-03-08 18:28 ` Eric Blake [this message]
2016-03-08 19:21 ` Markus Armbruster
2016-03-09 23:28 ` Eric Blake
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 06/10] qapi-commands: Inline single-use helpers of gen_marshal() Eric Blake
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 07/10] qapi: Don't special-case simple union wrappers Eric Blake
2016-03-08 15:59 ` Markus Armbruster
2016-03-08 16:16 ` Eric Blake
2016-03-08 18:10 ` Markus Armbruster
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 08/10] qapi: Allow anonymous base for flat union Eric Blake
2016-03-08 16:23 ` Markus Armbruster
2016-03-08 16:29 ` Eric Blake
2016-03-08 18:14 ` Markus Armbruster
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 09/10] qapi: Use anonymous bases in QMP flat unions Eric Blake
2016-03-05 16:16 ` [Qemu-devel] [PATCH v4 10/10] qapi: Populate info['name'] for each entity Eric Blake
2016-03-08 16:46 ` Markus Armbruster
2016-03-08 16:59 ` Eric Blake
2016-03-08 19:14 ` Markus Armbruster
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=56DF19D0.4030504@redhat.com \
--to=eblake@redhat.com \
--cc=armbru@redhat.com \
--cc=mdroth@linux.vnet.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).