Received: from eggs.gnu.org ([2001:4830:134:3::10]:56412) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WG1Jj-0007kv-Gk for qemu-devel@nongnu.org; Wed, 19 Feb 2014 02:11:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WG1Jd-0005Nu-HR for qemu-devel@nongnu.org; Wed, 19 Feb 2014 02:11:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34766) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WG1Jd-0005NR-86 for qemu-devel@nongnu.org; Wed, 19 Feb 2014 02:11:33 -0500 Message-ID: <1392793896.3076.21.camel@localhost.localdomain> From: Marcel Apfelbaum Date: Wed, 19 Feb 2014 09:11:36 +0200 In-Reply-To: <53039D3C.8050802@suse.de> References: <1392741987-6356-1-git-send-email-marcel.a@redhat.com> <53038F97.6070000@redhat.com> <1392743460.3076.10.camel@localhost.localdomain> <530397BD.6090905@redhat.com> <53039D3C.8050802@suse.de> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] qom: add object_property_is_set List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andreas =?ISO-8859-1?Q?F=E4rber?= Cc: peter.crosthwaite@xilinx.com, mst@redhat.com, qemu-devel@nongnu.org, anthony@codemonkey.ws, imammedo@redhat.com, Paolo Bonzini On Tue, 2014-02-18 at 18:49 +0100, Andreas F=C3=A4rber wrote: > Am 18.02.2014 18:26, schrieb Paolo Bonzini: > > Il 18/02/2014 18:11, Marcel Apfelbaum ha scritto: > >> It is used to replace qemu_opt_get_bool that provides a > >> parameter for a default value. In this case we need to > >> differentiate "no value" from "false." > >=20 > > But what would the getter return in that case? If possible, it's bet= ter > > to initialize to the default value in an instance_init method. >=20 > Another issue I see is that it's currently a valid use case to use a > setter in instance_init to set default values. Doing so would flag the > property as set with this patch. Hi Andreas, thank you for the review! As I replayed to Paolo, this does not contradict the patch's aim. Meaning, if you have a default for all cases, is ok to init it and make it "set". The interesting case is if you have 2 places: one that you want the value to be "x" if is not set, and other place that you need "y" if is not set. >=20 > To me it sounded like a concept similar to component-oriented IDEs wher= e > non-default values are shown in bold. We'd need a QMP API for that > however, and we'd need to reset properties in instance_post_init to > unset then (globals would be considered unset in that case). I thought about it, but it seemed to me over-engineering *for my case*, where all I need to know if the user supplied the value or not, not need to "unset" it. >=20 > Another aspect is that dynamic properties are slightly awkward, if we > think of setting the rtc, which then advances and reads back differentl= y. Sadly I am not familiar with the "rtc", but as I explained before, I don't need the "repeatedly set/unset" use-case. Thanks, Marcel =20 >=20 > Regards, > Andreas >=20