From: Eric Blake <eblake@redhat.com>
To: Wenchao Xia <wenchaoqemu@gmail.com>, qemu-devel@nongnu.org
Cc: mdroth@linux.vnet.ibm.com, armbru@redhat.com, lcapitulino@redhat.com
Subject: Re: [Qemu-devel] [RFC PATCH V3 3/5] qapi script: add event support
Date: Thu, 20 Mar 2014 17:06:29 -0600 [thread overview]
Message-ID: <532B7475.2060502@redhat.com> (raw)
In-Reply-To: <1395206201-22999-4-git-send-email-wenchaoqemu@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3735 bytes --]
On 03/18/2014 11:16 PM, Wenchao Xia wrote:
> qapi-event.py will parse the schema and generate qapi-event.c, then
> the API in qapi-event.c can be used to handle event in qemu code.
> All API have prefix "qapi_event".
>
> The script mainly include two parts: generate API for each event
s/include/includes/
> define, generate an enum type for all defined events.
>
> Since in some case the real emit behavior may change, for example,
s/case/cases/
> qemu-img would not send a event, a callback layer is used to
> control the behavior. As a result, the stubs at compile time
> can be saved, the binding of block layer code and monitor code
> will become looser.
>
> Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
> ---
> Makefile | 9 +-
> Makefile.objs | 2 +-
> docs/qapi-code-gen.txt | 18 +++
> scripts/qapi-event.py | 373 ++++++++++++++++++++++++++++++++++++++++++++++++
> 4 files changed, 398 insertions(+), 4 deletions(-)
> create mode 100644 scripts/qapi-event.py
>
> +++ b/docs/qapi-code-gen.txt
> @@ -180,6 +180,24 @@ An example command is:
> 'data': { 'arg1': 'str', '*arg2': 'str' },
> 'returns': 'str' }
>
> +=== Events ===
> +
> +Events are defined with key workd 'event'. When 'data' is also specified,
s/workd/word/
> +additional info will be carried on. Finally there will be C API generated
> +in qapi-event.h, and when called by QEMU code, message with timestamp will
s/message/a message/
> +be emit on the wire. If timestamp is -1, it means failure in host time
s/emit/emitted/
> +retrieving.
s/in host time retrieving/to retrieve host time/
> +++ b/scripts/qapi-event.py
> @@ -0,0 +1,373 @@
> +#
> +# QAPI event generator
> +#
> +# Authors:
> +# Wenchao Xia <wenchaoqemu@gmail.com>
> +#
> +# This work is licensed under the terms of the GNU GPL, version 2.
> +# See the COPYING file in the top-level directory.
Needs to use "Copyright".
> +
> + if params:
> + for argname, argentry, optional, structured in parse_args(params):
> + if structured:
> + sys.stderr.write("Nested structure define in event is not "
> + "supported now, event '%s', argname '%s'\n" %
> + (event_name, argname))
> + sys.exit(1)
> + continue
Isn't this 'continue' dead code?
> +
> +# Following are the functions that generate an enum type for all defined
> +# events, similar with qapi-types.py. Here we already have enum name and
s/with/to/
> +# values which is generated before and recorded in event_enum_*. It also
s/is/were/
> +# walk around the issue that "import qapi-types" can't work.
s/walk around/works around/
> +
> +fdef.write(mcgen('''
> +/* THIS FILE IS AUTOMATICALLY GENERATED, DO NOT MODIFY */
> +
> +/*
> + * schema-defined QAPI event functions
> + *
> + * Authors:
> + * Wenchao Xia <wenchaoqemu@gmail.com>
> + *
> + * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
> + * See the COPYING.LIB file in the top-level directory.
Also needs "Copyright"
> +fdecl.write(mcgen('''
> +/* THIS FILE IS AUTOMATICALLY GENERATED, DO NOT MODIFY */
> +
> +/*
> + * schema-defined QAPI event function
s/function/functions/
> + *
> + * Authors:
> + * Wenchao Xia <wenchaoqemu@gmail.com>
> + *
> + * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
> + * See the COPYING.LIB file in the top-level directory.
Needs "Copyright"
--
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:[~2014-03-20 23:06 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-19 5:16 [Qemu-devel] [RFC PATCH V3 0/5] add direct support of event in qapi schema Wenchao Xia
2014-03-19 5:16 ` [Qemu-devel] [RFC PATCH V3 1/5] os-posix: include sys/time.h Wenchao Xia
2014-03-19 5:16 ` [Qemu-devel] [RFC PATCH V3 2/5] qapi: add event helper functions Wenchao Xia
2014-03-20 22:53 ` Eric Blake
2014-03-24 0:53 ` Wenchao Xia
2014-03-24 13:11 ` Eric Blake
2014-03-19 5:16 ` [Qemu-devel] [RFC PATCH V3 3/5] qapi script: add event support Wenchao Xia
2014-03-20 23:06 ` Eric Blake [this message]
2014-03-24 0:59 ` Wenchao Xia
2014-03-19 5:16 ` [Qemu-devel] [RFC PATCH V3 4/5] test: add test cases for qapi event Wenchao Xia
2014-03-21 0:23 ` Eric Blake
2014-03-24 1:01 ` Wenchao Xia
2014-03-19 5:16 ` [Qemu-devel] [RFC PATCH V3 5/5] qapi event: convert RTC_CHANGE Wenchao Xia
2014-03-21 0:25 ` 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=532B7475.2060502@redhat.com \
--to=eblake@redhat.com \
--cc=armbru@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=wenchaoqemu@gmail.com \
/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).