From patchwork Wed Mar 30 15:02:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulina Szubarczyk X-Patchwork-Id: 8697841 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E40A09F3D1 for ; Wed, 30 Mar 2016 15:06:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3D3E42038F for ; Wed, 30 Mar 2016 15:06:26 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E28CF2038D for ; Wed, 30 Mar 2016 15:06:23 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1alHfc-0007cc-8q; Wed, 30 Mar 2016 15:04:32 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1alHfb-0007b6-92 for xen-devel@lists.xenproject.org; Wed, 30 Mar 2016 15:04:31 +0000 Received: from [85.158.137.68] by server-5.bemta-3.messagelabs.com id 8E/3E-03651-EFAEBF65; Wed, 30 Mar 2016 15:04:30 +0000 X-Env-Sender: paulinaszubarczyk@gmail.com X-Msg-Ref: server-8.tower-31.messagelabs.com!1459350269!32234974!1 X-Originating-IP: [209.85.217.178] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG X-StarScan-Received: X-StarScan-Version: 8.11; banners=-,-,- X-VirusChecked: Checked Received: (qmail 36662 invoked from network); 30 Mar 2016 15:04:29 -0000 Received: from mail-lb0-f178.google.com (HELO mail-lb0-f178.google.com) (209.85.217.178) by server-8.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 30 Mar 2016 15:04:29 -0000 Received: by mail-lb0-f178.google.com with SMTP id bc4so33890671lbc.2 for ; Wed, 30 Mar 2016 08:04:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=99dr7Q/q78yrLn7OF9KHLvcgf0aGdn9jSCP/461EH/4=; b=ET4LTXKFtXiyT9bV5curEoyCXR/2YYWomPANpkUQVm73z2nEO3yRSA6MLg4j/KBvpM URsf7r5bWlzKxaF4i/DHlXiW11BFivh+p4qGQnFiMqGUPihcqrlK63OryPK0+76cnwfL gZpueRXirBqqMoBByJasIS0PyzHXOJbqJ2cqujXv69ZgayC+mB9Qar94fwLPksdUOgwt 0HEWUl6jH+2l2wq2CrHRs+IrSlHqzpmSPMdQca+0Sx8AGmL41O8E0U1YKWRl+mxIQlV9 1QeIwQj2bQscCkrOBXrgu+lr7na8sgQwGcsgUdHLcwVM4lsqBwXmxzhzOGbklC1GZdiy EvgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=99dr7Q/q78yrLn7OF9KHLvcgf0aGdn9jSCP/461EH/4=; b=XSO/Lwefsc1TewhD6X6fRWnMeFozYKKiCLYjdQbPw0Nm95mtaT6iE9EWzPNfC26i+Z BljisazURes8Xl2O+QCDwQVep07eQ+f6egTkkUGSy1RVLfEmmIKc4p4UV3arFgiIuJo6 f8V688JW704cm+T8vMSZBNHElvhNnvn2P/UOodHfp+FRdHWFGDrNqA552a33fPQOxC5K tVGaoBbQ1LXN5SVZXtCZqP2HUMUwQEcimb0fYmDE0V56hnFv0UGis08vB5oRgmj5K9MG V3l+r3EZSyVHYzQFlVtNbL9PQxVZctvRLspdESraHTZnzIxS4M4+pxAdCZIl+l7tehig +7sg== X-Gm-Message-State: AD7BkJLIFGRuum7LmmaZCxHzwST9IYBkQQf1EktpcMoLisOkIWbipE2EC6YQLG3f1G8jfA== X-Received: by 10.112.161.68 with SMTP id xq4mr4214591lbb.29.1459350269346; Wed, 30 Mar 2016 08:04:29 -0700 (PDT) Received: from localhost.localdomain (84-10-74-207.static.chello.pl. [84.10.74.207]) by smtp.gmail.com with ESMTPSA id pe7sm644769lbc.14.2016.03.30.08.04.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 30 Mar 2016 08:04:28 -0700 (PDT) From: Paulina Szubarczyk To: roger.pau@citrix.com, George.Dunlap@eu.citrix.com, xen-devel@lists.xenproject.org Date: Wed, 30 Mar 2016 17:02:50 +0200 Message-Id: <1459350170-9573-12-git-send-email-paulinaszubarczyk@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1459350170-9573-1-git-send-email-paulinaszubarczyk@gmail.com> References: <1459350170-9573-1-git-send-email-paulinaszubarczyk@gmail.com> Cc: Wei Liu , Dario Faggioli , Paulina Szubarczyk , Ian Jackson , Ian Campbell Subject: [Xen-devel] [PATCH 11/11] libxl: libxl_tmem functions improving coding style X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In accordance with CODING_SYTLE: - Use 'r' for return values to functions whose return values are a different error space (like xc_tmem_control, xc_tmem_auth) Signed-off-by: Paulina Szubarczyk CC: Wei Liu CC: Ian Jackson CC: Dario Faggioli CC: Ian Campbell --- tools/libxl/libxl.c | 58 ++++++++++++++++++++++++++--------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) -- 1.9.1 diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 6bdf3b1..eddd39b 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -6046,14 +6046,14 @@ uint32_t libxl_vm_get_start_time(libxl_ctx *ctx, uint32_t domid) char *libxl_tmem_list(libxl_ctx *ctx, uint32_t domid, int use_long) { - int rc; + int r; char _buf[32768]; GC_INIT(ctx); - rc = xc_tmem_control(ctx->xch, -1, XEN_SYSCTL_TMEM_OP_LIST, domid, 32768, use_long, + r = xc_tmem_control(ctx->xch, -1, XEN_SYSCTL_TMEM_OP_LIST, domid, 32768, use_long, _buf); - if (rc < 0) { - LOGEV(ERROR, rc, "Can not get tmem list"); + if (r < 0) { + LOGEV(ERROR, r, "Can not get tmem list"); GC_FREE; return NULL; } @@ -6064,36 +6064,36 @@ char *libxl_tmem_list(libxl_ctx *ctx, uint32_t domid, int use_long) int libxl_tmem_freeze(libxl_ctx *ctx, uint32_t domid) { - int rc; + int r; GC_INIT(ctx); - rc = xc_tmem_control(ctx->xch, -1, XEN_SYSCTL_TMEM_OP_FREEZE, domid, 0, 0, + r = xc_tmem_control(ctx->xch, -1, XEN_SYSCTL_TMEM_OP_FREEZE, domid, 0, 0, NULL); - if (rc < 0) { - LOGEV(ERROR, rc, "Can not freeze tmem pools"); + if (r < 0) { + LOGEV(ERROR, r, "Can not freeze tmem pools"); GC_FREE; return ERROR_FAIL; } GC_FREE; - return rc; + return r; } int libxl_tmem_thaw(libxl_ctx *ctx, uint32_t domid) { - int rc; + int r; GC_INIT(ctx); - rc = xc_tmem_control(ctx->xch, -1, XEN_SYSCTL_TMEM_OP_THAW, domid, 0, 0, + r = xc_tmem_control(ctx->xch, -1, XEN_SYSCTL_TMEM_OP_THAW, domid, 0, 0, NULL); - if (rc < 0) { - LOGEV(ERROR, rc, "Can not thaw tmem pools"); + if (r < 0) { + LOGEV(ERROR, r, "Can not thaw tmem pools"); GC_FREE; return ERROR_FAIL; } GC_FREE; - return rc; + return r; } static int32_t tmem_setop_from_string(char *set_name) @@ -6110,7 +6110,7 @@ static int32_t tmem_setop_from_string(char *set_name) int libxl_tmem_set(libxl_ctx *ctx, uint32_t domid, char* name, uint32_t set) { - int rc; + int r; int32_t subop = tmem_setop_from_string(name); GC_INIT(ctx); @@ -6119,48 +6119,48 @@ int libxl_tmem_set(libxl_ctx *ctx, uint32_t domid, char* name, uint32_t set) GC_FREE; return ERROR_INVAL; } - rc = xc_tmem_control(ctx->xch, -1, subop, domid, set, 0, NULL); - if (rc < 0) { - LOGEV(ERROR, rc, "Can not set tmem %s", name); + r = xc_tmem_control(ctx->xch, -1, subop, domid, set, 0, NULL); + if (r < 0) { + LOGEV(ERROR, r, "Can not set tmem %s", name); GC_FREE; return ERROR_FAIL; } GC_FREE; - return rc; + return r; } int libxl_tmem_shared_auth(libxl_ctx *ctx, uint32_t domid, char* uuid, int auth) { - int rc; + int r; GC_INIT(ctx); - rc = xc_tmem_auth(ctx->xch, domid, uuid, auth); - if (rc < 0) { - LOGEV(ERROR, rc, "Can not set tmem shared auth"); + r = xc_tmem_auth(ctx->xch, domid, uuid, auth); + if (r < 0) { + LOGEV(ERROR, r, "Can not set tmem shared auth"); GC_FREE; return ERROR_FAIL; } GC_FREE; - return rc; + return r; } int libxl_tmem_freeable(libxl_ctx *ctx) { - int rc; + int r; GC_INIT(ctx); - rc = xc_tmem_control(ctx->xch, -1, XEN_SYSCTL_TMEM_OP_QUERY_FREEABLE_MB, -1, 0, 0, 0); - if (rc < 0) { - LOGEV(ERROR, rc, "Can not get tmem freeable memory"); + r = xc_tmem_control(ctx->xch, -1, XEN_SYSCTL_TMEM_OP_QUERY_FREEABLE_MB, -1, 0, 0, 0); + if (r < 0) { + LOGEV(ERROR, r, "Can not get tmem freeable memory"); GC_FREE; return ERROR_FAIL; } GC_FREE; - return rc; + return r; } int libxl_get_freecpus(libxl_ctx *ctx, libxl_bitmap *cpumap)