From patchwork Thu Jan 28 22:53:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 8154901 Return-Path: X-Original-To: patchwork-linux-nvdimm@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 CA2EC9F38B for ; Thu, 28 Jan 2016 22:53:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 06AFB20256 for ; Thu, 28 Jan 2016 22:53:29 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2C52B20328 for ; Thu, 28 Jan 2016 22:53:27 +0000 (UTC) Received: from ml01.vlan14.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 20A171A1DE7; Thu, 28 Jan 2016 14:53:27 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by ml01.01.org (Postfix) with ESMTP id 9E4781A2075 for ; Thu, 28 Jan 2016 14:53:25 -0800 (PST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 28 Jan 2016 14:53:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,360,1449561600"; d="scan'208";a="900549652" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.136]) by orsmga002.jf.intel.com with ESMTP; 28 Jan 2016 14:53:25 -0800 Subject: [ndctl PATCH 12/13] ndctl: fix return code for enable/disable commands From: Dan Williams To: linux-nvdimm@lists.01.org Date: Thu, 28 Jan 2016 14:53:01 -0800 Message-ID: <20160128225300.17855.16492.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <20160128225157.17855.5190.stgit@dwillia2-desk3.amr.corp.intel.com> References: <20160128225157.17855.5190.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.17.1-9-g687f MIME-Version: 1.0 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, 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 Returning the number of enabled / disabled devices makes the commands unusable as a script since non-zero return code equals failure. Signed-off-by: Dan Williams --- builtin-xable-region.c | 8 ++++---- builtin-xaction-namespace.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/builtin-xable-region.c b/builtin-xable-region.c index 82bce63fda4b..1de1e97634cf 100644 --- a/builtin-xable-region.c +++ b/builtin-xable-region.c @@ -82,11 +82,11 @@ int cmd_disable_region(int argc, const char **argv) return disabled; } else if (disabled == 0) { fprintf(stderr, "disabled 0 regions\n"); - return -ENXIO; + return 0; } else { fprintf(stderr, "disabled %d region%s\n", disabled, disabled > 1 ? "s" : ""); - return disabled; + return 0; } } @@ -102,10 +102,10 @@ int cmd_enable_region(int argc, const char **argv) return enabled; } else if (enabled == 0) { fprintf(stderr, "enabled 0 regions\n"); - return -ENXIO; + return 0; } else { fprintf(stderr, "enabled %d region%s\n", enabled, enabled > 1 ? "s" : ""); - return enabled; + return 0; } } diff --git a/builtin-xaction-namespace.c b/builtin-xaction-namespace.c index 22e949a9ec6d..4135e04d93fd 100644 --- a/builtin-xaction-namespace.c +++ b/builtin-xaction-namespace.c @@ -653,11 +653,11 @@ int cmd_enable_namespace(int argc, const char **argv) return enabled; } else if (enabled == 0) { fprintf(stderr, "enabled 0 namespaces\n"); - return -ENXIO; + return 0; } else { fprintf(stderr, "enabled %d namespace%s\n", enabled, enabled > 1 ? "s" : ""); - return enabled; + return 0; } }