Received: from [140.186.70.92] (port=40199 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OSP95-0006F7-OU for qemu-devel@nongnu.org; Sat, 26 Jun 2010 02:45:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OSP94-0003Xg-MW for qemu-devel@nongnu.org; Sat, 26 Jun 2010 02:45:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39715) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OSP94-0003XX-B4 for qemu-devel@nongnu.org; Sat, 26 Jun 2010 02:45:42 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o5Q6jegd007904 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sat, 26 Jun 2010 02:45:40 -0400 From: Markus Armbruster Subject: Re: [Qemu-devel] [PATCH 00/19] RFC: Reporting QEMU binary capabilities References: <1275921752-29420-1-git-send-email-berrange@redhat.com> Date: Sat, 26 Jun 2010 08:45:38 +0200 In-Reply-To: <1275921752-29420-1-git-send-email-berrange@redhat.com> (Daniel P. Berrange's message of "Mon, 7 Jun 2010 15:42:13 +0100") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" Cc: qemu-devel@nongnu.org "Daniel P. Berrange" writes: [...] > The main problem encountered with this patch series is the > split between argv and config parameters. The qemu-config.c > file provides the information is a good data format, allowing > programatic access to the list of parameters for each config > option (eg, the 'cache', 'file', 'aio', etc bits for -drive). > There are some issues with it though > > - It lacks a huge amount of coverage wrt to the full argv > available, even simple things like the '-m' argument > don't exist. > > - It is inconsistent in handling parameters. eg it hands > off validation of netdev backends to other code, to allow > for handling of different parameters for tap vs user vs > socket backends. For chardev backends though, it directly > includes a union of all possible parameters. The problem behind this "inconsistency" (first order approximation): there are fixed options, and several sets of variable options. One of the fixed options is the discriminator, and its value determines which set of variable options applies. You can ignore this and put all variable options right into the QemuOptsList.desc[]. qemu-option still catches "alway-invalid" options, but application code needs to check again. If the variable sets conflict, we're reduced to QEMU_OPT_STRING type, and have to leave type-checking to application code. We can also have an empty desc[], and simply leave all of the validation job to application code. Typical way to do it: get discriminator value, look up its desc[], pass it to qemu_opts_validate(). This is how -netdev works. Drawbacks: duplicates fixed options in every desc[], even fixed options are hidden fairly deep in application code. It's easy to do better for fixed options: put them in QemuOptsList.desc[], use qemu_opts_validate() only for the variable options. I hope to post a patch for that soon. Pulling the variable options out of application code is a bit harder. More so for -device than for -netdev. [...]