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 v16 11/24] qmp-input: Refactor when list is advanced
Date: Fri, 29 Apr 2016 06:15:24 -0600 [thread overview]
Message-ID: <5723505C.9070605@redhat.com> (raw)
In-Reply-To: <87a8kc7q9g.fsf@dusky.pond.sub.org>
[-- Attachment #1: Type: text/plain, Size: 2975 bytes --]
On 04/29/2016 02:50 AM, Markus Armbruster wrote:
> Eric Blake <eblake@redhat.com> writes:
>
>> In the QMP input visitor, visiting a list traverses two objects:
>> the QAPI GenericList of the caller (which gets advanced in
>> visit_next_list() regardless of this patch), and the QList input
>> that we are converting to QAPI. For consistency with QDict
>> visits, we want to consume elements from the input QList during
>> the visit_type_FOO() for the list element; that is, we want ALL
>> the code for consuming an input to live in qmp_input_get_object(),
>> rather than having it split according to whether we are visiting
>> a dict or a list. Making qmp_input_get_object() the common point
>> of consumption will make it easier for a later patch to refactor
>> visit_start_list() to cover the GenericList * head of a QAPI list,
>> and in turn will get rid of the 'first' flag (which lived in
>> qmp_input_next_list() pre-patch, and is hoisted to StackObject
>> by this patch).
>>
>> This patch is therefore shifting the post-condition use of
>> 'entry' from:
>>
>> start_list next_list type_ELT ... next_list type_ELT next_list end_list
>> visit 1st elt last elt
>> entry NULL 1st elt 1st elt last elt last elt NULL gone
>
> You added a line "visit", but the introduction still only mentions
> 'entry'. Mildly confusing. If you have an idea on how to improve it, I
> can touch it up on commit.
[probably word wrapped by my mailer, but how about]
This patch is therefore altering the post-condition use of 'entry',
while keeping what gets visited unchanged, from:
start_list next_list type_ELT ... next_list type_ELT next_list
end_list
visits 1st elt last elt
entry NULL 1st elt 1st elt last elt last elt NULL gone
>
>>
>> where type_ELT() returns (entry ? entry : 1st elt) and next_list() steps
>> entry
>>
>> to this usage:
>>
>> start_list next_list type_ELT ... next_list type_ELT next_list end_list
>> visit 1st elt last elt
and another s/visit/visits/ here
>> entry 1st elt 1nd elt 2nd elt last elt NULL NULL gone
>>
>> where type_ELT() steps entry and returns the old entry, and next_list()
>> leaves entry alone.
>>
>> Signed-off-by: Eric Blake <eblake@redhat.com>
>
> Patch looks good.
I added the visit line to make it a little easier to see that type_ELT
is still visiting the same thing, even though 'entry' ends up on a
different spot (easier than deciphering "type_ELT() ... returns the old
entry"). But if you don't think it adds anything, I'm also okay with
dropping the 'visit[s]' line and sticking to just the phrase after the
diagram for that explanation.
--
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-04-29 12:15 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-28 21:45 [Qemu-devel] [PATCH v16 00/24] qapi visitor cleanups (post-introspection cleanups subset E) Eric Blake
2016-04-28 21:45 ` [Qemu-devel] [PATCH v16 01/24] qapi-visit: Add visitor.type classification Eric Blake
2016-04-28 21:45 ` [Qemu-devel] [PATCH v16 02/24] qapi: Guarantee NULL obj on input visitor callback error Eric Blake
2016-04-29 8:28 ` Markus Armbruster
2016-04-29 12:10 ` Eric Blake
2016-04-29 12:17 ` Eric Blake
2016-04-29 12:59 ` Markus Armbruster
2016-04-28 21:45 ` [Qemu-devel] [PATCH v16 03/24] qmp: Drop dead command->type Eric Blake
2016-04-28 21:45 ` [Qemu-devel] [PATCH v16 04/24] qmp-input: Clean up stack handling Eric Blake
2016-04-28 21:45 ` [Qemu-devel] [PATCH v16 05/24] qapi: Consolidate QMP input visitor creation Eric Blake
2016-04-28 21:45 ` [Qemu-devel] [PATCH v16 06/24] qapi: Use strict QMP input visitor in more places Eric Blake
2016-04-28 21:45 ` [Qemu-devel] [PATCH v16 07/24] qmp-input: Don't consume input when checking has_member Eric Blake
2016-04-28 21:45 ` [Qemu-devel] [PATCH v16 08/24] qapi-commands: Wrap argument visit in visit_start_struct Eric Blake
2016-04-28 21:45 ` [Qemu-devel] [PATCH v16 09/24] qom: Wrap prop " Eric Blake
2016-04-28 21:45 ` [Qemu-devel] [PATCH v16 10/24] qmp-input: Require struct push to visit members of top dict Eric Blake
2016-04-28 21:45 ` [Qemu-devel] [PATCH v16 11/24] qmp-input: Refactor when list is advanced Eric Blake
2016-04-29 8:50 ` Markus Armbruster
2016-04-29 12:15 ` Eric Blake [this message]
2016-04-29 13:03 ` Markus Armbruster
2016-04-28 21:45 ` [Qemu-devel] [PATCH v16 12/24] qapi: Document visitor interfaces, add assertions Eric Blake
2016-05-04 14:05 ` [Qemu-devel] [PATCH] fixup! " Eric Blake
2016-05-04 14:49 ` Eric Blake
2016-05-04 15:04 ` Markus Armbruster
2016-04-28 21:45 ` [Qemu-devel] [PATCH v16 13/24] tests: Add check-qnull Eric Blake
2016-04-28 21:45 ` [Qemu-devel] [PATCH v16 14/24] qapi: Add visit_type_null() visitor Eric Blake
2016-04-28 21:45 ` [Qemu-devel] [PATCH v16 15/24] qmp: Support explicit null during visits Eric Blake
2016-04-28 21:45 ` [Qemu-devel] [PATCH v16 16/24] spapr_drc: Expose 'null' in qom-get when there is no fdt Eric Blake
2016-04-28 21:45 ` [Qemu-devel] [PATCH v16 17/24] qmp: Add qmp_output_visitor_reset() Eric Blake
2016-05-10 4:20 ` [Qemu-devel] [PATCH v16A 17/24] qmp: Don't reuse qmp visitor after grabbing output Eric Blake
2016-05-10 8:18 ` Markus Armbruster
2016-04-28 21:45 ` [Qemu-devel] [PATCH v16 18/24] qmp: Tighten output visitor rules Eric Blake
2016-04-28 21:45 ` [Qemu-devel] [PATCH v16 19/24] qapi: Split visit_end_struct() into pieces Eric Blake
2016-04-28 21:45 ` [Qemu-devel] [PATCH v16 20/24] qapi: Don't pass NULL to printf in string input visitor Eric Blake
2016-04-29 9:03 ` Markus Armbruster
2016-04-28 21:45 ` [Qemu-devel] [PATCH v16 21/24] tests/string-input-visitor: Add negative integer tests Eric Blake
2016-04-28 21:45 ` [Qemu-devel] [PATCH v16 22/24] qapi: Fix string input visitor handling of invalid list Eric Blake
2016-04-28 21:45 ` [Qemu-devel] [PATCH v16 23/24] qapi: Simplify semantics of visit_next_list() Eric Blake
2016-04-28 21:45 ` [Qemu-devel] [PATCH v16 24/24] qapi: Change visit_type_FOO() to no longer return partial objects Eric Blake
2016-04-29 11:13 ` [Qemu-devel] [PATCH v16 00/24] qapi visitor cleanups (post-introspection cleanups subset E) Markus Armbruster
2016-04-29 12:16 ` Eric Blake
2016-04-29 13:09 ` Markus Armbruster
2016-04-29 14:09 ` Eric Blake
2016-05-04 13:54 ` Markus Armbruster
2016-05-04 14:07 ` Eric Blake
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=5723505C.9070605@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).