From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mm0ra-00035s-P5 for qemu-devel@nongnu.org; Fri, 11 Sep 2009 03:48:10 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mm0rV-0002xC-MH for qemu-devel@nongnu.org; Fri, 11 Sep 2009 03:48:09 -0400 Received: from [199.232.76.173] (port=38738 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mm0rV-0002wq-36 for qemu-devel@nongnu.org; Fri, 11 Sep 2009 03:48:05 -0400 Received: from mx20.gnu.org ([199.232.41.8]:2245) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Mm0rU-0002jM-Fx for qemu-devel@nongnu.org; Fri, 11 Sep 2009 03:48:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mm0rT-0003Lw-Kb for qemu-devel@nongnu.org; Fri, 11 Sep 2009 03:48:03 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n8B7m2HN031644 for ; Fri, 11 Sep 2009 03:48:02 -0400 Received: from zweiblum.home.kraxel.org (vpn1-5-42.ams2.redhat.com [10.36.5.42]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n8B7luKB023231 for ; Fri, 11 Sep 2009 03:47:59 -0400 Message-ID: <4AAA00A9.6070600@redhat.com> Date: Fri, 11 Sep 2009 09:47:53 +0200 From: Gerd Hoffmann MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 06/19] Add qemu_opts_validate() for post parsing validation References: <1252595941-15196-1-git-send-email-markmc@redhat.com> <1252595941-15196-7-git-send-email-markmc@redhat.com> In-Reply-To: <1252595941-15196-7-git-send-email-markmc@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On 09/10/09 17:18, Mark McLoughlin wrote: > Several qemu command line options have a parameter whose value affects > what other parameters are accepted for the option. > > In these cases, we can have an empty description table in the > QemuOptsList and once the option has been parsed we can use a suitable > description table to validate the other parameters based on the value of > that parameter. Hmm. The "empty description" mode is intended to be used in case the verification isn't done by QemuOpts at all (i.e. for -devices, where the qdev property code will do the checks). I really like to have the option description hooked into QemuOptsList. I can think of two possible ways to do that: (1) We can stick all possible values info QemuOptsList->desc. Then have separate data structures to describe which fields are allowed in which cases (and, while being at it, which fields are mandatory). (2) We have multiple QemuOptDesc lists for the different cases. I tend to prefer the first. We can do the option parsing unconditionally in qemu_opt_set() then and don't have two different possible code paths for that. Comments? Other ideas? cheers, Gerd