lib/iscsi: Rename iSCSI global data from g_spdk_iscsi to g_iscsi
The following patch will remove the "spdk_" prefix from iSCSI internal APIs. The iSCSI global data g_spdk_iscsi is also local in SPDK iSCSI library. Hence rename it by g_iscsi for consistency. Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: If35e9d58b1388fd725a505ee9be870e414c37ba5 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1831 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
parent
11e25ed27e
commit
be1489b9b9
@ -220,9 +220,9 @@ spdk_iscsi_conn_construct(struct spdk_iscsi_portal *portal,
|
||||
return -1;
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&g_spdk_iscsi.mutex);
|
||||
conn->timeout = g_spdk_iscsi.timeout * spdk_get_ticks_hz(); /* seconds to TSC */
|
||||
conn->nopininterval = g_spdk_iscsi.nopininterval;
|
||||
pthread_mutex_lock(&g_iscsi.mutex);
|
||||
conn->timeout = g_iscsi.timeout * spdk_get_ticks_hz(); /* seconds to TSC */
|
||||
conn->nopininterval = g_iscsi.nopininterval;
|
||||
conn->nopininterval *= spdk_get_ticks_hz(); /* seconds to TSC */
|
||||
conn->nop_outstanding = false;
|
||||
conn->data_out_cnt = 0;
|
||||
@ -231,7 +231,7 @@ spdk_iscsi_conn_construct(struct spdk_iscsi_portal *portal,
|
||||
conn->require_chap = portal->group->require_chap;
|
||||
conn->mutual_chap = portal->group->mutual_chap;
|
||||
conn->chap_group = portal->group->chap_group;
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
conn->MaxRecvDataSegmentLength = 8192; /* RFC3720(12.12) */
|
||||
|
||||
conn->portal = portal;
|
||||
@ -294,7 +294,7 @@ spdk_iscsi_conn_construct(struct spdk_iscsi_portal *portal,
|
||||
conn->pending_task_cnt = 0;
|
||||
|
||||
/* Get the first poll group. */
|
||||
pg = TAILQ_FIRST(&g_spdk_iscsi.poll_group_head);
|
||||
pg = TAILQ_FIRST(&g_iscsi.poll_group_head);
|
||||
if (pg == NULL) {
|
||||
SPDK_ERRLOG("There is no poll group.\n");
|
||||
assert(false);
|
||||
@ -376,7 +376,7 @@ iscsi_conn_cleanup_backend(struct spdk_iscsi_conn *conn)
|
||||
|
||||
if (conn->sess->connections > 1) {
|
||||
/* connection specific cleanup */
|
||||
} else if (!g_spdk_iscsi.AllowDuplicateIsid) {
|
||||
} else if (!g_iscsi.AllowDuplicateIsid) {
|
||||
/* clean up all tasks to all LUNs for session */
|
||||
target = conn->sess->target;
|
||||
if (target != NULL) {
|
||||
@ -1579,7 +1579,7 @@ spdk_iscsi_conn_schedule(struct spdk_iscsi_conn *conn)
|
||||
* thread. */
|
||||
return;
|
||||
}
|
||||
pthread_mutex_lock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_lock(&g_iscsi.mutex);
|
||||
|
||||
target = conn->sess->target;
|
||||
pthread_mutex_lock(&target->mutex);
|
||||
@ -1590,7 +1590,7 @@ spdk_iscsi_conn_schedule(struct spdk_iscsi_conn *conn)
|
||||
* Pick a poll group using round-robin.
|
||||
*/
|
||||
if (g_next_pg == NULL) {
|
||||
g_next_pg = TAILQ_FIRST(&g_spdk_iscsi.poll_group_head);
|
||||
g_next_pg = TAILQ_FIRST(&g_iscsi.poll_group_head);
|
||||
assert(g_next_pg != NULL);
|
||||
}
|
||||
|
||||
@ -1607,7 +1607,7 @@ spdk_iscsi_conn_schedule(struct spdk_iscsi_conn *conn)
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&target->mutex);
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
|
||||
assert(spdk_io_channel_get_thread(spdk_io_channel_from_ctx(conn->pg)) ==
|
||||
spdk_get_thread());
|
||||
|
@ -449,13 +449,13 @@ spdk_iscsi_init_grp_register(struct spdk_iscsi_init_grp *ig)
|
||||
|
||||
assert(ig != NULL);
|
||||
|
||||
pthread_mutex_lock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_lock(&g_iscsi.mutex);
|
||||
tmp = spdk_iscsi_init_grp_find_by_tag(ig->tag);
|
||||
if (tmp == NULL) {
|
||||
TAILQ_INSERT_TAIL(&g_spdk_iscsi.ig_head, ig, tailq);
|
||||
TAILQ_INSERT_TAIL(&g_iscsi.ig_head, ig, tailq);
|
||||
rc = 0;
|
||||
}
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
|
||||
return rc;
|
||||
}
|
||||
@ -525,10 +525,10 @@ spdk_iscsi_init_grp_add_initiators_from_initiator_list(int tag,
|
||||
"add initiator to initiator group: tag=%d, #initiators=%d, #masks=%d\n",
|
||||
tag, num_initiator_names, num_initiator_masks);
|
||||
|
||||
pthread_mutex_lock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_lock(&g_iscsi.mutex);
|
||||
ig = spdk_iscsi_init_grp_find_by_tag(tag);
|
||||
if (!ig) {
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
SPDK_ERRLOG("initiator group (%d) is not found\n", tag);
|
||||
return rc;
|
||||
}
|
||||
@ -549,7 +549,7 @@ spdk_iscsi_init_grp_add_initiators_from_initiator_list(int tag,
|
||||
}
|
||||
|
||||
error:
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -567,10 +567,10 @@ spdk_iscsi_init_grp_delete_initiators_from_initiator_list(int tag,
|
||||
"delete initiator from initiator group: tag=%d, #initiators=%d, #masks=%d\n",
|
||||
tag, num_initiator_names, num_initiator_masks);
|
||||
|
||||
pthread_mutex_lock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_lock(&g_iscsi.mutex);
|
||||
ig = spdk_iscsi_init_grp_find_by_tag(tag);
|
||||
if (!ig) {
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
SPDK_ERRLOG("initiator group (%d) is not found\n", tag);
|
||||
return rc;
|
||||
}
|
||||
@ -592,7 +592,7 @@ spdk_iscsi_init_grp_delete_initiators_from_initiator_list(int tag,
|
||||
}
|
||||
|
||||
error:
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -613,7 +613,7 @@ spdk_iscsi_init_grp_find_by_tag(int tag)
|
||||
{
|
||||
struct spdk_iscsi_init_grp *ig;
|
||||
|
||||
TAILQ_FOREACH(ig, &g_spdk_iscsi.ig_head, tailq) {
|
||||
TAILQ_FOREACH(ig, &g_iscsi.ig_head, tailq) {
|
||||
if (ig->tag == tag) {
|
||||
return ig;
|
||||
}
|
||||
@ -652,12 +652,12 @@ spdk_iscsi_init_grps_destroy(void)
|
||||
struct spdk_iscsi_init_grp *ig, *tmp;
|
||||
|
||||
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "spdk_iscsi_init_grp_array_destroy\n");
|
||||
pthread_mutex_lock(&g_spdk_iscsi.mutex);
|
||||
TAILQ_FOREACH_SAFE(ig, &g_spdk_iscsi.ig_head, tailq, tmp) {
|
||||
TAILQ_REMOVE(&g_spdk_iscsi.ig_head, ig, tailq);
|
||||
pthread_mutex_lock(&g_iscsi.mutex);
|
||||
TAILQ_FOREACH_SAFE(ig, &g_iscsi.ig_head, tailq, tmp) {
|
||||
TAILQ_REMOVE(&g_iscsi.ig_head, ig, tailq);
|
||||
spdk_iscsi_init_grp_destroy(ig);
|
||||
}
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
}
|
||||
|
||||
struct spdk_iscsi_init_grp *
|
||||
@ -665,15 +665,15 @@ spdk_iscsi_init_grp_unregister(int tag)
|
||||
{
|
||||
struct spdk_iscsi_init_grp *ig;
|
||||
|
||||
pthread_mutex_lock(&g_spdk_iscsi.mutex);
|
||||
TAILQ_FOREACH(ig, &g_spdk_iscsi.ig_head, tailq) {
|
||||
pthread_mutex_lock(&g_iscsi.mutex);
|
||||
TAILQ_FOREACH(ig, &g_iscsi.ig_head, tailq) {
|
||||
if (ig->tag == tag) {
|
||||
TAILQ_REMOVE(&g_spdk_iscsi.ig_head, ig, tailq);
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
TAILQ_REMOVE(&g_iscsi.ig_head, ig, tailq);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
return ig;
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -706,7 +706,7 @@ spdk_iscsi_init_grps_config_text(FILE *fp)
|
||||
fprintf(fp, "%s", initiator_group_section);
|
||||
|
||||
/* Dump initiator groups */
|
||||
TAILQ_FOREACH(ig, &g_spdk_iscsi.ig_head, tailq) {
|
||||
TAILQ_FOREACH(ig, &g_iscsi.ig_head, tailq) {
|
||||
if (NULL == ig) { continue; }
|
||||
fprintf(fp, INITIATOR_GROUP_TMPL, ig->tag, ig->tag);
|
||||
|
||||
@ -771,7 +771,7 @@ spdk_iscsi_init_grps_info_json(struct spdk_json_write_ctx *w)
|
||||
{
|
||||
struct spdk_iscsi_init_grp *ig;
|
||||
|
||||
TAILQ_FOREACH(ig, &g_spdk_iscsi.ig_head, tailq) {
|
||||
TAILQ_FOREACH(ig, &g_iscsi.ig_head, tailq) {
|
||||
iscsi_init_grp_info_json(ig, w);
|
||||
}
|
||||
}
|
||||
@ -781,7 +781,7 @@ spdk_iscsi_init_grps_config_json(struct spdk_json_write_ctx *w)
|
||||
{
|
||||
struct spdk_iscsi_init_grp *ig;
|
||||
|
||||
TAILQ_FOREACH(ig, &g_spdk_iscsi.ig_head, tailq) {
|
||||
TAILQ_FOREACH(ig, &g_iscsi.ig_head, tailq) {
|
||||
iscsi_init_grp_config_json(ig, w);
|
||||
}
|
||||
}
|
||||
|
@ -67,14 +67,14 @@
|
||||
#define HAVE_ARC4RANDOM 1
|
||||
#endif
|
||||
|
||||
struct spdk_iscsi_globals g_spdk_iscsi = {
|
||||
struct spdk_iscsi_globals g_iscsi = {
|
||||
.mutex = PTHREAD_MUTEX_INITIALIZER,
|
||||
.portal_head = TAILQ_HEAD_INITIALIZER(g_spdk_iscsi.portal_head),
|
||||
.pg_head = TAILQ_HEAD_INITIALIZER(g_spdk_iscsi.pg_head),
|
||||
.ig_head = TAILQ_HEAD_INITIALIZER(g_spdk_iscsi.ig_head),
|
||||
.target_head = TAILQ_HEAD_INITIALIZER(g_spdk_iscsi.target_head),
|
||||
.auth_group_head = TAILQ_HEAD_INITIALIZER(g_spdk_iscsi.auth_group_head),
|
||||
.poll_group_head = TAILQ_HEAD_INITIALIZER(g_spdk_iscsi.poll_group_head),
|
||||
.portal_head = TAILQ_HEAD_INITIALIZER(g_iscsi.portal_head),
|
||||
.pg_head = TAILQ_HEAD_INITIALIZER(g_iscsi.pg_head),
|
||||
.ig_head = TAILQ_HEAD_INITIALIZER(g_iscsi.ig_head),
|
||||
.target_head = TAILQ_HEAD_INITIALIZER(g_iscsi.target_head),
|
||||
.auth_group_head = TAILQ_HEAD_INITIALIZER(g_iscsi.auth_group_head),
|
||||
.poll_group_head = TAILQ_HEAD_INITIALIZER(g_iscsi.poll_group_head),
|
||||
};
|
||||
|
||||
#define MATCH_DIGEST_WORD(BUF, CRC32C) \
|
||||
@ -546,7 +546,7 @@ void spdk_free_sess(struct spdk_iscsi_sess *sess)
|
||||
spdk_iscsi_param_free(sess->params);
|
||||
free(sess->conns);
|
||||
spdk_scsi_port_free(&sess->initiator_port);
|
||||
spdk_mempool_put(g_spdk_iscsi.session_pool, (void *)sess);
|
||||
spdk_mempool_put(g_iscsi.session_pool, (void *)sess);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -557,30 +557,30 @@ create_iscsi_sess(struct spdk_iscsi_conn *conn,
|
||||
struct spdk_iscsi_sess *sess;
|
||||
int rc;
|
||||
|
||||
sess = spdk_mempool_get(g_spdk_iscsi.session_pool);
|
||||
sess = spdk_mempool_get(g_iscsi.session_pool);
|
||||
if (!sess) {
|
||||
SPDK_ERRLOG("Unable to get session object\n");
|
||||
SPDK_ERRLOG("MaxSessions set to %d\n", g_spdk_iscsi.MaxSessions);
|
||||
SPDK_ERRLOG("MaxSessions set to %d\n", g_iscsi.MaxSessions);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/* configuration values */
|
||||
pthread_mutex_lock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_lock(&g_iscsi.mutex);
|
||||
|
||||
sess->MaxConnections = g_spdk_iscsi.MaxConnectionsPerSession;
|
||||
sess->MaxConnections = g_iscsi.MaxConnectionsPerSession;
|
||||
sess->MaxOutstandingR2T = DEFAULT_MAXOUTSTANDINGR2T;
|
||||
|
||||
sess->DefaultTime2Wait = g_spdk_iscsi.DefaultTime2Wait;
|
||||
sess->DefaultTime2Retain = g_spdk_iscsi.DefaultTime2Retain;
|
||||
sess->FirstBurstLength = g_spdk_iscsi.FirstBurstLength;
|
||||
sess->DefaultTime2Wait = g_iscsi.DefaultTime2Wait;
|
||||
sess->DefaultTime2Retain = g_iscsi.DefaultTime2Retain;
|
||||
sess->FirstBurstLength = g_iscsi.FirstBurstLength;
|
||||
sess->MaxBurstLength = SPDK_ISCSI_MAX_BURST_LENGTH;
|
||||
sess->InitialR2T = DEFAULT_INITIALR2T;
|
||||
sess->ImmediateData = g_spdk_iscsi.ImmediateData;
|
||||
sess->ImmediateData = g_iscsi.ImmediateData;
|
||||
sess->DataPDUInOrder = DEFAULT_DATAPDUINORDER;
|
||||
sess->DataSequenceInOrder = DEFAULT_DATASEQUENCEINORDER;
|
||||
sess->ErrorRecoveryLevel = g_spdk_iscsi.ErrorRecoveryLevel;
|
||||
sess->ErrorRecoveryLevel = g_iscsi.ErrorRecoveryLevel;
|
||||
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
|
||||
sess->tag = conn->pg_tag;
|
||||
|
||||
@ -708,11 +708,11 @@ get_iscsi_sess_by_tsih(uint16_t tsih)
|
||||
{
|
||||
struct spdk_iscsi_sess *session;
|
||||
|
||||
if (tsih == 0 || tsih > g_spdk_iscsi.MaxSessions) {
|
||||
if (tsih == 0 || tsih > g_iscsi.MaxSessions) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
session = g_spdk_iscsi.session[tsih - 1];
|
||||
session = g_iscsi.session[tsih - 1];
|
||||
assert(tsih == session->tsih);
|
||||
|
||||
return session;
|
||||
@ -1073,9 +1073,9 @@ iscsi_check_values(struct spdk_iscsi_conn *conn)
|
||||
conn->sess->MaxBurstLength);
|
||||
return -1;
|
||||
}
|
||||
if (conn->sess->FirstBurstLength > g_spdk_iscsi.FirstBurstLength) {
|
||||
if (conn->sess->FirstBurstLength > g_iscsi.FirstBurstLength) {
|
||||
SPDK_ERRLOG("FirstBurstLength(%d) > iSCSI target restriction(%d)\n",
|
||||
conn->sess->FirstBurstLength, g_spdk_iscsi.FirstBurstLength);
|
||||
conn->sess->FirstBurstLength, g_iscsi.FirstBurstLength);
|
||||
return -1;
|
||||
}
|
||||
if (conn->sess->MaxBurstLength > 0x00ffffff) {
|
||||
@ -1514,7 +1514,7 @@ iscsi_op_login_check_session(struct spdk_iscsi_conn *conn,
|
||||
rsph->status_detail = rc;
|
||||
return SPDK_ISCSI_LOGIN_ERROR_RESPONSE;
|
||||
}
|
||||
} else if (!g_spdk_iscsi.AllowDuplicateIsid) {
|
||||
} else if (!g_iscsi.AllowDuplicateIsid) {
|
||||
/* new session, drop old sess by the initiator */
|
||||
spdk_iscsi_drop_conns(conn, initiator_port_name, 0 /* drop old */);
|
||||
}
|
||||
@ -1687,9 +1687,9 @@ iscsi_op_login_session_normal(struct spdk_iscsi_conn *conn,
|
||||
target_short_name);
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_lock(&g_iscsi.mutex);
|
||||
rc = iscsi_op_login_check_target(conn, rsp_pdu, target_name, &target);
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
|
||||
if (rc < 0) {
|
||||
return rc;
|
||||
@ -1914,9 +1914,9 @@ iscsi_op_login_phase_none(struct spdk_iscsi_conn *conn,
|
||||
rsph->tsih = 0;
|
||||
|
||||
/* force target flags */
|
||||
pthread_mutex_lock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_lock(&g_iscsi.mutex);
|
||||
rc = iscsi_op_login_session_discovery_chap(conn);
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
if (rc < 0) {
|
||||
return rc;
|
||||
}
|
||||
@ -4737,10 +4737,10 @@ iscsi_read_pdu(struct spdk_iscsi_conn *conn)
|
||||
|
||||
if (data_len != 0 && pdu->data_buf == NULL) {
|
||||
if (data_len <= spdk_get_max_immediate_data_size()) {
|
||||
pool = g_spdk_iscsi.pdu_immediate_data_pool;
|
||||
pool = g_iscsi.pdu_immediate_data_pool;
|
||||
pdu->data_buf_len = SPDK_BDEV_BUF_SIZE_WITH_MD(spdk_get_max_immediate_data_size());
|
||||
} else if (data_len <= SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH) {
|
||||
pool = g_spdk_iscsi.pdu_data_out_pool;
|
||||
pool = g_iscsi.pdu_data_out_pool;
|
||||
pdu->data_buf_len = SPDK_BDEV_BUF_SIZE_WITH_MD(SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH);
|
||||
} else {
|
||||
SPDK_ERRLOG("Data(%d) > MaxSegment(%d)\n",
|
||||
|
@ -389,7 +389,7 @@ enum spdk_error_codes {
|
||||
|
||||
#define xstrdup(s) (s ? strdup(s) : (char *)NULL)
|
||||
|
||||
extern struct spdk_iscsi_globals g_spdk_iscsi;
|
||||
extern struct spdk_iscsi_globals g_iscsi;
|
||||
extern struct spdk_iscsi_opts *g_spdk_iscsi_opts;
|
||||
|
||||
struct spdk_iscsi_task;
|
||||
@ -457,7 +457,7 @@ spdk_get_max_immediate_data_size(void)
|
||||
* take up much space and we need to make sure the worst-case scenario
|
||||
* can be satisified by the size returned here.
|
||||
*/
|
||||
return g_spdk_iscsi.FirstBurstLength +
|
||||
return g_iscsi.FirstBurstLength +
|
||||
ISCSI_DIGEST_LEN + /* data digest */
|
||||
ISCSI_DIGEST_LEN + /* header digest */
|
||||
8 + /* bidirectional AHS */
|
||||
|
@ -923,7 +923,7 @@ spdk_rpc_iscsi_portal_group_set_auth(struct spdk_jsonrpc_request *request,
|
||||
return;
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_lock(&g_iscsi.mutex);
|
||||
|
||||
pg = spdk_iscsi_portal_grp_find_by_tag(req.tag);
|
||||
if (pg == NULL) {
|
||||
@ -940,7 +940,7 @@ spdk_rpc_iscsi_portal_group_set_auth(struct spdk_jsonrpc_request *request,
|
||||
goto exit;
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
|
||||
w = spdk_jsonrpc_begin_result(request);
|
||||
spdk_json_write_bool(w, true);
|
||||
@ -949,7 +949,7 @@ spdk_rpc_iscsi_portal_group_set_auth(struct spdk_jsonrpc_request *request,
|
||||
return;
|
||||
|
||||
exit:
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
}
|
||||
SPDK_RPC_REGISTER("iscsi_portal_group_set_auth", spdk_rpc_iscsi_portal_group_set_auth,
|
||||
SPDK_RPC_RUNTIME)
|
||||
@ -1009,7 +1009,7 @@ spdk_rpc_iscsi_get_connections(struct spdk_jsonrpc_request *request,
|
||||
|
||||
spdk_json_write_array_begin(ctx->w);
|
||||
|
||||
spdk_for_each_channel(&g_spdk_iscsi,
|
||||
spdk_for_each_channel(&g_iscsi,
|
||||
rpc_iscsi_get_connections,
|
||||
ctx,
|
||||
rpc_iscsi_get_connections_done);
|
||||
@ -1308,11 +1308,11 @@ spdk_rpc_iscsi_create_auth_group(struct spdk_jsonrpc_request *request,
|
||||
return;
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_lock(&g_iscsi.mutex);
|
||||
|
||||
rc = spdk_iscsi_add_auth_group(req.tag, &group);
|
||||
if (rc != 0) {
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
|
||||
spdk_jsonrpc_send_error_response_fmt(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
|
||||
"Could not add auth group (%d), %s",
|
||||
@ -1327,7 +1327,7 @@ spdk_rpc_iscsi_create_auth_group(struct spdk_jsonrpc_request *request,
|
||||
_secret->muser, _secret->msecret);
|
||||
if (rc != 0) {
|
||||
spdk_iscsi_delete_auth_group(group);
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
|
||||
spdk_jsonrpc_send_error_response_fmt(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
|
||||
"Could not add secret to auth group (%d), %s",
|
||||
@ -1337,7 +1337,7 @@ spdk_rpc_iscsi_create_auth_group(struct spdk_jsonrpc_request *request,
|
||||
}
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
|
||||
free_rpc_auth_group(&req);
|
||||
|
||||
@ -1372,11 +1372,11 @@ spdk_rpc_iscsi_delete_auth_group(struct spdk_jsonrpc_request *request,
|
||||
return;
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_lock(&g_iscsi.mutex);
|
||||
|
||||
group = spdk_iscsi_find_auth_group_by_tag(req.tag);
|
||||
if (group == NULL) {
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
|
||||
spdk_jsonrpc_send_error_response_fmt(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
|
||||
"Could not find auth group (%d)", req.tag);
|
||||
@ -1385,7 +1385,7 @@ spdk_rpc_iscsi_delete_auth_group(struct spdk_jsonrpc_request *request,
|
||||
|
||||
spdk_iscsi_delete_auth_group(group);
|
||||
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
|
||||
w = spdk_jsonrpc_begin_result(request);
|
||||
spdk_json_write_bool(w, true);
|
||||
@ -1437,11 +1437,11 @@ spdk_rpc_iscsi_auth_group_add_secret(struct spdk_jsonrpc_request *request,
|
||||
return;
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_lock(&g_iscsi.mutex);
|
||||
|
||||
group = spdk_iscsi_find_auth_group_by_tag(req.tag);
|
||||
if (group == NULL) {
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
|
||||
spdk_jsonrpc_send_error_response_fmt(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
|
||||
"Could not find auth group (%d)", req.tag);
|
||||
@ -1451,7 +1451,7 @@ spdk_rpc_iscsi_auth_group_add_secret(struct spdk_jsonrpc_request *request,
|
||||
|
||||
rc = spdk_iscsi_auth_group_add_secret(group, req.user, req.secret, req.muser, req.msecret);
|
||||
if (rc != 0) {
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
|
||||
spdk_jsonrpc_send_error_response_fmt(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
|
||||
"Could not add secret to auth group (%d), %s",
|
||||
@ -1460,7 +1460,7 @@ spdk_rpc_iscsi_auth_group_add_secret(struct spdk_jsonrpc_request *request,
|
||||
return;
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
|
||||
free_rpc_add_auth_secret(&req);
|
||||
|
||||
@ -1507,11 +1507,11 @@ spdk_rpc_iscsi_auth_group_remove_secret(struct spdk_jsonrpc_request *request,
|
||||
return;
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_lock(&g_iscsi.mutex);
|
||||
|
||||
group = spdk_iscsi_find_auth_group_by_tag(req.tag);
|
||||
if (group == NULL) {
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
|
||||
spdk_jsonrpc_send_error_response_fmt(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
|
||||
"Could not find auth group (%d)", req.tag);
|
||||
@ -1521,7 +1521,7 @@ spdk_rpc_iscsi_auth_group_remove_secret(struct spdk_jsonrpc_request *request,
|
||||
|
||||
rc = spdk_iscsi_auth_group_delete_secret(group, req.user);
|
||||
if (rc != 0) {
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
|
||||
spdk_jsonrpc_send_error_response_fmt(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
|
||||
"Could not delete secret from CHAP group (%d), %s",
|
||||
@ -1530,7 +1530,7 @@ spdk_rpc_iscsi_auth_group_remove_secret(struct spdk_jsonrpc_request *request,
|
||||
return;
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
|
||||
free_rpc_remove_auth_secret(&req);
|
||||
|
||||
|
@ -98,30 +98,30 @@ iscsi_globals_config_text(FILE *fp)
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_spdk_iscsi.require_chap) {
|
||||
if (g_iscsi.require_chap) {
|
||||
authmethod = "CHAP";
|
||||
} else if (g_spdk_iscsi.mutual_chap) {
|
||||
} else if (g_iscsi.mutual_chap) {
|
||||
authmethod = "CHAP Mutual";
|
||||
} else if (!g_spdk_iscsi.disable_chap) {
|
||||
} else if (!g_iscsi.disable_chap) {
|
||||
authmethod = "Auto";
|
||||
}
|
||||
|
||||
if (g_spdk_iscsi.chap_group) {
|
||||
snprintf(authgroup, sizeof(authgroup), "AuthGroup%d", g_spdk_iscsi.chap_group);
|
||||
if (g_iscsi.chap_group) {
|
||||
snprintf(authgroup, sizeof(authgroup), "AuthGroup%d", g_iscsi.chap_group);
|
||||
}
|
||||
|
||||
fprintf(fp, ISCSI_CONFIG_TMPL,
|
||||
g_spdk_iscsi.nodebase,
|
||||
g_spdk_iscsi.authfile ? "AuthFile" : "",
|
||||
g_spdk_iscsi.authfile ? g_spdk_iscsi.authfile : "",
|
||||
g_spdk_iscsi.timeout, authmethod, authgroup,
|
||||
g_spdk_iscsi.MaxSessions, g_spdk_iscsi.MaxConnectionsPerSession,
|
||||
g_spdk_iscsi.MaxConnections,
|
||||
g_spdk_iscsi.MaxQueueDepth,
|
||||
g_spdk_iscsi.DefaultTime2Wait, g_spdk_iscsi.DefaultTime2Retain,
|
||||
g_spdk_iscsi.FirstBurstLength,
|
||||
(g_spdk_iscsi.ImmediateData) ? "Yes" : "No",
|
||||
g_spdk_iscsi.ErrorRecoveryLevel);
|
||||
g_iscsi.nodebase,
|
||||
g_iscsi.authfile ? "AuthFile" : "",
|
||||
g_iscsi.authfile ? g_iscsi.authfile : "",
|
||||
g_iscsi.timeout, authmethod, authgroup,
|
||||
g_iscsi.MaxSessions, g_iscsi.MaxConnectionsPerSession,
|
||||
g_iscsi.MaxConnections,
|
||||
g_iscsi.MaxQueueDepth,
|
||||
g_iscsi.DefaultTime2Wait, g_iscsi.DefaultTime2Retain,
|
||||
g_iscsi.FirstBurstLength,
|
||||
(g_iscsi.ImmediateData) ? "Yes" : "No",
|
||||
g_iscsi.ErrorRecoveryLevel);
|
||||
}
|
||||
|
||||
#define ISCSI_DATA_BUFFER_ALIGNMENT (0x1000)
|
||||
@ -147,7 +147,7 @@ mobj_ctor(struct spdk_mempool *mp, __attribute__((unused)) void *arg,
|
||||
static int
|
||||
iscsi_initialize_pdu_pool(void)
|
||||
{
|
||||
struct spdk_iscsi_globals *iscsi = &g_spdk_iscsi;
|
||||
struct spdk_iscsi_globals *iscsi = &g_iscsi;
|
||||
int imm_mobj_size = SPDK_BDEV_BUF_SIZE_WITH_MD(spdk_get_max_immediate_data_size()) +
|
||||
sizeof(struct spdk_mobj) + ISCSI_DATA_BUFFER_ALIGNMENT;
|
||||
int dout_mobj_size = SPDK_BDEV_BUF_SIZE_WITH_MD(SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH) +
|
||||
@ -204,7 +204,7 @@ iscsi_sess_ctor(struct spdk_mempool *pool, void *arg, void *session_buf,
|
||||
static int
|
||||
iscsi_initialize_task_pool(void)
|
||||
{
|
||||
struct spdk_iscsi_globals *iscsi = &g_spdk_iscsi;
|
||||
struct spdk_iscsi_globals *iscsi = &g_iscsi;
|
||||
|
||||
/* create scsi_task pool */
|
||||
iscsi->task_pool = spdk_mempool_create("SCSI_TASK_Pool",
|
||||
@ -223,7 +223,7 @@ iscsi_initialize_task_pool(void)
|
||||
static int
|
||||
iscsi_initialize_session_pool(void)
|
||||
{
|
||||
struct spdk_iscsi_globals *iscsi = &g_spdk_iscsi;
|
||||
struct spdk_iscsi_globals *iscsi = &g_iscsi;
|
||||
|
||||
iscsi->session_pool = spdk_mempool_create_ctor("Session_Pool",
|
||||
SESSION_POOL_SIZE(iscsi),
|
||||
@ -268,7 +268,7 @@ iscsi_check_pool(struct spdk_mempool *pool, size_t count)
|
||||
static void
|
||||
iscsi_check_pools(void)
|
||||
{
|
||||
struct spdk_iscsi_globals *iscsi = &g_spdk_iscsi;
|
||||
struct spdk_iscsi_globals *iscsi = &g_iscsi;
|
||||
|
||||
iscsi_check_pool(iscsi->pdu_pool, PDU_POOL_SIZE(iscsi));
|
||||
iscsi_check_pool(iscsi->session_pool, SESSION_POOL_SIZE(iscsi));
|
||||
@ -280,7 +280,7 @@ iscsi_check_pools(void)
|
||||
static void
|
||||
iscsi_free_pools(void)
|
||||
{
|
||||
struct spdk_iscsi_globals *iscsi = &g_spdk_iscsi;
|
||||
struct spdk_iscsi_globals *iscsi = &g_iscsi;
|
||||
|
||||
spdk_mempool_free(iscsi->pdu_pool);
|
||||
spdk_mempool_free(iscsi->session_pool);
|
||||
@ -307,7 +307,7 @@ void spdk_put_pdu(struct spdk_iscsi_pdu *pdu)
|
||||
free(pdu->data);
|
||||
}
|
||||
|
||||
spdk_mempool_put(g_spdk_iscsi.pdu_pool, (void *)pdu);
|
||||
spdk_mempool_put(g_iscsi.pdu_pool, (void *)pdu);
|
||||
}
|
||||
}
|
||||
|
||||
@ -316,7 +316,7 @@ struct spdk_iscsi_pdu *spdk_get_pdu(struct spdk_iscsi_conn *conn)
|
||||
struct spdk_iscsi_pdu *pdu;
|
||||
|
||||
assert(conn != NULL);
|
||||
pdu = spdk_mempool_get(g_spdk_iscsi.pdu_pool);
|
||||
pdu = spdk_mempool_get(g_iscsi.pdu_pool);
|
||||
if (!pdu) {
|
||||
SPDK_ERRLOG("Unable to get PDU\n");
|
||||
abort();
|
||||
@ -334,47 +334,47 @@ static void
|
||||
iscsi_log_globals(void)
|
||||
{
|
||||
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "AuthFile %s\n",
|
||||
g_spdk_iscsi.authfile ? g_spdk_iscsi.authfile : "(none)");
|
||||
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "NodeBase %s\n", g_spdk_iscsi.nodebase);
|
||||
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "MaxSessions %d\n", g_spdk_iscsi.MaxSessions);
|
||||
g_iscsi.authfile ? g_iscsi.authfile : "(none)");
|
||||
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "NodeBase %s\n", g_iscsi.nodebase);
|
||||
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "MaxSessions %d\n", g_iscsi.MaxSessions);
|
||||
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "MaxConnectionsPerSession %d\n",
|
||||
g_spdk_iscsi.MaxConnectionsPerSession);
|
||||
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "MaxQueueDepth %d\n", g_spdk_iscsi.MaxQueueDepth);
|
||||
g_iscsi.MaxConnectionsPerSession);
|
||||
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "MaxQueueDepth %d\n", g_iscsi.MaxQueueDepth);
|
||||
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "DefaultTime2Wait %d\n",
|
||||
g_spdk_iscsi.DefaultTime2Wait);
|
||||
g_iscsi.DefaultTime2Wait);
|
||||
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "DefaultTime2Retain %d\n",
|
||||
g_spdk_iscsi.DefaultTime2Retain);
|
||||
g_iscsi.DefaultTime2Retain);
|
||||
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "FirstBurstLength %d\n",
|
||||
g_spdk_iscsi.FirstBurstLength);
|
||||
g_iscsi.FirstBurstLength);
|
||||
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "ImmediateData %s\n",
|
||||
g_spdk_iscsi.ImmediateData ? "Yes" : "No");
|
||||
g_iscsi.ImmediateData ? "Yes" : "No");
|
||||
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "AllowDuplicateIsid %s\n",
|
||||
g_spdk_iscsi.AllowDuplicateIsid ? "Yes" : "No");
|
||||
g_iscsi.AllowDuplicateIsid ? "Yes" : "No");
|
||||
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "ErrorRecoveryLevel %d\n",
|
||||
g_spdk_iscsi.ErrorRecoveryLevel);
|
||||
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "Timeout %d\n", g_spdk_iscsi.timeout);
|
||||
g_iscsi.ErrorRecoveryLevel);
|
||||
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "Timeout %d\n", g_iscsi.timeout);
|
||||
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "NopInInterval %d\n",
|
||||
g_spdk_iscsi.nopininterval);
|
||||
if (g_spdk_iscsi.disable_chap) {
|
||||
g_iscsi.nopininterval);
|
||||
if (g_iscsi.disable_chap) {
|
||||
SPDK_DEBUGLOG(SPDK_LOG_ISCSI,
|
||||
"DiscoveryAuthMethod None\n");
|
||||
} else if (!g_spdk_iscsi.require_chap) {
|
||||
} else if (!g_iscsi.require_chap) {
|
||||
SPDK_DEBUGLOG(SPDK_LOG_ISCSI,
|
||||
"DiscoveryAuthMethod Auto\n");
|
||||
} else {
|
||||
SPDK_DEBUGLOG(SPDK_LOG_ISCSI,
|
||||
"DiscoveryAuthMethod %s %s\n",
|
||||
g_spdk_iscsi.require_chap ? "CHAP" : "",
|
||||
g_spdk_iscsi.mutual_chap ? "Mutual" : "");
|
||||
g_iscsi.require_chap ? "CHAP" : "",
|
||||
g_iscsi.mutual_chap ? "Mutual" : "");
|
||||
}
|
||||
|
||||
if (g_spdk_iscsi.chap_group == 0) {
|
||||
if (g_iscsi.chap_group == 0) {
|
||||
SPDK_DEBUGLOG(SPDK_LOG_ISCSI,
|
||||
"DiscoveryAuthGroup None\n");
|
||||
} else {
|
||||
SPDK_DEBUGLOG(SPDK_LOG_ISCSI,
|
||||
"DiscoveryAuthGroup AuthGroup%d\n",
|
||||
g_spdk_iscsi.chap_group);
|
||||
g_iscsi.chap_group);
|
||||
}
|
||||
}
|
||||
|
||||
@ -739,34 +739,34 @@ iscsi_set_global_params(struct spdk_iscsi_opts *opts)
|
||||
}
|
||||
|
||||
if (opts->authfile != NULL) {
|
||||
g_spdk_iscsi.authfile = strdup(opts->authfile);
|
||||
if (!g_spdk_iscsi.authfile) {
|
||||
g_iscsi.authfile = strdup(opts->authfile);
|
||||
if (!g_iscsi.authfile) {
|
||||
SPDK_ERRLOG("failed to strdup for auth file %s\n", opts->authfile);
|
||||
return -ENOMEM;
|
||||
}
|
||||
}
|
||||
|
||||
g_spdk_iscsi.nodebase = strdup(opts->nodebase);
|
||||
if (!g_spdk_iscsi.nodebase) {
|
||||
g_iscsi.nodebase = strdup(opts->nodebase);
|
||||
if (!g_iscsi.nodebase) {
|
||||
SPDK_ERRLOG("failed to strdup for nodebase %s\n", opts->nodebase);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
g_spdk_iscsi.MaxSessions = opts->MaxSessions;
|
||||
g_spdk_iscsi.MaxConnectionsPerSession = opts->MaxConnectionsPerSession;
|
||||
g_spdk_iscsi.MaxQueueDepth = opts->MaxQueueDepth;
|
||||
g_spdk_iscsi.DefaultTime2Wait = opts->DefaultTime2Wait;
|
||||
g_spdk_iscsi.DefaultTime2Retain = opts->DefaultTime2Retain;
|
||||
g_spdk_iscsi.FirstBurstLength = opts->FirstBurstLength;
|
||||
g_spdk_iscsi.ImmediateData = opts->ImmediateData;
|
||||
g_spdk_iscsi.AllowDuplicateIsid = opts->AllowDuplicateIsid;
|
||||
g_spdk_iscsi.ErrorRecoveryLevel = opts->ErrorRecoveryLevel;
|
||||
g_spdk_iscsi.timeout = opts->timeout;
|
||||
g_spdk_iscsi.nopininterval = opts->nopininterval;
|
||||
g_spdk_iscsi.disable_chap = opts->disable_chap;
|
||||
g_spdk_iscsi.require_chap = opts->require_chap;
|
||||
g_spdk_iscsi.mutual_chap = opts->mutual_chap;
|
||||
g_spdk_iscsi.chap_group = opts->chap_group;
|
||||
g_iscsi.MaxSessions = opts->MaxSessions;
|
||||
g_iscsi.MaxConnectionsPerSession = opts->MaxConnectionsPerSession;
|
||||
g_iscsi.MaxQueueDepth = opts->MaxQueueDepth;
|
||||
g_iscsi.DefaultTime2Wait = opts->DefaultTime2Wait;
|
||||
g_iscsi.DefaultTime2Retain = opts->DefaultTime2Retain;
|
||||
g_iscsi.FirstBurstLength = opts->FirstBurstLength;
|
||||
g_iscsi.ImmediateData = opts->ImmediateData;
|
||||
g_iscsi.AllowDuplicateIsid = opts->AllowDuplicateIsid;
|
||||
g_iscsi.ErrorRecoveryLevel = opts->ErrorRecoveryLevel;
|
||||
g_iscsi.timeout = opts->timeout;
|
||||
g_iscsi.nopininterval = opts->nopininterval;
|
||||
g_iscsi.disable_chap = opts->disable_chap;
|
||||
g_iscsi.require_chap = opts->require_chap;
|
||||
g_iscsi.mutual_chap = opts->mutual_chap;
|
||||
g_iscsi.chap_group = opts->chap_group;
|
||||
|
||||
iscsi_log_globals();
|
||||
|
||||
@ -783,12 +783,12 @@ spdk_iscsi_set_discovery_auth(bool disable_chap, bool require_chap, bool mutual_
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&g_spdk_iscsi.mutex);
|
||||
g_spdk_iscsi.disable_chap = disable_chap;
|
||||
g_spdk_iscsi.require_chap = require_chap;
|
||||
g_spdk_iscsi.mutual_chap = mutual_chap;
|
||||
g_spdk_iscsi.chap_group = chap_group;
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_lock(&g_iscsi.mutex);
|
||||
g_iscsi.disable_chap = disable_chap;
|
||||
g_iscsi.require_chap = require_chap;
|
||||
g_iscsi.mutual_chap = mutual_chap;
|
||||
g_iscsi.chap_group = chap_group;
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -899,7 +899,7 @@ spdk_iscsi_add_auth_group(int32_t tag, struct spdk_iscsi_auth_group **_group)
|
||||
{
|
||||
struct spdk_iscsi_auth_group *group;
|
||||
|
||||
TAILQ_FOREACH(group, &g_spdk_iscsi.auth_group_head, tailq) {
|
||||
TAILQ_FOREACH(group, &g_iscsi.auth_group_head, tailq) {
|
||||
if (group->tag == tag) {
|
||||
SPDK_ERRLOG("Auth group (%d) already exists\n", tag);
|
||||
return -EEXIST;
|
||||
@ -915,7 +915,7 @@ spdk_iscsi_add_auth_group(int32_t tag, struct spdk_iscsi_auth_group **_group)
|
||||
TAILQ_INIT(&group->secret_head);
|
||||
group->tag = tag;
|
||||
|
||||
TAILQ_INSERT_TAIL(&g_spdk_iscsi.auth_group_head, group, tailq);
|
||||
TAILQ_INSERT_TAIL(&g_iscsi.auth_group_head, group, tailq);
|
||||
|
||||
*_group = group;
|
||||
return 0;
|
||||
@ -926,7 +926,7 @@ spdk_iscsi_delete_auth_group(struct spdk_iscsi_auth_group *group)
|
||||
{
|
||||
struct spdk_iscsi_auth_secret *_secret, *tmp;
|
||||
|
||||
TAILQ_REMOVE(&g_spdk_iscsi.auth_group_head, group, tailq);
|
||||
TAILQ_REMOVE(&g_iscsi.auth_group_head, group, tailq);
|
||||
|
||||
TAILQ_FOREACH_SAFE(_secret, &group->secret_head, tailq, tmp) {
|
||||
TAILQ_REMOVE(&group->secret_head, _secret, tailq);
|
||||
@ -940,7 +940,7 @@ spdk_iscsi_find_auth_group_by_tag(int32_t tag)
|
||||
{
|
||||
struct spdk_iscsi_auth_group *group;
|
||||
|
||||
TAILQ_FOREACH(group, &g_spdk_iscsi.auth_group_head, tailq) {
|
||||
TAILQ_FOREACH(group, &g_iscsi.auth_group_head, tailq) {
|
||||
if (group->tag == tag) {
|
||||
return group;
|
||||
}
|
||||
@ -954,7 +954,7 @@ iscsi_auth_groups_destroy(void)
|
||||
{
|
||||
struct spdk_iscsi_auth_group *group, *tmp;
|
||||
|
||||
TAILQ_FOREACH_SAFE(group, &g_spdk_iscsi.auth_group_head, tailq, tmp) {
|
||||
TAILQ_FOREACH_SAFE(group, &g_iscsi.auth_group_head, tailq, tmp) {
|
||||
spdk_iscsi_delete_auth_group(group);
|
||||
}
|
||||
}
|
||||
@ -1016,7 +1016,7 @@ iscsi_parse_auth_info(void)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
rc = spdk_conf_read(config, g_spdk_iscsi.authfile);
|
||||
rc = spdk_conf_read(config, g_iscsi.authfile);
|
||||
if (rc != 0) {
|
||||
SPDK_INFOLOG(SPDK_LOG_ISCSI, "Failed to load auth file\n");
|
||||
spdk_conf_free(config);
|
||||
@ -1054,7 +1054,7 @@ iscsi_find_auth_secret(const char *authuser, int ag_tag)
|
||||
struct spdk_iscsi_auth_group *group;
|
||||
struct spdk_iscsi_auth_secret *_secret;
|
||||
|
||||
TAILQ_FOREACH(group, &g_spdk_iscsi.auth_group_head, tailq) {
|
||||
TAILQ_FOREACH(group, &g_iscsi.auth_group_head, tailq) {
|
||||
if (group->tag == ag_tag) {
|
||||
TAILQ_FOREACH(_secret, &group->secret_head, tailq) {
|
||||
if (strcmp(_secret->user, authuser) == 0) {
|
||||
@ -1084,11 +1084,11 @@ spdk_iscsi_chap_get_authinfo(struct iscsi_chap_auth *auth, const char *authuser,
|
||||
memset(auth->msecret, 0, sizeof(auth->msecret));
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_lock(&g_iscsi.mutex);
|
||||
|
||||
_secret = iscsi_find_auth_secret(authuser, ag_tag);
|
||||
if (_secret == NULL) {
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
|
||||
SPDK_ERRLOG("CHAP secret is not found: user:%s, tag:%d\n",
|
||||
authuser, ag_tag);
|
||||
@ -1103,7 +1103,7 @@ spdk_iscsi_chap_get_authinfo(struct iscsi_chap_auth *auth, const char *authuser,
|
||||
memcpy(auth->msecret, _secret->msecret, sizeof(auth->msecret));
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1165,15 +1165,15 @@ iscsi_parse_configuration(void)
|
||||
SPDK_ERRLOG("spdk_iscsi_parse_tgt_nodes() failed\n");
|
||||
}
|
||||
|
||||
if (g_spdk_iscsi.authfile != NULL) {
|
||||
if (access(g_spdk_iscsi.authfile, R_OK) == 0) {
|
||||
if (g_iscsi.authfile != NULL) {
|
||||
if (access(g_iscsi.authfile, R_OK) == 0) {
|
||||
rc = iscsi_parse_auth_info();
|
||||
if (rc < 0) {
|
||||
SPDK_ERRLOG("spdk_iscsi_parse_auth_info() failed\n");
|
||||
}
|
||||
} else {
|
||||
SPDK_INFOLOG(SPDK_LOG_ISCSI, "CHAP secret file is not found in the path %s\n",
|
||||
g_spdk_iscsi.authfile);
|
||||
g_iscsi.authfile);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1262,8 +1262,8 @@ _iscsi_init_thread_done(void *ctx)
|
||||
{
|
||||
struct spdk_iscsi_poll_group *pg = ctx;
|
||||
|
||||
TAILQ_INSERT_TAIL(&g_spdk_iscsi.poll_group_head, pg, link);
|
||||
if (--g_spdk_iscsi.refcnt == 0) {
|
||||
TAILQ_INSERT_TAIL(&g_iscsi.poll_group_head, pg, link);
|
||||
if (--g_iscsi.refcnt == 0) {
|
||||
iscsi_parse_configuration();
|
||||
}
|
||||
}
|
||||
@ -1274,7 +1274,7 @@ _iscsi_init_thread(void *ctx)
|
||||
struct spdk_io_channel *ch;
|
||||
struct spdk_iscsi_poll_group *pg;
|
||||
|
||||
ch = spdk_get_io_channel(&g_spdk_iscsi);
|
||||
ch = spdk_get_io_channel(&g_iscsi);
|
||||
pg = spdk_io_channel_get_ctx(ch);
|
||||
|
||||
spdk_thread_send_msg(g_init_thread, _iscsi_init_thread_done, pg);
|
||||
@ -1288,7 +1288,7 @@ initialize_iscsi_poll_group(void)
|
||||
char thread_name[32];
|
||||
struct spdk_thread *thread;
|
||||
|
||||
spdk_io_device_register(&g_spdk_iscsi, iscsi_poll_group_create, iscsi_poll_group_destroy,
|
||||
spdk_io_device_register(&g_iscsi, iscsi_poll_group_create, iscsi_poll_group_destroy,
|
||||
sizeof(struct spdk_iscsi_poll_group), "iscsi_tgt");
|
||||
|
||||
/* Create threads for CPU cores active for this application, and send a
|
||||
@ -1296,7 +1296,7 @@ initialize_iscsi_poll_group(void)
|
||||
*/
|
||||
g_init_thread = spdk_get_thread();
|
||||
assert(g_init_thread != NULL);
|
||||
assert(g_spdk_iscsi.refcnt == 0);
|
||||
assert(g_iscsi.refcnt == 0);
|
||||
|
||||
SPDK_ENV_FOREACH_CORE(i) {
|
||||
spdk_cpuset_zero(&tmp_cpumask);
|
||||
@ -1306,7 +1306,7 @@ initialize_iscsi_poll_group(void)
|
||||
thread = spdk_thread_create(thread_name, &tmp_cpumask);
|
||||
assert(thread != NULL);
|
||||
|
||||
g_spdk_iscsi.refcnt++;
|
||||
g_iscsi.refcnt++;
|
||||
spdk_thread_send_msg(thread, _iscsi_init_thread, NULL);
|
||||
}
|
||||
}
|
||||
@ -1322,8 +1322,8 @@ iscsi_parse_globals(void)
|
||||
return rc;
|
||||
}
|
||||
|
||||
g_spdk_iscsi.session = calloc(1, sizeof(struct spdk_iscsi_sess *) * g_spdk_iscsi.MaxSessions);
|
||||
if (!g_spdk_iscsi.session) {
|
||||
g_iscsi.session = calloc(1, sizeof(struct spdk_iscsi_sess *) * g_iscsi.MaxSessions);
|
||||
if (!g_iscsi.session) {
|
||||
SPDK_ERRLOG("calloc() failed for session array\n");
|
||||
return -1;
|
||||
}
|
||||
@ -1334,21 +1334,21 @@ iscsi_parse_globals(void)
|
||||
* handling for low resource conditions from our various buffer
|
||||
* pools, we can bump this up to support more connections.
|
||||
*/
|
||||
g_spdk_iscsi.MaxConnections = g_spdk_iscsi.MaxSessions;
|
||||
g_iscsi.MaxConnections = g_iscsi.MaxSessions;
|
||||
|
||||
rc = iscsi_initialize_all_pools();
|
||||
if (rc != 0) {
|
||||
SPDK_ERRLOG("spdk_initialize_all_pools() failed\n");
|
||||
free(g_spdk_iscsi.session);
|
||||
g_spdk_iscsi.session = NULL;
|
||||
free(g_iscsi.session);
|
||||
g_iscsi.session = NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
rc = spdk_initialize_iscsi_conns();
|
||||
if (rc < 0) {
|
||||
SPDK_ERRLOG("spdk_initialize_iscsi_conns() failed\n");
|
||||
free(g_spdk_iscsi.session);
|
||||
g_spdk_iscsi.session = NULL;
|
||||
free(g_iscsi.session);
|
||||
g_iscsi.session = NULL;
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -1391,10 +1391,10 @@ spdk_iscsi_fini(spdk_iscsi_fini_cb cb_fn, void *cb_arg)
|
||||
static void
|
||||
iscsi_fini_done(void *io_device)
|
||||
{
|
||||
free(g_spdk_iscsi.authfile);
|
||||
free(g_spdk_iscsi.nodebase);
|
||||
free(g_iscsi.authfile);
|
||||
free(g_iscsi.nodebase);
|
||||
|
||||
pthread_mutex_destroy(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_destroy(&g_iscsi.mutex);
|
||||
g_fini_cb_fn(g_fini_cb_arg);
|
||||
}
|
||||
|
||||
@ -1403,16 +1403,16 @@ _iscsi_fini_dev_unreg(struct spdk_io_channel_iter *i, int status)
|
||||
{
|
||||
iscsi_check_pools();
|
||||
iscsi_free_pools();
|
||||
free(g_spdk_iscsi.session);
|
||||
free(g_iscsi.session);
|
||||
|
||||
assert(TAILQ_EMPTY(&g_spdk_iscsi.poll_group_head));
|
||||
assert(TAILQ_EMPTY(&g_iscsi.poll_group_head));
|
||||
|
||||
spdk_iscsi_shutdown_tgt_nodes();
|
||||
spdk_iscsi_init_grps_destroy();
|
||||
spdk_iscsi_portal_grps_destroy();
|
||||
iscsi_auth_groups_destroy();
|
||||
|
||||
spdk_io_device_unregister(&g_spdk_iscsi, iscsi_fini_done);
|
||||
spdk_io_device_unregister(&g_iscsi, iscsi_fini_done);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1424,9 +1424,9 @@ _iscsi_fini_thread(struct spdk_io_channel_iter *i)
|
||||
ch = spdk_io_channel_iter_get_channel(i);
|
||||
pg = spdk_io_channel_get_ctx(ch);
|
||||
|
||||
pthread_mutex_lock(&g_spdk_iscsi.mutex);
|
||||
TAILQ_REMOVE(&g_spdk_iscsi.poll_group_head, pg, link);
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_lock(&g_iscsi.mutex);
|
||||
TAILQ_REMOVE(&g_iscsi.poll_group_head, pg, link);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
|
||||
spdk_put_io_channel(ch);
|
||||
|
||||
@ -1436,7 +1436,7 @@ _iscsi_fini_thread(struct spdk_io_channel_iter *i)
|
||||
void
|
||||
spdk_shutdown_iscsi_conns_done(void)
|
||||
{
|
||||
spdk_for_each_channel(&g_spdk_iscsi, _iscsi_fini_thread, NULL, _iscsi_fini_dev_unreg);
|
||||
spdk_for_each_channel(&g_iscsi, _iscsi_fini_thread, NULL, _iscsi_fini_dev_unreg);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1453,35 +1453,35 @@ spdk_iscsi_opts_info_json(struct spdk_json_write_ctx *w)
|
||||
{
|
||||
spdk_json_write_object_begin(w);
|
||||
|
||||
if (g_spdk_iscsi.authfile != NULL) {
|
||||
spdk_json_write_named_string(w, "auth_file", g_spdk_iscsi.authfile);
|
||||
if (g_iscsi.authfile != NULL) {
|
||||
spdk_json_write_named_string(w, "auth_file", g_iscsi.authfile);
|
||||
}
|
||||
spdk_json_write_named_string(w, "node_base", g_spdk_iscsi.nodebase);
|
||||
spdk_json_write_named_string(w, "node_base", g_iscsi.nodebase);
|
||||
|
||||
spdk_json_write_named_uint32(w, "max_sessions", g_spdk_iscsi.MaxSessions);
|
||||
spdk_json_write_named_uint32(w, "max_sessions", g_iscsi.MaxSessions);
|
||||
spdk_json_write_named_uint32(w, "max_connections_per_session",
|
||||
g_spdk_iscsi.MaxConnectionsPerSession);
|
||||
g_iscsi.MaxConnectionsPerSession);
|
||||
|
||||
spdk_json_write_named_uint32(w, "max_queue_depth", g_spdk_iscsi.MaxQueueDepth);
|
||||
spdk_json_write_named_uint32(w, "max_queue_depth", g_iscsi.MaxQueueDepth);
|
||||
|
||||
spdk_json_write_named_uint32(w, "default_time2wait", g_spdk_iscsi.DefaultTime2Wait);
|
||||
spdk_json_write_named_uint32(w, "default_time2retain", g_spdk_iscsi.DefaultTime2Retain);
|
||||
spdk_json_write_named_uint32(w, "default_time2wait", g_iscsi.DefaultTime2Wait);
|
||||
spdk_json_write_named_uint32(w, "default_time2retain", g_iscsi.DefaultTime2Retain);
|
||||
|
||||
spdk_json_write_named_uint32(w, "first_burst_length", g_spdk_iscsi.FirstBurstLength);
|
||||
spdk_json_write_named_uint32(w, "first_burst_length", g_iscsi.FirstBurstLength);
|
||||
|
||||
spdk_json_write_named_bool(w, "immediate_data", g_spdk_iscsi.ImmediateData);
|
||||
spdk_json_write_named_bool(w, "immediate_data", g_iscsi.ImmediateData);
|
||||
|
||||
spdk_json_write_named_bool(w, "allow_duplicated_isid", g_spdk_iscsi.AllowDuplicateIsid);
|
||||
spdk_json_write_named_bool(w, "allow_duplicated_isid", g_iscsi.AllowDuplicateIsid);
|
||||
|
||||
spdk_json_write_named_uint32(w, "error_recovery_level", g_spdk_iscsi.ErrorRecoveryLevel);
|
||||
spdk_json_write_named_uint32(w, "error_recovery_level", g_iscsi.ErrorRecoveryLevel);
|
||||
|
||||
spdk_json_write_named_int32(w, "nop_timeout", g_spdk_iscsi.timeout);
|
||||
spdk_json_write_named_int32(w, "nop_in_interval", g_spdk_iscsi.nopininterval);
|
||||
spdk_json_write_named_int32(w, "nop_timeout", g_iscsi.timeout);
|
||||
spdk_json_write_named_int32(w, "nop_in_interval", g_iscsi.nopininterval);
|
||||
|
||||
spdk_json_write_named_bool(w, "disable_chap", g_spdk_iscsi.disable_chap);
|
||||
spdk_json_write_named_bool(w, "require_chap", g_spdk_iscsi.require_chap);
|
||||
spdk_json_write_named_bool(w, "mutual_chap", g_spdk_iscsi.mutual_chap);
|
||||
spdk_json_write_named_int32(w, "chap_group", g_spdk_iscsi.chap_group);
|
||||
spdk_json_write_named_bool(w, "disable_chap", g_iscsi.disable_chap);
|
||||
spdk_json_write_named_bool(w, "require_chap", g_iscsi.require_chap);
|
||||
spdk_json_write_named_bool(w, "mutual_chap", g_iscsi.mutual_chap);
|
||||
spdk_json_write_named_int32(w, "chap_group", g_iscsi.chap_group);
|
||||
|
||||
spdk_json_write_object_end(w);
|
||||
}
|
||||
@ -1534,7 +1534,7 @@ spdk_iscsi_auth_groups_info_json(struct spdk_json_write_ctx *w)
|
||||
{
|
||||
struct spdk_iscsi_auth_group *group;
|
||||
|
||||
TAILQ_FOREACH(group, &g_spdk_iscsi.auth_group_head, tailq) {
|
||||
TAILQ_FOREACH(group, &g_iscsi.auth_group_head, tailq) {
|
||||
iscsi_auth_group_info_json(group, w);
|
||||
}
|
||||
}
|
||||
@ -1544,7 +1544,7 @@ iscsi_auth_groups_config_json(struct spdk_json_write_ctx *w)
|
||||
{
|
||||
struct spdk_iscsi_auth_group *group;
|
||||
|
||||
TAILQ_FOREACH(group, &g_spdk_iscsi.auth_group_head, tailq) {
|
||||
TAILQ_FOREACH(group, &g_iscsi.auth_group_head, tailq) {
|
||||
iscsi_auth_group_config_json(group, w);
|
||||
}
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ iscsi_portal_find_by_addr(const char *host, const char *port)
|
||||
{
|
||||
struct spdk_iscsi_portal *p;
|
||||
|
||||
TAILQ_FOREACH(p, &g_spdk_iscsi.portal_head, g_tailq) {
|
||||
TAILQ_FOREACH(p, &g_iscsi.portal_head, g_tailq) {
|
||||
if (!strcmp(p->host, host) && !strcmp(p->port, port)) {
|
||||
return p;
|
||||
}
|
||||
@ -136,16 +136,16 @@ spdk_iscsi_portal_create(const char *host, const char *port)
|
||||
p->group = NULL; /* set at a later time by caller */
|
||||
p->acceptor_poller = NULL;
|
||||
|
||||
pthread_mutex_lock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_lock(&g_iscsi.mutex);
|
||||
tmp = iscsi_portal_find_by_addr(host, port);
|
||||
if (tmp != NULL) {
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
SPDK_ERRLOG("portal (%s, %s) already exists\n", host, port);
|
||||
goto error_out;
|
||||
}
|
||||
|
||||
TAILQ_INSERT_TAIL(&g_spdk_iscsi.portal_head, p, g_tailq);
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
TAILQ_INSERT_TAIL(&g_iscsi.portal_head, p, g_tailq);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
|
||||
return p;
|
||||
|
||||
@ -162,9 +162,9 @@ spdk_iscsi_portal_destroy(struct spdk_iscsi_portal *p)
|
||||
|
||||
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "spdk_iscsi_portal_destroy\n");
|
||||
|
||||
pthread_mutex_lock(&g_spdk_iscsi.mutex);
|
||||
TAILQ_REMOVE(&g_spdk_iscsi.portal_head, p, g_tailq);
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_lock(&g_iscsi.mutex);
|
||||
TAILQ_REMOVE(&g_iscsi.portal_head, p, g_tailq);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
|
||||
free(p);
|
||||
|
||||
@ -298,12 +298,12 @@ spdk_iscsi_portal_grp_create(int tag)
|
||||
pg->ref = 0;
|
||||
pg->tag = tag;
|
||||
|
||||
pthread_mutex_lock(&g_spdk_iscsi.mutex);
|
||||
pg->disable_chap = g_spdk_iscsi.disable_chap;
|
||||
pg->require_chap = g_spdk_iscsi.require_chap;
|
||||
pg->mutual_chap = g_spdk_iscsi.mutual_chap;
|
||||
pg->chap_group = g_spdk_iscsi.chap_group;
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_lock(&g_iscsi.mutex);
|
||||
pg->disable_chap = g_iscsi.disable_chap;
|
||||
pg->require_chap = g_iscsi.require_chap;
|
||||
pg->mutual_chap = g_iscsi.mutual_chap;
|
||||
pg->chap_group = g_iscsi.chap_group;
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
|
||||
TAILQ_INIT(&pg->head);
|
||||
|
||||
@ -334,13 +334,13 @@ spdk_iscsi_portal_grp_register(struct spdk_iscsi_portal_grp *pg)
|
||||
|
||||
assert(pg != NULL);
|
||||
|
||||
pthread_mutex_lock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_lock(&g_iscsi.mutex);
|
||||
tmp = spdk_iscsi_portal_grp_find_by_tag(pg->tag);
|
||||
if (tmp == NULL) {
|
||||
TAILQ_INSERT_TAIL(&g_spdk_iscsi.pg_head, pg, tailq);
|
||||
TAILQ_INSERT_TAIL(&g_iscsi.pg_head, pg, tailq);
|
||||
rc = 0;
|
||||
}
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -441,7 +441,7 @@ spdk_iscsi_portal_grp_find_by_tag(int tag)
|
||||
{
|
||||
struct spdk_iscsi_portal_grp *pg;
|
||||
|
||||
TAILQ_FOREACH(pg, &g_spdk_iscsi.pg_head, tailq) {
|
||||
TAILQ_FOREACH(pg, &g_iscsi.pg_head, tailq) {
|
||||
if (pg->tag == tag) {
|
||||
return pg;
|
||||
}
|
||||
@ -482,15 +482,15 @@ spdk_iscsi_portal_grps_destroy(void)
|
||||
struct spdk_iscsi_portal_grp *pg;
|
||||
|
||||
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "spdk_iscsi_portal_grps_destroy\n");
|
||||
pthread_mutex_lock(&g_spdk_iscsi.mutex);
|
||||
while (!TAILQ_EMPTY(&g_spdk_iscsi.pg_head)) {
|
||||
pg = TAILQ_FIRST(&g_spdk_iscsi.pg_head);
|
||||
TAILQ_REMOVE(&g_spdk_iscsi.pg_head, pg, tailq);
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_lock(&g_iscsi.mutex);
|
||||
while (!TAILQ_EMPTY(&g_iscsi.pg_head)) {
|
||||
pg = TAILQ_FIRST(&g_iscsi.pg_head);
|
||||
TAILQ_REMOVE(&g_iscsi.pg_head, pg, tailq);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
spdk_iscsi_portal_grp_destroy(pg);
|
||||
pthread_mutex_lock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_lock(&g_iscsi.mutex);
|
||||
}
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
}
|
||||
|
||||
int
|
||||
@ -524,11 +524,11 @@ spdk_iscsi_portal_grp_close_all(void)
|
||||
struct spdk_iscsi_portal_grp *pg;
|
||||
|
||||
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "spdk_iscsi_portal_grp_close_all\n");
|
||||
pthread_mutex_lock(&g_spdk_iscsi.mutex);
|
||||
TAILQ_FOREACH(pg, &g_spdk_iscsi.pg_head, tailq) {
|
||||
pthread_mutex_lock(&g_iscsi.mutex);
|
||||
TAILQ_FOREACH(pg, &g_iscsi.pg_head, tailq) {
|
||||
iscsi_portal_grp_close(pg);
|
||||
}
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
}
|
||||
|
||||
struct spdk_iscsi_portal_grp *
|
||||
@ -536,15 +536,15 @@ spdk_iscsi_portal_grp_unregister(int tag)
|
||||
{
|
||||
struct spdk_iscsi_portal_grp *pg;
|
||||
|
||||
pthread_mutex_lock(&g_spdk_iscsi.mutex);
|
||||
TAILQ_FOREACH(pg, &g_spdk_iscsi.pg_head, tailq) {
|
||||
pthread_mutex_lock(&g_iscsi.mutex);
|
||||
TAILQ_FOREACH(pg, &g_iscsi.pg_head, tailq) {
|
||||
if (pg->tag == tag) {
|
||||
TAILQ_REMOVE(&g_spdk_iscsi.pg_head, pg, tailq);
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
TAILQ_REMOVE(&g_iscsi.pg_head, pg, tailq);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
return pg;
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -586,7 +586,7 @@ spdk_iscsi_portal_grps_config_text(FILE *fp)
|
||||
fprintf(fp, "%s", portal_group_section);
|
||||
|
||||
/* Dump portal groups */
|
||||
TAILQ_FOREACH(pg, &g_spdk_iscsi.pg_head, tailq) {
|
||||
TAILQ_FOREACH(pg, &g_iscsi.pg_head, tailq) {
|
||||
if (NULL == pg) { continue; }
|
||||
fprintf(fp, PORTAL_GROUP_TMPL, pg->tag, pg->tag);
|
||||
/* Dump portals */
|
||||
@ -640,7 +640,7 @@ spdk_iscsi_portal_grps_info_json(struct spdk_json_write_ctx *w)
|
||||
{
|
||||
struct spdk_iscsi_portal_grp *pg;
|
||||
|
||||
TAILQ_FOREACH(pg, &g_spdk_iscsi.pg_head, tailq) {
|
||||
TAILQ_FOREACH(pg, &g_iscsi.pg_head, tailq) {
|
||||
iscsi_portal_grp_info_json(pg, w);
|
||||
}
|
||||
}
|
||||
@ -650,7 +650,7 @@ spdk_iscsi_portal_grps_config_json(struct spdk_json_write_ctx *w)
|
||||
{
|
||||
struct spdk_iscsi_portal_grp *pg;
|
||||
|
||||
TAILQ_FOREACH(pg, &g_spdk_iscsi.pg_head, tailq) {
|
||||
TAILQ_FOREACH(pg, &g_iscsi.pg_head, tailq) {
|
||||
iscsi_portal_grp_config_json(pg, w);
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ iscsi_task_free(struct spdk_scsi_task *scsi_task)
|
||||
spdk_iscsi_task_disassociate_pdu(task);
|
||||
assert(task->conn->pending_task_cnt > 0);
|
||||
task->conn->pending_task_cnt--;
|
||||
spdk_mempool_put(g_spdk_iscsi.task_pool, (void *)task);
|
||||
spdk_mempool_put(g_iscsi.task_pool, (void *)task);
|
||||
}
|
||||
|
||||
struct spdk_iscsi_task *
|
||||
@ -64,7 +64,7 @@ spdk_iscsi_task_get(struct spdk_iscsi_conn *conn, struct spdk_iscsi_task *parent
|
||||
{
|
||||
struct spdk_iscsi_task *task;
|
||||
|
||||
task = spdk_mempool_get(g_spdk_iscsi.task_pool);
|
||||
task = spdk_mempool_get(g_iscsi.task_pool);
|
||||
if (!task) {
|
||||
SPDK_ERRLOG("Unable to get task\n");
|
||||
abort();
|
||||
|
@ -330,8 +330,8 @@ spdk_iscsi_send_tgts(struct spdk_iscsi_conn *conn, const char *iiqn,
|
||||
return total;
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&g_spdk_iscsi.mutex);
|
||||
TAILQ_FOREACH(target, &g_spdk_iscsi.target_head, tailq) {
|
||||
pthread_mutex_lock(&g_iscsi.mutex);
|
||||
TAILQ_FOREACH(target, &g_iscsi.target_head, tailq) {
|
||||
if (strcasecmp(tiqn, "ALL") != 0
|
||||
&& strcasecmp(tiqn, target->name) != 0) {
|
||||
continue;
|
||||
@ -351,7 +351,7 @@ spdk_iscsi_send_tgts(struct spdk_iscsi_conn *conn, const char *iiqn,
|
||||
pg = pg_map->pg;
|
||||
TAILQ_FOREACH(p, &pg->head, per_pg_tailq) {
|
||||
if (alloc_len - total < 1) {
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
SPDK_ERRLOG("data space small %d\n", alloc_len);
|
||||
return total;
|
||||
}
|
||||
@ -383,7 +383,7 @@ spdk_iscsi_send_tgts(struct spdk_iscsi_conn *conn, const char *iiqn,
|
||||
}
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
|
||||
return total;
|
||||
}
|
||||
@ -396,7 +396,7 @@ spdk_iscsi_find_tgt_node(const char *target_name)
|
||||
if (target_name == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
TAILQ_FOREACH(target, &g_spdk_iscsi.target_head, tailq) {
|
||||
TAILQ_FOREACH(target, &g_iscsi.target_head, tailq) {
|
||||
if (strcasecmp(target_name, target->name) == 0) {
|
||||
return target;
|
||||
}
|
||||
@ -408,16 +408,16 @@ spdk_iscsi_find_tgt_node(const char *target_name)
|
||||
static int
|
||||
iscsi_tgt_node_register(struct spdk_iscsi_tgt_node *target)
|
||||
{
|
||||
pthread_mutex_lock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_lock(&g_iscsi.mutex);
|
||||
|
||||
if (spdk_iscsi_find_tgt_node(target->name) != NULL) {
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
return -EEXIST;
|
||||
}
|
||||
|
||||
TAILQ_INSERT_TAIL(&g_spdk_iscsi.target_head, target, tailq);
|
||||
TAILQ_INSERT_TAIL(&g_iscsi.target_head, target, tailq);
|
||||
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -426,9 +426,9 @@ iscsi_tgt_node_unregister(struct spdk_iscsi_tgt_node *target)
|
||||
{
|
||||
struct spdk_iscsi_tgt_node *t;
|
||||
|
||||
TAILQ_FOREACH(t, &g_spdk_iscsi.target_head, tailq) {
|
||||
TAILQ_FOREACH(t, &g_iscsi.target_head, tailq) {
|
||||
if (t == target) {
|
||||
TAILQ_REMOVE(&g_spdk_iscsi.target_head, t, tailq);
|
||||
TAILQ_REMOVE(&g_iscsi.target_head, t, tailq);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -638,9 +638,9 @@ _iscsi_tgt_node_destruct(void *cb_arg, int rc)
|
||||
return;
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_lock(&g_iscsi.mutex);
|
||||
iscsi_tgt_node_delete_all_pg_maps(target);
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
|
||||
pthread_mutex_destroy(&target->mutex);
|
||||
free(target);
|
||||
@ -793,7 +793,7 @@ spdk_iscsi_target_node_add_pg_ig_maps(struct spdk_iscsi_tgt_node *target,
|
||||
uint16_t i;
|
||||
int rc;
|
||||
|
||||
pthread_mutex_lock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_lock(&g_iscsi.mutex);
|
||||
for (i = 0; i < num_maps; i++) {
|
||||
rc = iscsi_tgt_node_add_pg_ig_map(target, pg_tag_list[i],
|
||||
ig_tag_list[i]);
|
||||
@ -802,7 +802,7 @@ spdk_iscsi_target_node_add_pg_ig_maps(struct spdk_iscsi_tgt_node *target,
|
||||
goto invalid;
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
return 0;
|
||||
|
||||
invalid:
|
||||
@ -810,7 +810,7 @@ invalid:
|
||||
iscsi_tgt_node_delete_pg_ig_map(target, pg_tag_list[i - 1],
|
||||
ig_tag_list[i - 1]);
|
||||
}
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -821,7 +821,7 @@ spdk_iscsi_target_node_remove_pg_ig_maps(struct spdk_iscsi_tgt_node *target,
|
||||
uint16_t i;
|
||||
int rc;
|
||||
|
||||
pthread_mutex_lock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_lock(&g_iscsi.mutex);
|
||||
for (i = 0; i < num_maps; i++) {
|
||||
rc = iscsi_tgt_node_delete_pg_ig_map(target, pg_tag_list[i],
|
||||
ig_tag_list[i]);
|
||||
@ -830,7 +830,7 @@ spdk_iscsi_target_node_remove_pg_ig_maps(struct spdk_iscsi_tgt_node *target,
|
||||
goto invalid;
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
return 0;
|
||||
|
||||
invalid:
|
||||
@ -842,7 +842,7 @@ invalid:
|
||||
break;
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -947,7 +947,7 @@ struct spdk_iscsi_tgt_node *spdk_iscsi_tgt_node_construct(int target_index,
|
||||
if (strncasecmp(name, "iqn.", 4) != 0
|
||||
&& strncasecmp(name, "eui.", 4) != 0
|
||||
&& strncasecmp(name, "naa.", 4) != 0) {
|
||||
snprintf(fullname, sizeof(fullname), "%s:%s", g_spdk_iscsi.nodebase, name);
|
||||
snprintf(fullname, sizeof(fullname), "%s:%s", g_iscsi.nodebase, name);
|
||||
} else {
|
||||
snprintf(fullname, sizeof(fullname), "%s", name);
|
||||
}
|
||||
@ -1007,12 +1007,12 @@ struct spdk_iscsi_tgt_node *spdk_iscsi_tgt_node_construct(int target_index,
|
||||
target->header_digest = header_digest;
|
||||
target->data_digest = data_digest;
|
||||
|
||||
if (queue_depth > 0 && ((uint32_t)queue_depth <= g_spdk_iscsi.MaxQueueDepth)) {
|
||||
if (queue_depth > 0 && ((uint32_t)queue_depth <= g_iscsi.MaxQueueDepth)) {
|
||||
target->queue_depth = queue_depth;
|
||||
} else {
|
||||
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "QueueDepth %d is invalid and %d is used instead.\n",
|
||||
queue_depth, g_spdk_iscsi.MaxQueueDepth);
|
||||
target->queue_depth = g_spdk_iscsi.MaxQueueDepth;
|
||||
queue_depth, g_iscsi.MaxQueueDepth);
|
||||
target->queue_depth = g_iscsi.MaxQueueDepth;
|
||||
}
|
||||
|
||||
rc = iscsi_tgt_node_register(target);
|
||||
@ -1198,7 +1198,7 @@ iscsi_parse_tgt_node(struct spdk_conf_section *sp)
|
||||
|
||||
val = spdk_conf_section_get_val(sp, "QueueDepth");
|
||||
if (val == NULL) {
|
||||
queue_depth = g_spdk_iscsi.MaxQueueDepth;
|
||||
queue_depth = g_iscsi.MaxQueueDepth;
|
||||
} else {
|
||||
queue_depth = (int) strtol(val, NULL, 10);
|
||||
}
|
||||
@ -1279,18 +1279,18 @@ spdk_iscsi_shutdown_tgt_nodes(void)
|
||||
{
|
||||
struct spdk_iscsi_tgt_node *target;
|
||||
|
||||
pthread_mutex_lock(&g_spdk_iscsi.mutex);
|
||||
while (!TAILQ_EMPTY(&g_spdk_iscsi.target_head)) {
|
||||
target = TAILQ_FIRST(&g_spdk_iscsi.target_head);
|
||||
TAILQ_REMOVE(&g_spdk_iscsi.target_head, target, tailq);
|
||||
pthread_mutex_lock(&g_iscsi.mutex);
|
||||
while (!TAILQ_EMPTY(&g_iscsi.target_head)) {
|
||||
target = TAILQ_FIRST(&g_iscsi.target_head);
|
||||
TAILQ_REMOVE(&g_iscsi.target_head, target, tailq);
|
||||
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
|
||||
iscsi_tgt_node_destruct(target, NULL, NULL);
|
||||
|
||||
pthread_mutex_lock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_lock(&g_iscsi.mutex);
|
||||
}
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1299,17 +1299,17 @@ spdk_iscsi_shutdown_tgt_node_by_name(const char *target_name,
|
||||
{
|
||||
struct spdk_iscsi_tgt_node *target;
|
||||
|
||||
pthread_mutex_lock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_lock(&g_iscsi.mutex);
|
||||
target = spdk_iscsi_find_tgt_node(target_name);
|
||||
if (target != NULL) {
|
||||
iscsi_tgt_node_unregister(target);
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
|
||||
iscsi_tgt_node_destruct(target, cb_fn, cb_arg);
|
||||
|
||||
return;
|
||||
}
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
|
||||
if (cb_fn) {
|
||||
cb_fn(cb_arg, -ENOENT);
|
||||
@ -1358,8 +1358,8 @@ void spdk_iscsi_tgt_node_delete_map(struct spdk_iscsi_portal_grp *portal_group,
|
||||
{
|
||||
struct spdk_iscsi_tgt_node *target;
|
||||
|
||||
pthread_mutex_lock(&g_spdk_iscsi.mutex);
|
||||
TAILQ_FOREACH(target, &g_spdk_iscsi.target_head, tailq) {
|
||||
pthread_mutex_lock(&g_iscsi.mutex);
|
||||
TAILQ_FOREACH(target, &g_iscsi.target_head, tailq) {
|
||||
if (portal_group) {
|
||||
iscsi_tgt_node_delete_pg_map(target, portal_group);
|
||||
}
|
||||
@ -1367,7 +1367,7 @@ void spdk_iscsi_tgt_node_delete_map(struct spdk_iscsi_portal_grp *portal_group,
|
||||
iscsi_tgt_node_delete_ig_maps(target, initiator_group);
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&g_spdk_iscsi.mutex);
|
||||
pthread_mutex_unlock(&g_iscsi.mutex);
|
||||
}
|
||||
|
||||
int
|
||||
@ -1461,7 +1461,7 @@ spdk_iscsi_tgt_nodes_config_text(FILE *fp)
|
||||
/* Create target nodes section */
|
||||
fprintf(fp, "%s", target_nodes_section);
|
||||
|
||||
TAILQ_FOREACH(target, &g_spdk_iscsi.target_head, tailq) {
|
||||
TAILQ_FOREACH(target, &g_iscsi.target_head, tailq) {
|
||||
int idx;
|
||||
const char *authmethod = "None";
|
||||
char authgroup[32] = "None";
|
||||
@ -1593,7 +1593,7 @@ spdk_iscsi_tgt_nodes_info_json(struct spdk_json_write_ctx *w)
|
||||
{
|
||||
struct spdk_iscsi_tgt_node *target;
|
||||
|
||||
TAILQ_FOREACH(target, &g_spdk_iscsi.target_head, tailq) {
|
||||
TAILQ_FOREACH(target, &g_iscsi.target_head, tailq) {
|
||||
iscsi_tgt_node_info_json(target, w);
|
||||
}
|
||||
}
|
||||
@ -1603,7 +1603,7 @@ spdk_iscsi_tgt_nodes_config_json(struct spdk_json_write_ctx *w)
|
||||
{
|
||||
struct spdk_iscsi_tgt_node *target;
|
||||
|
||||
TAILQ_FOREACH(target, &g_spdk_iscsi.target_head, tailq) {
|
||||
TAILQ_FOREACH(target, &g_iscsi.target_head, tailq) {
|
||||
iscsi_tgt_node_config_json(target, w);
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ struct spdk_scsi_lun {
|
||||
uint8_t reserved;
|
||||
};
|
||||
|
||||
struct spdk_iscsi_globals g_spdk_iscsi;
|
||||
struct spdk_iscsi_globals g_iscsi;
|
||||
static TAILQ_HEAD(read_tasks_head, spdk_iscsi_task) g_ut_read_tasks =
|
||||
TAILQ_HEAD_INITIALIZER(g_ut_read_tasks);
|
||||
static struct spdk_iscsi_task *g_new_task = NULL;
|
||||
|
@ -40,14 +40,14 @@
|
||||
|
||||
SPDK_LOG_REGISTER_COMPONENT("iscsi", SPDK_LOG_ISCSI)
|
||||
|
||||
struct spdk_iscsi_globals g_spdk_iscsi;
|
||||
struct spdk_iscsi_globals g_iscsi;
|
||||
|
||||
const char *config_file;
|
||||
|
||||
static int
|
||||
test_setup(void)
|
||||
{
|
||||
TAILQ_INIT(&g_spdk_iscsi.ig_head);
|
||||
TAILQ_INIT(&g_iscsi.ig_head);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -229,9 +229,9 @@ op_login_session_normal_test(void)
|
||||
CU_ASSERT(rsph->status_detail == ISCSI_LOGIN_CONN_ADD_FAIL);
|
||||
|
||||
/* expect failure: session found while tag is wrong */
|
||||
g_spdk_iscsi.MaxSessions = UT_ISCSI_TSIH * 2;
|
||||
g_spdk_iscsi.session = calloc(1, sizeof(void *) * g_spdk_iscsi.MaxSessions);
|
||||
g_spdk_iscsi.session[UT_ISCSI_TSIH - 1] = &sess;
|
||||
g_iscsi.MaxSessions = UT_ISCSI_TSIH * 2;
|
||||
g_iscsi.session = calloc(1, sizeof(void *) * g_iscsi.MaxSessions);
|
||||
g_iscsi.session[UT_ISCSI_TSIH - 1] = &sess;
|
||||
sess.tsih = UT_ISCSI_TSIH;
|
||||
rsph->tsih = UT_ISCSI_TSIH >> 8; /* to append the session */
|
||||
sess.tag = 1;
|
||||
@ -244,19 +244,19 @@ op_login_session_normal_test(void)
|
||||
|
||||
/* expect suceess: drop the session */
|
||||
rsph->tsih = 0; /* to create the session */
|
||||
g_spdk_iscsi.AllowDuplicateIsid = false;
|
||||
g_iscsi.AllowDuplicateIsid = false;
|
||||
rc = iscsi_op_login_session_normal(&conn, &rsp_pdu, UT_INITIATOR_NAME1,
|
||||
¶m, 0);
|
||||
CU_ASSERT(rc == 0);
|
||||
|
||||
/* expect suceess: create the session */
|
||||
rsph->tsih = 0; /* to create the session */
|
||||
g_spdk_iscsi.AllowDuplicateIsid = true;
|
||||
g_iscsi.AllowDuplicateIsid = true;
|
||||
rc = iscsi_op_login_session_normal(&conn, &rsp_pdu, UT_INITIATOR_NAME1,
|
||||
¶m, 0);
|
||||
CU_ASSERT(rc == 0);
|
||||
|
||||
free(g_spdk_iscsi.session);
|
||||
free(g_iscsi.session);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
#include "spdk_internal/mock.h"
|
||||
|
||||
struct spdk_iscsi_globals g_spdk_iscsi;
|
||||
struct spdk_iscsi_globals g_iscsi;
|
||||
|
||||
DEFINE_STUB(spdk_iscsi_find_tgt_node, struct spdk_iscsi_tgt_node *,
|
||||
(const char *target_name), NULL);
|
||||
|
@ -49,14 +49,14 @@ DEFINE_STUB(spdk_iscsi_conn_construct, int,
|
||||
(struct spdk_iscsi_portal *portal, struct spdk_sock *sock),
|
||||
0);
|
||||
|
||||
struct spdk_iscsi_globals g_spdk_iscsi;
|
||||
struct spdk_iscsi_globals g_iscsi;
|
||||
|
||||
static int
|
||||
test_setup(void)
|
||||
{
|
||||
TAILQ_INIT(&g_spdk_iscsi.portal_head);
|
||||
TAILQ_INIT(&g_spdk_iscsi.pg_head);
|
||||
pthread_mutex_init(&g_spdk_iscsi.mutex, NULL);
|
||||
TAILQ_INIT(&g_iscsi.portal_head);
|
||||
TAILQ_INIT(&g_iscsi.pg_head);
|
||||
pthread_mutex_init(&g_iscsi.mutex, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -72,7 +72,7 @@ portal_create_ipv4_normal_case(void)
|
||||
CU_ASSERT(p != NULL);
|
||||
|
||||
spdk_iscsi_portal_destroy(p);
|
||||
CU_ASSERT(TAILQ_EMPTY(&g_spdk_iscsi.portal_head));
|
||||
CU_ASSERT(TAILQ_EMPTY(&g_iscsi.portal_head));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -87,7 +87,7 @@ portal_create_ipv6_normal_case(void)
|
||||
CU_ASSERT(p != NULL);
|
||||
|
||||
spdk_iscsi_portal_destroy(p);
|
||||
CU_ASSERT(TAILQ_EMPTY(&g_spdk_iscsi.portal_head));
|
||||
CU_ASSERT(TAILQ_EMPTY(&g_iscsi.portal_head));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -102,7 +102,7 @@ portal_create_ipv4_wildcard_case(void)
|
||||
CU_ASSERT(p != NULL);
|
||||
|
||||
spdk_iscsi_portal_destroy(p);
|
||||
CU_ASSERT(TAILQ_EMPTY(&g_spdk_iscsi.portal_head));
|
||||
CU_ASSERT(TAILQ_EMPTY(&g_iscsi.portal_head));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -117,7 +117,7 @@ portal_create_ipv6_wildcard_case(void)
|
||||
CU_ASSERT(p != NULL);
|
||||
|
||||
spdk_iscsi_portal_destroy(p);
|
||||
CU_ASSERT(TAILQ_EMPTY(&g_spdk_iscsi.portal_head));
|
||||
CU_ASSERT(TAILQ_EMPTY(&g_iscsi.portal_head));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -135,7 +135,7 @@ portal_create_twice_case(void)
|
||||
CU_ASSERT(p2 == NULL);
|
||||
|
||||
spdk_iscsi_portal_destroy(p1);
|
||||
CU_ASSERT(TAILQ_EMPTY(&g_spdk_iscsi.portal_head));
|
||||
CU_ASSERT(TAILQ_EMPTY(&g_iscsi.portal_head));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -154,7 +154,7 @@ parse_portal_ipv4_normal_case(void)
|
||||
CU_ASSERT(strcmp(p->port, port_str) == 0);
|
||||
|
||||
spdk_iscsi_portal_destroy(p);
|
||||
CU_ASSERT(TAILQ_EMPTY(&g_spdk_iscsi.portal_head));
|
||||
CU_ASSERT(TAILQ_EMPTY(&g_iscsi.portal_head));
|
||||
|
||||
}
|
||||
|
||||
@ -174,7 +174,7 @@ parse_portal_ipv6_normal_case(void)
|
||||
CU_ASSERT(strcmp(p->port, port_str) == 0);
|
||||
|
||||
spdk_iscsi_portal_destroy(p);
|
||||
CU_ASSERT(TAILQ_EMPTY(&g_spdk_iscsi.portal_head));
|
||||
CU_ASSERT(TAILQ_EMPTY(&g_iscsi.portal_head));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -193,7 +193,7 @@ parse_portal_ipv4_skip_port_case(void)
|
||||
CU_ASSERT(strcmp(p->port, port_str) == 0);
|
||||
|
||||
spdk_iscsi_portal_destroy(p);
|
||||
CU_ASSERT(TAILQ_EMPTY(&g_spdk_iscsi.portal_head));
|
||||
CU_ASSERT(TAILQ_EMPTY(&g_iscsi.portal_head));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -212,7 +212,7 @@ parse_portal_ipv6_skip_port_case(void)
|
||||
CU_ASSERT(strcmp(p->port, port_str) == 0);
|
||||
|
||||
spdk_iscsi_portal_destroy(p);
|
||||
CU_ASSERT(TAILQ_EMPTY(&g_spdk_iscsi.portal_head));
|
||||
CU_ASSERT(TAILQ_EMPTY(&g_iscsi.portal_head));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -239,11 +239,11 @@ portal_grp_register_unregister_case(void)
|
||||
CU_ASSERT(pg2 != NULL);
|
||||
CU_ASSERT(pg1 == pg2);
|
||||
|
||||
CU_ASSERT(TAILQ_EMPTY(&g_spdk_iscsi.pg_head));
|
||||
CU_ASSERT(TAILQ_EMPTY(&g_iscsi.pg_head));
|
||||
|
||||
spdk_iscsi_portal_grp_destroy(pg1);
|
||||
|
||||
CU_ASSERT(TAILQ_EMPTY(&g_spdk_iscsi.portal_head));
|
||||
CU_ASSERT(TAILQ_EMPTY(&g_iscsi.portal_head));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -273,11 +273,11 @@ portal_grp_register_twice_case(void)
|
||||
CU_ASSERT(pg2 != NULL);
|
||||
CU_ASSERT(pg1 == pg2);
|
||||
|
||||
CU_ASSERT(TAILQ_EMPTY(&g_spdk_iscsi.pg_head));
|
||||
CU_ASSERT(TAILQ_EMPTY(&g_iscsi.pg_head));
|
||||
|
||||
spdk_iscsi_portal_grp_destroy(pg1);
|
||||
|
||||
CU_ASSERT(TAILQ_EMPTY(&g_spdk_iscsi.portal_head));
|
||||
CU_ASSERT(TAILQ_EMPTY(&g_iscsi.portal_head));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -320,8 +320,8 @@ portal_grp_add_delete_case(void)
|
||||
|
||||
poll_thread(0);
|
||||
|
||||
CU_ASSERT(TAILQ_EMPTY(&g_spdk_iscsi.portal_head));
|
||||
CU_ASSERT(TAILQ_EMPTY(&g_spdk_iscsi.pg_head));
|
||||
CU_ASSERT(TAILQ_EMPTY(&g_iscsi.portal_head));
|
||||
CU_ASSERT(TAILQ_EMPTY(&g_iscsi.pg_head));
|
||||
|
||||
free_threads();
|
||||
}
|
||||
@ -379,8 +379,8 @@ portal_grp_add_delete_twice_case(void)
|
||||
|
||||
spdk_iscsi_portal_grps_destroy();
|
||||
|
||||
CU_ASSERT(TAILQ_EMPTY(&g_spdk_iscsi.portal_head));
|
||||
CU_ASSERT(TAILQ_EMPTY(&g_spdk_iscsi.pg_head));
|
||||
CU_ASSERT(TAILQ_EMPTY(&g_iscsi.portal_head));
|
||||
CU_ASSERT(TAILQ_EMPTY(&g_iscsi.pg_head));
|
||||
|
||||
MOCK_CLEAR_P(spdk_sock_listen);
|
||||
|
||||
|
@ -44,7 +44,7 @@
|
||||
#include "unit/lib/json_mock.c"
|
||||
#include "common/lib/test_env.c"
|
||||
|
||||
struct spdk_iscsi_globals g_spdk_iscsi;
|
||||
struct spdk_iscsi_globals g_iscsi;
|
||||
|
||||
const char *config_file;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user