From patchwork Tue Jan 19 05:57:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chester Lin X-Patchwork-Id: 8058271 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 BA07B9F1CC for ; Tue, 19 Jan 2016 06:00:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E752320414 for ; Tue, 19 Jan 2016 06:00:52 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D8E7F203FB for ; Tue, 19 Jan 2016 06:00:51 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aLPII-0005ub-Js; Tue, 19 Jan 2016 05:57:30 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aLPIG-0005uW-Nz for xen-devel@lists.xen.org; Tue, 19 Jan 2016 05:57:28 +0000 Received: from [85.158.137.68] by server-11.bemta-3.messagelabs.com id 52/54-32641-740DD965; Tue, 19 Jan 2016 05:57:27 +0000 X-Env-Sender: czylin@uwaterloo.ca X-Msg-Ref: server-12.tower-31.messagelabs.com!1453183046!16562069!1 X-Originating-IP: [129.97.128.141] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 29496 invoked from network); 19 Jan 2016 05:57:27 -0000 Received: from mailservices.uwaterloo.ca (HELO minos.uwaterloo.ca) (129.97.128.141) by server-12.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 19 Jan 2016 05:57:27 -0000 Received: from ubuntu1204-004.student.cs.uwaterloo.ca (ubuntu1204-004.student.cs.uwaterloo.ca [129.97.167.42]) (authenticated bits=0) by minos.uwaterloo.ca (8.14.4/8.14.4) with ESMTP id u0J5vEBQ022145 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 19 Jan 2016 00:57:22 -0500 From: Chester Lin To: xen-devel@lists.xen.org Date: Tue, 19 Jan 2016 00:57:08 -0500 Message-Id: <1453183028-50263-1-git-send-email-czylin@uwaterloo.ca> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1451982030.27063.30.camel@citrix.com> References: <1451982030.27063.30.camel@citrix.com> X-UUID: aad553bf-1149-4cf9-b54b-4270836f4214 Cc: wei.liu2@citrix.com, ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com, dario.faggioli@citrix.com, ian.jackson@eu.citrix.com, Chester Lin , jtotto@uwaterloo.ca, hjarmstr@uwaterloo.ca Subject: [Xen-devel] [PATCH v2 1/5] libxl: tidy libxl_get_scheduler() according to CODING_STYLE X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 To more closely follow the guidelines in CODING_STYLE, store the result of xc_sched_id() in the local variable r, and the check the result of the call in a separate statement. Change the type of the output parameter given to xc_sched_id() from libxl_scheduler to int to match the libxc interface. Additionally, change the error log statement to more accurately reflect the failure. This is the only functional change introduced by this patch. Suggested-by: Ian Campbell Signed-off-by: Chester Lin Reviewed-by: Dario Faggioli --- Now storing the return of xc_sched_id in an int as per On Mon, 2016-01-04 at 16:23 +0000, Ian Campbell wrote: >Safer (and cleaner looking even if I'm wrong) would be to use a temporary >int for the function call and turn it into an enum implicitly in the return --- tools/libxl/libxl.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 9207621..7f28af8 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -5585,10 +5585,12 @@ out: libxl_scheduler libxl_get_scheduler(libxl_ctx *ctx) { - libxl_scheduler sched, ret; + int r, sched; + GC_INIT(ctx); - if ((ret = xc_sched_id(ctx->xch, (int *)&sched)) != 0) { - LOGE(ERROR, "getting domain info list"); + r = xc_sched_id(ctx->xch, &sched); + if (r != 0) { + LOGE(ERROR, "getting current scheduler id"); return ERROR_FAIL; GC_FREE; }