From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35243) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VK87X-0004qG-Le for qemu-devel@nongnu.org; Thu, 12 Sep 2013 10:43:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VK87P-0000Iy-6h for qemu-devel@nongnu.org; Thu, 12 Sep 2013 10:43:47 -0400 Received: from mail-ea0-x230.google.com ([2a00:1450:4013:c01::230]:39768) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VK87O-0000In-TE for qemu-devel@nongnu.org; Thu, 12 Sep 2013 10:43:39 -0400 Received: by mail-ea0-f176.google.com with SMTP id q16so5315985ead.7 for ; Thu, 12 Sep 2013 07:43:37 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <5231D320.7050006@redhat.com> Date: Thu, 12 Sep 2013 16:43:44 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1378977312-17696-1-git-send-email-xiawenc@linux.vnet.ibm.com> <523189F2.6050107@redhat.com> <20130912120853.GI3514@dhcp-200-207.str.redhat.com> In-Reply-To: <20130912120853.GI3514@dhcp-200-207.str.redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC PATCH 0/8] Remove stub mon-protocol-event for block List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: stefanha@redhat.com, Wenchao Xia , anthony@codemonkey.ws, qemu-devel@nongnu.org Il 12/09/2013 14:08, Kevin Wolf ha scritto: > Am 12.09.2013 um 11:31 hat Paolo Bonzini geschrieben: >> Il 12/09/2013 11:15, Wenchao Xia ha scritto: >>> This series will remove the usage of symbols of mon-protocol-event in >>> qemu-img, qemu-nbd and qemu-io, in short remove the connetion for block >>> layer. >>> >>> Background: >>> I am tring to decouple block layer code with other unnnessary components, >>> and in ./stub there many symbols that qemu-img linked as fake implemtion. >>> As a first step, I am decouple monitor with block layer code, this is the >>> first part of it. >>> There are still other stub symbols for monitor, which will be solved later. >>> It seems error handlering is also link with those symbols, and will adjust >>> that. > >> Patches 1-4 look good. I'm not sure of the advantage of the last four, >> however. The ugly part of monitor_protocol_event is not really the >> stub, but the dependency on QObject. >> >> So, in my opinion a more interesting approach would be to describe >> events using QAPI types. Generating the events would require a small >> amount of code to build QObjects manually, because the event syntax >> doesn't match exactly a QAPI union, but that is only a technical detail. > > You mean the QAPI schema cannot describe events? Why do you think so, > and wouldn't this be a reason to extend the schema language? > > The QMP spec describes events like this: > > { "event": json-string, "data": json-object, > "timestamp": { "seconds": json-number, "microseconds": json-number } } > > Looks like it could be described as: > > { 'type': 'EventTypeA', > 'data': { > 'data': { > # event-specific data > } } } > { 'type': 'EventBase', > 'data': { 'event': 'str'. 'timestamp': { > 'seconds': 'int', 'microseconds': 'int' } } > { 'union': 'Event', > 'base:' EventBase', > 'discriminator': 'event', > 'data': { > 'EVENT_NAME_A': 'EventTypeA' > } } I didn't know about all this cool stuff you added. :) Paolo