Received: from eggs.gnu.org ([2001:4830:134:3::10]:41329) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adNCi-0004bM-G2 for qemu-devel@nongnu.org; Tue, 08 Mar 2016 14:22:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1adNCd-0000ny-Kz for qemu-devel@nongnu.org; Tue, 08 Mar 2016 14:22:00 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51591) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adNCd-0000nq-Ei for qemu-devel@nongnu.org; Tue, 08 Mar 2016 14:21:55 -0500 From: Markus Armbruster References: <1457194595-16189-1-git-send-email-eblake@redhat.com> <1457194595-16189-6-git-send-email-eblake@redhat.com> <87d1r580q0.fsf@blackfin.pond.sub.org> <56DEF9CB.6020601@redhat.com> <87wppc3kpt.fsf@blackfin.pond.sub.org> <56DF19D0.4030504@redhat.com> Date: Tue, 08 Mar 2016 20:21:52 +0100 In-Reply-To: <56DF19D0.4030504@redhat.com> (Eric Blake's message of "Tue, 8 Mar 2016 11:28:32 -0700") Message-ID: <87si00zsfj.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v4 05/10] qapi: Utilize implicit struct visits List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: qemu-devel@nongnu.org, Michael Roth Eric Blake writes: > 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. Rename it to q_errp. >> { >> 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 Works for me.