Received: from eggs.gnu.org ([2001:4830:134:3::10]:57807) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WT6to-0004rF-Kc for qemu-devel@nongnu.org; Thu, 27 Mar 2014 05:47:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WT6ti-0005rH-Lx for qemu-devel@nongnu.org; Thu, 27 Mar 2014 05:47:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:22459) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WT6ti-0005qT-Ee for qemu-devel@nongnu.org; Thu, 27 Mar 2014 05:46: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 (8.14.4/8.14.4) with ESMTP id s2R9kqFO029091 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 27 Mar 2014 05:46:52 -0400 From: Markus Armbruster References: <1394073416-12578-1-git-send-email-akong@redhat.com> <1394073416-12578-3-git-send-email-akong@redhat.com> <5318E743.7070609@redhat.com> <878usms5a6.fsf@blackfin.pond.sub.org> <20140320140312.GA24041@amosk.info> <87fvm55cex.fsf@blackfin.pond.sub.org> <20140327050433.GC7531@amosk.info> Date: Thu, 27 Mar 2014 10:46:49 +0100 In-Reply-To: <20140327050433.GC7531@amosk.info> (Amos Kong's message of "Thu, 27 Mar 2014 13:04:33 +0800") Message-ID: <87ha6kq8hi.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v4 2/2] query-command-line-options: query all the options in qemu-options.hx List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Amos Kong Cc: pbonzini@redhat.com, lcapitulino@redhat.com, libvirt-list@redhat.com, jyang@redhat.com, qemu-devel@nongnu.org Amos Kong writes: > On Wed, Mar 26, 2014 at 02:15:18PM +0100, Markus Armbruster wrote: >> Amos Kong writes: >> >> > On Fri, Mar 07, 2014 at 10:54:09AM +0100, Markus Armbruster wrote: >> >> Eric Blake writes: >> >> >> >> > On 03/05/2014 07:36 PM, Amos Kong wrote: >> >> >> vm_config_groups[] only contains part of the options which have >> >> >> argument, and all options which have no argument aren't added >> >> >> to vm_config_groups[]. Current query-command-line-options only >> >> >> checks options from vm_config_groups[], so some options will >> >> >> be lost. >> >> >> >> >> >> We have macro in qemu-options.hx to generate a table that >> >> >> contains all the options. This patch tries to query options >> >> >> from the table. >> >> >> >> >> >> Then we won't lose the legacy options that weren't added to >> >> >> vm_config_groups[] (eg: -vnc, -smbios). The options that have >> >> >> no argument will also be returned (eg: -enable-fips) >> >> >> >> >> >> Some options that have argument have a NULL desc list, some >> >> >> options don't have argument, and "parameters" is mandatory >> >> >> in the past. So we add a new field "argument" to present >> >> >> if the option takes unspecified arguments. >> >> > >> >> > I like Markus' suggestion of naming the new field >> >> > 'unspecified-parameters' rather than 'argument'. >> > >> > Hi Markus, >> > >> >> Looking again, there are more problems. >> >> >> >> 1. Non-parameter argument vs. parameter argument taking unspecified >> >> parameters >> >> >> >> Example: -device takes unspecified parameters. -cdrom doesn't take >> >> parameters, it takes a file name. Yet, the command reports the same >> >> for both: "parameters": [], "argument": true. >> >> >> >> Looks like we need a tri-state: option takes no argument, QemuOpts >> >> argument, or other argument. >> > >> > '-cdrom' is the 'other argument' == 'Non-parameter argument'? >> >> Let me clarify my terminology: >> >> * A "parameter argument" is an option argument of the form KEY=VALUE,... >> Since parameter arguments should always be parsed with QemuOpts[*], I >> use the term "QemuOpts argument" interchangeably. >> >> * A "non-parameter argument" or "other argument" is an option argument >> that doesn't use this form. >> >> Does that answer your question? > > Got it, thanks. > >> > We can use a enum state. >> >> I'm not sure I got that. >> >> > | { 'enum': 'ArgumentStateType', >> > | 'data': ['no-argument', 'unspecified-parameters-argument', >> > | 'non-parameter-argument'] >> > | } > > > {'enum': 'ArgumentStateType', > 'data': ['no-argument', 'qemuopts-argument', 'non-param-argument'] > } > > no-argument: -enable-kvm > qemuopts-argument: -boot order=c,menu=on > non-param-argument: -cdrom file > > > I don't know if it's the tri-state you suggested in previous reply. It is. Maybe { 'enum': 'OptionArgumentKind', 'data': ['none, 'QemuOpts, 'other'] } The type name makes clear it's about *option* argument, and avoids connotation with schema types or C types. The enum value names are short and to the point. [...]