Skip to contentSkip to conversation

infoblock: Make output mutually exclusive

PATCH In review Harish 2 participants 3 messages Jul 7, 2020 – Jul 8, 2020 libnvdimm: non-volatile memory device

lore
Share & tools
lore

Harish

author
#0 lore raw

PATCH 1/1 infoblock: Make output mutually exclusive

Patch fixes checking output filter option (-o <file> or -c) of write-infoblock command to be mutually exclusive.

---
 ndctl/namespace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ndctl/namespace.c +1 -1
index 0550580..d3ade25 100644
@@ -440,7 +440,7 @@ static const char *parse_namespace_options(int argc, const char **argv,
 		rc = -EINVAL;
 	}
 
-	if (action == ACTION_WRITE_INFOBLOCK && (param.outfile || param.std_out)
+	if (action == ACTION_WRITE_INFOBLOCK && (param.outfile && param.std_out)
 			&& argc) {
 		error("specify only one of a namespace filter, --output, or --stdout\n");
 		rc = -EINVAL;
Signature · 4 lines
2.26.2
_______________________________________________
Linux-nvdimm mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Harish

Patch fixes checking output filter option (-o <file> or -c) of write-infoblock command to be mutually exclusive.

Looks reasonable to me.

Quoted 22 lines
---
 ndctl/namespace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ndctl/namespace.c +1 -1
index 0550580..d3ade25 100644
@@ -440,7 +440,7 @@ static const char *parse_namespace_options(int argc, const char **argv,
 		rc = -EINVAL;
 	}
 
-	if (action == ACTION_WRITE_INFOBLOCK && (param.outfile || param.std_out)
+	if (action == ACTION_WRITE_INFOBLOCK && (param.outfile && param.std_out)
 			&& argc) {
 		error("specify only one of a namespace filter, --output, or --stdout\n");
 		rc = -EINVAL;
Signature · 4 lines
2.26.2
_______________________________________________
Linux-nvdimm mailing list -- [email protected]
To unsubscribe send an email to [email protected]

_______________________________________________
Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]

author
#2 lore raw
In reply to Harish

This patch can be dropped as the error specifies namespace filter also is mutually exclusive with these options, so this is not needed. The usage confused me as it portrays namespace filtering to be mandatory as opposed to the Documentation.

Command line:
usage: ndctl write-infoblock <namespace> [<options>]

Sorry for the noise.

- Harish

Quoted 13 lines · Harish

Patch fixes checking output filter option (-o <file> or -c) of write-infoblock command to be mutually exclusive.

---
  ndctl/namespace.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
ndctl/namespace.c +0 -0
index 0550580..d3ade25 100644

ndctl/namespace.c static const char *parse_namespace_options(int argc, const char **argv, · line 446

Quoted 8 lines
ndctl/namespace.c +1 -1
@@ -440,7 +440,7 @@ static const char *parse_namespace_options(int argc, const char **argv,
  		rc = -EINVAL;
  	}
 
-	if (action == ACTION_WRITE_INFOBLOCK && (param.outfile || param.std_out)
+	if (action == ACTION_WRITE_INFOBLOCK && (param.outfile && param.std_out)
  			&& argc) {
  		error("specify only one of a namespace filter, --output, or --stdout\n");
  		rc = -EINVAL;

_______________________________________________
Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]