From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54250) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZTB9o-0006XP-BS for qemu-devel@nongnu.org; Sat, 22 Aug 2015 11:56:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZTB9l-0005dm-5c for qemu-devel@nongnu.org; Sat, 22 Aug 2015 11:56:36 -0400 Received: from mail-wi0-x22a.google.com ([2a00:1450:400c:c05::22a]:38870) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZTB9k-0005dL-Vu for qemu-devel@nongnu.org; Sat, 22 Aug 2015 11:56:33 -0400 Received: by wicja10 with SMTP id ja10so37570203wic.1 for ; Sat, 22 Aug 2015 08:56:31 -0700 (PDT) From: "=?UTF-8?B?S8WRdsOhZ8OzIFpvbHTDoW4=?=" References: <7dcbdc8169de6b0090aa1ba89e7426fb3cd0e6cf.1440171025.git.DirtY.iCE.hu@gmail.com> <20150821231307.GD5816@thinpad.lan.raisama.net> Message-ID: <55D89BB8.4090201@gmail.com> Date: Sat, 22 Aug 2015 17:56:40 +0200 MIME-Version: 1.0 In-Reply-To: <20150821231307.GD5816@thinpad.lan.raisama.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v2 03/49] qapi: convert NumaOptions into a flat union List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost Cc: Markus Armbruster , qemu-devel@nongnu.org, Gerd Hoffmann 2015-08-22 01:13 keltezéssel, Eduardo Habkost írta: > On Fri, Aug 21, 2015 at 05:36:59PM +0200, Kővágó, Zoltán wrote: >> Signed-off-by: Kővágó, Zoltán > > I don't understand QAPI enough to understand why exactly this is needed > (so I would like to get feedback from somebody who actually understands > QAPI unions), but I have one comment below. It's needed so the option visitor can support nested structures properly without flattening them (or breaking backward compatibility). There is some discussion here: http://lists.nongnu.org/archive/html/qemu-devel/2015-06/msg04438.html But basically the thing is that with new new opts visitor, unless we convert NumaOptions into a flat union, the user would have to type -numa node,node.nodeid=foo instead of -numa node,nodeid=foo which would break backward compatibility. > > [...] >> ## >> +# @NumaDriver >> +# >> +# List of possible numa drivers. >> +# >> +# Since: 2.5 >> +## >> +{ 'enum': 'NumaDriver', >> + 'data': [ 'node' ] } > > Why is the name "NumaDriver"? Below, the field is called "type", so why > not something like "NumaOptionType"? No particular reason other than the example in docs/qapi-code-gen.txt used driver. The field is called type because in the non-flat union the discriminator is called type. >> + >> +## >> +# @NumaCommonOptions >> +# >> +# Common set of numa options. >> +# >> +# @type: the numa driver to use >> +# >> +# Since: 2.5 >> +## >> +{ 'struct': 'NumaCommonOptions', >> + 'data': { >> + 'type': 'NumaDriver' } } >> + >> +## >> +# @NumaOptions >> +# >> +# A discriminated record of NUMA options. (for OptsVisitor) >> +# >> +# Since 2.1 >> +## >> +{ 'union': 'NumaOptions', >> + 'base': 'NumaCommonOptions', >> + 'discriminator': 'type', >> + 'data': { >> + 'node': 'NumaNodeOptions' }} >> + >> +## >> # @HostMemPolicy >> # >> # Host memory policy types >> -- >> 2.5.0 >> >