Add libxo(3) support to iscsictl(8).
PR: 198396 Submitted by: Marie Helene Kvello-Aune <marieheleneka at gmail.com> MFC after: 1 month Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
fac289a29e
commit
01d54ad206
@ -6,6 +6,8 @@ CFLAGS+= -I${.CURDIR}
|
||||
CFLAGS+= -I${.CURDIR}/../../sys/dev/iscsi
|
||||
MAN= iscsi.conf.5 iscsictl.8
|
||||
|
||||
LIBADD= xo
|
||||
|
||||
YFLAGS+= -v
|
||||
LFLAGS+= -i
|
||||
CLEANFILES= y.tab.c y.tab.h y.output
|
||||
|
@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/linker.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
@ -44,6 +43,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <libxo/xo.h>
|
||||
|
||||
#include <iscsi_ioctl.h>
|
||||
#include "iscsictl.h"
|
||||
@ -55,7 +55,7 @@ conf_new(void)
|
||||
|
||||
conf = calloc(1, sizeof(*conf));
|
||||
if (conf == NULL)
|
||||
err(1, "calloc");
|
||||
xo_err(1, "calloc");
|
||||
|
||||
TAILQ_INIT(&conf->conf_targets);
|
||||
|
||||
@ -83,7 +83,7 @@ target_new(struct conf *conf)
|
||||
|
||||
targ = calloc(1, sizeof(*targ));
|
||||
if (targ == NULL)
|
||||
err(1, "calloc");
|
||||
xo_err(1, "calloc");
|
||||
targ->t_conf = conf;
|
||||
TAILQ_INSERT_TAIL(&conf->conf_targets, targ, t_next);
|
||||
|
||||
@ -110,12 +110,12 @@ default_initiator_name(void)
|
||||
|
||||
name = calloc(1, namelen + 1);
|
||||
if (name == NULL)
|
||||
err(1, "calloc");
|
||||
xo_err(1, "calloc");
|
||||
strcpy(name, DEFAULT_IQN);
|
||||
error = gethostname(name + strlen(DEFAULT_IQN),
|
||||
namelen - strlen(DEFAULT_IQN));
|
||||
if (error != 0)
|
||||
err(1, "gethostname");
|
||||
xo_err(1, "gethostname");
|
||||
|
||||
return (name);
|
||||
}
|
||||
@ -158,7 +158,7 @@ valid_iscsi_name(const char *name)
|
||||
int i;
|
||||
|
||||
if (strlen(name) >= MAX_NAME_LEN) {
|
||||
warnx("overlong name for \"%s\"; max length allowed "
|
||||
xo_warnx("overlong name for \"%s\"; max length allowed "
|
||||
"by iSCSI specification is %d characters",
|
||||
name, MAX_NAME_LEN);
|
||||
return (false);
|
||||
@ -178,7 +178,7 @@ valid_iscsi_name(const char *name)
|
||||
continue;
|
||||
if (name[i] == '-' || name[i] == '.' || name[i] == ':')
|
||||
continue;
|
||||
warnx("invalid character \"%c\" in iSCSI name "
|
||||
xo_warnx("invalid character \"%c\" in iSCSI name "
|
||||
"\"%s\"; allowed characters are letters, digits, "
|
||||
"'-', '.', and ':'", name[i], name);
|
||||
break;
|
||||
@ -188,12 +188,12 @@ valid_iscsi_name(const char *name)
|
||||
*/
|
||||
} else if (strncasecmp(name, "eui.", strlen("eui.")) == 0) {
|
||||
if (strlen(name) != strlen("eui.") + 16)
|
||||
warnx("invalid iSCSI name \"%s\"; the \"eui.\" "
|
||||
xo_warnx("invalid iSCSI name \"%s\"; the \"eui.\" "
|
||||
"should be followed by exactly 16 hexadecimal "
|
||||
"digits", name);
|
||||
for (i = strlen("eui."); name[i] != '\0'; i++) {
|
||||
if (!valid_hex(name[i])) {
|
||||
warnx("invalid character \"%c\" in iSCSI "
|
||||
xo_warnx("invalid character \"%c\" in iSCSI "
|
||||
"name \"%s\"; allowed characters are 1-9 "
|
||||
"and A-F", name[i], name);
|
||||
break;
|
||||
@ -201,19 +201,19 @@ valid_iscsi_name(const char *name)
|
||||
}
|
||||
} else if (strncasecmp(name, "naa.", strlen("naa.")) == 0) {
|
||||
if (strlen(name) > strlen("naa.") + 32)
|
||||
warnx("invalid iSCSI name \"%s\"; the \"naa.\" "
|
||||
xo_warnx("invalid iSCSI name \"%s\"; the \"naa.\" "
|
||||
"should be followed by at most 32 hexadecimal "
|
||||
"digits", name);
|
||||
for (i = strlen("naa."); name[i] != '\0'; i++) {
|
||||
if (!valid_hex(name[i])) {
|
||||
warnx("invalid character \"%c\" in ISCSI "
|
||||
xo_warnx("invalid character \"%c\" in ISCSI "
|
||||
"name \"%s\"; allowed characters are 1-9 "
|
||||
"and A-F", name[i], name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
warnx("invalid iSCSI name \"%s\"; should start with "
|
||||
xo_warnx("invalid iSCSI name \"%s\"; should start with "
|
||||
"either \".iqn\", \"eui.\", or \"naa.\"",
|
||||
name);
|
||||
}
|
||||
@ -231,26 +231,26 @@ conf_verify(struct conf *conf)
|
||||
targ->t_session_type = SESSION_TYPE_NORMAL;
|
||||
if (targ->t_session_type == SESSION_TYPE_NORMAL &&
|
||||
targ->t_name == NULL)
|
||||
errx(1, "missing TargetName for target \"%s\"",
|
||||
xo_errx(1, "missing TargetName for target \"%s\"",
|
||||
targ->t_nickname);
|
||||
if (targ->t_session_type == SESSION_TYPE_DISCOVERY &&
|
||||
targ->t_name != NULL)
|
||||
errx(1, "cannot specify TargetName for discovery "
|
||||
xo_errx(1, "cannot specify TargetName for discovery "
|
||||
"sessions for target \"%s\"", targ->t_nickname);
|
||||
if (targ->t_name != NULL) {
|
||||
if (valid_iscsi_name(targ->t_name) == false)
|
||||
errx(1, "invalid target name \"%s\"",
|
||||
xo_errx(1, "invalid target name \"%s\"",
|
||||
targ->t_name);
|
||||
}
|
||||
if (targ->t_protocol == PROTOCOL_UNSPECIFIED)
|
||||
targ->t_protocol = PROTOCOL_ISCSI;
|
||||
if (targ->t_address == NULL)
|
||||
errx(1, "missing TargetAddress for target \"%s\"",
|
||||
xo_errx(1, "missing TargetAddress for target \"%s\"",
|
||||
targ->t_nickname);
|
||||
if (targ->t_initiator_name == NULL)
|
||||
targ->t_initiator_name = default_initiator_name();
|
||||
if (valid_iscsi_name(targ->t_initiator_name) == false)
|
||||
errx(1, "invalid initiator name \"%s\"",
|
||||
xo_errx(1, "invalid initiator name \"%s\"",
|
||||
targ->t_initiator_name);
|
||||
if (targ->t_header_digest == DIGEST_UNSPECIFIED)
|
||||
targ->t_header_digest = DIGEST_NONE;
|
||||
@ -268,19 +268,19 @@ conf_verify(struct conf *conf)
|
||||
}
|
||||
if (targ->t_auth_method == AUTH_METHOD_CHAP) {
|
||||
if (targ->t_user == NULL) {
|
||||
errx(1, "missing chapIName for target \"%s\"",
|
||||
xo_errx(1, "missing chapIName for target \"%s\"",
|
||||
targ->t_nickname);
|
||||
}
|
||||
if (targ->t_secret == NULL)
|
||||
errx(1, "missing chapSecret for target \"%s\"",
|
||||
xo_errx(1, "missing chapSecret for target \"%s\"",
|
||||
targ->t_nickname);
|
||||
if (targ->t_mutual_user != NULL ||
|
||||
targ->t_mutual_secret != NULL) {
|
||||
if (targ->t_mutual_user == NULL)
|
||||
errx(1, "missing tgtChapName for "
|
||||
xo_errx(1, "missing tgtChapName for "
|
||||
"target \"%s\"", targ->t_nickname);
|
||||
if (targ->t_mutual_secret == NULL)
|
||||
errx(1, "missing tgtChapSecret for "
|
||||
xo_errx(1, "missing tgtChapSecret for "
|
||||
"target \"%s\"", targ->t_nickname);
|
||||
}
|
||||
}
|
||||
@ -350,7 +350,7 @@ kernel_add(int iscsi_fd, const struct target *targ)
|
||||
conf_from_target(&isa.isa_conf, targ);
|
||||
error = ioctl(iscsi_fd, ISCSISADD, &isa);
|
||||
if (error != 0)
|
||||
warn("ISCSISADD");
|
||||
xo_warn("ISCSISADD");
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -365,7 +365,7 @@ kernel_modify(int iscsi_fd, unsigned int session_id, const struct target *targ)
|
||||
conf_from_target(&ism.ism_conf, targ);
|
||||
error = ioctl(iscsi_fd, ISCSISMODIFY, &ism);
|
||||
if (error != 0)
|
||||
warn("ISCSISMODIFY");
|
||||
xo_warn("ISCSISMODIFY");
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -385,7 +385,7 @@ kernel_modify_some(int iscsi_fd, unsigned int session_id, const char *target,
|
||||
states = realloc(states,
|
||||
nentries * sizeof(struct iscsi_session_state));
|
||||
if (states == NULL)
|
||||
err(1, "realloc");
|
||||
xo_err(1, "realloc");
|
||||
|
||||
memset(&isl, 0, sizeof(isl));
|
||||
isl.isl_nentries = nentries;
|
||||
@ -399,7 +399,7 @@ kernel_modify_some(int iscsi_fd, unsigned int session_id, const char *target,
|
||||
break;
|
||||
}
|
||||
if (error != 0)
|
||||
errx(1, "ISCSISLIST");
|
||||
xo_errx(1, "ISCSISLIST");
|
||||
|
||||
for (i = 0; i < isl.isl_nentries; i++) {
|
||||
state = &states[i];
|
||||
@ -408,7 +408,7 @@ kernel_modify_some(int iscsi_fd, unsigned int session_id, const char *target,
|
||||
break;
|
||||
}
|
||||
if (i == isl.isl_nentries)
|
||||
errx(1, "session-id %u not found", session_id);
|
||||
xo_errx(1, "session-id %u not found", session_id);
|
||||
|
||||
conf = &state->iss_conf;
|
||||
|
||||
@ -427,7 +427,7 @@ kernel_modify_some(int iscsi_fd, unsigned int session_id, const char *target,
|
||||
memcpy(&ism.ism_conf, conf, sizeof(ism.ism_conf));
|
||||
error = ioctl(iscsi_fd, ISCSISMODIFY, &ism);
|
||||
if (error != 0)
|
||||
warn("ISCSISMODIFY");
|
||||
xo_warn("ISCSISMODIFY");
|
||||
}
|
||||
|
||||
static int
|
||||
@ -440,7 +440,7 @@ kernel_remove(int iscsi_fd, const struct target *targ)
|
||||
conf_from_target(&isr.isr_conf, targ);
|
||||
error = ioctl(iscsi_fd, ISCSISREMOVE, &isr);
|
||||
if (error != 0)
|
||||
warn("ISCSISREMOVE");
|
||||
xo_warn("ISCSISREMOVE");
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -462,7 +462,7 @@ kernel_list(int iscsi_fd, const struct target *targ __unused,
|
||||
states = realloc(states,
|
||||
nentries * sizeof(struct iscsi_session_state));
|
||||
if (states == NULL)
|
||||
err(1, "realloc");
|
||||
xo_err(1, "realloc");
|
||||
|
||||
memset(&isl, 0, sizeof(isl));
|
||||
isl.isl_nentries = nentries;
|
||||
@ -476,79 +476,117 @@ kernel_list(int iscsi_fd, const struct target *targ __unused,
|
||||
break;
|
||||
}
|
||||
if (error != 0) {
|
||||
warn("ISCSISLIST");
|
||||
xo_warn("ISCSISLIST");
|
||||
return (error);
|
||||
}
|
||||
|
||||
if (verbose != 0) {
|
||||
xo_open_list("session");
|
||||
for (i = 0; i < isl.isl_nentries; i++) {
|
||||
state = &states[i];
|
||||
conf = &state->iss_conf;
|
||||
|
||||
printf("Session ID: %u\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",
|
||||
conf->isc_initiator_alias);
|
||||
printf("Target name: %s\n", conf->isc_target);
|
||||
printf("Target portal: %s\n",
|
||||
conf->isc_target_addr);
|
||||
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",
|
||||
conf->isc_mutual_user);
|
||||
printf("Mutual secret: %s\n",
|
||||
conf->isc_mutual_secret);
|
||||
printf("Session type: %s\n",
|
||||
xo_open_instance("session");
|
||||
|
||||
/*
|
||||
* Display-only modifier as this information
|
||||
* is also present within the 'session' container
|
||||
*/
|
||||
xo_emit("{L:/%-18s}{V:sessionId/%u}\n",
|
||||
"Session ID:", state->iss_id);
|
||||
|
||||
xo_open_container("initiator");
|
||||
xo_emit("{L:/%-18s}{V:name/%s}\n",
|
||||
"Initiator name:", conf->isc_initiator);
|
||||
xo_emit("{L:/%-18s}{V:portal/%s}\n",
|
||||
"Initiator portal:", conf->isc_initiator_addr);
|
||||
xo_emit("{L:/%-18s}{V:alias/%s}\n",
|
||||
"Initiator alias:", conf->isc_initiator_alias);
|
||||
xo_close_container("initiator");
|
||||
|
||||
xo_open_container("target");
|
||||
xo_emit("{L:/%-18s}{V:name/%s}\n",
|
||||
"Target name:", conf->isc_target);
|
||||
xo_emit("{L:/%-18s}{V:portal/%s}\n",
|
||||
"Target portal:", conf->isc_target_addr);
|
||||
xo_emit("{L:/%-18s}{V:alias/%s}\n",
|
||||
"Target alias:", state->iss_target_alias);
|
||||
xo_close_container("target");
|
||||
|
||||
xo_open_container("auth");
|
||||
xo_emit("{L:/%-18s}{V:user/%s}\n",
|
||||
"User:", conf->isc_user);
|
||||
xo_emit("{L:/%-18s}{V:secret/%s}\n",
|
||||
"Secret:", conf->isc_secret);
|
||||
xo_emit("{L:/%-18s}{V:mutualUser/%s}\n",
|
||||
"Mutual user:", conf->isc_mutual_user);
|
||||
xo_emit("{L:/%-18s}{V:mutualSecret/%s}\n",
|
||||
"Mutual secret:", conf->isc_mutual_secret);
|
||||
xo_close_container("auth");
|
||||
|
||||
xo_emit("{L:/%-18s}{V:type/%s}\n",
|
||||
"Session type:",
|
||||
conf->isc_discovery ? "Discovery" : "Normal");
|
||||
printf("Session state: %s\n",
|
||||
state->iss_connected ?
|
||||
"Connected" : "Disconnected");
|
||||
printf("Failure reason: %s\n", state->iss_reason);
|
||||
printf("Header digest: %s\n",
|
||||
xo_emit("{L:/%-18s}{V:state/%s}\n",
|
||||
"Session state:",
|
||||
state->iss_connected ? "Connected" : "Disconnected");
|
||||
xo_emit("{L:/%-18s}{V:failureReason/%s}\n",
|
||||
"Failure reason:", state->iss_reason);
|
||||
xo_emit("{L:/%-18s}{V:headerDigest/%s}\n",
|
||||
"Header digest:",
|
||||
state->iss_header_digest == ISCSI_DIGEST_CRC32C ?
|
||||
"CRC32C" : "None");
|
||||
printf("Data digest: %s\n",
|
||||
xo_emit("{L:/%-18s}{V:dataDigest/%s}\n",
|
||||
"Data digest:",
|
||||
state->iss_data_digest == ISCSI_DIGEST_CRC32C ?
|
||||
"CRC32C" : "None");
|
||||
printf("DataSegmentLen: %d\n",
|
||||
state->iss_max_data_segment_length);
|
||||
printf("ImmediateData: %s\n",
|
||||
state->iss_immediate_data ? "Yes" : "No");
|
||||
printf("iSER (RDMA): %s\n",
|
||||
conf->isc_iser ? "Yes" : "No");
|
||||
printf("Offload driver: %s\n", state->iss_offload);
|
||||
printf("Device nodes: ");
|
||||
xo_emit("{L:/%-18s}{V:dataSegmentLen/%d}\n",
|
||||
"DataSegmentLen:", state->iss_max_data_segment_length);
|
||||
xo_emit("{L:/%-18s}{V:immediateData/%s}\n",
|
||||
"ImmediateData:", state->iss_immediate_data ? "Yes" : "No");
|
||||
xo_emit("{L:/%-18s}{V:iSER/%s}\n",
|
||||
"iSER (RDMA):", conf->isc_iser ? "Yes" : "No");
|
||||
xo_emit("{L:/%-18s}{V:offloadDriver/%s}\n",
|
||||
"Offload driver:", state->iss_offload);
|
||||
xo_emit("{L:/%-18s}",
|
||||
"Device nodes:");
|
||||
print_periphs(state->iss_id);
|
||||
printf("\n\n");
|
||||
xo_emit("\n\n");
|
||||
xo_close_instance("session");
|
||||
}
|
||||
xo_close_list("session");
|
||||
} else {
|
||||
printf("%-36s %-16s %s\n",
|
||||
xo_emit("{T:/%-36s} {T:/%-16s} {T:/%s}\n",
|
||||
"Target name", "Target portal", "State");
|
||||
|
||||
if (isl.isl_nentries != 0)
|
||||
xo_open_list("session");
|
||||
for (i = 0; i < isl.isl_nentries; i++) {
|
||||
|
||||
state = &states[i];
|
||||
conf = &state->iss_conf;
|
||||
|
||||
printf("%-36s %-16s ",
|
||||
xo_open_instance("session");
|
||||
xo_emit("{V:name/%-36s/%s} {V:portal/%-16s/%s} ",
|
||||
conf->isc_target, conf->isc_target_addr);
|
||||
|
||||
if (state->iss_reason[0] != '\0') {
|
||||
printf("%s\n", state->iss_reason);
|
||||
xo_emit("{V:state/%s}\n", state->iss_reason);
|
||||
} else {
|
||||
if (conf->isc_discovery) {
|
||||
printf("Discovery\n");
|
||||
xo_emit("{V:state}\n", "Discovery");
|
||||
} else if (state->iss_connected) {
|
||||
printf("Connected: ");
|
||||
xo_emit("{V:state}: ", "Connected");
|
||||
print_periphs(state->iss_id);
|
||||
printf("\n");
|
||||
xo_emit("\n");
|
||||
} else {
|
||||
printf("Disconnected\n");
|
||||
xo_emit("{V:state}\n", "Disconnected");
|
||||
}
|
||||
}
|
||||
xo_close_instance("session");
|
||||
}
|
||||
if (isl.isl_nentries != 0)
|
||||
xo_close_list("session");
|
||||
}
|
||||
|
||||
return (0);
|
||||
@ -582,7 +620,7 @@ checked_strdup(const char *s)
|
||||
|
||||
c = strdup(s);
|
||||
if (c == NULL)
|
||||
err(1, "strdup");
|
||||
xo_err(1, "strdup");
|
||||
return (c);
|
||||
}
|
||||
|
||||
@ -600,6 +638,9 @@ main(int argc, char **argv)
|
||||
struct conf *conf;
|
||||
struct target *targ;
|
||||
|
||||
argc = xo_parse_args(argc, argv);
|
||||
xo_open_container("iscsictl");
|
||||
|
||||
while ((ch = getopt(argc, argv, "AMRLac:d:i:n:p:t:u:s:v")) != -1) {
|
||||
switch (ch) {
|
||||
case 'A':
|
||||
@ -626,11 +667,11 @@ main(int argc, char **argv)
|
||||
case 'i':
|
||||
session_id = strtol(optarg, &end, 10);
|
||||
if ((size_t)(end - optarg) != strlen(optarg))
|
||||
errx(1, "trailing characters after session-id");
|
||||
xo_errx(1, "trailing characters after session-id");
|
||||
if (session_id < 0)
|
||||
errx(1, "session-id cannot be negative");
|
||||
xo_errx(1, "session-id cannot be negative");
|
||||
if (session_id > UINT_MAX)
|
||||
errx(1, "session-id cannot be greater than %u",
|
||||
xo_errx(1, "session-id cannot be greater than %u",
|
||||
UINT_MAX);
|
||||
break;
|
||||
case 'n':
|
||||
@ -663,7 +704,7 @@ main(int argc, char **argv)
|
||||
if (Aflag + Mflag + Rflag + Lflag == 0)
|
||||
Lflag = 1;
|
||||
if (Aflag + Mflag + Rflag + Lflag > 1)
|
||||
errx(1, "at most one of -A, -M, -R, or -L may be specified");
|
||||
xo_errx(1, "at most one of -A, -M, -R, or -L may be specified");
|
||||
|
||||
/*
|
||||
* Note that we ignore unneccessary/inapplicable "-c" flag; so that
|
||||
@ -673,122 +714,122 @@ main(int argc, char **argv)
|
||||
if (Aflag != 0) {
|
||||
if (aflag != 0) {
|
||||
if (portal != NULL)
|
||||
errx(1, "-a and -p and mutually exclusive");
|
||||
xo_errx(1, "-a and -p and mutually exclusive");
|
||||
if (target != NULL)
|
||||
errx(1, "-a and -t and mutually exclusive");
|
||||
xo_errx(1, "-a and -t and mutually exclusive");
|
||||
if (user != NULL)
|
||||
errx(1, "-a and -u and mutually exclusive");
|
||||
xo_errx(1, "-a and -u and mutually exclusive");
|
||||
if (secret != NULL)
|
||||
errx(1, "-a and -s and mutually exclusive");
|
||||
xo_errx(1, "-a and -s and mutually exclusive");
|
||||
if (nickname != NULL)
|
||||
errx(1, "-a and -n and mutually exclusive");
|
||||
xo_errx(1, "-a and -n and mutually exclusive");
|
||||
if (discovery_host != NULL)
|
||||
errx(1, "-a and -d and mutually exclusive");
|
||||
xo_errx(1, "-a and -d and mutually exclusive");
|
||||
} else if (nickname != NULL) {
|
||||
if (portal != NULL)
|
||||
errx(1, "-n and -p and mutually exclusive");
|
||||
xo_errx(1, "-n and -p and mutually exclusive");
|
||||
if (target != NULL)
|
||||
errx(1, "-n and -t and mutually exclusive");
|
||||
xo_errx(1, "-n and -t and mutually exclusive");
|
||||
if (user != NULL)
|
||||
errx(1, "-n and -u and mutually exclusive");
|
||||
xo_errx(1, "-n and -u and mutually exclusive");
|
||||
if (secret != NULL)
|
||||
errx(1, "-n and -s and mutually exclusive");
|
||||
xo_errx(1, "-n and -s and mutually exclusive");
|
||||
if (discovery_host != NULL)
|
||||
errx(1, "-n and -d and mutually exclusive");
|
||||
xo_errx(1, "-n and -d and mutually exclusive");
|
||||
} else if (discovery_host != NULL) {
|
||||
if (portal != NULL)
|
||||
errx(1, "-d and -p and mutually exclusive");
|
||||
xo_errx(1, "-d and -p and mutually exclusive");
|
||||
if (target != NULL)
|
||||
errx(1, "-d and -t and mutually exclusive");
|
||||
xo_errx(1, "-d and -t and mutually exclusive");
|
||||
} else {
|
||||
if (target == NULL && portal == NULL)
|
||||
errx(1, "must specify -a, -n or -t/-p");
|
||||
xo_errx(1, "must specify -a, -n or -t/-p");
|
||||
|
||||
if (target != NULL && portal == NULL)
|
||||
errx(1, "-t must always be used with -p");
|
||||
xo_errx(1, "-t must always be used with -p");
|
||||
if (portal != NULL && target == NULL)
|
||||
errx(1, "-p must always be used with -t");
|
||||
xo_errx(1, "-p must always be used with -t");
|
||||
}
|
||||
|
||||
if (user != NULL && secret == NULL)
|
||||
errx(1, "-u must always be used with -s");
|
||||
xo_errx(1, "-u must always be used with -s");
|
||||
if (secret != NULL && user == NULL)
|
||||
errx(1, "-s must always be used with -u");
|
||||
xo_errx(1, "-s must always be used with -u");
|
||||
|
||||
if (session_id != -1)
|
||||
errx(1, "-i cannot be used with -A");
|
||||
xo_errx(1, "-i cannot be used with -A");
|
||||
if (vflag != 0)
|
||||
errx(1, "-v cannot be used with -A");
|
||||
xo_errx(1, "-v cannot be used with -A");
|
||||
|
||||
} else if (Mflag != 0) {
|
||||
if (session_id == -1)
|
||||
errx(1, "-M requires -i");
|
||||
xo_errx(1, "-M requires -i");
|
||||
|
||||
if (discovery_host != NULL)
|
||||
errx(1, "-M and -d are mutually exclusive");
|
||||
xo_errx(1, "-M and -d are mutually exclusive");
|
||||
if (aflag != 0)
|
||||
errx(1, "-M and -a are mutually exclusive");
|
||||
xo_errx(1, "-M and -a are mutually exclusive");
|
||||
if (nickname != NULL) {
|
||||
if (portal != NULL)
|
||||
errx(1, "-n and -p and mutually exclusive");
|
||||
xo_errx(1, "-n and -p and mutually exclusive");
|
||||
if (target != NULL)
|
||||
errx(1, "-n and -t and mutually exclusive");
|
||||
xo_errx(1, "-n and -t and mutually exclusive");
|
||||
if (user != NULL)
|
||||
errx(1, "-n and -u and mutually exclusive");
|
||||
xo_errx(1, "-n and -u and mutually exclusive");
|
||||
if (secret != NULL)
|
||||
errx(1, "-n and -s and mutually exclusive");
|
||||
xo_errx(1, "-n and -s and mutually exclusive");
|
||||
}
|
||||
|
||||
if (vflag != 0)
|
||||
errx(1, "-v cannot be used with -M");
|
||||
xo_errx(1, "-v cannot be used with -M");
|
||||
|
||||
} else if (Rflag != 0) {
|
||||
if (user != NULL)
|
||||
errx(1, "-R and -u are mutually exclusive");
|
||||
xo_errx(1, "-R and -u are mutually exclusive");
|
||||
if (secret != NULL)
|
||||
errx(1, "-R and -s are mutually exclusive");
|
||||
xo_errx(1, "-R and -s are mutually exclusive");
|
||||
if (discovery_host != NULL)
|
||||
errx(1, "-R and -d are mutually exclusive");
|
||||
xo_errx(1, "-R and -d are mutually exclusive");
|
||||
|
||||
if (aflag != 0) {
|
||||
if (portal != NULL)
|
||||
errx(1, "-a and -p and mutually exclusive");
|
||||
xo_errx(1, "-a and -p and mutually exclusive");
|
||||
if (target != NULL)
|
||||
errx(1, "-a and -t and mutually exclusive");
|
||||
xo_errx(1, "-a and -t and mutually exclusive");
|
||||
if (nickname != NULL)
|
||||
errx(1, "-a and -n and mutually exclusive");
|
||||
xo_errx(1, "-a and -n and mutually exclusive");
|
||||
} else if (nickname != NULL) {
|
||||
if (portal != NULL)
|
||||
errx(1, "-n and -p and mutually exclusive");
|
||||
xo_errx(1, "-n and -p and mutually exclusive");
|
||||
if (target != NULL)
|
||||
errx(1, "-n and -t and mutually exclusive");
|
||||
xo_errx(1, "-n and -t and mutually exclusive");
|
||||
} else if (target == NULL && portal == NULL) {
|
||||
errx(1, "must specify either -a, -n, -t, or -p");
|
||||
xo_errx(1, "must specify either -a, -n, -t, or -p");
|
||||
}
|
||||
|
||||
if (session_id != -1)
|
||||
errx(1, "-i cannot be used with -R");
|
||||
xo_errx(1, "-i cannot be used with -R");
|
||||
if (vflag != 0)
|
||||
errx(1, "-v cannot be used with -R");
|
||||
xo_errx(1, "-v cannot be used with -R");
|
||||
|
||||
} else {
|
||||
assert(Lflag != 0);
|
||||
|
||||
if (portal != NULL)
|
||||
errx(1, "-L and -p and mutually exclusive");
|
||||
xo_errx(1, "-L and -p and mutually exclusive");
|
||||
if (target != NULL)
|
||||
errx(1, "-L and -t and mutually exclusive");
|
||||
xo_errx(1, "-L and -t and mutually exclusive");
|
||||
if (user != NULL)
|
||||
errx(1, "-L and -u and mutually exclusive");
|
||||
xo_errx(1, "-L and -u and mutually exclusive");
|
||||
if (secret != NULL)
|
||||
errx(1, "-L and -s and mutually exclusive");
|
||||
xo_errx(1, "-L and -s and mutually exclusive");
|
||||
if (nickname != NULL)
|
||||
errx(1, "-L and -n and mutually exclusive");
|
||||
xo_errx(1, "-L and -n and mutually exclusive");
|
||||
if (discovery_host != NULL)
|
||||
errx(1, "-L and -d and mutually exclusive");
|
||||
xo_errx(1, "-L and -d and mutually exclusive");
|
||||
|
||||
if (session_id != -1)
|
||||
errx(1, "-i cannot be used with -L");
|
||||
xo_errx(1, "-i cannot be used with -L");
|
||||
}
|
||||
|
||||
iscsi_fd = open(ISCSI_PATH, O_RDWR);
|
||||
@ -801,7 +842,7 @@ main(int argc, char **argv)
|
||||
errno = saved_errno;
|
||||
}
|
||||
if (iscsi_fd < 0)
|
||||
err(1, "failed to open %s", ISCSI_PATH);
|
||||
xo_err(1, "failed to open %s", ISCSI_PATH);
|
||||
|
||||
if (Aflag != 0 && aflag != 0) {
|
||||
conf = conf_new_from_file(conf_path);
|
||||
@ -812,7 +853,7 @@ main(int argc, char **argv)
|
||||
conf = conf_new_from_file(conf_path);
|
||||
targ = target_find(conf, nickname);
|
||||
if (targ == NULL)
|
||||
errx(1, "target %s not found in %s",
|
||||
xo_errx(1, "target %s not found in %s",
|
||||
nickname, conf_path);
|
||||
|
||||
if (Aflag != 0)
|
||||
@ -829,7 +870,7 @@ main(int argc, char **argv)
|
||||
} else {
|
||||
if (Aflag != 0 && target != NULL) {
|
||||
if (valid_iscsi_name(target) == false)
|
||||
errx(1, "invalid target name \"%s\"", target);
|
||||
xo_errx(1, "invalid target name \"%s\"", target);
|
||||
}
|
||||
conf = conf_new();
|
||||
targ = target_new(conf);
|
||||
@ -857,9 +898,12 @@ main(int argc, char **argv)
|
||||
|
||||
error = close(iscsi_fd);
|
||||
if (error != 0)
|
||||
err(1, "close");
|
||||
xo_err(1, "close");
|
||||
|
||||
if (failed > 0)
|
||||
return (1);
|
||||
|
||||
xo_close_container("iscsictl");
|
||||
xo_finish();
|
||||
return (0);
|
||||
}
|
||||
|
@ -34,12 +34,13 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <assert.h>
|
||||
#include <err.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <libxo/xo.h>
|
||||
|
||||
#include "iscsictl.h"
|
||||
|
||||
extern FILE *yyin;
|
||||
@ -77,7 +78,7 @@ targets:
|
||||
target: STR OPENING_BRACKET target_entries CLOSING_BRACKET
|
||||
{
|
||||
if (target_find(conf, $1) != NULL)
|
||||
errx(1, "duplicated target %s", $1);
|
||||
xo_errx(1, "duplicated target %s", $1);
|
||||
target->t_nickname = $1;
|
||||
target = target_new(conf);
|
||||
}
|
||||
@ -127,7 +128,7 @@ target_entry:
|
||||
target_name: TARGET_NAME EQUALS STR
|
||||
{
|
||||
if (target->t_name != NULL)
|
||||
errx(1, "duplicated TargetName at line %d", lineno);
|
||||
xo_errx(1, "duplicated TargetName at line %d", lineno);
|
||||
target->t_name = $3;
|
||||
}
|
||||
;
|
||||
@ -135,7 +136,7 @@ target_name: TARGET_NAME EQUALS STR
|
||||
target_address: TARGET_ADDRESS EQUALS STR
|
||||
{
|
||||
if (target->t_address != NULL)
|
||||
errx(1, "duplicated TargetAddress at line %d", lineno);
|
||||
xo_errx(1, "duplicated TargetAddress at line %d", lineno);
|
||||
target->t_address = $3;
|
||||
}
|
||||
;
|
||||
@ -143,7 +144,7 @@ target_address: TARGET_ADDRESS EQUALS STR
|
||||
initiator_name: INITIATOR_NAME EQUALS STR
|
||||
{
|
||||
if (target->t_initiator_name != NULL)
|
||||
errx(1, "duplicated InitiatorName at line %d", lineno);
|
||||
xo_errx(1, "duplicated InitiatorName at line %d", lineno);
|
||||
target->t_initiator_name = $3;
|
||||
}
|
||||
;
|
||||
@ -151,7 +152,7 @@ initiator_name: INITIATOR_NAME EQUALS STR
|
||||
initiator_address: INITIATOR_ADDRESS EQUALS STR
|
||||
{
|
||||
if (target->t_initiator_address != NULL)
|
||||
errx(1, "duplicated InitiatorAddress at line %d", lineno);
|
||||
xo_errx(1, "duplicated InitiatorAddress at line %d", lineno);
|
||||
target->t_initiator_address = $3;
|
||||
}
|
||||
;
|
||||
@ -159,7 +160,7 @@ initiator_address: INITIATOR_ADDRESS EQUALS STR
|
||||
initiator_alias: INITIATOR_ALIAS EQUALS STR
|
||||
{
|
||||
if (target->t_initiator_alias != NULL)
|
||||
errx(1, "duplicated InitiatorAlias at line %d", lineno);
|
||||
xo_errx(1, "duplicated InitiatorAlias at line %d", lineno);
|
||||
target->t_initiator_alias = $3;
|
||||
}
|
||||
;
|
||||
@ -167,7 +168,7 @@ initiator_alias: INITIATOR_ALIAS EQUALS STR
|
||||
user: USER EQUALS STR
|
||||
{
|
||||
if (target->t_user != NULL)
|
||||
errx(1, "duplicated chapIName at line %d", lineno);
|
||||
xo_errx(1, "duplicated chapIName at line %d", lineno);
|
||||
target->t_user = $3;
|
||||
}
|
||||
;
|
||||
@ -175,7 +176,7 @@ user: USER EQUALS STR
|
||||
secret: SECRET EQUALS STR
|
||||
{
|
||||
if (target->t_secret != NULL)
|
||||
errx(1, "duplicated chapSecret at line %d", lineno);
|
||||
xo_errx(1, "duplicated chapSecret at line %d", lineno);
|
||||
target->t_secret = $3;
|
||||
}
|
||||
;
|
||||
@ -183,7 +184,7 @@ secret: SECRET EQUALS STR
|
||||
mutual_user: MUTUAL_USER EQUALS STR
|
||||
{
|
||||
if (target->t_mutual_user != NULL)
|
||||
errx(1, "duplicated tgtChapName at line %d", lineno);
|
||||
xo_errx(1, "duplicated tgtChapName at line %d", lineno);
|
||||
target->t_mutual_user = $3;
|
||||
}
|
||||
;
|
||||
@ -191,7 +192,7 @@ mutual_user: MUTUAL_USER EQUALS STR
|
||||
mutual_secret: MUTUAL_SECRET EQUALS STR
|
||||
{
|
||||
if (target->t_mutual_secret != NULL)
|
||||
errx(1, "duplicated tgtChapSecret at line %d", lineno);
|
||||
xo_errx(1, "duplicated tgtChapSecret at line %d", lineno);
|
||||
target->t_mutual_secret = $3;
|
||||
}
|
||||
;
|
||||
@ -199,13 +200,13 @@ mutual_secret: MUTUAL_SECRET EQUALS STR
|
||||
auth_method: AUTH_METHOD EQUALS STR
|
||||
{
|
||||
if (target->t_auth_method != AUTH_METHOD_UNSPECIFIED)
|
||||
errx(1, "duplicated AuthMethod at line %d", lineno);
|
||||
xo_errx(1, "duplicated AuthMethod at line %d", lineno);
|
||||
if (strcasecmp($3, "none") == 0)
|
||||
target->t_auth_method = AUTH_METHOD_NONE;
|
||||
else if (strcasecmp($3, "chap") == 0)
|
||||
target->t_auth_method = AUTH_METHOD_CHAP;
|
||||
else
|
||||
errx(1, "invalid AuthMethod at line %d; "
|
||||
xo_errx(1, "invalid AuthMethod at line %d; "
|
||||
"must be either \"none\" or \"CHAP\"", lineno);
|
||||
}
|
||||
;
|
||||
@ -213,13 +214,13 @@ auth_method: AUTH_METHOD EQUALS STR
|
||||
header_digest: HEADER_DIGEST EQUALS STR
|
||||
{
|
||||
if (target->t_header_digest != DIGEST_UNSPECIFIED)
|
||||
errx(1, "duplicated HeaderDigest at line %d", lineno);
|
||||
xo_errx(1, "duplicated HeaderDigest at line %d", lineno);
|
||||
if (strcasecmp($3, "none") == 0)
|
||||
target->t_header_digest = DIGEST_NONE;
|
||||
else if (strcasecmp($3, "CRC32C") == 0)
|
||||
target->t_header_digest = DIGEST_CRC32C;
|
||||
else
|
||||
errx(1, "invalid HeaderDigest at line %d; "
|
||||
xo_errx(1, "invalid HeaderDigest at line %d; "
|
||||
"must be either \"none\" or \"CRC32C\"", lineno);
|
||||
}
|
||||
;
|
||||
@ -227,13 +228,13 @@ header_digest: HEADER_DIGEST EQUALS STR
|
||||
data_digest: DATA_DIGEST EQUALS STR
|
||||
{
|
||||
if (target->t_data_digest != DIGEST_UNSPECIFIED)
|
||||
errx(1, "duplicated DataDigest at line %d", lineno);
|
||||
xo_errx(1, "duplicated DataDigest at line %d", lineno);
|
||||
if (strcasecmp($3, "none") == 0)
|
||||
target->t_data_digest = DIGEST_NONE;
|
||||
else if (strcasecmp($3, "CRC32C") == 0)
|
||||
target->t_data_digest = DIGEST_CRC32C;
|
||||
else
|
||||
errx(1, "invalid DataDigest at line %d; "
|
||||
xo_errx(1, "invalid DataDigest at line %d; "
|
||||
"must be either \"none\" or \"CRC32C\"", lineno);
|
||||
}
|
||||
;
|
||||
@ -241,13 +242,13 @@ data_digest: DATA_DIGEST EQUALS STR
|
||||
session_type: SESSION_TYPE EQUALS STR
|
||||
{
|
||||
if (target->t_session_type != SESSION_TYPE_UNSPECIFIED)
|
||||
errx(1, "duplicated SessionType at line %d", lineno);
|
||||
xo_errx(1, "duplicated SessionType at line %d", lineno);
|
||||
if (strcasecmp($3, "normal") == 0)
|
||||
target->t_session_type = SESSION_TYPE_NORMAL;
|
||||
else if (strcasecmp($3, "discovery") == 0)
|
||||
target->t_session_type = SESSION_TYPE_DISCOVERY;
|
||||
else
|
||||
errx(1, "invalid SessionType at line %d; "
|
||||
xo_errx(1, "invalid SessionType at line %d; "
|
||||
"must be either \"normal\" or \"discovery\"", lineno);
|
||||
}
|
||||
;
|
||||
@ -255,7 +256,7 @@ session_type: SESSION_TYPE EQUALS STR
|
||||
offload: OFFLOAD EQUALS STR
|
||||
{
|
||||
if (target->t_offload != NULL)
|
||||
errx(1, "duplicated offload at line %d", lineno);
|
||||
xo_errx(1, "duplicated offload at line %d", lineno);
|
||||
target->t_offload = $3;
|
||||
}
|
||||
;
|
||||
@ -263,20 +264,20 @@ offload: OFFLOAD EQUALS STR
|
||||
protocol: PROTOCOL EQUALS STR
|
||||
{
|
||||
if (target->t_protocol != PROTOCOL_UNSPECIFIED)
|
||||
errx(1, "duplicated protocol at line %d", lineno);
|
||||
xo_errx(1, "duplicated protocol at line %d", lineno);
|
||||
if (strcasecmp($3, "iscsi") == 0)
|
||||
target->t_protocol = PROTOCOL_ISCSI;
|
||||
else if (strcasecmp($3, "iser") == 0)
|
||||
target->t_protocol = PROTOCOL_ISER;
|
||||
else
|
||||
errx(1, "invalid protocol at line %d; "
|
||||
xo_errx(1, "invalid protocol at line %d; "
|
||||
"must be either \"iscsi\" or \"iser\"", lineno);
|
||||
}
|
||||
;
|
||||
|
||||
ignored: IGNORED EQUALS STR
|
||||
{
|
||||
warnx("obsolete statement ignored at line %d", lineno);
|
||||
xo_warnx("obsolete statement ignored at line %d", lineno);
|
||||
}
|
||||
;
|
||||
|
||||
@ -286,7 +287,7 @@ void
|
||||
yyerror(const char *str)
|
||||
{
|
||||
|
||||
errx(1, "error in configuration file at line %d near '%s': %s",
|
||||
xo_errx(1, "error in configuration file at line %d near '%s': %s",
|
||||
lineno, yytext, str);
|
||||
}
|
||||
|
||||
@ -298,19 +299,19 @@ check_perms(const char *path)
|
||||
|
||||
error = stat(path, &sb);
|
||||
if (error != 0) {
|
||||
warn("stat");
|
||||
xo_warn("stat");
|
||||
return;
|
||||
}
|
||||
if (sb.st_mode & S_IWOTH) {
|
||||
warnx("%s is world-writable", path);
|
||||
xo_warnx("%s is world-writable", path);
|
||||
} else if (sb.st_mode & S_IROTH) {
|
||||
warnx("%s is world-readable", path);
|
||||
xo_warnx("%s is world-readable", path);
|
||||
} else if (sb.st_mode & S_IXOTH) {
|
||||
/*
|
||||
* Ok, this one doesn't matter, but still do it,
|
||||
* just for consistency.
|
||||
*/
|
||||
warnx("%s is world-executable", path);
|
||||
xo_warnx("%s is world-executable", path);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -328,7 +329,7 @@ conf_new_from_file(const char *path)
|
||||
|
||||
yyin = fopen(path, "r");
|
||||
if (yyin == NULL)
|
||||
err(1, "unable to open configuration file %s", path);
|
||||
xo_err(1, "unable to open configuration file %s", path);
|
||||
check_perms(path);
|
||||
lineno = 1;
|
||||
yyrestart(yyin);
|
||||
|
@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <inttypes.h>
|
||||
#include <limits.h>
|
||||
#include <fcntl.h>
|
||||
#include <err.h>
|
||||
|
||||
#include <cam/cam.h>
|
||||
#include <cam/cam_debug.h>
|
||||
@ -58,6 +57,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <cam/scsi/smp_all.h>
|
||||
#include <cam/ata/ata_all.h>
|
||||
#include <camlib.h>
|
||||
#include <libxo/xo.h>
|
||||
|
||||
#include "iscsictl.h"
|
||||
|
||||
@ -67,10 +67,11 @@ print_periphs(int session_id)
|
||||
union ccb ccb;
|
||||
int bufsize, fd;
|
||||
unsigned int i;
|
||||
int skip_bus, skip_device;
|
||||
int have_path_id, skip_bus, skip_device;
|
||||
path_id_t path_id;
|
||||
|
||||
if ((fd = open(XPT_DEVICE, O_RDWR)) == -1) {
|
||||
warn("couldn't open %s", XPT_DEVICE);
|
||||
xo_warn("couldn't open %s", XPT_DEVICE);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -89,7 +90,7 @@ print_periphs(int session_id)
|
||||
ccb.cdm.match_buf_len = bufsize;
|
||||
ccb.cdm.matches = (struct dev_match_result *)malloc(bufsize);
|
||||
if (ccb.cdm.matches == NULL) {
|
||||
warnx("can't malloc memory for matches");
|
||||
xo_warnx("can't malloc memory for matches");
|
||||
close(fd);
|
||||
return;
|
||||
}
|
||||
@ -102,23 +103,27 @@ print_periphs(int session_id)
|
||||
ccb.cdm.num_patterns = 0;
|
||||
ccb.cdm.pattern_buf_len = 0;
|
||||
|
||||
path_id = -1; /* Make GCC happy. */
|
||||
have_path_id = 0;
|
||||
skip_bus = 1;
|
||||
skip_device = 1;
|
||||
|
||||
xo_open_container("devices");
|
||||
xo_open_list("lun");
|
||||
/*
|
||||
* We do the ioctl multiple times if necessary, in case there are
|
||||
* more than 100 nodes in the EDT.
|
||||
*/
|
||||
do {
|
||||
if (ioctl(fd, CAMIOCOMMAND, &ccb) == -1) {
|
||||
warn("error sending CAMIOCOMMAND ioctl");
|
||||
xo_warn("error sending CAMIOCOMMAND ioctl");
|
||||
break;
|
||||
}
|
||||
|
||||
if ((ccb.ccb_h.status != CAM_REQ_CMP)
|
||||
|| ((ccb.cdm.status != CAM_DEV_MATCH_LAST)
|
||||
&& (ccb.cdm.status != CAM_DEV_MATCH_MORE))) {
|
||||
warnx("got CAM error %#x, CDM error %d\n",
|
||||
xo_warnx("got CAM error %#x, CDM error %d\n",
|
||||
ccb.ccb_h.status, ccb.cdm.status);
|
||||
break;
|
||||
}
|
||||
@ -141,7 +146,6 @@ print_periphs(int session_id)
|
||||
//printf("wrong unit, %d != %d\n", bus_result->unit_number, session_id);
|
||||
continue;
|
||||
}
|
||||
|
||||
skip_bus = 0;
|
||||
}
|
||||
case DEV_MATCH_DEVICE: {
|
||||
@ -151,7 +155,6 @@ print_periphs(int session_id)
|
||||
continue;
|
||||
|
||||
skip_device = 0;
|
||||
|
||||
break;
|
||||
}
|
||||
case DEV_MATCH_PERIPH: {
|
||||
@ -166,9 +169,17 @@ print_periphs(int session_id)
|
||||
if (strcmp(periph_result->periph_name, "pass") == 0)
|
||||
continue;
|
||||
|
||||
fprintf(stdout, "%s%d ",
|
||||
periph_result->periph_name,
|
||||
periph_result->unit_number);
|
||||
xo_open_instance("lun");
|
||||
xo_emit("{e:lun/%d}", periph_result->target_lun);
|
||||
xo_emit("{Vq:device/%s%d} ",
|
||||
periph_result->periph_name,
|
||||
periph_result->unit_number);
|
||||
xo_close_instance("lun");
|
||||
|
||||
if (have_path_id == 0) {
|
||||
path_id = periph_result->path_id;
|
||||
have_path_id = 1;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@ -180,6 +191,11 @@ print_periphs(int session_id)
|
||||
|
||||
} while ((ccb.ccb_h.status == CAM_REQ_CMP)
|
||||
&& (ccb.cdm.status == CAM_DEV_MATCH_MORE));
|
||||
xo_close_list("lun");
|
||||
|
||||
xo_emit("{e:scbus/%d}{e:bus/%d}{e:target/%d}",
|
||||
have_path_id ? (int)path_id : -1, 0, have_path_id ? 0 : -1);
|
||||
xo_close_container("devices");
|
||||
|
||||
close(fd);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user