Lines Matching refs:targ

70 	struct target *targ;
72 TAILQ_FOREACH(targ, &conf->conf_targets, t_next) {
73 if (targ->t_nickname != NULL &&
74 strcasecmp(targ->t_nickname, nickname) == 0)
75 return (targ);
84 struct target *targ;
86 targ = calloc(1, sizeof(*targ));
87 if (targ == NULL)
89 targ->t_conf = conf;
90 TAILQ_INSERT_TAIL(&conf->conf_targets, targ, t_next);
92 return (targ);
96 target_delete(struct target *targ)
99 TAILQ_REMOVE(&targ->t_conf->conf_targets, targ, t_next);
100 free(targ);
244 struct target *targ;
246 TAILQ_FOREACH(targ, &conf->conf_targets, t_next) {
247 assert(targ->t_nickname != NULL);
248 if (targ->t_session_type == SESSION_TYPE_UNSPECIFIED)
249 targ->t_session_type = SESSION_TYPE_NORMAL;
250 if (targ->t_session_type == SESSION_TYPE_NORMAL &&
251 targ->t_name == NULL)
253 targ->t_nickname);
254 if (targ->t_session_type == SESSION_TYPE_DISCOVERY &&
255 targ->t_name != NULL)
257 "sessions for target \"%s\"", targ->t_nickname);
258 if (targ->t_name != NULL) {
259 if (valid_iscsi_name(targ->t_name) == false)
261 targ->t_name);
263 if (targ->t_protocol == PROTOCOL_UNSPECIFIED)
264 targ->t_protocol = PROTOCOL_ISCSI;
265 if (targ->t_address == NULL)
267 targ->t_nickname);
268 if (targ->t_initiator_name == NULL)
269 targ->t_initiator_name = default_initiator_name();
270 if (valid_iscsi_name(targ->t_initiator_name) == false)
272 targ->t_initiator_name);
273 if (targ->t_header_digest == DIGEST_UNSPECIFIED)
274 targ->t_header_digest = DIGEST_NONE;
275 if (targ->t_data_digest == DIGEST_UNSPECIFIED)
276 targ->t_data_digest = DIGEST_NONE;
277 if (targ->t_auth_method == AUTH_METHOD_UNSPECIFIED) {
278 if (targ->t_user != NULL || targ->t_secret != NULL ||
279 targ->t_mutual_user != NULL ||
280 targ->t_mutual_secret != NULL)
281 targ->t_auth_method =
284 targ->t_auth_method =
287 if (targ->t_auth_method == AUTH_METHOD_CHAP) {
288 if (targ->t_user == NULL) {
290 targ->t_nickname);
292 if (targ->t_secret == NULL)
294 targ->t_nickname);
295 if (targ->t_mutual_user != NULL ||
296 targ->t_mutual_secret != NULL) {
297 if (targ->t_mutual_user == NULL)
299 "target \"%s\"", targ->t_nickname);
300 if (targ->t_mutual_secret == NULL)
302 "target \"%s\"", targ->t_nickname);
310 const struct target *targ)
317 if (targ->t_initiator_name != NULL)
318 strlcpy(conf->isc_initiator, targ->t_initiator_name,
320 if (targ->t_initiator_address != NULL)
321 strlcpy(conf->isc_initiator_addr, targ->t_initiator_address,
323 if (targ->t_initiator_alias != NULL)
324 strlcpy(conf->isc_initiator_alias, targ->t_initiator_alias,
326 if (targ->t_name != NULL)
327 strlcpy(conf->isc_target, targ->t_name,
329 if (targ->t_address != NULL)
330 strlcpy(conf->isc_target_addr, targ->t_address,
332 if (targ->t_user != NULL)
333 strlcpy(conf->isc_user, targ->t_user,
335 if (targ->t_secret != NULL)
336 strlcpy(conf->isc_secret, targ->t_secret,
338 if (targ->t_mutual_user != NULL)
339 strlcpy(conf->isc_mutual_user, targ->t_mutual_user,
341 if (targ->t_mutual_secret != NULL)
342 strlcpy(conf->isc_mutual_secret, targ->t_mutual_secret,
344 if (targ->t_session_type == SESSION_TYPE_DISCOVERY)
346 if (targ->t_enable != ENABLE_OFF)
348 if (targ->t_protocol == PROTOCOL_ISER)
350 if (targ->t_offload != NULL)
351 strlcpy(conf->isc_offload, targ->t_offload,
353 if (targ->t_header_digest == DIGEST_CRC32C)
357 if (targ->t_data_digest == DIGEST_CRC32C)
364 kernel_add(int iscsi_fd, const struct target *targ)
370 conf_from_target(&isa.isa_conf, targ);
378 kernel_modify(int iscsi_fd, unsigned int session_id, const struct target *targ)
385 conf_from_target(&ism.ism_conf, targ);
458 kernel_remove(int iscsi_fd, const struct target *targ)
464 conf_from_target(&isr.isr_conf, targ);
475 kernel_list(int iscsi_fd, const struct target *targ __unused,
720 struct target *targ;
968 TAILQ_FOREACH(targ, &conf->conf_targets, t_next)
969 failed += kernel_add(iscsi_fd, targ);
972 targ = target_find(conf, nickname);
973 if (targ == NULL)
978 failed += kernel_add(iscsi_fd, targ);
980 failed += kernel_modify(iscsi_fd, session_id, targ);
982 failed += kernel_remove(iscsi_fd, targ);
984 failed += kernel_list(iscsi_fd, targ, vflag);
994 targ = target_new(conf);
995 targ->t_initiator_name = default_initiator_name();
996 targ->t_header_digest = DIGEST_NONE;
997 targ->t_data_digest = DIGEST_NONE;
998 targ->t_name = target;
1000 targ->t_session_type = SESSION_TYPE_DISCOVERY;
1001 targ->t_address = discovery_host;
1003 targ->t_session_type = SESSION_TYPE_NORMAL;
1004 targ->t_address = portal;
1006 targ->t_enable = enable;
1008 targ->t_protocol = PROTOCOL_ISER;
1009 targ->t_user = user;
1010 targ->t_secret = secret;
1013 failed += kernel_add(iscsi_fd, targ);
1015 failed += kernel_remove(iscsi_fd, targ);
1017 failed += kernel_list(iscsi_fd, targ, vflag);