Changeset View
Changeset View
Standalone View
Standalone View
head/usr.bin/iscsictl/iscsictl.c
Show First 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | |||||
target_new(struct conf *conf) | target_new(struct conf *conf) | ||||
{ | { | ||||
struct target *targ; | struct target *targ; | ||||
targ = calloc(1, sizeof(*targ)); | targ = calloc(1, sizeof(*targ)); | ||||
if (targ == NULL) | if (targ == NULL) | ||||
xo_err(1, "calloc"); | xo_err(1, "calloc"); | ||||
targ->t_conf = conf; | targ->t_conf = conf; | ||||
targ->t_dscp = -1; | |||||
TAILQ_INSERT_TAIL(&conf->conf_targets, targ, t_next); | TAILQ_INSERT_TAIL(&conf->conf_targets, targ, t_next); | ||||
return (targ); | return (targ); | ||||
} | } | ||||
void | void | ||||
target_delete(struct target *targ) | target_delete(struct target *targ) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 255 Lines • ▼ Show 20 Lines | conf_from_target(struct iscsi_session_conf *conf, | ||||
if (targ->t_header_digest == DIGEST_CRC32C) | if (targ->t_header_digest == DIGEST_CRC32C) | ||||
conf->isc_header_digest = ISCSI_DIGEST_CRC32C; | conf->isc_header_digest = ISCSI_DIGEST_CRC32C; | ||||
else | else | ||||
conf->isc_header_digest = ISCSI_DIGEST_NONE; | conf->isc_header_digest = ISCSI_DIGEST_NONE; | ||||
if (targ->t_data_digest == DIGEST_CRC32C) | if (targ->t_data_digest == DIGEST_CRC32C) | ||||
conf->isc_data_digest = ISCSI_DIGEST_CRC32C; | conf->isc_data_digest = ISCSI_DIGEST_CRC32C; | ||||
else | else | ||||
conf->isc_data_digest = ISCSI_DIGEST_NONE; | conf->isc_data_digest = ISCSI_DIGEST_NONE; | ||||
conf->isc_dscp = targ->t_dscp; | |||||
} | } | ||||
static int | static int | ||||
kernel_add(int iscsi_fd, const struct target *targ) | kernel_add(int iscsi_fd, const struct target *targ) | ||||
{ | { | ||||
struct iscsi_session_add isa; | struct iscsi_session_add isa; | ||||
int error; | int error; | ||||
▲ Show 20 Lines • Show All 161 Lines • ▼ Show 20 Lines | for (i = 0; i < isl.isl_nentries; i++) { | ||||
xo_open_container("target"); | xo_open_container("target"); | ||||
xo_emit("{L:/%-26s}{V:name/%s}\n", | xo_emit("{L:/%-26s}{V:name/%s}\n", | ||||
"Target name:", conf->isc_target); | "Target name:", conf->isc_target); | ||||
xo_emit("{L:/%-26s}{V:portal/%s}\n", | xo_emit("{L:/%-26s}{V:portal/%s}\n", | ||||
"Target portal:", conf->isc_target_addr); | "Target portal:", conf->isc_target_addr); | ||||
xo_emit("{L:/%-26s}{V:alias/%s}\n", | xo_emit("{L:/%-26s}{V:alias/%s}\n", | ||||
"Target alias:", state->iss_target_alias); | "Target alias:", state->iss_target_alias); | ||||
if (conf->isc_dscp != -1) | |||||
xo_emit("{L:/%-26s}{V:dscp/0x%02x}\n", | |||||
"Target DSCP:", conf->isc_dscp); | |||||
xo_close_container("target"); | xo_close_container("target"); | ||||
xo_open_container("auth"); | xo_open_container("auth"); | ||||
xo_emit("{L:/%-26s}{V:user/%s}\n", | xo_emit("{L:/%-26s}{V:user/%s}\n", | ||||
"User:", conf->isc_user); | "User:", conf->isc_user); | ||||
xo_emit("{L:/%-26s}{V:secret/%s}\n", | xo_emit("{L:/%-26s}{V:secret/%s}\n", | ||||
"Secret:", conf->isc_secret); | "Secret:", conf->isc_secret); | ||||
xo_emit("{L:/%-26s}{V:mutualUser/%s}\n", | xo_emit("{L:/%-26s}{V:mutualUser/%s}\n", | ||||
▲ Show 20 Lines • Show All 493 Lines • Show Last 20 Lines |