qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Wenchao Xia <wenchaoqemu@gmail.com>
To: Eric Blake <eblake@redhat.com>, qemu-devel@nongnu.org
Cc: mdroth@linux.vnet.ibm.com, armbru@redhat.com, lcapitulino@redhat.com
Subject: Re: [Qemu-devel] [PATCH V6 08/29] qapi event: convert SHUTDOWN
Date: Sun, 15 Jun 2014 08:32:23 +0800	[thread overview]
Message-ID: <539CE997.9010602@gmail.com> (raw)
In-Reply-To: <539B57AB.9050000@redhat.com>

于 2014/6/14 3:57, Eric Blake 写道:
> On 06/05/2014 06:22 AM, Wenchao Xia wrote:
>> This patch also eliminates build time warning caused by
>> QAPI_EVENT_MAX = 0.
>
> I still don't know why I wasn't seeing a warning for that, but agree
> this cleans it up (or whichever event gets converted first, as there
> aren't really any dependency restrictions in the order in which you do
> conversions).  If you do follow my suggestion of adding a workaround in
> 6/29 to avoid build warnings, then don't undo it here, but save it until
> 29/29; that way, no one individual conversion is doing more work than
> any other.
>
>>
>> Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
>> ---
>>   docs/qmp/qmp-events.txt |   15 ---------------
>>   qapi-event.json         |   12 ++++++++++++
>>   vl.c                    |    3 ++-
>>   3 files changed, 14 insertions(+), 16 deletions(-)
>
> Yay - I finally have enough to see what code gets generated in 3/29.
> The qapi-event.h header now has:
>
> void qapi_event_send_shutdown(Error **errp);
>
> extern const char *QAPIEvent_lookup[];
> typedef enum QAPIEvent
> {
>      QAPI_EVENT_SHUTDOWN = 0,
>      QAPI_EVENT_MAX = 1,
> } QAPIEvent;
>
>
> and the .c file has:
>
> void qapi_event_send_shutdown(Error **errp)
> {
>      QDict *qmp;
>      Error *local_err = NULL;
>      QMPEventFuncEmit emit;
>      emit = qmp_event_get_func_emit();
>      if (!emit) {
>          return;
>      }
>
>      qmp = qmp_event_build_dict("SHUTDOWN");
>
>      emit(QAPI_EVENT_SHUTDOWN, qmp, &local_err);
>
>      error_propagate(errp, local_err);
>      QDECREF(qmp);
> }
>
>
> Looks good, for a data-free event (I guess I'll have to wait till later
> in the series to see what gets generated for an event with data).  Hmm,
> I wonder if patch 3/29 should have also modified docs/qapi-code-gen.txt
> to show a sample generated function.
>
   Will add doc part.


>>
>> -
>> -Emitted when the Virtual Machine is powered down.
>
>> +++ b/qapi-event.json
>> @@ -0,0 +1,12 @@
>> +##
>> +# @SHUTDOWN
>> +#
>> +# Emitted when the virtual machine shutdown, qemu terminated the emulation and
>> +# is about to exit.
>
> Different wording than the text it replaces, and the grammar is a bit
> unusual.  Maybe:
>
> Emitted when the virtual machine has shut down, indicating that qemu is
> about to exit.
>
>>       if (qemu_shutdown_requested()) {
>>           qemu_kill_report();
>> -        monitor_protocol_event(QEVENT_SHUTDOWN, NULL);
>> +        qapi_event_send_shutdown(NULL);
>
> Note that the two NULLs serve different purposes.  In the old code, NULL
> meant there was no additional data.  In the new code, NULL indicates
> that we are ignoring the possibility for error.  I wonder if it would be
> better to pass &error_abort instead of NULL?  For that matter, I just
> re-read 6/29 - the one implementation we have of an emit function
> (monitor_qapi_event_queue) never sets errp.  Is it better to just
> consider events as best-effort, and completely ditch the errp parameter
> from the emit callback typedef in 2/29, since it looks like you intend
> to pass NULL for all clients of the callback?
>
   It make things simple, I will remove &errp in next version.

  reply	other threads:[~2014-06-15  0:32 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-05 12:21 [Qemu-devel] [PATCH V6 00/29] add direct support of event in qapi schema Wenchao Xia
2014-06-05 12:21 ` [Qemu-devel] [PATCH V6 01/29] os-posix: include sys/time.h Wenchao Xia
2014-06-05 12:21 ` [Qemu-devel] [PATCH V6 02/29] qapi: add event helper functions Wenchao Xia
2014-06-05 12:21 ` [Qemu-devel] [PATCH V6 03/29] qapi script: add event support Wenchao Xia
2014-06-13 16:47   ` Eric Blake
2014-06-13 21:28   ` Eric Blake
2014-06-18  3:33   ` Eric Blake
2014-06-18  6:06     ` Paolo Bonzini
2014-06-18 22:45       ` Wenchao Xia
2014-06-18  3:50   ` Eric Blake
2014-06-05 12:21 ` [Qemu-devel] [PATCH V6 04/29] test: add test cases for qapi event Wenchao Xia
2014-06-13 17:05   ` Eric Blake
2014-06-05 12:22 ` [Qemu-devel] [PATCH V6 05/29] qapi: adjust existing defines Wenchao Xia
2014-06-13 17:32   ` Eric Blake
2014-06-05 12:22 ` [Qemu-devel] [PATCH V6 06/29] monitor: add an implemention as qapi event emit method Wenchao Xia
2014-06-13 19:04   ` Eric Blake
2014-06-15  0:27     ` Wenchao Xia
2014-06-05 12:22 ` [Qemu-devel] [PATCH V6 07/29] qapi: add new schema file qapi-event.json Wenchao Xia
2014-06-13 19:25   ` Eric Blake
2014-06-13 19:45     ` Eric Blake
2014-06-05 12:22 ` [Qemu-devel] [PATCH V6 08/29] qapi event: convert SHUTDOWN Wenchao Xia
2014-06-13 19:57   ` Eric Blake
2014-06-15  0:32     ` Wenchao Xia [this message]
2014-06-05 12:22 ` [Qemu-devel] [PATCH V6 09/29] qapi event: convert POWERDOWN Wenchao Xia
2014-06-13 20:02   ` Eric Blake
2014-06-05 12:22 ` [Qemu-devel] [PATCH V6 10/29] qapi event: convert RESET Wenchao Xia
2014-06-05 12:22 ` [Qemu-devel] [PATCH V6 11/29] qapi event: convert STOP Wenchao Xia
2014-06-13 20:29   ` Eric Blake
2014-06-17  9:17     ` Paolo Bonzini
2014-06-17 13:18       ` Eric Blake
2014-06-05 12:22 ` [Qemu-devel] [PATCH V6 12/29] qapi event: convert RESUME Wenchao Xia
2014-06-13 20:33   ` Eric Blake
2014-06-05 12:22 ` [Qemu-devel] [PATCH V6 13/29] qapi event: convert SUSPEND Wenchao Xia
2014-06-13 20:40   ` Eric Blake
2014-06-05 12:22 ` [Qemu-devel] [PATCH V6 14/29] qapi event: convert SUSPEND_DISK Wenchao Xia
2014-06-13 20:42   ` Eric Blake
2014-06-05 12:22 ` [Qemu-devel] [PATCH V6 15/29] qapi event: convert WAKEUP Wenchao Xia
2014-06-13 20:57   ` Eric Blake
2014-06-05 12:22 ` [Qemu-devel] [PATCH V6 16/29] qapi event: convert RTC_CHANGE Wenchao Xia
2014-06-13 21:27   ` Eric Blake
2014-06-15  0:38     ` Wenchao Xia
2014-06-15 14:01       ` Paolo Bonzini
2014-06-15 14:00     ` Paolo Bonzini
2014-06-17  9:21     ` Paolo Bonzini
2014-06-17 13:19       ` Eric Blake
2014-06-05 12:22 ` [Qemu-devel] [PATCH V6 17/29] qapi event: convert WATCHDOG Wenchao Xia
2014-06-13 21:47   ` Eric Blake
2014-06-13 22:05     ` Eric Blake
2014-06-15  0:45       ` Wenchao Xia
2014-06-17  9:23     ` Paolo Bonzini
2014-06-17 13:21       ` Eric Blake
2014-06-05 12:22 ` [Qemu-devel] [PATCH V6 18/29] qapi event: convert DEVICE_DELETED Wenchao Xia
2014-06-05 12:22 ` [Qemu-devel] [PATCH V6 19/29] qapi event: convert DEVICE_TRAY_MOVED Wenchao Xia
2014-06-05 12:22 ` [Qemu-devel] [PATCH V6 20/29] qapi event: convert BLOCK_IO_ERROR and BLOCK_JOB_ERROR Wenchao Xia
2014-06-05 12:22 ` [Qemu-devel] [PATCH V6 21/29] qapi event: convert BLOCK_IMAGE_CORRUPTED Wenchao Xia
2014-06-16 22:53   ` Eric Blake
2014-06-05 12:22 ` [Qemu-devel] [PATCH V6 22/29] qapi event: convert other BLOCK_JOB events Wenchao Xia
2014-06-16 22:57   ` Eric Blake
2014-06-05 12:22 ` [Qemu-devel] [PATCH V6 23/29] qapi event: convert NIC_RX_FILTER_CHANGED Wenchao Xia
2014-06-05 12:22 ` [Qemu-devel] [PATCH V6 24/29] qapi event: convert VNC events Wenchao Xia
2014-06-16 23:01   ` Eric Blake
2014-06-05 12:22 ` [Qemu-devel] [PATCH V6 25/29] qapi event: convert SPICE events Wenchao Xia
2014-06-16 23:05   ` Eric Blake
2014-06-05 12:22 ` [Qemu-devel] [PATCH V6 26/29] qapi event: convert BALLOON_CHANGE Wenchao Xia
2014-06-05 12:22 ` [Qemu-devel] [PATCH V6 27/29] qapi event: convert GUEST_PANICKED Wenchao Xia
2014-06-16 14:08   ` Eric Blake
2014-06-05 12:22 ` [Qemu-devel] [PATCH V6 28/29] qapi event: convert QUORUM events Wenchao Xia
2014-06-05 12:22 ` [Qemu-devel] [PATCH V6 29/29] qapi event: clean up Wenchao Xia
2014-06-16 14:09   ` Eric Blake
2014-06-10  5:48 ` [Qemu-devel] [PATCH V6 00/29] add direct support of event in qapi schema Paolo Bonzini
2014-06-15  0:52   ` Wenchao Xia
2014-06-17 10:57     ` Paolo Bonzini
2014-06-17 16:05       ` Eric Blake
2014-06-17 16:30         ` Paolo Bonzini
2014-06-17 22:10           ` Wenchao Xia
2014-06-18  4:00       ` Eric Blake
2014-06-18  6:07         ` Paolo Bonzini

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=539CE997.9010602@gmail.com \
    --to=wenchaoqemu@gmail.com \
    --cc=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=lcapitulino@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).