Received: from eggs.gnu.org ([2001:4830:134:3::10]:42732) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xroee-00056v-VO for qemu-devel@nongnu.org; Fri, 21 Nov 2014 08:53:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XroeY-00043X-LP for qemu-devel@nongnu.org; Fri, 21 Nov 2014 08:53:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52334) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XroeY-00043P-Dw for qemu-devel@nongnu.org; Fri, 21 Nov 2014 08:53:38 -0500 Date: Fri, 21 Nov 2014 11:53:33 -0200 From: Eduardo Habkost Message-ID: <20141121135333.GD3137@thinpad.lan.raisama.net> References: <1416522776-22169-1-git-send-email-dslutz@verizon.com> <20141121020142.GC3137@thinpad.lan.raisama.net> <546F3E92.5080406@terremark.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <546F3E92.5080406@terremark.com> Subject: Re: [Qemu-devel] [BUGFIX][PATCH for 2.2 v5 1/1] -machine vmport=auto: Fix handling of VMWare ioport emulation for xen List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Don Slutz Cc: Anthony Liguori , "Michael S. Tsirkin" , Michael Tokarev , qemu-devel@nongnu.org, "Dr. David Alan Gilbert" , Stefan Hajnoczi , Paolo Bonzini On Fri, Nov 21, 2014 at 08:30:58AM -0500, Don Slutz wrote: > On 11/20/14 21:01, Eduardo Habkost wrote: > >On Thu, Nov 20, 2014 at 05:32:56PM -0500, Don Slutz wrote: > >[...] > >>@@ -1711,18 +1711,23 @@ static void pc_machine_set_max_ram_below_4g(Object *obj, Visitor *v, > >> pcms->max_ram_below_4g = value; > >> } > >>-static bool pc_machine_get_vmport(Object *obj, Error **errp) > >>+static void pc_machine_get_vmport(Object *obj, Visitor *v, void *opaque, > >>+ const char *name, Error **errp) > >> { > >> PCMachineState *pcms = PC_MACHINE(obj); > >>+ int vmport = pcms->vmport; > >>- return pcms->vmport; > >>+ visit_type_enum(v, &vmport, OnOffAuto_lookup, NULL, name, errp); > >A visit_type_OnOffAuto() function is automatically generated by the QAPI > >schema, so you don't need to deal with the low level visit_type_enum() > >function. > > Ok. Will switch. > > >> } > >>-static void pc_machine_set_vmport(Object *obj, bool value, Error **errp) > >>+static void pc_machine_set_vmport(Object *obj, Visitor *v, void *opaque, > >>+ const char *name, Error **errp) > >> { > >> PCMachineState *pcms = PC_MACHINE(obj); > >>+ int vmport; > >>- pcms->vmport = value; > >>+ visit_type_enum(v, &vmport, OnOffAuto_lookup, NULL, name, errp); > >>+ pcms->vmport = vmport; > >'vmport' may be undefined in case the visitor return an error, and in > >this case you shouldn't change pcms->vmport. This won't be a problem if > >you just call: > > > > visit_type_OnOffAuto(v, &pcms->vmport, name, errp); > > Will do. > > >> } > >> static void pc_machine_initfn(Object *obj) > >>@@ -1737,11 +1742,11 @@ static void pc_machine_initfn(Object *obj) > >> pc_machine_get_max_ram_below_4g, > >> pc_machine_set_max_ram_below_4g, > >> NULL, NULL, NULL); > >>- pcms->vmport = !xen_enabled(); > >>- object_property_add_bool(obj, PC_MACHINE_VMPORT, > >>- pc_machine_get_vmport, > >>- pc_machine_set_vmport, > >>- NULL); > >>+ pcms->vmport = ON_OFF_AUTO_AUTO; > >>+ object_property_add(obj, PC_MACHINE_VMPORT, "str", > >I believe "OnOffAuto" is a valid type name, if it is defined in the QAPI > >schema. > > I can only find: > > qapi-types.h:typedef enum OnOffAuto > qapi-types.h:} OnOffAuto; I don't understand what you mean, where did you expect to find it? You added it to the schema, so it is now a valid type name. > > Which I use to define pcms->vmport. The best I can translate this is > that "str" is what you are looking to replace. > > So I plan no change here. You are not defining a string property, but an OnOffAuto enum property, so why use "str"? See, for example, the type of an existing enum property: ide-hd.bios-chs-trans: $ qemu-system-x86_64 -device ide-hd,? [...] ide-hd.bios-chs-trans=BiosAtaTranslation (Logical CHS translation algorithm, auto/none/lba/large/rechs) [...] $ -- Eduardo