mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-26 16:18:31 +00:00
Clean up (refactor) discovery a little; no functional changes.
MFC after: 1 month Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
34bad16f60
commit
7c8e3a7f48
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=273543
@ -160,7 +160,7 @@ logout_new_response(struct pdu *request)
|
||||
}
|
||||
|
||||
static void
|
||||
discovery_add_target(struct keys *response_keys, struct target *targ)
|
||||
discovery_add_target(struct keys *response_keys, const struct target *targ)
|
||||
{
|
||||
struct portal *portal;
|
||||
char *buf;
|
||||
@ -206,9 +206,12 @@ discovery(struct connection *conn)
|
||||
{
|
||||
struct pdu *request, *response;
|
||||
struct keys *request_keys, *response_keys;
|
||||
struct target *targ;
|
||||
const struct portal_group *pg;
|
||||
const struct target *targ;
|
||||
const char *send_targets;
|
||||
|
||||
pg = conn->conn_portal->p_portal_group;
|
||||
|
||||
log_debugx("beginning discovery session; waiting for Text PDU");
|
||||
request = text_receive(conn);
|
||||
request_keys = keys_new();
|
||||
@ -222,11 +225,8 @@ discovery(struct connection *conn)
|
||||
response_keys = keys_new();
|
||||
|
||||
if (strcmp(send_targets, "All") == 0) {
|
||||
TAILQ_FOREACH(targ,
|
||||
&conn->conn_portal->p_portal_group->pg_conf->conf_targets,
|
||||
t_next) {
|
||||
if (targ->t_portal_group !=
|
||||
conn->conn_portal->p_portal_group) {
|
||||
TAILQ_FOREACH(targ, &pg->pg_conf->conf_targets, t_next) {
|
||||
if (targ->t_portal_group != pg) {
|
||||
log_debugx("not returning target \"%s\"; "
|
||||
"belongs to a different portal group",
|
||||
targ->t_name);
|
||||
@ -235,8 +235,7 @@ discovery(struct connection *conn)
|
||||
discovery_add_target(response_keys, targ);
|
||||
}
|
||||
} else {
|
||||
targ = target_find(conn->conn_portal->p_portal_group->pg_conf,
|
||||
send_targets);
|
||||
targ = target_find(pg->pg_conf, send_targets);
|
||||
if (targ == NULL) {
|
||||
log_debugx("initiator requested information on unknown "
|
||||
"target \"%s\"; returning nothing", send_targets);
|
||||
|
Loading…
Reference in New Issue
Block a user