From patchwork Fri Sep 30 02:54:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Faggioli X-Patchwork-Id: 9357467 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 61C4F6077A for ; Fri, 30 Sep 2016 02:56:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 56A3C29D3E for ; Fri, 30 Sep 2016 02:56:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4B00C29D43; Fri, 30 Sep 2016 02:56:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RCVD_IN_SORBS_SPAM,T_DKIM_INVALID autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id E4ABD29D3E for ; Fri, 30 Sep 2016 02:56:13 +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 1bpnxr-00028i-Mj; Fri, 30 Sep 2016 02:54:19 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bpnxq-00027q-Fb for xen-devel@lists.xenproject.org; Fri, 30 Sep 2016 02:54:18 +0000 Received: from [85.158.143.35] by server-6.bemta-6.messagelabs.com id 79/30-11175-9D3DDE75; Fri, 30 Sep 2016 02:54:17 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrHIsWRWlGSWpSXmKPExsXiVRvkrHvz8tt wg5Ov2S2+b5nM5MDocfjDFZYAxijWzLyk/IoE1oxzjcvYCm5JVZy71MHUwPhNuIuRi0NIYAaj xJx1z1lBHBaBNawSM28+YQNxJAQusUpc/3uNsYuRE8iJkTi1dTUThF0tMevzG7C4kICKxM3tq 5ggRv1ilJj57TwrSEJYQE/iyNEf7BB2lMTquVvBGtgEDCTe7NgLViMioCRxb9VksKHMAhUSK1 7eALNZBFQlXn4/zQJi8wp4S7TPXMgMYnMK+Er82vaCBWKxj8Tv5cvZQGxRATmJlZdbWCHqBSV OznwCVMMBNFNTYv0ufYjx8hLb385hnsAoMgtJ1SyEqllIqhYwMq9iVC9OLSpLLdI11UsqykzP KMlNzMzRNTQw08tNLS5OTE/NSUwq1kvOz93ECAx/BiDYwTj9sv8hRkkOJiVRXtmjb8OF+JLyU yozEosz4otKc1KLDzFqcHAITDg7dzqTFEtefl6qkgTv2ktAdYJFqempFWmZOcAIhSmV4OBREu FVAEapEG9xQWJucWY6ROoUoy7Hlqn31jIJgc2QEudVBikSACnKKM2DGwFLFpcYZaWEeRmBDhT iKUgtys0sQZV/xSjOwagkzGsMMoUnM68EbtMroCOYgI7IP/oG5IiSRISUVAPj8ffm1cr+dyq0 Pm/9eLv22P+6kriOAwvfWGlXXIt9FjPxxXZp5zJeYZkMwcL0Z9WXhG7zfffMie18atb/PIVdN ezKCqVzHHx2yTzl206n+8bGz7qukpS79VTjacOEXfnSCpqPq596KtueW7pRvuS0ZgmzFv/6E8 d8jOz56prjp+/QkNVJdVJiKc5INNRiLipOBAAMebqjEQMAAA== X-Env-Sender: raistlin.df@gmail.com X-Msg-Ref: server-4.tower-21.messagelabs.com!1475204056!29624912!1 X-Originating-IP: [74.125.82.67] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 37730 invoked from network); 30 Sep 2016 02:54:17 -0000 Received: from mail-wm0-f67.google.com (HELO mail-wm0-f67.google.com) (74.125.82.67) by server-4.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 30 Sep 2016 02:54:17 -0000 Received: by mail-wm0-f67.google.com with SMTP id p138so1405564wmb.0 for ; Thu, 29 Sep 2016 19:54:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:from:to:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=uELfH8C6TgnsjzyVtBCEriePVvNcU//CZ8aoTPj9kac=; b=IlNsgbVZhD5vc1SRJpBT5jqGWIbl/HLFmBApbHkuwEDbQRfedHJL6JEyl9tUAWD2Si dM+CYUJZ2oepux78TTLaaQK9Ct+kHfXFALRbhKAGzJfOb0m0UV8WPPeSmZavzii9dTYH 5bq2nTzIwlGVUYszcQyT2ZKGsiQnwgGHZnC9ll/0h5Vwb9ldDZYMV0nfZ1n7aUwqbMgc scxv5MB+XEKxWs/wMsLbF+xd38zYTudzxhcLAhjOGiMIJwR21pQ0OO5PA2g1ssDxU681 IUSzyk+S4DPfbCIylwUEv3K2U3QZ4cMnShnQURs6qve+qHzFIN2ESwKNsa70mpuJkW3q fdKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:from:to:cc:date:message-id :in-reply-to:references:user-agent:mime-version :content-transfer-encoding; bh=uELfH8C6TgnsjzyVtBCEriePVvNcU//CZ8aoTPj9kac=; b=ErON8UkPJczlV3VnuN3y2NoHHvi1r6CkwFxnUpuBFvCSDpCa00dPjCruYgCId1+FR9 hVFVsvzlBFp7VYnKS6amuylNPkfzm4rOC85NbNRmcMmc1jLjW459k9akDeOkkMnj61P6 JTsZwakkRGn9X0edtAfregagDsEBYVzGmRYHyp4Abz8Xn/OniueC5bRmx+Pp2wR5737U W39eFLQv0ez/Khj/Xh3yzX5Dcz2PbqZ4Z4mjEJR4HmTYX37uLz78QVIahfa4tkTUzaB4 hb7jvoOLcGet96J2t5ydSmFMgHQ96C/a9UahLzqtZRf71G33EFcxX2apCfOIbKjl96ev MzjA== X-Gm-Message-State: AA6/9Rly2VZj+iPBg1QgT7V5K7EpuO26lp7Sd6W0T80j3EywFyjuug+KBlIjJaUL3zIL0Q== X-Received: by 10.28.140.213 with SMTP id o204mr1387884wmd.111.1475204056756; Thu, 29 Sep 2016 19:54:16 -0700 (PDT) Received: from Solace.fritz.box ([80.66.223.126]) by smtp.gmail.com with ESMTPSA id j198sm1727965wmg.4.2016.09.29.19.54.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Sep 2016 19:54:16 -0700 (PDT) From: Dario Faggioli To: xen-devel@lists.xenproject.org Date: Fri, 30 Sep 2016 04:54:14 +0200 Message-ID: <147520405481.22544.7998206786104494657.stgit@Solace.fritz.box> In-Reply-To: <147520253247.22544.10673844222866363947.stgit@Solace.fritz.box> References: <147520253247.22544.10673844222866363947.stgit@Solace.fritz.box> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Cc: George Dunlap , Wei Liu , Ian Jackson Subject: [Xen-devel] [PATCH v2 08/10] libxl: fix coding style of credit1 parameters related functions 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: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP More specifically, the the error handling path is made compliant with libxl's codying style. No functional change intended. Signed-off-by: Dario Faggioli --- Cc: Ian Jackson Cc: Wei Liu Cc: George Dunlap --- Changes from v1: * new patch, containing only the coding style changes from what was patch 14 in v1. --- tools/libxl/libxl.c | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 997d94c..606d71a 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -5233,65 +5233,68 @@ int libxl_sched_credit_params_get(libxl_ctx *ctx, uint32_t poolid, libxl_sched_credit_params *scinfo) { struct xen_sysctl_credit_schedule sparam; - int rc; + int r, rc; GC_INIT(ctx); - rc = xc_sched_credit_params_get(ctx->xch, poolid, &sparam); - if (rc != 0) { - LOGE(ERROR, "getting sched credit param"); - GC_FREE; - return ERROR_FAIL; + r = xc_sched_credit_params_get(ctx->xch, poolid, &sparam); + if (r < 0) { + LOGE(ERROR, "getting Credit scheduler parameters"); + rc = ERROR_FAIL; + goto out; } scinfo->tslice_ms = sparam.tslice_ms; scinfo->ratelimit_us = sparam.ratelimit_us; + rc = 0; + out: GC_FREE; - return 0; + return rc; } int libxl_sched_credit_params_set(libxl_ctx *ctx, uint32_t poolid, libxl_sched_credit_params *scinfo) { struct xen_sysctl_credit_schedule sparam; - int rc=0; + int r, rc; GC_INIT(ctx); if (scinfo->tslice_ms < XEN_SYSCTL_CSCHED_TSLICE_MIN || scinfo->tslice_ms > XEN_SYSCTL_CSCHED_TSLICE_MAX) { LOG(ERROR, "Time slice out of range, valid range is from %d to %d", XEN_SYSCTL_CSCHED_TSLICE_MIN, XEN_SYSCTL_CSCHED_TSLICE_MAX); - GC_FREE; - return ERROR_INVAL; + rc = ERROR_INVAL; + goto out; } if (scinfo->ratelimit_us < XEN_SYSCTL_SCHED_RATELIMIT_MIN || scinfo->ratelimit_us > XEN_SYSCTL_SCHED_RATELIMIT_MAX) { LOG(ERROR, "Ratelimit out of range, valid range is from %d to %d", XEN_SYSCTL_SCHED_RATELIMIT_MIN, XEN_SYSCTL_SCHED_RATELIMIT_MAX); - GC_FREE; - return ERROR_INVAL; + rc = ERROR_INVAL; + goto out; } if (scinfo->ratelimit_us > scinfo->tslice_ms*1000) { LOG(ERROR, "Ratelimit cannot be greater than timeslice"); - GC_FREE; - return ERROR_INVAL; + rc = ERROR_INVAL; + goto out; } sparam.tslice_ms = scinfo->tslice_ms; sparam.ratelimit_us = scinfo->ratelimit_us; - rc = xc_sched_credit_params_set(ctx->xch, poolid, &sparam); - if ( rc < 0 ) { - LOGE(ERROR, "setting sched credit param"); - GC_FREE; - return ERROR_FAIL; + r = xc_sched_credit_params_set(ctx->xch, poolid, &sparam); + if ( r < 0 ) { + LOGE(ERROR, "Setting Credit scheduler parameters"); + rc = ERROR_FAIL; + goto out; } scinfo->tslice_ms = sparam.tslice_ms; scinfo->ratelimit_us = sparam.ratelimit_us; + out: GC_FREE; - return 0; + return rc; } static int sched_credit2_domain_get(libxl__gc *gc, uint32_t domid,