From b49e1028bf4736abea46ea4fb04dbc4fdf91b98f Mon Sep 17 00:00:00 2001 From: trasz Date: Wed, 30 Oct 2013 11:38:46 +0000 Subject: [PATCH] Rename '-h' option to '-p', and use "portal" instead of "host" or "address", in order to be consistent with iSCSI terminology. Besides, calling the option '-h' was just wrong. This changes usage for newly added iscsictl(8), and two newly added subcommands to ctladm(8). This breaks POLA between CURRENT and 10, but since 10.0 has not been released yet, it's still ok to do. MFC after: 3 days Discussed with: re (glebius) Sponsored by: FreeBSD Foundation --- usr.bin/iscsictl/iscsictl.8 | 10 ++--- usr.bin/iscsictl/iscsictl.c | 74 ++++++++++++++++++------------------- usr.sbin/ctladm/ctladm.8 | 12 +++--- usr.sbin/ctladm/ctladm.c | 64 ++++++++++++++++---------------- 4 files changed, 80 insertions(+), 80 deletions(-) diff --git a/usr.bin/iscsictl/iscsictl.8 b/usr.bin/iscsictl/iscsictl.8 index 03525df1238a..054f1d14e9b0 100644 --- a/usr.bin/iscsictl/iscsictl.8 +++ b/usr.bin/iscsictl/iscsictl.8 @@ -36,7 +36,7 @@ .Sh SYNOPSIS .Nm .Fl A -.Fl h Ar host Fl t Ar target Op Fl u Ar user Fl s Ar secret +.Fl p Ar portal Fl t Ar target Op Fl u Ar user Fl s Ar secret .Nm .Fl A .Fl d Ar discovery-host Op Fl u Ar user Fl s Ar secret @@ -48,7 +48,7 @@ .Fl n Ar nickname Op Fl c Ar path .Nm .Fl R -.Op Fl h Ar host +.Op Fl p Ar portal .Op Fl t Ar target .Nm .Fl R @@ -84,10 +84,10 @@ Target host name or address used for SendTargets discovery. When used, it will add a temporary discovery session. After discovery is done, sessions will be added for each discovered target, and the temporary discovery sesion will be removed. -.It Fl h -Target host name or address for statically defined targets. .It Fl n The "nickname" of session defined in the configuration file. +.It Fl p +Target portal - host name or address - for statically defined targets. .It Fl t Target name. .It Fl v @@ -133,7 +133,7 @@ The utility exits 0 on success, and >0 if an error occurs. .Sh EXAMPLES Attach to target qn.2012-06.com.example:target0, served by 192.168.1.1: -.Dl Nm Fl A Fl t Ar qn.2012-06.com.example:target0 Fl h Ar 192.168.1.1 +.Dl Nm Fl A Fl t Ar qn.2012-06.com.example:target0 Fl p Ar 192.168.1.1 .Pp Disconnect all iSCSI sessions: .Dl Nm Fl Ra diff --git a/usr.bin/iscsictl/iscsictl.c b/usr.bin/iscsictl/iscsictl.c index 1088d69f03e7..ca70980078e9 100644 --- a/usr.bin/iscsictl/iscsictl.c +++ b/usr.bin/iscsictl/iscsictl.c @@ -410,48 +410,48 @@ kernel_list(int iscsi_fd, const struct target *targ __unused, state = &states[i]; conf = &state->iss_conf; - printf("Session ID: %d\n", state->iss_id); - printf("Initiator name: %s\n", conf->isc_initiator); - printf("Initiator addr: %s\n", + printf("Session ID: %d\n", state->iss_id); + printf("Initiator name: %s\n", conf->isc_initiator); + printf("Initiator portal: %s\n", conf->isc_initiator_addr); - printf("Initiator alias: %s\n", + printf("Initiator alias: %s\n", conf->isc_initiator_alias); - printf("Target name: %s\n", conf->isc_target); - printf("Target addr: %s\n", + printf("Target name: %s\n", conf->isc_target); + printf("Target portal: %s\n", conf->isc_target_addr); - printf("Target alias: %s\n", + printf("Target alias: %s\n", state->iss_target_alias); - printf("User: %s\n", conf->isc_user); - printf("Secret: %s\n", conf->isc_secret); - printf("Mutual user: %s\n", + printf("User: %s\n", conf->isc_user); + printf("Secret: %s\n", conf->isc_secret); + printf("Mutual user: %s\n", conf->isc_mutual_user); - printf("Mutual secret: %s\n", + printf("Mutual secret : %s\n", conf->isc_mutual_secret); - printf("Session type: %s\n", + printf("Session type: %s\n", conf->isc_discovery ? "Discovery" : "Normal"); - printf("Session state: %s\n", + printf("Session state: %s\n", state->iss_connected ? "Connected" : "Disconnected"); - printf("Failure reason: %s\n", state->iss_reason); - printf("Header digest: %s\n", + printf("Failure reason: %s\n", state->iss_reason); + printf("Header digest: %s\n", state->iss_header_digest == ISCSI_DIGEST_CRC32C ? "CRC32C" : "None"); - printf("Data digest: %s\n", + printf("Data digest: %s\n", state->iss_data_digest == ISCSI_DIGEST_CRC32C ? "CRC32C" : "None"); - printf("DataSegmentLen: %d\n", + printf("DataSegmentLen: %d\n", state->iss_max_data_segment_length); - printf("ImmediateData: %s\n", + printf("ImmediateData: %s\n", state->iss_immediate_data ? "Yes" : "No"); - printf("iSER (RDMA): %s\n", + printf("iSER (RDMA): %s\n", conf->isc_iser ? "Yes" : "No"); - printf("Device nodes: "); + printf("Device nodes: "); print_periphs(state->iss_id); printf("\n\n"); } } else { printf("%-36s %-16s %s\n", - "Target name", "Target addr", "State"); + "Target name", "Target portal", "State"); for (i = 0; i < isl.isl_nentries; i++) { state = &states[i]; conf = &state->iss_conf; @@ -483,13 +483,13 @@ static void usage(void) { - fprintf(stderr, "usage: iscsictl -A -h host -t target " + fprintf(stderr, "usage: iscsictl -A -p portal -t target " "[-u user -s secret]\n"); fprintf(stderr, " iscsictl -A -d discovery-host " "[-u user -s secret]\n"); fprintf(stderr, " iscsictl -A -a [-c path]\n"); fprintf(stderr, " iscsictl -A -n nickname [-c path]\n"); - fprintf(stderr, " iscsictl -R [-h host] [-t target]\n"); + fprintf(stderr, " iscsictl -R [-p portal] [-t target]\n"); fprintf(stderr, " iscsictl -R -a\n"); fprintf(stderr, " iscsictl -R -n nickname [-c path]\n"); fprintf(stderr, " iscsictl -L [-v]\n"); @@ -519,7 +519,7 @@ main(int argc, char **argv) struct conf *conf; struct target *targ; - while ((ch = getopt(argc, argv, "ARLac:d:n:h:t:u:s:v")) != -1) { + while ((ch = getopt(argc, argv, "ARLac:d:n:p:t:u:s:v")) != -1) { switch (ch) { case 'A': Aflag = 1; @@ -542,7 +542,7 @@ main(int argc, char **argv) case 'n': nickname = optarg; break; - case 'h': + case 'p': host = optarg; break; case 't': @@ -579,7 +579,7 @@ main(int argc, char **argv) if (Aflag != 0) { if (aflag != 0) { if (host != NULL) - errx(1, "-a and -h and mutually exclusive"); + errx(1, "-a and -p and mutually exclusive"); if (target != NULL) errx(1, "-a and -t and mutually exclusive"); if (user != NULL) @@ -592,7 +592,7 @@ main(int argc, char **argv) errx(1, "-a and -d and mutually exclusive"); } else if (nickname != NULL) { if (host != NULL) - errx(1, "-n and -h and mutually exclusive"); + errx(1, "-n and -p and mutually exclusive"); if (target != NULL) errx(1, "-n and -t and mutually exclusive"); if (user != NULL) @@ -603,17 +603,17 @@ main(int argc, char **argv) errx(1, "-n and -d and mutually exclusive"); } else if (discovery_host != NULL) { if (host != NULL) - errx(1, "-d and -h and mutually exclusive"); + errx(1, "-d and -p and mutually exclusive"); if (target != NULL) errx(1, "-d and -t and mutually exclusive"); } else { if (target == NULL && host == NULL) - errx(1, "must specify -a, -n or -t/-h"); + errx(1, "must specify -a, -n or -t/-p"); if (target != NULL && host == NULL) - errx(1, "-t must always be used with -h"); + errx(1, "-t must always be used with -p"); if (host != NULL && target == NULL) - errx(1, "-h must always be used with -t"); + errx(1, "-p must always be used with -t"); } if (user != NULL && secret == NULL) @@ -634,24 +634,24 @@ main(int argc, char **argv) if (aflag != 0) { if (host != NULL) - errx(1, "-a and -h and mutually exclusive"); + errx(1, "-a and -p and mutually exclusive"); if (target != NULL) errx(1, "-a and -t and mutually exclusive"); if (nickname != NULL) errx(1, "-a and -n and mutually exclusive"); } else if (nickname != NULL) { if (host != NULL) - errx(1, "-n and -h and mutually exclusive"); + errx(1, "-n and -p and mutually exclusive"); if (target != NULL) errx(1, "-n and -t and mutually exclusive"); } else if (host != NULL) { if (target != NULL) - errx(1, "-h and -t and mutually exclusive"); + errx(1, "-p and -t and mutually exclusive"); } else if (target != NULL) { if (host != NULL) - errx(1, "-t and -h and mutually exclusive"); + errx(1, "-t and -p and mutually exclusive"); } else - errx(1, "must specify either-a, -n, -t, or -h"); + errx(1, "must specify either -a, -n, -t, or -p"); if (vflag != 0) errx(1, "-v cannot be used with -R"); @@ -660,7 +660,7 @@ main(int argc, char **argv) assert(Lflag != 0); if (host != NULL) - errx(1, "-L and -h and mutually exclusive"); + errx(1, "-L and -p and mutually exclusive"); if (target != NULL) errx(1, "-L and -t and mutually exclusive"); if (user != NULL) diff --git a/usr.sbin/ctladm/ctladm.8 b/usr.sbin/ctladm/ctladm.8 index b9d4e61ae83b..ae1627b54397 100644 --- a/usr.sbin/ctladm/ctladm.8 +++ b/usr.sbin/ctladm/ctladm.8 @@ -202,10 +202,10 @@ .Op Fl x .Nm .Ic islogout -.Aq Fl a | Fl h Ar host | Fl c Ar connection-id | Fl i Ar name +.Aq Fl a | Fl c Ar connection-id | Fl i Ar name | Fl p Ar portal .Nm .Ic isterminate -.Aq Fl a | Fl h Ar host | Fl c Ar connection-id | Fl i Ar name +.Aq Fl a | Fl c Ar connection-id | Fl i Ar name | Fl p Ar portal .Nm .Ic help .Sh DESCRIPTION @@ -909,24 +909,24 @@ Ask the initiator to log out iSCSI connections matching criteria. .Bl -tag -width 11n .It Fl a Log out all connections. -.It Fl h -Specify initiator IP address. .It Fl c Specify connection ID. .It Fl i Specify initiator name. +.It Fl p +Specify initiator portal (hostname or IP address). .El .It Ic isterminate Forcibly terminate iSCSI connections matching criteria. .Bl -tag -width 11n .It Fl a Terminate all connections. -.It Fl h -Specify initiator IP address. .It Fl c Specify connection ID. .It Fl i Specify initiator name. +.It Fl p +Specify initiator portal (hostname or IP address). .El .It Ic help Display diff --git a/usr.sbin/ctladm/ctladm.c b/usr.sbin/ctladm/ctladm.c index 6f03de0c6ba6..783315524a30 100644 --- a/usr.sbin/ctladm/ctladm.c +++ b/usr.sbin/ctladm/ctladm.c @@ -184,8 +184,8 @@ static struct ctladm_opts option_table[] = { {"inject", CTLADM_CMD_ERR_INJECT, CTLADM_ARG_NEED_TL, "cd:i:p:r:s:"}, {"inquiry", CTLADM_CMD_INQUIRY, CTLADM_ARG_NEED_TL, NULL}, {"islist", CTLADM_CMD_ISLIST, CTLADM_ARG_NONE, "vx"}, - {"islogout", CTLADM_CMD_ISLOGOUT, CTLADM_ARG_NONE, "ah:c:i:"}, - {"isterminate", CTLADM_CMD_ISTERMINATE, CTLADM_ARG_NONE, "ah:c:i:"}, + {"islogout", CTLADM_CMD_ISLOGOUT, CTLADM_ARG_NONE, "ac:i:p:"}, + {"isterminate", CTLADM_CMD_ISTERMINATE, CTLADM_ARG_NONE, "ac:i:p:"}, {"lunlist", CTLADM_CMD_LUNLIST, CTLADM_ARG_NONE, NULL}, {"modesense", CTLADM_CMD_MODESENSE, CTLADM_ARG_NEED_TL, "P:S:dlm:c:"}, {"modify", CTLADM_CMD_MODIFY, CTLADM_ARG_NONE, "b:l:s:"}, @@ -3633,21 +3633,21 @@ cctl_islist(int fd, int argc, char **argv, char *combinedopt) if (verbose != 0) { STAILQ_FOREACH(conn, &islist.conn_list, links) { - printf("Session ID: %d\n", conn->connection_id); - printf("Initiator name: %s\n", conn->initiator); - printf("Initiator addr: %s\n", conn->initiator_addr); - printf("Initiator alias: %s\n", conn->initiator_alias); - printf("Target name: %s\n", conn->target); - printf("Target alias: %s\n", conn->target_alias); - printf("Header digest: %s\n", conn->header_digest); - printf("Data digest: %s\n", conn->data_digest); - printf("DataSegmentLen: %s\n", conn->max_data_segment_length); - printf("ImmediateData: %s\n", conn->immediate_data ? "Yes" : "No"); - printf("iSER (RDMA): %s\n", conn->iser ? "Yes" : "No"); + printf("Session ID: %d\n", conn->connection_id); + printf("Initiator name: %s\n", conn->initiator); + printf("Initiator portal: %s\n", conn->initiator_addr); + printf("Initiator alias: %s\n", conn->initiator_alias); + printf("Target name: %s\n", conn->target); + printf("Target alias: %s\n", conn->target_alias); + printf("Header digest: %s\n", conn->header_digest); + printf("Data digest: %s\n", conn->data_digest); + printf("DataSegmentLen: %s\n", conn->max_data_segment_length); + printf("ImmediateData: %s\n", conn->immediate_data ? "Yes" : "No"); + printf("iSER (RDMA): %s\n", conn->iser ? "Yes" : "No"); printf("\n"); } } else { - printf("%4s %-16s %-36s %-36s\n", "ID", "Address", "Initiator name", + printf("%4s %-16s %-36s %-36s\n", "ID", "Portal", "Initiator name", "Target name"); STAILQ_FOREACH(conn, &islist.conn_list, links) { printf("%4u %-16s %-36s %-36s\n", @@ -3675,12 +3675,6 @@ cctl_islogout(int fd, int argc, char **argv, char *combinedopt) all = 1; nargs++; break; - case 'h': - initiator_addr = strdup(optarg); - if (initiator_addr == NULL) - err(1, "%s: strdup", __func__); - nargs++; - break; case 'c': connection_id = strtoul(optarg, NULL, 0); nargs++; @@ -3691,16 +3685,22 @@ cctl_islogout(int fd, int argc, char **argv, char *combinedopt) err(1, "%s: strdup", __func__); nargs++; break; + case 'p': + initiator_addr = strdup(optarg); + if (initiator_addr == NULL) + err(1, "%s: strdup", __func__); + nargs++; + break; default: break; } } if (nargs == 0) - errx(1, "%s: either -a, -h, -c, or -i must be specified", + errx(1, "%s: either -a, -c, -i, or -p must be specified", __func__); if (nargs > 1) - errx(1, "%s: only one of -a, -h, -c, or -i may be specified", + errx(1, "%s: only one of -a, -c, -i, or -p may be specified", __func__); bzero(&req, sizeof(req)); @@ -3748,12 +3748,6 @@ cctl_isterminate(int fd, int argc, char **argv, char *combinedopt) all = 1; nargs++; break; - case 'h': - initiator_addr = strdup(optarg); - if (initiator_addr == NULL) - err(1, "%s: strdup", __func__); - nargs++; - break; case 'c': connection_id = strtoul(optarg, NULL, 0); nargs++; @@ -3764,16 +3758,22 @@ cctl_isterminate(int fd, int argc, char **argv, char *combinedopt) err(1, "%s: strdup", __func__); nargs++; break; + case 'p': + initiator_addr = strdup(optarg); + if (initiator_addr == NULL) + err(1, "%s: strdup", __func__); + nargs++; + break; default: break; } } if (nargs == 0) - errx(1, "%s: either -a, -h, -c, or -i must be specified", + errx(1, "%s: either -a, -c, -i, or -p must be specified", __func__); if (nargs > 1) - errx(1, "%s: only one of -a, -h, -c, or -i may be specified", + errx(1, "%s: only one of -a, -c, -i, or -p may be specified", __func__); bzero(&req, sizeof(req)); @@ -4121,8 +4121,8 @@ usage(int error) " ctladm port <-l | -o | [-w wwnn][-W wwpn]>\n" " [-p targ_port] [-t port_type] [-q] [-x]\n" " ctladm islist [-v | -x]\n" -" ctladm islogout <-A | -a addr | -c connection-id | -n name>\n" -" ctladm isterminate <-A | -a addr | -c connection-id | -n name>\n" +" ctladm islogout <-a | -c connection-id | -i name | -p portal>\n" +" ctladm isterminate <-a | -c connection-id | -i name | -p portal>\n" " ctladm dumpooa\n" " ctladm dumpstructs\n" " ctladm help\n"