From patchwork Mon Jun 27 19:28:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Verma, Vishal L" X-Patchwork-Id: 9201289 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 63F476075F for ; Mon, 27 Jun 2016 19:28:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 520B6285AC for ; Mon, 27 Jun 2016 19:28:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 46CC0285BA; Mon, 27 Jun 2016 19:28:39 +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=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id D278E285AC for ; Mon, 27 Jun 2016 19:28:38 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 3F3F71A1E00; Mon, 27 Jun 2016 12:29:12 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by ml01.01.org (Postfix) with ESMTP id 0709A1A1E00 for ; Mon, 27 Jun 2016 12:29:11 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 27 Jun 2016 12:28:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,537,1459839600"; d="scan'208";a="984302853" Received: from omniknight.lm.intel.com ([10.232.112.171]) by orsmga001.jf.intel.com with ESMTP; 27 Jun 2016 12:28:38 -0700 Date: Mon, 27 Jun 2016 13:28:12 -0600 From: Vishal Verma To: Dan Williams Subject: Re: [ndctl PATCH 4/9] ndctl, list: allow limiting namespace listing Message-ID: <20160627192812.GD20767@omniknight.lm.intel.com> References: <146698346627.40541.14661847967712551305.stgit@dwillia2-desk3.amr.corp.intel.com> <146698348937.40541.3876891950806088867.stgit@dwillia2-desk3.amr.corp.intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <146698348937.40541.3876891950806088867.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-nvdimm@lists.01.org Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP On 06/26, Dan Williams wrote: > In addition to filtering by bus, dimm, and/or region, introduce > -n/--namespace to limit the listing to the given namespace. > > Signed-off-by: Dan Williams > --- > Documentation/ndctl-list.txt | 6 ++++++ > ndctl/builtin-list.c | 6 ++++++ > util/filter.c | 21 +++++++++++++++++++++ > util/filter.h | 2 ++ > 4 files changed, 35 insertions(+) > This needs a bash completion update as follows (feel free to squash in or keep separatley..): From b6d09ff03b7ed16efdc4169aec0442d5c32053bd Mon Sep 17 00:00:00 2001 From: Vishal Verma Date: Mon, 27 Jun 2016 13:22:58 -0600 Subject: [PATCH] ndctl: bash completion updates for the --namespace= filter Add completion for the new --namespace= filter. This will list idle namespaces for completion. It could possibly be made smarter by checking if a '--idle' or '-i' has been specified on the command line so far, but maybe that's a bit confusing for the user? For now, enable the simpler path of listing everything for completion. Signed-off-by: Vishal Verma --- contrib/ndctl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/contrib/ndctl b/contrib/ndctl index 5a7455f..b7a82fc 100755 --- a/contrib/ndctl +++ b/contrib/ndctl @@ -91,7 +91,7 @@ __ndctlcomp() COMPREPLY=( $( compgen -W "$1" -- "$2" ) ) for cword in "${COMPREPLY[@]}"; do - if [[ "$cword" == @(--bus|--region|--type|--mode|--size|--dimm|--reconfig|--uuid|--name|--sector-size|--map) ]]; then + if [[ "$cword" == @(--bus|--region|--type|--mode|--size|--dimm|--reconfig|--uuid|--name|--sector-size|--map|--namespace) ]]; then COMPREPLY[$i]="${cword}=" else COMPREPLY[$i]="${cword} " @@ -146,6 +146,9 @@ __ndctl_comp_options() --dimm) opts=$(__ndctl_get_dimms) ;; + --namespace) + opts=$(__ndctl_get_ns -i) + ;; --reconfig) # It is ok to reconfig disabled namespaces opts=$(__ndctl_get_ns -i)