All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] tgtadm: Correct mode names in the option error message
@ 2014-01-18  5:27 Zhang Yanfei
  2014-01-18  5:28 ` [PATCH 2/2] tgtadm: display unsupported operation name explicitly Zhang Yanfei
  2014-01-18  6:22 ` [PATCH 1/2] tgtadm: Correct mode names in the option error message FUJITA Tomonori
  0 siblings, 2 replies; 3+ messages in thread
From: Zhang Yanfei @ 2014-01-18  5:27 UTC (permalink / raw)
  To: fujita.tomonori; +Cc: stgt, Zhang Yanfei

From: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>

When an error option is specified for some mode and operation,
tgtadm outputs an error message which contains the mode name.
But some of the mode names are obviously wrong so the patch fixes
them.

Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
---
 usr/tgtadm.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/usr/tgtadm.c b/usr/tgtadm.c
index 7771119..d708a65 100644
--- a/usr/tgtadm.c
+++ b/usr/tgtadm.c
@@ -739,7 +739,7 @@ int main(int argc, char **argv)
 		case OP_NEW:
 			rc = verify_mode_params(argc, argv, "LmoupfC");
 			if (rc) {
-				eprintf("logicalunit mode: option '-%c' is "
+				eprintf("account mode: option '-%c' is "
 					"not allowed/supported\n", rc);
 				exit(EINVAL);
 			}
@@ -752,7 +752,7 @@ int main(int argc, char **argv)
 		case OP_SHOW:
 			rc = verify_mode_params(argc, argv, "LmoC");
 			if (rc) {
-				eprintf("target mode: option '-%c' is not "
+				eprintf("account mode: option '-%c' is not "
 					"allowed/supported\n", rc);
 				exit(EINVAL);
 			}
@@ -760,7 +760,7 @@ int main(int argc, char **argv)
 		case OP_DELETE:
 			rc = verify_mode_params(argc, argv, "LmouC");
 			if (rc) {
-				eprintf("target mode: option '-%c' is not "
+				eprintf("account mode: option '-%c' is not "
 					"allowed/supported\n", rc);
 				exit(EINVAL);
 			}
@@ -768,7 +768,7 @@ int main(int argc, char **argv)
 		case OP_BIND:
 			rc = verify_mode_params(argc, argv, "LmotuOC");
 			if (rc) {
-				eprintf("target mode: option '-%c' is not "
+				eprintf("account mode: option '-%c' is not "
 					"allowed/supported\n", rc);
 				exit(EINVAL);
 			}
@@ -782,7 +782,7 @@ int main(int argc, char **argv)
 		case OP_UNBIND:
 			rc = verify_mode_params(argc, argv, "LmotuOC");
 			if (rc) {
-				eprintf("target mode: option '-%c' is not "
+				eprintf("account mode: option '-%c' is not "
 					"allowed/supported\n", rc);
 				exit(EINVAL);
 			}
@@ -817,7 +817,7 @@ int main(int argc, char **argv)
 		case OP_NEW:
 			rc = verify_mode_params(argc, argv, "LmofytlbEYCS");
 			if (rc) {
-				eprintf("target mode: option '-%c' is not "
+				eprintf("logicalunit mode: option '-%c' is not "
 					  "allowed/supported\n", rc);
 				exit(EINVAL);
 			}
@@ -833,7 +833,7 @@ int main(int argc, char **argv)
 		case OP_STATS:
 			rc = verify_mode_params(argc, argv, "LmotlC");
 			if (rc) {
-				eprintf("target mode: option '-%c' is not "
+				eprintf("logicalunit mode: option '-%c' is not "
 					  "allowed/supported\n", rc);
 				exit(EINVAL);
 			}
@@ -905,7 +905,7 @@ int main(int argc, char **argv)
 		case OP_SHOW:
 			rc = verify_mode_params(argc, argv, "LmoC");
 			if (rc) {
-				eprintf("system mode: option '-%c' is not "
+				eprintf("lld mode: option '-%c' is not "
 					"allowed/supported\n", rc);
 				exit(EINVAL);
 			}
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] tgtadm: display unsupported operation name explicitly
  2014-01-18  5:27 [PATCH 1/2] tgtadm: Correct mode names in the option error message Zhang Yanfei
@ 2014-01-18  5:28 ` Zhang Yanfei
  2014-01-18  6:22 ` [PATCH 1/2] tgtadm: Correct mode names in the option error message FUJITA Tomonori
  1 sibling, 0 replies; 3+ messages in thread
From: Zhang Yanfei @ 2014-01-18  5:28 UTC (permalink / raw)
  To: fujita.tomonori; +Cc: stgt, Zhang Yanfei

From: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>

When we specify an unsupported operation type for some mode,
tgtadm will display the error message which contains the
unsupported operation type value. The patch changes to
display the operation name which is more explicit. Also
change the word 'option' to 'operation'.

Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
---
 usr/tgtadm.c |   26 +++++++++++++++-----------
 1 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/usr/tgtadm.c b/usr/tgtadm.c
index d708a65..cc63fbf 100644
--- a/usr/tgtadm.c
+++ b/usr/tgtadm.c
@@ -493,6 +493,7 @@ int main(int argc, char **argv)
 	char *user, *password;
 	struct tgtadm_req adm_req = {0}, *req = &adm_req;
 	struct concat_buf b;
+	char *op_name;
 
 	op = tid = mode = -1;
 	cid = hostno = sid = 0;
@@ -503,7 +504,7 @@ int main(int argc, char **argv)
 	ac_dir = ACCOUNT_TYPE_INCOMING;
 	name = value = path = targetname = address = iqnname = NULL;
 	targetOps = portalOps = bstype = bsopts = NULL;
-	bsoflags = blocksize = user = password = NULL;
+	bsoflags = blocksize = user = password = op_name = NULL;
 	force = 0;
 
 	optind = 1;
@@ -516,6 +517,7 @@ int main(int argc, char **argv)
 			break;
 		case 'o':
 			op = str_to_op(optarg);
+			op_name = optarg;
 			break;
 		case 'm':
 			mode = str_to_mode(optarg);
@@ -653,7 +655,8 @@ int main(int argc, char **argv)
 		case OP_STATS:
 			break;
 		default:
-			eprintf("option %d not supported in system mode\n", op);
+			eprintf("operation %s not supported in system mode\n",
+				op_name);
 			exit(EINVAL);
 			break;
 		}
@@ -709,8 +712,8 @@ int main(int argc, char **argv)
 			}
 			if (!address && !iqnname && !hostno) {
 				eprintf("%s operation requires"
-					" initiator-address, initiator-name or bus\n",
-					op == OP_BIND ? "bind" : "unbind");
+					" initiator-address, initiator-name"
+					"or bus\n", op_name);
 				exit(EINVAL);
 			}
 			break;
@@ -728,7 +731,8 @@ int main(int argc, char **argv)
 			}
 			break;
 		default:
-			eprintf("option %d not supported in target mode\n", op);
+			eprintf("operation %s not supported in target mode\n",
+				op_name);
 			exit(EINVAL);
 			break;
 		}
@@ -794,8 +798,8 @@ int main(int argc, char **argv)
 				tid = GLOBAL_TID;
 			break;
 		default:
-			eprintf("option %d not supported in account mode\n",
-				op);
+			eprintf("operation %s not supported in account mode\n",
+				op_name);
 			exit(EINVAL);
 			break;
 		}
@@ -847,8 +851,8 @@ int main(int argc, char **argv)
 			}
 			break;
 		default:
-			eprintf("option %d not supported in "
-				"logicalunit mode\n", op);
+			eprintf("operation %s not supported in "
+				"logicalunit mode\n", op_name);
 			exit(EINVAL);
 			break;
 		}
@@ -891,8 +895,8 @@ int main(int argc, char **argv)
 			}
 			break;
 		default:
-			eprintf("option %d not supported in "
-					"portal mode\n", op);
+			eprintf("operation %s not supported in portal mode\n",
+				op_name);
 			exit(EINVAL);
 			break;
 		}
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] tgtadm: Correct mode names in the option error message
  2014-01-18  5:27 [PATCH 1/2] tgtadm: Correct mode names in the option error message Zhang Yanfei
  2014-01-18  5:28 ` [PATCH 2/2] tgtadm: display unsupported operation name explicitly Zhang Yanfei
@ 2014-01-18  6:22 ` FUJITA Tomonori
  1 sibling, 0 replies; 3+ messages in thread
From: FUJITA Tomonori @ 2014-01-18  6:22 UTC (permalink / raw)
  To: zhangyanfei.yes; +Cc: fujita.tomonori, stgt, zhangyanfei

On Sat, 18 Jan 2014 13:27:15 +0800
Zhang Yanfei <zhangyanfei.yes@gmail.com> wrote:

> From: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
> 
> When an error option is specified for some mode and operation,
> tgtadm outputs an error message which contains the mode name.
> But some of the mode names are obviously wrong so the patch fixes
> them.
> 
> Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
> ---
>  usr/tgtadm.c |   16 ++++++++--------
>  1 files changed, 8 insertions(+), 8 deletions(-)

Both look good. Applied, thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-01-18  6:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-18  5:27 [PATCH 1/2] tgtadm: Correct mode names in the option error message Zhang Yanfei
2014-01-18  5:28 ` [PATCH 2/2] tgtadm: display unsupported operation name explicitly Zhang Yanfei
2014-01-18  6:22 ` [PATCH 1/2] tgtadm: Correct mode names in the option error message FUJITA Tomonori

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.