diff mbox

[ndctl,3/5] ndctl, list: clean up default behavior

Message ID 20160407010714.30641.19033.stgit@dwillia2-desk3.jf.intel.com (mailing list archive)
State Accepted
Commit f2067ea6a31e
Headers show

Commit Message

Dan Williams April 7, 2016, 1:07 a.m. UTC
Only list namespaces by default when no other option is specified.
Otherwise, to limit the listing to dimm info a user would need to run:

	ndctl list --dimms --no-namespaces

...with the change this is reduced to:

	ndctl list --dimms

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 Documentation/ndctl-list.txt |    2 +-
 builtin-list.c               |    7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

Comments

Johannes Thumshirn April 7, 2016, 8:38 a.m. UTC | #1
On Mittwoch, 6. April 2016 18:07:14 CEST Dan Williams wrote:
> Only list namespaces by default when no other option is specified.
> Otherwise, to limit the listing to dimm info a user would need to run:
> 
> 	ndctl list --dimms --no-namespaces
> 
> ...with the change this is reduced to:
> 
> 	ndctl list --dimms
> 
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---

Looks good,
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
diff mbox

Patch

diff --git a/Documentation/ndctl-list.txt b/Documentation/ndctl-list.txt
index abf3ff07cfa9..806548196118 100644
--- a/Documentation/ndctl-list.txt
+++ b/Documentation/ndctl-list.txt
@@ -79,7 +79,7 @@  include::xable-region-options.txt[]
 -N::
 --namespaces::
 	Include namespace info in the listing.  Namespace info is
-	included by default, specify '--no-namespaces' to omit.
+	listed by default if no other options are specified to the command.
 
 -i::
 --idle::
diff --git a/builtin-list.c b/builtin-list.c
index 413b36ac0208..df0871ab544a 100644
--- a/builtin-list.c
+++ b/builtin-list.c
@@ -22,9 +22,7 @@  static struct {
 	bool regions;
 	bool namespaces;
 	bool idle;
-} list = {
-	.namespaces = true,
-};
+} list;
 
 static struct {
 	const char *bus;
@@ -222,6 +220,9 @@  int cmd_list(int argc, const char **argv)
 	unsigned int type = 0;
 	int i, rc;
 
+	if (argc == 1)
+		list.namespaces = true;
+
         argc = parse_options(argc, argv, options, u, 0);
 	for (i = 0; i < argc; i++)
 		error("unknown parameter \"%s\"\n", argv[i]);