Received: from eggs.gnu.org ([2001:4830:134:3::10]:56099) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAdHc-0006Yl-1I for qemu-devel@nongnu.org; Thu, 02 Jul 2015 08:08:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZAdHW-00047z-U7 for qemu-devel@nongnu.org; Thu, 02 Jul 2015 08:07:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51026) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAdHW-00047G-OK for qemu-devel@nongnu.org; Thu, 02 Jul 2015 08:07:54 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 6000CC797E for ; Thu, 2 Jul 2015 12:07:54 +0000 (UTC) From: Markus Armbruster References: <20150605095004.GB2139@work-vm> <5571965F.7040502@redhat.com> <20150605140043.GD2139@work-vm> <87eglmgyc3.fsf@blackfin.pond.sub.org> <20150608145750.GG2217@work-vm> <87fv61w9vn.fsf_-_@blackfin.pond.sub.org> <5583F19B.2010709@redhat.com> Date: Thu, 02 Jul 2015 14:07:51 +0200 In-Reply-To: <5583F19B.2010709@redhat.com> (Paolo Bonzini's message of "Fri, 19 Jun 2015 12:40:27 +0200") Message-ID: <87r3oqyd7s.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] qapi: What does "'gen': false" actually do, and when should I use it? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: amit.shah@redhat.com, quintela@redhat.com, "Dr. David Alan Gilbert" , qemu-devel@nongnu.org Paolo Bonzini writes: > On 09/06/2015 10:42, Markus Armbruster wrote: >> Part 2: When to use it? >> >> We use 'gen': false when we can't (be bothered to) specify the exact >> type of an argument or result. >> >> Bad example: netdev_add >> >> We have arguments 'type': 'str' and '*props': '**'. >> >> We should have a union tagged by network backend type. For each >> type, the union holds the type's properties (if any). > > The problem with this is that netdev_add was not type safe, because it > uses qemu_opts_from_qdict and QemuOpts is exclusively string-based. So > you could write 'port': '123' or 'port': 123, and both would work, the > conversion to integer is done by the QemuOptsVisitor. > > Note that device_add would have the same problem. Yes. We can always start over with a new command and deprecate the old one. Or we can add a backward-misfeature-compatible mode to QmpInputVisitor, enabled only for the misfeatured commands.