• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /freebsd-13-stable/usr.bin/iscsictl/

Lines Matching defs:targ

69 	struct target *targ;
71 TAILQ_FOREACH(targ, &conf->conf_targets, t_next) {
72 if (targ->t_nickname != NULL &&
73 strcasecmp(targ->t_nickname, nickname) == 0)
74 return (targ);
83 struct target *targ;
85 targ = calloc(1, sizeof(*targ));
86 if (targ == NULL)
88 targ->t_conf = conf;
89 targ->t_dscp = -1;
90 targ->t_pcp = -1;
91 TAILQ_INSERT_TAIL(&conf->conf_targets, targ, t_next);
93 return (targ);
97 target_delete(struct target *targ)
100 TAILQ_REMOVE(&targ->t_conf->conf_targets, targ, t_next);
101 free(targ);
245 struct target *targ;
247 TAILQ_FOREACH(targ, &conf->conf_targets, t_next) {
248 assert(targ->t_nickname != NULL);
249 if (targ->t_session_type == SESSION_TYPE_UNSPECIFIED)
250 targ->t_session_type = SESSION_TYPE_NORMAL;
251 if (targ->t_session_type == SESSION_TYPE_NORMAL &&
252 targ->t_name == NULL)
254 targ->t_nickname);
255 if (targ->t_session_type == SESSION_TYPE_DISCOVERY &&
256 targ->t_name != NULL)
258 "sessions for target \"%s\"", targ->t_nickname);
259 if (targ->t_name != NULL) {
260 if (valid_iscsi_name(targ->t_name) == false)
262 targ->t_name);
264 if (targ->t_protocol == PROTOCOL_UNSPECIFIED)
265 targ->t_protocol = PROTOCOL_ISCSI;
266 if (targ->t_address == NULL)
268 targ->t_nickname);
269 if (targ->t_initiator_name == NULL)
270 targ->t_initiator_name = default_initiator_name();
271 if (valid_iscsi_name(targ->t_initiator_name) == false)
273 targ->t_initiator_name);
274 if (targ->t_header_digest == DIGEST_UNSPECIFIED)
275 targ->t_header_digest = DIGEST_NONE;
276 if (targ->t_data_digest == DIGEST_UNSPECIFIED)
277 targ->t_data_digest = DIGEST_NONE;
278 if (targ->t_auth_method == AUTH_METHOD_UNSPECIFIED) {
279 if (targ->t_user != NULL || targ->t_secret != NULL ||
280 targ->t_mutual_user != NULL ||
281 targ->t_mutual_secret != NULL)
282 targ->t_auth_method =
285 targ->t_auth_method =
288 if (targ->t_auth_method == AUTH_METHOD_CHAP) {
289 if (targ->t_user == NULL) {
291 targ->t_nickname);
293 if (targ->t_secret == NULL)
295 targ->t_nickname);
296 if (targ->t_mutual_user != NULL ||
297 targ->t_mutual_secret != NULL) {
298 if (targ->t_mutual_user == NULL)
300 "target \"%s\"", targ->t_nickname);
301 if (targ->t_mutual_secret == NULL)
303 "target \"%s\"", targ->t_nickname);
311 const struct target *targ)
318 if (targ->t_initiator_name != NULL)
319 strlcpy(conf->isc_initiator, targ->t_initiator_name,
321 if (targ->t_initiator_address != NULL)
322 strlcpy(conf->isc_initiator_addr, targ->t_initiator_address,
324 if (targ->t_initiator_alias != NULL)
325 strlcpy(conf->isc_initiator_alias, targ->t_initiator_alias,
327 if (targ->t_name != NULL)
328 strlcpy(conf->isc_target, targ->t_name,
330 if (targ->t_address != NULL)
331 strlcpy(conf->isc_target_addr, targ->t_address,
333 if (targ->t_user != NULL)
334 strlcpy(conf->isc_user, targ->t_user,
336 if (targ->t_secret != NULL)
337 strlcpy(conf->isc_secret, targ->t_secret,
339 if (targ->t_mutual_user != NULL)
340 strlcpy(conf->isc_mutual_user, targ->t_mutual_user,
342 if (targ->t_mutual_secret != NULL)
343 strlcpy(conf->isc_mutual_secret, targ->t_mutual_secret,
345 if (targ->t_session_type == SESSION_TYPE_DISCOVERY)
347 if (targ->t_enable != ENABLE_OFF)
349 if (targ->t_protocol == PROTOCOL_ISER)
351 if (targ->t_offload != NULL)
352 strlcpy(conf->isc_offload, targ->t_offload,
354 if (targ->t_header_digest == DIGEST_CRC32C)
358 if (targ->t_data_digest == DIGEST_CRC32C)
362 conf->isc_dscp = targ->t_dscp;
363 conf->isc_pcp = targ->t_pcp;
367 kernel_add(int iscsi_fd, const struct target *targ)
373 conf_from_target(&isa.isa_conf, targ);
381 kernel_modify(int iscsi_fd, unsigned int session_id, const struct target *targ)
388 conf_from_target(&ism.ism_conf, targ);
461 kernel_remove(int iscsi_fd, const struct target *targ)
467 conf_from_target(&isr.isr_conf, targ);
478 kernel_list(int iscsi_fd, const struct target *targ __unused,
733 struct target *targ;
981 TAILQ_FOREACH(targ, &conf->conf_targets, t_next)
982 failed += kernel_add(iscsi_fd, targ);
985 targ = target_find(conf, nickname);
986 if (targ == NULL)
991 failed += kernel_add(iscsi_fd, targ);
993 failed += kernel_modify(iscsi_fd, session_id, targ);
995 failed += kernel_remove(iscsi_fd, targ);
997 failed += kernel_list(iscsi_fd, targ, vflag);
1007 targ = target_new(conf);
1008 targ->t_initiator_name = default_initiator_name();
1009 targ->t_header_digest = DIGEST_NONE;
1010 targ->t_data_digest = DIGEST_NONE;
1011 targ->t_name = target;
1013 targ->t_session_type = SESSION_TYPE_DISCOVERY;
1014 targ->t_address = discovery_host;
1016 targ->t_session_type = SESSION_TYPE_NORMAL;
1017 targ->t_address = portal;
1019 targ->t_enable = enable;
1021 targ->t_protocol = PROTOCOL_ISER;
1022 targ->t_user = user;
1023 targ->t_secret = secret;
1026 failed += kernel_add(iscsi_fd, targ);
1028 failed += kernel_remove(iscsi_fd, targ);
1030 failed += kernel_list(iscsi_fd, targ, vflag);