From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39743) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Utc6n-00067D-BC for qemu-devel@nongnu.org; Mon, 01 Jul 2013 07:17:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Utc6l-00063I-Qc for qemu-devel@nongnu.org; Mon, 01 Jul 2013 07:17:25 -0400 Date: Mon, 1 Jul 2013 19:17:18 +0800 From: Amos Kong Message-ID: <20130701111718.GA32751@amosk.info> References: <1372342930-28684-1-git-send-email-armbru@redhat.com> <1372342930-28684-5-git-send-email-armbru@redhat.com> <51CD9188.8060203@redhat.com> <874nci40gk.fsf@blackfin.pond.sub.org> <20130701030856.GD1946@amosk.info> <87a9m6bszj.fsf@blackfin.pond.sub.org> <20130701090020.GC20061@amosk.info> <874ncezl0l.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <874ncezl0l.fsf@blackfin.pond.sub.org> Subject: Re: [Qemu-devel] [PATCH 4/4] qapi: Rename ChardevBackend member "memory" to "ringbuf" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: aliguori@us.ibm.com, lilei@linux.vnet.ibm.com, qemu-stable@nongnu.org, qemu-devel@nongnu.org, lcapitulino@redhat.com, kraxel@redhat.com On Mon, Jul 01, 2013 at 11:28:58AM +0200, Markus Armbruster wrote: > Amos Kong writes: > > > On Mon, Jul 01, 2013 at 10:10:40AM +0200, Markus Armbruster wrote: > >> Amos Kong writes: > >> > >> > On Fri, Jun 28, 2013 at 07:19:39PM +0200, Markus Armbruster wrote: > >> >> Eric Blake writes: > >> >> > >> >> > On 06/27/2013 08:22 AM, Markus Armbruster wrote: > >> >> >> Commit 1da48c6 called the new member "memory" after commit 3949e59 > >> >> >> standardized "ringbuf". Rename for consistency. > >> >> >> > >> >> >> However, member name "memory" is visible in QMP since 1.5. It's > >> >> >> undocumented just like the driver name. Keep it working anyway. > >> >> >> > >> >> >> Cc: qemu-stable@nongnu.org > >> >> >> Signed-off-by: Markus Armbruster > >> >> >> --- > >> >> >> qapi-schema.json | 6 ++++-- > >> >> >> qemu-char.c | 11 ++++++----- > >> >> >> 2 files changed, 10 insertions(+), 7 deletions(-) > >> >> >> > >> >> >> diff --git a/qapi-schema.json b/qapi-schema.json > >> >> >> index 6445da6..b3df8a5 100644 > >> >> >> --- a/qapi-schema.json > >> >> >> +++ b/qapi-schema.json > >> >> >> @@ -3277,9 +3277,9 @@ > >> >> >> ## > >> >> >> # @ChardevRingbuf: > >> >> >> # > >> >> >> -# Configuration info for memory chardevs > >> >> >> +# Configuration info for ring buffer chardevs. > >> >> >> # > >> >> >> -# @size: #optional Ringbuffer size, must be power of two, default is 65536 > >> >> >> +# @size: #optional ring buffer size, must be power of two, default is 65536 > >> >> >> # > >> >> >> # Since: 1.5 > >> >> >> ## > >> >> >> @@ -3310,6 +3310,8 @@ > >> >> >> 'spicevmc' : 'ChardevSpiceChannel', > >> >> >> 'spiceport' : 'ChardevSpicePort', > >> >> >> 'vc' : 'ChardevVC', > >> >> >> + 'ringbuf': 'ChardevRingbuf', > >> >> >> + # next one is just for compatibility > >> >> >> 'memory' : 'ChardevRingbuf' } } > >> >> > > >> >> > Does JSON allow comments in the middle of content? Is this going to > >> >> > screw up Amos' work on introspection? You may need to instead have a > >> >> > comment before the open '{' stating that 'memory' is an alias within the > >> >> > union for back-compat reasons. > >> > > >> > I didn't parse the json file by myself. I just used the parsed > >> > dictionary. So it only needs to make qapi.py happy. > >> > > >> >> RFC 4627 doesn't do comments at all. > >> >> > >> >> This file is parsed by scripts/qapi.py, which as far as I can tell > >> >> ignores lines starting with '#' anywhere in the input. > >> > > >> > Not anywhere, only start with '#' > >> > >> Isn't that what I said? > >> > >> > | def parse_schema(fp): > >> > | exprs = [] > >> > | raw_exprs = [] > >> > | expr = '' > >> > | expr_eval = None > >> > | > >> > | for line in fp: > >> > | if line.startswith('#') or line == '\n': > >> > > >> > # ignores lines starting with '#' anywhere > >> > if line.strip().startswith('#') > >> > > >> > | continue > >> > | > >> > > >> > > >> > So we should not add this kind of comment for back-compat. > >> > >> Now I'm confused. My patch adds a line that starts with '#'. > >> parse_schema() ignores it. Works as designed. Why do you think we > >> shouldn't do that? > > > > The comment line in your patch doen't start with '#', it starts with > > blank-space. If we want qapi.py to process it, we need to do strip() > > first. > > Aha. I agree with your reading of parse_schema(). However, I get > exactly identical generated files with and without this comment. I tried to add a '#hello' prefix for 'serial' item, but 'serial' can still be parsed as before. The '#hello' prefix will be ignored in qapi.py:tokenize() { 'union': 'ChardevBackend', 'data': { 'file' : 'ChardevFile', #hello 'serial' : 'ChardevHostdev', 'parallel': 'ChardevHostdev', > Michael, Anthony, can you explain why? > > Any particular reason for requiring comments to start in column 0? -- Amos.