Received: from eggs.gnu.org ([2001:4830:134:3::10]:51481) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YBP1l-0007xI-UC for qemu-devel@nongnu.org; Wed, 14 Jan 2015 09:34:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YBP1l-0007aD-5b for qemu-devel@nongnu.org; Wed, 14 Jan 2015 09:34:33 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35738) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YBP1k-0007a7-Up for qemu-devel@nongnu.org; Wed, 14 Jan 2015 09:34:33 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t0EEYW16021784 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 14 Jan 2015 09:34:32 -0500 From: Markus Armbruster References: <1421171432-8733-1-git-send-email-armbru@redhat.com> <1421171432-8733-9-git-send-email-armbru@redhat.com> <54B66F45.3020102@redhat.com> Date: Wed, 14 Jan 2015 15:34:30 +0100 In-Reply-To: <54B66F45.3020102@redhat.com> (Eric Blake's message of "Wed, 14 Jan 2015 06:29:41 -0700") Message-ID: <87y4p5bfd5.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH 8/9] balloon: Factor out common "is balloon active" test List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: lcapitulino@redhat.com, qemu-devel@nongnu.org, kraxel@redhat.com Eric Blake writes: > On 01/13/2015 10:50 AM, Markus Armbruster wrote: >> Signed-off-by: Markus Armbruster >> --- >> balloon.c | 29 +++++++++++++++-------------- >> 1 file changed, 15 insertions(+), 14 deletions(-) >> >> diff --git a/balloon.c b/balloon.c >> index 2884c2d..aa30617 100644 >> --- a/balloon.c >> +++ b/balloon.c >> @@ -36,6 +36,19 @@ static QEMUBalloonEvent *balloon_event_fn; >> static QEMUBalloonStatus *balloon_stat_fn; >> static void *balloon_opaque; >> >> +static int have_ballon(Error **errp) >> +{ >> + if (kvm_enabled() && !kvm_has_sync_mmu()) { >> + error_set(errp, QERR_KVM_MISSING_CAP, "synchronous MMU", "balloon"); >> + return 0; >> + } >> + if (!balloon_event_fn) { >> + error_set(errp, QERR_DEVICE_NOT_ACTIVE, "balloon"); >> + return 0; >> + } >> + return 1; > > Another case where I would have used bool, true, false. Me too now that you mention it %-) > Either way, > Reviewed-by: Eric Blake Thanks!