From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:57993) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uc4qK-00081W-I0 for qemu-devel@nongnu.org; Mon, 13 May 2013 22:19:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uc4qJ-0001c5-Hl for qemu-devel@nongnu.org; Mon, 13 May 2013 22:19:56 -0400 Received: from e23smtp08.au.ibm.com ([202.81.31.141]:50914) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uc4qI-0001by-Qh for qemu-devel@nongnu.org; Mon, 13 May 2013 22:19:55 -0400 Received: from /spool/local by e23smtp08.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 14 May 2013 12:17:12 +1000 Received: from d23relay04.au.ibm.com (d23relay04.au.ibm.com [9.190.234.120]) by d23dlp03.au.ibm.com (Postfix) with ESMTP id 248653578017 for ; Tue, 14 May 2013 12:19:30 +1000 (EST) Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.235.138]) by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r4E25Sm019595294 for ; Tue, 14 May 2013 12:05:31 +1000 Received: from d23av02.au.ibm.com (loopback [127.0.0.1]) by d23av02.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r4E2JQ0l019262 for ; Tue, 14 May 2013 12:19:26 +1000 Message-ID: <51919F0B.4060409@linux.vnet.ibm.com> Date: Tue, 14 May 2013 10:18:51 +0800 From: Wenchao Xia MIME-Version: 1.0 References: <1367221335-22777-1-git-send-email-stefanha@redhat.com> <1367221335-22777-3-git-send-email-stefanha@redhat.com> <518DC2C6.5030500@redhat.com> <20130513082811.GB6419@dhcp-200-207.str.redhat.com> <5190E30E.40005@redhat.com> <20130513130931.GC6419@dhcp-200-207.str.redhat.com> <20130513091858.54c4e4e6@redhat.com> <5190F534.40806@redhat.com> <20130513142705.GE6419@dhcp-200-207.str.redhat.com> <5190FDBC.8090607@redhat.com> In-Reply-To: <5190FDBC.8090607@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v2 2/3] block: add block-backup QMP command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Kevin Wolf , Fam Zheng , qemu-devel@nongnu.org, Luiz Capitulino , imain@redhat.com, Stefan Hajnoczi , pbonzini@redhat.com, dietmar@proxmox.com 于 2013-5-13 22:50, Eric Blake 写道: > On 05/13/2013 08:27 AM, Kevin Wolf wrote: >> I think long term we'll need a dynamic schema anyway. As we go forward >> with modularisation and putting things into shared libraries, we'll have >> modules that add support for commands, enum values, etc. > > In other words, qapi-schema.json should have a way to declare a > dynamic-enum, where introspection on that enum will see what is made > available at runtime, rather than manually listing the enum contents > directly in the .json file. > >> >> Providing the full list of theoretically available elements (i.e. what >> would be there, if everything was compiled and all modules were loaded) >> would probably implement the spec for the introspection interfaces by the >> letter, but just give useless information. Callers want to know what's >> really there. >> >> If we're going to have a query-* command for everything, then we don't >> need introspection at all. I would however prefer having the uniform >> schema introspection and building the schema at runtime instead of many >> separate query-* commands. > > Indeed, having introspection of a dynamic enum results in fewer commands > overall, by making a reusable command have more power. And maybe it's > possible to have introspection do both - with an optional boolean > parameter that distinguishes between full vs. runtime querying of any > enum type. > "string <-> enum mapping" issue happens when I try coding libqblock, what I found is that, since lower level implement code still depends string, so there will be another translating back to string inside later. For format string, it is probably OK since two functions will be enough, but when more enum is wanted, things become complex. So I feel it is right to try use enum in the API now, but maybe a plan to reorganize block layer will be also needed, which may be a bit complex needing serous plan. -- Best Regards Wenchao Xia