From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH 09/14] libxl: Check xc_domain_maximum_gpfn for negative return values Date: Wed, 18 Mar 2015 16:30:38 +0000 Message-ID: <1426696238.14291.76.camel@citrix.com> References: <1426520383-20855-1-git-send-email-konrad.wilk@oracle.com> <1426520383-20855-10-git-send-email-konrad.wilk@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YYH4L-00039j-Oy for xen-devel@lists.xenproject.org; Wed, 18 Mar 2015 16:43:45 +0000 In-Reply-To: <1426520383-20855-10-git-send-email-konrad.wilk@oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Konrad Rzeszutek Wilk Cc: xen-devel@lists.xenproject.org, ian.jackson@eu.citrix.com, wei.liu2@citrix.com, stefano.stabellini@eu.citrix.com List-Id: xen-devel@lists.xenproject.org On Mon, 2015-03-16 at 11:39 -0400, Konrad Rzeszutek Wilk wrote: > Instead of assuming everything is always OK. > > Signed-off-by: Konrad Rzeszutek Wilk > --- > tools/libxc/xc_core_arm.c | 14 +++++++++++--- > tools/libxc/xc_core_x86.c | 21 +++++++++++++++++---- > tools/libxc/xc_domain_save.c | 8 +++++++- > 3 files changed, 35 insertions(+), 8 deletions(-) > > diff --git a/tools/libxc/xc_core_arm.c b/tools/libxc/xc_core_arm.c > index 34185cf..654692a 100644 > --- a/tools/libxc/xc_core_arm.c > +++ b/tools/libxc/xc_core_arm.c > @@ -31,9 +31,13 @@ xc_core_arch_gpfn_may_present(struct xc_core_arch_context *arch_ctxt, > } > > > -static int nr_gpfns(xc_interface *xch, domid_t domid) > +static int nr_gpfns(xc_interface *xch, domid_t domid, int *rc) It would be more natural to return the rc directly and update a pointer argument for the max gpfn on success. > diff --git a/tools/libxc/xc_core_x86.c b/tools/libxc/xc_core_x86.c > index b5d442d..426b90d 100644 > --- a/tools/libxc/xc_core_x86.c > +++ b/tools/libxc/xc_core_x86.c > @@ -36,9 +36,13 @@ xc_core_arch_gpfn_may_present(struct xc_core_arch_context *arch_ctxt, > } > > > -static int nr_gpfns(xc_interface *xch, domid_t domid) > +static int nr_gpfns(xc_interface *xch, domid_t domid, int *rc) Likewise, although perhaps you could consolidate those two into one common wrapper? And then use it everywhere (there were some open-coded ones later on). Or even fix the prototype of xc_domain_maximum_gpfn turning it into said helper, it doesn't look like it has too many callers. Ian.