From patchwork Fri Apr 1 12:40:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulina Szubarczyk X-Patchwork-Id: 8723531 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 4457A9FC89 for ; Fri, 1 Apr 2016 12:43:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 738EF203B7 for ; Fri, 1 Apr 2016 12:43:43 +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 8E4BA20303 for ; Fri, 1 Apr 2016 12:43:42 +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 1alyO8-0001CZ-MT; Fri, 01 Apr 2016 12:41:20 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1alyO7-0001BW-Jg for xen-devel@lists.xenproject.org; Fri, 01 Apr 2016 12:41:19 +0000 Received: from [85.158.139.211] by server-4.bemta-5.messagelabs.com id 2B/B2-20731-E6C6EF65; Fri, 01 Apr 2016 12:41:18 +0000 X-Env-Sender: paulinaszubarczyk@gmail.com X-Msg-Ref: server-7.tower-206.messagelabs.com!1459514477!32263540!1 X-Originating-IP: [209.85.217.170] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.11; banners=-,-,- X-VirusChecked: Checked Received: (qmail 19097 invoked from network); 1 Apr 2016 12:41:18 -0000 Received: from mail-lb0-f170.google.com (HELO mail-lb0-f170.google.com) (209.85.217.170) by server-7.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 1 Apr 2016 12:41:18 -0000 Received: by mail-lb0-f170.google.com with SMTP id qe11so71166658lbc.3 for ; Fri, 01 Apr 2016 05:41:18 -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=vXCKejcbFYICrCFi3UDtX73NYqe8F90vAeL/dfi7+7s=; b=ptRxtaOE+XBtHukt3v6oSslL+XBJw/amClGKkycaCHBbrzy1OZn5GA73aHRnHAF7A/ 1KBvS5WIzqvlp2+cF3wYTfz1O+2ZqJAiryFGI94cVg1H4qLdVa7lTG1j4V9Fim+3tl/r WowObZv+MrEmTdtdulSlTLAAIhMutHBz7F3g8QKUdbOlWNOQQuAkIrJ1iF1WrS6Cvl9N e/lyhXBssAk4YwyC8MG8ul9OxNSkyy2Bv3VKzCwwIbzxDgfB/q8/o9hE6B4cJkr9FcQY rgA1y5+Jc4uO+qGzIxC/RQJyottGwvpPmhyblI9brjSZxGQf81yOU/soI4M+9RHaSKrF MVlQ== 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=vXCKejcbFYICrCFi3UDtX73NYqe8F90vAeL/dfi7+7s=; b=MidthgG0UbEIDZpiavdMzhwM0kfPg+cChDjJ6HPVMHlmiocRm5D9t8Kven81E3epTG 61SfgmXoKTdZC7Bb7ocBrGd3GLOkpZAjuc+2yxKSRg1ZSBQsuNsQccqO2qu0XhpWxvBv T8GCiqUn3G3nyEpuldmWbQ6d/xX9+8wtFS3I7/yLQ/lhKH34MTOvma06c7b8qZWEtzOK USS89HxqDIn1ZqTgVlTDtxKsIhzVpRvigW7J/K4jKCTlUB7F8QFPa5CeImwaXh7x5bpi MR2NEB+ZYT21KeTKKeI4AI7C0SqKeM2iSFTiq8Lu/gxnQN1PYb3aPpToty4Ee14TgTGY OZFA== X-Gm-Message-State: AD7BkJLSbejET6iYDhiZsF8bVERQoFmQthi795Jd+OZAsEQApuDuQ42MzYShlbjeMDBhgg== X-Received: by 10.112.13.8 with SMTP id d8mr1769179lbc.110.1459514477516; Fri, 01 Apr 2016 05:41:17 -0700 (PDT) Received: from localhost.localdomain (84-10-74-207.static.chello.pl. [84.10.74.207]) by smtp.gmail.com with ESMTPSA id do4sm2134801lbc.35.2016.04.01.05.41.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 01 Apr 2016 05:41:16 -0700 (PDT) From: Paulina Szubarczyk To: xen-devel@lists.xenproject.org, roger.pau@citrix.com, George.Dunlap@eu.citrix.com Date: Fri, 1 Apr 2016 14:40:08 +0200 Message-Id: <1459514413-18682-6-git-send-email-paulinaszubarczyk@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1459514413-18682-1-git-send-email-paulinaszubarczyk@gmail.com> References: <1459514413-18682-1-git-send-email-paulinaszubarczyk@gmail.com> Cc: Paulina Szubarczyk , dario.faggioli@citrix.com, wei.liu2@citrix.com, ian.campbell@citrix.com Subject: [Xen-devel] [PATCH 05/10] xl_cmdimpl: improve return codes for memset commands 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 - Use EXIT_{SUCCESS,FAILURE} for main_mem*() function - Use 0/1 as return values of set_memory_{max,target} Signed-off-by: Paulina Szubarczyk --- tools/libxl/xl_cmdimpl.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 7ee6953..31f037f 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -3380,15 +3380,15 @@ static int set_memory_max(uint32_t domid, const char *mem) memorykb = parse_mem_size_kb(mem); if (memorykb == -1) { fprintf(stderr, "invalid memory size: %s\n", mem); - exit(3); + exit(EXIT_FAILURE); } if (libxl_domain_setmaxmem(ctx, domid, memorykb)) { fprintf(stderr, "cannot set domid %d static max memory to : %s\n", domid, mem); - return EXIT_FAILURE; + return 1; } - return EXIT_SUCCESS; + return 0; } int main_memmax(int argc, char **argv) @@ -3404,7 +3404,11 @@ int main_memmax(int argc, char **argv) domid = find_domain(argv[optind]); mem = argv[optind + 1]; - return set_memory_max(domid, mem); + if (set_memory_max(domid, mem)) { + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; } static int set_memory_target(uint32_t domid, const char *mem) @@ -3414,15 +3418,15 @@ static int set_memory_target(uint32_t domid, const char *mem) memorykb = parse_mem_size_kb(mem); if (memorykb == -1) { fprintf(stderr, "invalid memory size: %s\n", mem); - exit(3); + exit(EXIT_FAILURE); } if (libxl_set_memory_target(ctx, domid, memorykb, 0, /* enforce */ 1)) { fprintf(stderr, "cannot set domid %d dynamic max memory to : %s\n", domid, mem); - return EXIT_FAILURE; + return 1; } - return EXIT_SUCCESS; + return 0; } int main_memset(int argc, char **argv) @@ -3438,7 +3442,11 @@ int main_memset(int argc, char **argv) domid = find_domain(argv[optind]); mem = argv[optind + 1]; - return set_memory_target(domid, mem); + if (set_memory_target(domid, mem)) { + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; } static int cd_insert(uint32_t domid, const char *virtdev, char *phys)