Received: from eggs.gnu.org ([2001:4830:134:3::10]:40734) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yzhmj-00071h-KG for qemu-devel@nongnu.org; Tue, 02 Jun 2015 04:43:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yzhmg-0007GO-0D for qemu-devel@nongnu.org; Tue, 02 Jun 2015 04:42:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51503) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yzhmf-0007G2-R2 for qemu-devel@nongnu.org; Tue, 02 Jun 2015 04:42:53 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 4007919F218 for ; Tue, 2 Jun 2015 08:42:53 +0000 (UTC) From: Markus Armbruster References: <1432815695-31687-1-git-send-email-armbru@redhat.com> <1432815695-31687-5-git-send-email-armbru@redhat.com> <55672FCF.4090204@redhat.com> Date: Tue, 02 Jun 2015 10:42:50 +0200 In-Reply-To: <55672FCF.4090204@redhat.com> (Eric Blake's message of "Thu, 28 May 2015 09:10:07 -0600") Message-ID: <87oakycxh1.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH 4/9] QemuOpts: Drop qemu_opts_foreach() parameter abort_on_failure List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: pbonzini@redhat.com, qemu-devel@nongnu.org Eric Blake writes: > On 05/28/2015 06:21 AM, Markus Armbruster wrote: >> When the argument is non-zero, qemus_opt_foreach() stops on callback > > s/qemus_opt/qemu_opts/ Wonder what got my fingers into *that* tangle. Fixing... >> returning non-zero, and returns that value. >> >> When the argument is zero, it doesn't stop, and returns the bit-wise >> inclusive or of all the return values. Funky :) >> >> The callers that pass zero could just as well pass one, because their >> callbacks can't return anything but zero: >> >> * qemu_add_globals()'s callback qdev_add_one_global() >> >> * qemu_config_write()'s callback config_write_opts() >> >> * main()'s callbacks default_driver_check(), drive_enable_snapshot(), >> vnc_init_func() >> >> Drop the parameter, and always stop. > > I had a hunch you might be getting to this point, just from reading the > earlier patches :) I take that as a good sign :) >> >> Signed-off-by: Markus Armbruster >> --- >> block/blkdebug.c | 4 ++-- >> hw/core/qdev-properties-system.c | 2 +- >> include/qemu/option.h | 4 ++-- >> net/net.c | 5 +++-- >> net/vhost-user.c | 2 +- >> numa.c | 3 +-- >> tpm.c | 3 +-- >> util/qemu-config.c | 2 +- >> util/qemu-option.c | 21 ++++++++++++++------- >> vl.c | 35 ++++++++++++++++++----------------- >> 10 files changed, 44 insertions(+), 37 deletions(-) >> > >> +++ b/net/vhost-user.c >> @@ -240,7 +240,7 @@ int net_init_vhost_user(const NetClientOptions *opts, const char *name, >> >> /* verify net frontend */ >> if (qemu_opts_foreach(qemu_find_opts("device"), net_vhost_check_net, >> - (char *)name, true) == -1) { >> + (char *)name)) { > > Also evidence that we weren't clear on 'int' vs. 'bool' on the > parameter's usage, so getting rid of it is indeed an improvement. > > Reviewed-by: Eric Blake Thanks!