diff --git a/lib/iscsi/acceptor.c b/lib/iscsi/acceptor.c index 9b13de3097..fad062c26d 100644 --- a/lib/iscsi/acceptor.c +++ b/lib/iscsi/acceptor.c @@ -46,7 +46,7 @@ #define ACCEPT_TIMEOUT_US 1000 /* 1ms */ static int -spdk_iscsi_portal_accept(void *arg) +iscsi_portal_accept(void *arg) { struct spdk_iscsi_portal *portal = arg; struct spdk_sock *sock; @@ -81,7 +81,7 @@ spdk_iscsi_portal_accept(void *arg) void spdk_iscsi_acceptor_start(struct spdk_iscsi_portal *p) { - p->acceptor_poller = spdk_poller_register(spdk_iscsi_portal_accept, p, ACCEPT_TIMEOUT_US); + p->acceptor_poller = spdk_poller_register(iscsi_portal_accept, p, ACCEPT_TIMEOUT_US); } void diff --git a/lib/iscsi/conn.c b/lib/iscsi/conn.c index 7e08fb664f..c30facb5e4 100644 --- a/lib/iscsi/conn.c +++ b/lib/iscsi/conn.c @@ -73,12 +73,12 @@ static pthread_mutex_t g_conns_mutex = PTHREAD_MUTEX_INITIALIZER; static struct spdk_poller *g_shutdown_timer = NULL; -static uint32_t spdk_iscsi_conn_allocate_reactor(const struct spdk_cpuset *cpumask); +static uint32_t iscsi_conn_allocate_reactor(const struct spdk_cpuset *cpumask); -static void spdk_iscsi_conn_full_feature_migrate(void *arg1, void *arg2); -static void spdk_iscsi_conn_stop(struct spdk_iscsi_conn *conn); -static void spdk_iscsi_conn_sock_cb(void *arg, struct spdk_sock_group *group, - struct spdk_sock *sock); +static void iscsi_conn_full_feature_migrate(void *arg1, void *arg2); +static void iscsi_conn_stop(struct spdk_iscsi_conn *conn); +static void iscsi_conn_sock_cb(void *arg, struct spdk_sock_group *group, + struct spdk_sock *sock); static struct spdk_iscsi_conn * allocate_conn(void) @@ -110,7 +110,7 @@ free_conn(struct spdk_iscsi_conn *conn) } static struct spdk_iscsi_conn * -spdk_find_iscsi_connection_by_id(int cid) +find_iscsi_connection_by_id(int cid) { if (g_conns_array[cid].is_valid == 1) { return &g_conns_array[cid]; @@ -177,7 +177,7 @@ err: } static void -spdk_iscsi_poll_group_add_conn_sock(struct spdk_iscsi_conn *conn) +iscsi_poll_group_add_conn_sock(struct spdk_iscsi_conn *conn) { struct spdk_iscsi_poll_group *poll_group; int rc; @@ -186,14 +186,14 @@ spdk_iscsi_poll_group_add_conn_sock(struct spdk_iscsi_conn *conn) poll_group = &g_spdk_iscsi.poll_group[conn->lcore]; - rc = spdk_sock_group_add_sock(poll_group->sock_group, conn->sock, spdk_iscsi_conn_sock_cb, conn); + rc = spdk_sock_group_add_sock(poll_group->sock_group, conn->sock, iscsi_conn_sock_cb, conn); if (rc < 0) { SPDK_ERRLOG("Failed to add sock=%p of conn=%p\n", conn->sock, conn); } } static void -spdk_iscsi_poll_group_remove_conn_sock(struct spdk_iscsi_conn *conn) +iscsi_poll_group_remove_conn_sock(struct spdk_iscsi_conn *conn) { struct spdk_iscsi_poll_group *poll_group; int rc; @@ -209,7 +209,7 @@ spdk_iscsi_poll_group_remove_conn_sock(struct spdk_iscsi_conn *conn) } static void -spdk_iscsi_poll_group_add_conn(struct spdk_iscsi_conn *conn) +iscsi_poll_group_add_conn(struct spdk_iscsi_conn *conn) { struct spdk_iscsi_poll_group *poll_group; @@ -219,11 +219,11 @@ spdk_iscsi_poll_group_add_conn(struct spdk_iscsi_conn *conn) conn->is_stopped = false; STAILQ_INSERT_TAIL(&poll_group->connections, conn, link); - spdk_iscsi_poll_group_add_conn_sock(conn); + iscsi_poll_group_add_conn_sock(conn); } static void -spdk_iscsi_poll_group_remove_conn(struct spdk_iscsi_conn *conn) +iscsi_poll_group_remove_conn(struct spdk_iscsi_conn *conn) { struct spdk_iscsi_poll_group *poll_group; @@ -347,7 +347,7 @@ spdk_iscsi_conn_construct(struct spdk_iscsi_portal *portal, conn->lcore = spdk_env_get_current_core(); __sync_fetch_and_add(&g_num_connections[conn->lcore], 1); - spdk_iscsi_poll_group_add_conn(conn); + iscsi_poll_group_add_conn(conn); return 0; error_return: @@ -380,7 +380,8 @@ spdk_iscsi_conn_free_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pd spdk_put_pdu(pdu); } -static int spdk_iscsi_conn_free_tasks(struct spdk_iscsi_conn *conn) +static int +iscsi_conn_free_tasks(struct spdk_iscsi_conn *conn) { struct spdk_iscsi_pdu *pdu, *tmp_pdu; struct spdk_iscsi_task *iscsi_task, *tmp_iscsi_task; @@ -413,7 +414,7 @@ static int spdk_iscsi_conn_free_tasks(struct spdk_iscsi_conn *conn) } static void -_spdk_iscsi_conn_free(struct spdk_iscsi_conn *conn) +_iscsi_conn_free(struct spdk_iscsi_conn *conn) { if (conn == NULL) { return; @@ -431,7 +432,7 @@ _spdk_iscsi_conn_free(struct spdk_iscsi_conn *conn) } static void -spdk_iscsi_conn_cleanup_backend(struct spdk_iscsi_conn *conn) +iscsi_conn_cleanup_backend(struct spdk_iscsi_conn *conn) { int rc; struct spdk_iscsi_tgt_node *target; @@ -451,7 +452,7 @@ spdk_iscsi_conn_cleanup_backend(struct spdk_iscsi_conn *conn) } static void -spdk_iscsi_conn_free(struct spdk_iscsi_conn *conn) +iscsi_conn_free(struct spdk_iscsi_conn *conn) { struct spdk_iscsi_sess *sess; int idx; @@ -496,53 +497,53 @@ spdk_iscsi_conn_free(struct spdk_iscsi_conn *conn) end: SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "cleanup free conn\n"); - _spdk_iscsi_conn_free(conn); + _iscsi_conn_free(conn); pthread_mutex_unlock(&g_conns_mutex); } static int -_spdk_iscsi_conn_check_shutdown(void *arg) +_iscsi_conn_check_shutdown(void *arg) { struct spdk_iscsi_conn *conn = arg; int rc; - rc = spdk_iscsi_conn_free_tasks(conn); + rc = iscsi_conn_free_tasks(conn); if (rc < 0) { return 1; } spdk_poller_unregister(&conn->shutdown_timer); - spdk_iscsi_conn_stop(conn); - spdk_iscsi_conn_free(conn); + iscsi_conn_stop(conn); + iscsi_conn_free(conn); return 1; } static void -_spdk_iscsi_conn_destruct(struct spdk_iscsi_conn *conn) +_iscsi_conn_destruct(struct spdk_iscsi_conn *conn) { int rc; spdk_clear_all_transfer_task(conn, NULL, NULL); - spdk_iscsi_poll_group_remove_conn_sock(conn); + iscsi_poll_group_remove_conn_sock(conn); spdk_sock_close(&conn->sock); spdk_poller_unregister(&conn->logout_timer); spdk_poller_unregister(&conn->flush_poller); - rc = spdk_iscsi_conn_free_tasks(conn); + rc = iscsi_conn_free_tasks(conn); if (rc < 0) { /* The connection cannot be freed yet. Check back later. */ - conn->shutdown_timer = spdk_poller_register(_spdk_iscsi_conn_check_shutdown, conn, 1000); + conn->shutdown_timer = spdk_poller_register(_iscsi_conn_check_shutdown, conn, 1000); } else { - spdk_iscsi_conn_stop(conn); - spdk_iscsi_conn_free(conn); + iscsi_conn_stop(conn); + iscsi_conn_free(conn); } } static int -_spdk_iscsi_conn_check_pending_tasks(void *arg) +_iscsi_conn_check_pending_tasks(void *arg) { struct spdk_iscsi_conn *conn = arg; @@ -552,7 +553,7 @@ _spdk_iscsi_conn_check_pending_tasks(void *arg) spdk_poller_unregister(&conn->shutdown_timer); - _spdk_iscsi_conn_destruct(conn); + _iscsi_conn_destruct(conn); return 1; } @@ -568,18 +569,18 @@ spdk_iscsi_conn_destruct(struct spdk_iscsi_conn *conn) conn->state = ISCSI_CONN_STATE_EXITED; if (conn->sess != NULL && conn->pending_task_cnt > 0) { - spdk_iscsi_conn_cleanup_backend(conn); + iscsi_conn_cleanup_backend(conn); } if (conn->dev != NULL && spdk_scsi_dev_has_pending_tasks(conn->dev)) { - conn->shutdown_timer = spdk_poller_register(_spdk_iscsi_conn_check_pending_tasks, conn, 1000); + conn->shutdown_timer = spdk_poller_register(_iscsi_conn_check_pending_tasks, conn, 1000); } else { - _spdk_iscsi_conn_destruct(conn); + _iscsi_conn_destruct(conn); } } static int -spdk_iscsi_get_active_conns(void) +iscsi_get_active_conns(void) { struct spdk_iscsi_conn *conn; int num = 0; @@ -587,7 +588,7 @@ spdk_iscsi_get_active_conns(void) pthread_mutex_lock(&g_conns_mutex); for (i = 0; i < MAX_ISCSI_CONNECTIONS; i++) { - conn = spdk_find_iscsi_connection_by_id(i); + conn = find_iscsi_connection_by_id(i); if (conn == NULL) { continue; } @@ -598,7 +599,7 @@ spdk_iscsi_get_active_conns(void) } static void -spdk_iscsi_conns_cleanup(void) +iscsi_conns_cleanup(void) { free(g_num_connections); munmap(g_conns_array, sizeof(struct spdk_iscsi_conn) * @@ -611,24 +612,24 @@ spdk_iscsi_conns_cleanup(void) } static void -spdk_iscsi_conn_check_shutdown_cb(void *arg1, void *arg2) +iscsi_conn_check_shutdown_cb(void *arg1, void *arg2) { - spdk_iscsi_conns_cleanup(); + iscsi_conns_cleanup(); spdk_shutdown_iscsi_conns_done(); } static int -spdk_iscsi_conn_check_shutdown(void *arg) +iscsi_conn_check_shutdown(void *arg) { struct spdk_event *event; - if (spdk_iscsi_get_active_conns() != 0) { + if (iscsi_get_active_conns() != 0) { return 1; } spdk_poller_unregister(&g_shutdown_timer); event = spdk_event_allocate(spdk_env_get_current_core(), - spdk_iscsi_conn_check_shutdown_cb, NULL, NULL); + iscsi_conn_check_shutdown_cb, NULL, NULL); spdk_event_call(event); return 1; @@ -745,7 +746,7 @@ error: * This function will stop executing the specified connection. */ static void -spdk_iscsi_conn_stop(struct spdk_iscsi_conn *conn) +iscsi_conn_stop(struct spdk_iscsi_conn *conn) { struct spdk_iscsi_tgt_node *target; @@ -763,7 +764,7 @@ spdk_iscsi_conn_stop(struct spdk_iscsi_conn *conn) assert(conn->lcore == spdk_env_get_current_core()); __sync_fetch_and_sub(&g_num_connections[conn->lcore], 1); - spdk_iscsi_poll_group_remove_conn(conn); + iscsi_poll_group_remove_conn(conn); } void spdk_shutdown_iscsi_conns(void) @@ -774,7 +775,7 @@ void spdk_shutdown_iscsi_conns(void) pthread_mutex_lock(&g_conns_mutex); for (i = 0; i < MAX_ISCSI_CONNECTIONS; i++) { - conn = spdk_find_iscsi_connection_by_id(i); + conn = find_iscsi_connection_by_id(i); if (conn == NULL) { continue; } @@ -788,8 +789,7 @@ void spdk_shutdown_iscsi_conns(void) } pthread_mutex_unlock(&g_conns_mutex); - g_shutdown_timer = spdk_poller_register(spdk_iscsi_conn_check_shutdown, NULL, - 1000); + g_shutdown_timer = spdk_poller_register(iscsi_conn_check_shutdown, NULL, 1000); } int @@ -805,7 +805,7 @@ spdk_iscsi_drop_conns(struct spdk_iscsi_conn *conn, const char *conn_match, num = 0; pthread_mutex_lock(&g_conns_mutex); for (i = 0; i < MAX_ISCSI_CONNECTIONS; i++) { - xconn = spdk_find_iscsi_connection_by_id(i); + xconn = find_iscsi_connection_by_id(i); if (xconn == NULL) { continue; @@ -962,8 +962,8 @@ spdk_iscsi_task_mgmt_cpl(struct spdk_scsi_task *scsi_task) } static void -spdk_iscsi_task_copy_to_rsp_scsi_status(struct spdk_iscsi_task *primary, - struct spdk_scsi_task *task) +iscsi_task_copy_to_rsp_scsi_status(struct spdk_iscsi_task *primary, + struct spdk_scsi_task *task) { memcpy(primary->rsp_sense_data, task->sense_data, task->sense_data_len); primary->rsp_sense_data_len = task->sense_data_len; @@ -971,8 +971,8 @@ spdk_iscsi_task_copy_to_rsp_scsi_status(struct spdk_iscsi_task *primary, } static void -spdk_iscsi_task_copy_from_rsp_scsi_status(struct spdk_scsi_task *task, - struct spdk_iscsi_task *primary) +iscsi_task_copy_from_rsp_scsi_status(struct spdk_scsi_task *task, + struct spdk_iscsi_task *primary) { memcpy(task->sense_data, primary->rsp_sense_data, primary->rsp_sense_data_len); @@ -1018,10 +1018,10 @@ process_read_task_completion(struct spdk_iscsi_conn *conn, TAILQ_FOREACH(tmp, &primary->subtask_list, subtask_link) { spdk_scsi_task_copy_status(&tmp->scsi, &task->scsi); } - spdk_iscsi_task_copy_to_rsp_scsi_status(primary, &task->scsi); + iscsi_task_copy_to_rsp_scsi_status(primary, &task->scsi); } } else if (primary->rsp_scsi_status != SPDK_SCSI_STATUS_GOOD) { - spdk_iscsi_task_copy_from_rsp_scsi_status(&task->scsi, primary); + iscsi_task_copy_from_rsp_scsi_status(&task->scsi, primary); } if ((task != primary) && @@ -1079,13 +1079,13 @@ spdk_iscsi_task_cpl(struct spdk_scsi_task *scsi_task) primary->scsi.data_transferred += task->scsi.data_transferred; } } else if (primary->rsp_scsi_status == SPDK_SCSI_STATUS_GOOD) { - spdk_iscsi_task_copy_to_rsp_scsi_status(primary, &task->scsi); + iscsi_task_copy_to_rsp_scsi_status(primary, &task->scsi); } if (primary->bytes_completed == primary->scsi.transfer_len) { spdk_del_transfer_task(conn, primary->tag); if (primary->rsp_scsi_status != SPDK_SCSI_STATUS_GOOD) { - spdk_iscsi_task_copy_from_rsp_scsi_status(&primary->scsi, primary); + iscsi_task_copy_from_rsp_scsi_status(&primary->scsi, primary); } spdk_iscsi_task_response(conn, primary); /* @@ -1109,8 +1109,8 @@ spdk_iscsi_task_cpl(struct spdk_scsi_task *scsi_task) } static int -spdk_iscsi_get_pdu_length(struct spdk_iscsi_pdu *pdu, int header_digest, - int data_digest) +iscsi_get_pdu_length(struct spdk_iscsi_pdu *pdu, int header_digest, + int data_digest) { int data_len, enable_digest, total; @@ -1188,7 +1188,7 @@ spdk_iscsi_conn_handle_nop(struct spdk_iscsi_conn *conn) * should be closed. */ static int -spdk_iscsi_conn_flush_pdus_internal(struct spdk_iscsi_conn *conn) +iscsi_conn_flush_pdus_internal(struct spdk_iscsi_conn *conn) { const int num_iovs = 32; struct iovec iovs[num_iovs]; @@ -1244,9 +1244,8 @@ spdk_iscsi_conn_flush_pdus_internal(struct spdk_iscsi_conn *conn) * time only the unwritten portion will be sent to writev(). */ while (bytes > 0) { - pdu_length = spdk_iscsi_get_pdu_length(pdu, - conn->header_digest, - conn->data_digest); + pdu_length = iscsi_get_pdu_length(pdu, conn->header_digest, + conn->data_digest); pdu_length -= pdu->writev_offset; if (bytes >= pdu_length) { @@ -1289,17 +1288,17 @@ spdk_iscsi_conn_flush_pdus_internal(struct spdk_iscsi_conn *conn) * function will spin until all PDUs have successfully been flushed. */ static int -spdk_iscsi_conn_flush_pdus(void *_conn) +iscsi_conn_flush_pdus(void *_conn) { struct spdk_iscsi_conn *conn = _conn; int rc; if (conn->state == ISCSI_CONN_STATE_RUNNING) { - rc = spdk_iscsi_conn_flush_pdus_internal(conn); + rc = iscsi_conn_flush_pdus_internal(conn); if (rc == 0 && conn->flush_poller != NULL) { spdk_poller_unregister(&conn->flush_poller); } else if (rc == 1 && conn->flush_poller == NULL) { - conn->flush_poller = spdk_poller_register(spdk_iscsi_conn_flush_pdus, + conn->flush_poller = spdk_poller_register(iscsi_conn_flush_pdus, conn, 50); } } else { @@ -1310,7 +1309,7 @@ spdk_iscsi_conn_flush_pdus(void *_conn) * closing the connection. */ do { - rc = spdk_iscsi_conn_flush_pdus_internal(conn); + rc = iscsi_conn_flush_pdus_internal(conn); } while (rc == 1); } @@ -1327,7 +1326,7 @@ spdk_iscsi_conn_flush_pdus(void *_conn) } static int -spdk_iscsi_dif_verify(struct spdk_iscsi_pdu *pdu, struct spdk_dif_ctx *dif_ctx) +iscsi_dif_verify(struct spdk_iscsi_pdu *pdu, struct spdk_dif_ctx *dif_ctx) { struct iovec iov; struct spdk_dif_error err_blk = {}; @@ -1354,7 +1353,7 @@ spdk_iscsi_conn_write_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *p int rc; if (spdk_unlikely(spdk_iscsi_get_dif_ctx(conn, pdu, &pdu->dif_ctx))) { - rc = spdk_iscsi_dif_verify(pdu, &pdu->dif_ctx); + rc = iscsi_dif_verify(pdu, &pdu->dif_ctx); if (rc != 0) { spdk_iscsi_conn_free_pdu(conn, pdu); conn->state = ISCSI_CONN_STATE_EXITING; @@ -1378,13 +1377,13 @@ spdk_iscsi_conn_write_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *p } TAILQ_INSERT_TAIL(&conn->write_pdu_list, pdu, tailq); - spdk_iscsi_conn_flush_pdus(conn); + iscsi_conn_flush_pdus(conn); } #define GET_PDU_LOOP_COUNT 16 static int -spdk_iscsi_conn_handle_incoming_pdus(struct spdk_iscsi_conn *conn) +iscsi_conn_handle_incoming_pdus(struct spdk_iscsi_conn *conn) { struct spdk_iscsi_pdu *pdu; int i, rc; @@ -1423,7 +1422,7 @@ spdk_iscsi_conn_handle_incoming_pdus(struct spdk_iscsi_conn *conn) } static void -spdk_iscsi_conn_sock_cb(void *arg, struct spdk_sock_group *group, struct spdk_sock *sock) +iscsi_conn_sock_cb(void *arg, struct spdk_sock_group *group, struct spdk_sock *sock) { struct spdk_iscsi_conn *conn = arg; int rc; @@ -1436,15 +1435,15 @@ spdk_iscsi_conn_sock_cb(void *arg, struct spdk_sock_group *group, struct spdk_so } /* Handle incoming PDUs */ - rc = spdk_iscsi_conn_handle_incoming_pdus(conn); + rc = iscsi_conn_handle_incoming_pdus(conn); if (rc < 0) { conn->state = ISCSI_CONN_STATE_EXITING; - spdk_iscsi_conn_flush_pdus(conn); + iscsi_conn_flush_pdus(conn); } } static void -spdk_iscsi_conn_full_feature_migrate(void *arg1, void *arg2) +iscsi_conn_full_feature_migrate(void *arg1, void *arg2) { struct spdk_iscsi_conn *conn = arg1; @@ -1454,7 +1453,7 @@ spdk_iscsi_conn_full_feature_migrate(void *arg1, void *arg2) /* The poller has been unregistered, so now we can re-register it on the new core. */ conn->lcore = spdk_env_get_current_core(); - spdk_iscsi_poll_group_add_conn(conn); + iscsi_poll_group_add_conn(conn); } void @@ -1464,7 +1463,7 @@ spdk_iscsi_conn_migration(struct spdk_iscsi_conn *conn) struct spdk_event *event; struct spdk_iscsi_tgt_node *target; - lcore = spdk_iscsi_conn_allocate_reactor(conn->portal->cpumask); + lcore = iscsi_conn_allocate_reactor(conn->portal->cpumask); if (conn->sess->session_type == SESSION_TYPE_NORMAL) { target = conn->sess->target; pthread_mutex_lock(&target->mutex); @@ -1488,13 +1487,13 @@ spdk_iscsi_conn_migration(struct spdk_iscsi_conn *conn) pthread_mutex_unlock(&target->mutex); } - spdk_iscsi_poll_group_remove_conn_sock(conn); + iscsi_poll_group_remove_conn_sock(conn); spdk_poller_unregister(&conn->flush_poller); - spdk_iscsi_conn_stop(conn); + iscsi_conn_stop(conn); __sync_fetch_and_add(&g_num_connections[lcore], 1); conn->last_nopin = spdk_get_ticks(); - event = spdk_event_allocate(lcore, spdk_iscsi_conn_full_feature_migrate, + event = spdk_event_allocate(lcore, iscsi_conn_full_feature_migrate, conn, NULL); spdk_event_call(event); } @@ -1512,7 +1511,7 @@ spdk_iscsi_conn_get_min_per_core(void) } static uint32_t -spdk_iscsi_conn_allocate_reactor(const struct spdk_cpuset *cpumask) +iscsi_conn_allocate_reactor(const struct spdk_cpuset *cpumask) { uint32_t i, selected_core; int32_t num_pollers, min_pollers; diff --git a/lib/iscsi/init_grp.c b/lib/iscsi/init_grp.c index 4dcd64fc86..c7321f8179 100644 --- a/lib/iscsi/init_grp.c +++ b/lib/iscsi/init_grp.c @@ -43,7 +43,7 @@ #include "iscsi/init_grp.h" static struct spdk_iscsi_init_grp * -spdk_iscsi_init_grp_create(int tag) +iscsi_init_grp_create(int tag) { struct spdk_iscsi_init_grp *ig; @@ -60,7 +60,7 @@ spdk_iscsi_init_grp_create(int tag) } static struct spdk_iscsi_initiator_name * -spdk_iscsi_init_grp_find_initiator(struct spdk_iscsi_init_grp *ig, char *name) +iscsi_init_grp_find_initiator(struct spdk_iscsi_init_grp *ig, char *name) { struct spdk_iscsi_initiator_name *iname; @@ -73,7 +73,7 @@ spdk_iscsi_init_grp_find_initiator(struct spdk_iscsi_init_grp *ig, char *name) } static int -spdk_iscsi_init_grp_add_initiator(struct spdk_iscsi_init_grp *ig, char *name) +iscsi_init_grp_add_initiator(struct spdk_iscsi_init_grp *ig, char *name) { struct spdk_iscsi_initiator_name *iname; char *p; @@ -88,7 +88,7 @@ spdk_iscsi_init_grp_add_initiator(struct spdk_iscsi_init_grp *ig, char *name) return -EINVAL; } - iname = spdk_iscsi_init_grp_find_initiator(ig, name); + iname = iscsi_init_grp_find_initiator(ig, name); if (iname != NULL) { return -EEXIST; } @@ -122,11 +122,11 @@ spdk_iscsi_init_grp_add_initiator(struct spdk_iscsi_init_grp *ig, char *name) } static int -spdk_iscsi_init_grp_delete_initiator(struct spdk_iscsi_init_grp *ig, char *name) +iscsi_init_grp_delete_initiator(struct spdk_iscsi_init_grp *ig, char *name) { struct spdk_iscsi_initiator_name *iname; - iname = spdk_iscsi_init_grp_find_initiator(ig, name); + iname = iscsi_init_grp_find_initiator(ig, name); if (iname == NULL) { return -ENOENT; } @@ -139,13 +139,14 @@ spdk_iscsi_init_grp_delete_initiator(struct spdk_iscsi_init_grp *ig, char *name) } static int -spdk_iscsi_init_grp_add_initiators(struct spdk_iscsi_init_grp *ig, int num_inames, char **inames) +iscsi_init_grp_add_initiators(struct spdk_iscsi_init_grp *ig, int num_inames, + char **inames) { int i; int rc; for (i = 0; i < num_inames; i++) { - rc = spdk_iscsi_init_grp_add_initiator(ig, inames[i]); + rc = iscsi_init_grp_add_initiator(ig, inames[i]); if (rc < 0) { goto cleanup; } @@ -154,13 +155,13 @@ spdk_iscsi_init_grp_add_initiators(struct spdk_iscsi_init_grp *ig, int num_iname cleanup: for (; i > 0; --i) { - spdk_iscsi_init_grp_delete_initiator(ig, inames[i - 1]); + iscsi_init_grp_delete_initiator(ig, inames[i - 1]); } return rc; } static void -spdk_iscsi_init_grp_delete_all_initiators(struct spdk_iscsi_init_grp *ig) +iscsi_init_grp_delete_all_initiators(struct spdk_iscsi_init_grp *ig) { struct spdk_iscsi_initiator_name *iname, *tmp; @@ -173,13 +174,13 @@ spdk_iscsi_init_grp_delete_all_initiators(struct spdk_iscsi_init_grp *ig) } static int -spdk_iscsi_init_grp_delete_initiators(struct spdk_iscsi_init_grp *ig, int num_inames, char **inames) +iscsi_init_grp_delete_initiators(struct spdk_iscsi_init_grp *ig, int num_inames, char **inames) { int i; int rc; for (i = 0; i < num_inames; i++) { - rc = spdk_iscsi_init_grp_delete_initiator(ig, inames[i]); + rc = iscsi_init_grp_delete_initiator(ig, inames[i]); if (rc < 0) { goto cleanup; } @@ -188,9 +189,9 @@ spdk_iscsi_init_grp_delete_initiators(struct spdk_iscsi_init_grp *ig, int num_in cleanup: for (; i > 0; --i) { - rc = spdk_iscsi_init_grp_add_initiator(ig, inames[i - 1]); + rc = iscsi_init_grp_add_initiator(ig, inames[i - 1]); if (rc != 0) { - spdk_iscsi_init_grp_delete_all_initiators(ig); + iscsi_init_grp_delete_all_initiators(ig); break; } } @@ -198,7 +199,7 @@ cleanup: } static struct spdk_iscsi_initiator_netmask * -spdk_iscsi_init_grp_find_netmask(struct spdk_iscsi_init_grp *ig, const char *mask) +iscsi_init_grp_find_netmask(struct spdk_iscsi_init_grp *ig, const char *mask) { struct spdk_iscsi_initiator_netmask *netmask; @@ -211,7 +212,7 @@ spdk_iscsi_init_grp_find_netmask(struct spdk_iscsi_init_grp *ig, const char *mas } static int -spdk_iscsi_init_grp_add_netmask(struct spdk_iscsi_init_grp *ig, char *mask) +iscsi_init_grp_add_netmask(struct spdk_iscsi_init_grp *ig, char *mask) { struct spdk_iscsi_initiator_netmask *imask; char *p; @@ -221,7 +222,7 @@ spdk_iscsi_init_grp_add_netmask(struct spdk_iscsi_init_grp *ig, char *mask) return -EPERM; } - imask = spdk_iscsi_init_grp_find_netmask(ig, mask); + imask = iscsi_init_grp_find_netmask(ig, mask); if (imask != NULL) { return -EEXIST; } @@ -255,11 +256,11 @@ spdk_iscsi_init_grp_add_netmask(struct spdk_iscsi_init_grp *ig, char *mask) } static int -spdk_iscsi_init_grp_delete_netmask(struct spdk_iscsi_init_grp *ig, char *mask) +iscsi_init_grp_delete_netmask(struct spdk_iscsi_init_grp *ig, char *mask) { struct spdk_iscsi_initiator_netmask *imask; - imask = spdk_iscsi_init_grp_find_netmask(ig, mask); + imask = iscsi_init_grp_find_netmask(ig, mask); if (imask == NULL) { return -ENOENT; } @@ -272,13 +273,13 @@ spdk_iscsi_init_grp_delete_netmask(struct spdk_iscsi_init_grp *ig, char *mask) } static int -spdk_iscsi_init_grp_add_netmasks(struct spdk_iscsi_init_grp *ig, int num_imasks, char **imasks) +iscsi_init_grp_add_netmasks(struct spdk_iscsi_init_grp *ig, int num_imasks, char **imasks) { int i; int rc; for (i = 0; i < num_imasks; i++) { - rc = spdk_iscsi_init_grp_add_netmask(ig, imasks[i]); + rc = iscsi_init_grp_add_netmask(ig, imasks[i]); if (rc != 0) { goto cleanup; } @@ -287,13 +288,13 @@ spdk_iscsi_init_grp_add_netmasks(struct spdk_iscsi_init_grp *ig, int num_imasks, cleanup: for (; i > 0; --i) { - spdk_iscsi_init_grp_delete_netmask(ig, imasks[i - 1]); + iscsi_init_grp_delete_netmask(ig, imasks[i - 1]); } return rc; } static void -spdk_iscsi_init_grp_delete_all_netmasks(struct spdk_iscsi_init_grp *ig) +iscsi_init_grp_delete_all_netmasks(struct spdk_iscsi_init_grp *ig) { struct spdk_iscsi_initiator_netmask *imask, *tmp; @@ -306,13 +307,13 @@ spdk_iscsi_init_grp_delete_all_netmasks(struct spdk_iscsi_init_grp *ig) } static int -spdk_iscsi_init_grp_delete_netmasks(struct spdk_iscsi_init_grp *ig, int num_imasks, char **imasks) +iscsi_init_grp_delete_netmasks(struct spdk_iscsi_init_grp *ig, int num_imasks, char **imasks) { int i; int rc; for (i = 0; i < num_imasks; i++) { - rc = spdk_iscsi_init_grp_delete_netmask(ig, imasks[i]); + rc = iscsi_init_grp_delete_netmask(ig, imasks[i]); if (rc != 0) { goto cleanup; } @@ -321,9 +322,9 @@ spdk_iscsi_init_grp_delete_netmasks(struct spdk_iscsi_init_grp *ig, int num_imas cleanup: for (; i > 0; --i) { - rc = spdk_iscsi_init_grp_add_netmask(ig, imasks[i - 1]); + rc = iscsi_init_grp_add_netmask(ig, imasks[i - 1]); if (rc != 0) { - spdk_iscsi_init_grp_delete_all_netmasks(ig); + iscsi_init_grp_delete_all_netmasks(ig); break; } } @@ -332,7 +333,7 @@ cleanup: /* Read spdk iscsi target's config file and create initiator group */ static int -spdk_iscsi_parse_init_grp(struct spdk_conf_section *sp) +iscsi_parse_init_grp(struct spdk_conf_section *sp) { int i, rc = 0; const char *val = NULL; @@ -483,21 +484,21 @@ spdk_iscsi_init_grp_create_from_initiator_list(int tag, "add initiator group (from initiator list) tag=%d, #initiators=%d, #masks=%d\n", tag, num_initiator_names, num_initiator_masks); - ig = spdk_iscsi_init_grp_create(tag); + ig = iscsi_init_grp_create(tag); if (!ig) { SPDK_ERRLOG("initiator group create error (%d)\n", tag); return rc; } - rc = spdk_iscsi_init_grp_add_initiators(ig, num_initiator_names, - initiator_names); + rc = iscsi_init_grp_add_initiators(ig, num_initiator_names, + initiator_names); if (rc < 0) { SPDK_ERRLOG("add initiator name error\n"); goto cleanup; } - rc = spdk_iscsi_init_grp_add_netmasks(ig, num_initiator_masks, - initiator_masks); + rc = iscsi_init_grp_add_netmasks(ig, num_initiator_masks, + initiator_masks); if (rc < 0) { SPDK_ERRLOG("add initiator netmask error\n"); goto cleanup; @@ -537,19 +538,19 @@ spdk_iscsi_init_grp_add_initiators_from_initiator_list(int tag, return rc; } - rc = spdk_iscsi_init_grp_add_initiators(ig, num_initiator_names, - initiator_names); + rc = iscsi_init_grp_add_initiators(ig, num_initiator_names, + initiator_names); if (rc < 0) { SPDK_ERRLOG("add initiator name error\n"); goto error; } - rc = spdk_iscsi_init_grp_add_netmasks(ig, num_initiator_masks, - initiator_masks); + rc = iscsi_init_grp_add_netmasks(ig, num_initiator_masks, + initiator_masks); if (rc < 0) { SPDK_ERRLOG("add initiator netmask error\n"); - spdk_iscsi_init_grp_delete_initiators(ig, num_initiator_names, - initiator_names); + iscsi_init_grp_delete_initiators(ig, num_initiator_names, + initiator_names); } error: @@ -579,19 +580,19 @@ spdk_iscsi_init_grp_delete_initiators_from_initiator_list(int tag, return rc; } - rc = spdk_iscsi_init_grp_delete_initiators(ig, num_initiator_names, - initiator_names); + rc = iscsi_init_grp_delete_initiators(ig, num_initiator_names, + initiator_names); if (rc < 0) { SPDK_ERRLOG("delete initiator name error\n"); goto error; } - rc = spdk_iscsi_init_grp_delete_netmasks(ig, num_initiator_masks, - initiator_masks); + rc = iscsi_init_grp_delete_netmasks(ig, num_initiator_masks, + initiator_masks); if (rc < 0) { SPDK_ERRLOG("delete initiator netmask error\n"); - spdk_iscsi_init_grp_add_initiators(ig, num_initiator_names, - initiator_names); + iscsi_init_grp_add_initiators(ig, num_initiator_names, + initiator_names); goto error; } @@ -607,8 +608,8 @@ spdk_iscsi_init_grp_destroy(struct spdk_iscsi_init_grp *ig) return; } - spdk_iscsi_init_grp_delete_all_initiators(ig); - spdk_iscsi_init_grp_delete_all_netmasks(ig); + iscsi_init_grp_delete_all_initiators(ig); + iscsi_init_grp_delete_all_netmasks(ig); free(ig); }; @@ -639,7 +640,7 @@ spdk_iscsi_parse_init_grps(void) SPDK_ERRLOG("Group 0 is invalid\n"); return -1; } - rc = spdk_iscsi_parse_init_grp(sp); + rc = iscsi_parse_init_grp(sp); if (rc < 0) { SPDK_ERRLOG("parse_init_group() failed\n"); return -1; @@ -731,8 +732,8 @@ spdk_iscsi_init_grps_config_text(FILE *fp) } static void -spdk_iscsi_init_grp_info_json(struct spdk_iscsi_init_grp *ig, - struct spdk_json_write_ctx *w) +iscsi_init_grp_info_json(struct spdk_iscsi_init_grp *ig, + struct spdk_json_write_ctx *w) { struct spdk_iscsi_initiator_name *iname; struct spdk_iscsi_initiator_netmask *imask; @@ -757,15 +758,15 @@ spdk_iscsi_init_grp_info_json(struct spdk_iscsi_init_grp *ig, } static void -spdk_iscsi_init_grp_config_json(struct spdk_iscsi_init_grp *ig, - struct spdk_json_write_ctx *w) +iscsi_init_grp_config_json(struct spdk_iscsi_init_grp *ig, + struct spdk_json_write_ctx *w) { spdk_json_write_object_begin(w); spdk_json_write_named_string(w, "method", "add_initiator_group"); spdk_json_write_name(w, "params"); - spdk_iscsi_init_grp_info_json(ig, w); + iscsi_init_grp_info_json(ig, w); spdk_json_write_object_end(w); } @@ -776,7 +777,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) { - spdk_iscsi_init_grp_info_json(ig, w); + iscsi_init_grp_info_json(ig, w); } } @@ -786,6 +787,6 @@ 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) { - spdk_iscsi_init_grp_config_json(ig, w); + iscsi_init_grp_config_json(ig, w); } } diff --git a/lib/iscsi/iscsi.c b/lib/iscsi/iscsi.c index 0171da4cd4..8ed2f0ef9a 100644 --- a/lib/iscsi/iscsi.c +++ b/lib/iscsi/iscsi.c @@ -77,7 +77,7 @@ struct spdk_iscsi_globals g_spdk_iscsi = { }; /* random value generation */ -static void spdk_gen_random(uint8_t *buf, size_t len); +static void gen_random(uint8_t *buf, size_t len); #ifndef HAVE_SRANDOMDEV static void srandomdev(void); #endif /* HAVE_SRANDOMDEV */ @@ -85,25 +85,25 @@ static void srandomdev(void); /* static uint32_t arc4random(void); */ #endif /* HAVE_ARC4RANDOM */ -static int spdk_add_transfer_task(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_task *task); +static int add_transfer_task(struct spdk_iscsi_conn *conn, + struct spdk_iscsi_task *task); -static int spdk_iscsi_send_r2t(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_task *task, int offset, - int len, uint32_t transfer_tag, uint32_t *R2TSN); -static int spdk_iscsi_send_r2t_recovery(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_task *r2t_task, uint32_t r2t_sn, - bool send_new_r2tsn); +static int iscsi_send_r2t(struct spdk_iscsi_conn *conn, + struct spdk_iscsi_task *task, int offset, + int len, uint32_t transfer_tag, uint32_t *R2TSN); +static int iscsi_send_r2t_recovery(struct spdk_iscsi_conn *conn, + struct spdk_iscsi_task *r2t_task, uint32_t r2t_sn, + bool send_new_r2tsn); -static int spdk_create_iscsi_sess(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_tgt_node *target, enum session_type session_type); -static int spdk_append_iscsi_sess(struct spdk_iscsi_conn *conn, - const char *initiator_port_name, uint16_t tsih, uint16_t cid); +static int create_iscsi_sess(struct spdk_iscsi_conn *conn, + struct spdk_iscsi_tgt_node *target, enum session_type session_type); +static int append_iscsi_sess(struct spdk_iscsi_conn *conn, + const char *initiator_port_name, uint16_t tsih, uint16_t cid); -static void spdk_remove_acked_pdu(struct spdk_iscsi_conn *conn, uint32_t ExpStatSN); +static void remove_acked_pdu(struct spdk_iscsi_conn *conn, uint32_t ExpStatSN); -static int spdk_iscsi_reject(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu, - int reason); +static int iscsi_reject(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu, + int reason); #define DMIN32(A,B) ((uint32_t) ((uint32_t)(A) > (uint32_t)(B) ? (uint32_t)(B) : (uint32_t)(A))) #define DMIN64(A,B) ((uint64_t) ((A) > (B) ? (B) : (A))) @@ -117,7 +117,7 @@ static int spdk_iscsi_reject(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu #if 0 static int -spdk_match_digest_word(const uint8_t *buf, uint32_t crc32c) +match_digest_word(const uint8_t *buf, uint32_t crc32c) { uint32_t l; @@ -129,7 +129,7 @@ spdk_match_digest_word(const uint8_t *buf, uint32_t crc32c) } static uint8_t * -spdk_make_digest_word(uint8_t *buf, size_t len, uint32_t crc32c) +make_digest_word(uint8_t *buf, size_t len, uint32_t crc32c) { if (len < ISCSI_DIGEST_LEN) { return NULL; @@ -159,7 +159,7 @@ srandomdev(void) #endif /* HAVE_SRANDOMDEV */ #ifndef HAVE_ARC4RANDOM -static int spdk_arc4random_initialized = 0; +static int g_arc4random_initialized = 0; static uint32_t arc4random(void) @@ -167,9 +167,9 @@ arc4random(void) uint32_t r; uint32_t r1, r2; - if (!spdk_arc4random_initialized) { + if (!g_arc4random_initialized) { srandomdev(); - spdk_arc4random_initialized = 1; + g_arc4random_initialized = 1; } r1 = (uint32_t)(random() & 0xffff); r2 = (uint32_t)(random() & 0xffff); @@ -179,7 +179,7 @@ arc4random(void) #endif /* HAVE_ARC4RANDOM */ static void -spdk_gen_random(uint8_t *buf, size_t len) +gen_random(uint8_t *buf, size_t len) { #ifdef USE_RANDOM long l; @@ -202,7 +202,7 @@ spdk_gen_random(uint8_t *buf, size_t len) } static uint64_t -spdk_iscsi_get_isid(const uint8_t isid[6]) +iscsi_get_isid(const uint8_t isid[6]) { return (uint64_t)isid[0] << 40 | (uint64_t)isid[1] << 32 | @@ -213,7 +213,7 @@ spdk_iscsi_get_isid(const uint8_t isid[6]) } static int -spdk_bin2hex(char *buf, size_t len, const uint8_t *data, size_t data_len) +bin2hex(char *buf, size_t len, const uint8_t *data, size_t data_len) { const char *digits = "0123456789ABCDEF"; size_t total = 0; @@ -243,7 +243,7 @@ spdk_bin2hex(char *buf, size_t len, const uint8_t *data, size_t data_len) } static int -spdk_hex2bin(uint8_t *data, size_t data_len, const char *str) +hex2bin(uint8_t *data, size_t data_len, const char *str) { const char *digits = "0123456789ABCDEF"; const char *dp; @@ -280,7 +280,7 @@ spdk_hex2bin(uint8_t *data, size_t data_len, const char *str) } static int -spdk_islun2lun(uint64_t islun) +islun2lun(uint64_t islun) { uint64_t fmt_lun; uint64_t method; @@ -342,8 +342,8 @@ spdk_iscsi_pdu_calc_data_digest(struct spdk_iscsi_pdu *pdu) } static bool -spdk_iscsi_check_data_segment_length(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_pdu *pdu, int data_len) +iscsi_check_data_segment_length(struct spdk_iscsi_conn *conn, + struct spdk_iscsi_pdu *pdu, int data_len) { int max_segment_len; @@ -382,9 +382,9 @@ spdk_iscsi_check_data_segment_length(struct spdk_iscsi_conn *conn, } static int -spdk_iscsi_conn_read_data_segment(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_pdu *pdu, - uint32_t segment_len) +iscsi_conn_read_data_segment(struct spdk_iscsi_conn *conn, + struct spdk_iscsi_pdu *pdu, + uint32_t segment_len) { struct spdk_dif_ctx dif_ctx; struct iovec iovs[32]; @@ -522,7 +522,7 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu) pdu->data_buf = pdu->mobj->buf; } - rc = spdk_iscsi_conn_read_data_segment(conn, pdu, data_len); + rc = iscsi_conn_read_data_segment(conn, pdu, data_len); if (rc < 0) { *_pdu = NULL; spdk_put_pdu(pdu); @@ -565,8 +565,8 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu) /* Data Segment */ if (data_len != 0) { - if (!spdk_iscsi_check_data_segment_length(conn, pdu, data_len)) { - rc = spdk_iscsi_reject(conn, pdu, ISCSI_REASON_PROTOCOL_ERROR); + if (!iscsi_check_data_segment_length(conn, pdu, data_len)) { + rc = iscsi_reject(conn, pdu, ISCSI_REASON_PROTOCOL_ERROR); spdk_put_pdu(pdu); /* @@ -753,9 +753,9 @@ end: } static int -spdk_iscsi_append_text(struct spdk_iscsi_conn *conn __attribute__((__unused__)), - const char *key, const char *val, uint8_t *data, - int alloc_len, int data_len) +iscsi_append_text(struct spdk_iscsi_conn *conn __attribute__((__unused__)), + const char *key, const char *val, uint8_t *data, + int alloc_len, int data_len) { int total; int len; @@ -781,8 +781,8 @@ spdk_iscsi_append_text(struct spdk_iscsi_conn *conn __attribute__((__unused__)), } static int -spdk_iscsi_append_param(struct spdk_iscsi_conn *conn, const char *key, - uint8_t *data, int alloc_len, int data_len) +iscsi_append_param(struct spdk_iscsi_conn *conn, const char *key, + uint8_t *data, int alloc_len, int data_len) { struct iscsi_param *param; int rc; @@ -795,13 +795,13 @@ spdk_iscsi_append_param(struct spdk_iscsi_conn *conn, const char *key, return data_len; } } - rc = spdk_iscsi_append_text(conn, param->key, param->val, data, - alloc_len, data_len); + rc = iscsi_append_text(conn, param->key, param->val, data, + alloc_len, data_len); return rc; } static int -spdk_iscsi_get_authinfo(struct spdk_iscsi_conn *conn, const char *authuser) +iscsi_get_authinfo(struct spdk_iscsi_conn *conn, const char *authuser) { int ag_tag; int rc; @@ -825,9 +825,9 @@ spdk_iscsi_get_authinfo(struct spdk_iscsi_conn *conn, const char *authuser) } static int -spdk_iscsi_auth_params(struct spdk_iscsi_conn *conn, - struct iscsi_param *params, const char *method, uint8_t *data, - int alloc_len, int data_len) +iscsi_auth_params(struct spdk_iscsi_conn *conn, + struct iscsi_param *params, const char *method, uint8_t *data, + int alloc_len, int data_len) { char *in_val; char *in_next; @@ -886,32 +886,30 @@ spdk_iscsi_auth_params(struct spdk_iscsi_conn *conn, if (new_val == NULL) { snprintf(in_val, ISCSI_TEXT_MAX_VAL_LEN + 1, "%s", "Reject"); new_val = in_val; - spdk_iscsi_append_text(conn, "CHAP_A", new_val, - data, alloc_len, total); + iscsi_append_text(conn, "CHAP_A", new_val, + data, alloc_len, total); goto error_return; } /* selected algorithm is 5 (MD5) */ SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "got CHAP_A=%s\n", new_val); - total = spdk_iscsi_append_text(conn, "CHAP_A", new_val, - data, alloc_len, total); + total = iscsi_append_text(conn, "CHAP_A", new_val, + data, alloc_len, total); /* Identifier is one octet */ - spdk_gen_random(conn->auth.chap_id, 1); + gen_random(conn->auth.chap_id, 1); snprintf(in_val, ISCSI_TEXT_MAX_VAL_LEN, "%d", (int) conn->auth.chap_id[0]); - total = spdk_iscsi_append_text(conn, "CHAP_I", in_val, - data, alloc_len, total); + total = iscsi_append_text(conn, "CHAP_I", in_val, + data, alloc_len, total); /* Challenge Value is a variable stream of octets */ /* (binary length MUST not exceed 1024 bytes) */ conn->auth.chap_challenge_len = ISCSI_CHAP_CHALLENGE_LEN; - spdk_gen_random(conn->auth.chap_challenge, - conn->auth.chap_challenge_len); - spdk_bin2hex(in_val, ISCSI_TEXT_MAX_VAL_LEN, - conn->auth.chap_challenge, - conn->auth.chap_challenge_len); - total = spdk_iscsi_append_text(conn, "CHAP_C", in_val, - data, alloc_len, total); + gen_random(conn->auth.chap_challenge, conn->auth.chap_challenge_len); + bin2hex(in_val, ISCSI_TEXT_MAX_VAL_LEN, + conn->auth.chap_challenge, conn->auth.chap_challenge_len); + total = iscsi_append_text(conn, "CHAP_C", in_val, + data, alloc_len, total); conn->auth.chap_phase = ISCSI_CHAP_PHASE_WAIT_NR; } else if ((name = spdk_iscsi_param_get_val(params, "CHAP_N")) != NULL) { @@ -932,7 +930,7 @@ spdk_iscsi_auth_params(struct spdk_iscsi_conn *conn, } if (response[0] == '0' && (response[1] == 'x' || response[1] == 'X')) { - rc = spdk_hex2bin(resmd5, SPDK_MD5DIGEST_LEN, response); + rc = hex2bin(resmd5, SPDK_MD5DIGEST_LEN, response); if (rc < 0 || rc != SPDK_MD5DIGEST_LEN) { SPDK_ERRLOG("response format error\n"); goto error_return; @@ -951,7 +949,7 @@ spdk_iscsi_auth_params(struct spdk_iscsi_conn *conn, } SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "got CHAP_N/CHAP_R\n"); - rc = spdk_iscsi_get_authinfo(conn, name); + rc = iscsi_get_authinfo(conn, name); if (rc < 0) { /* SPDK_ERRLOG("auth user or secret is missing\n"); */ SPDK_ERRLOG("iscsi_get_authinfo() failed\n"); @@ -975,8 +973,7 @@ spdk_iscsi_auth_params(struct spdk_iscsi_conn *conn, /* tgtmd5 is expecting Response Value */ spdk_md5final(tgtmd5, &md5ctx); - spdk_bin2hex(in_val, ISCSI_TEXT_MAX_VAL_LEN, - tgtmd5, SPDK_MD5DIGEST_LEN); + bin2hex(in_val, ISCSI_TEXT_MAX_VAL_LEN, tgtmd5, SPDK_MD5DIGEST_LEN); #if 0 SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "tgtmd5=%s, resmd5=%s\n", in_val, response); @@ -1005,9 +1002,8 @@ spdk_iscsi_auth_params(struct spdk_iscsi_conn *conn, } if (challenge[0] == '0' && (challenge[1] == 'x' || challenge[1] == 'X')) { - rc = spdk_hex2bin(conn->auth.chap_mchallenge, - ISCSI_CHAP_CHALLENGE_LEN, - challenge); + rc = hex2bin(conn->auth.chap_mchallenge, + ISCSI_CHAP_CHALLENGE_LEN, challenge); if (rc < 0) { SPDK_ERRLOG("challenge format error\n"); goto error_return; @@ -1051,13 +1047,12 @@ spdk_iscsi_auth_params(struct spdk_iscsi_conn *conn, /* tgtmd5 is Response Value */ spdk_md5final(tgtmd5, &md5ctx); - spdk_bin2hex(in_val, ISCSI_TEXT_MAX_VAL_LEN, - tgtmd5, SPDK_MD5DIGEST_LEN); + bin2hex(in_val, ISCSI_TEXT_MAX_VAL_LEN, tgtmd5, SPDK_MD5DIGEST_LEN); - total = spdk_iscsi_append_text(conn, "CHAP_N", - conn->auth.muser, data, alloc_len, total); - total = spdk_iscsi_append_text(conn, "CHAP_R", - in_val, data, alloc_len, total); + total = iscsi_append_text(conn, "CHAP_N", + conn->auth.muser, data, alloc_len, total); + total = iscsi_append_text(conn, "CHAP_R", + in_val, data, alloc_len, total); } else { /* not mutual */ if (conn->mutual_chap) { @@ -1083,8 +1078,8 @@ error_return: } static int -spdk_iscsi_reject(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu, - int reason) +iscsi_reject(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu, + int reason) { struct spdk_iscsi_pdu *rsp_pdu; struct iscsi_bhs_reject *rsph; @@ -1164,7 +1159,7 @@ spdk_iscsi_reject(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu, } static int -spdk_iscsi_check_values(struct spdk_iscsi_conn *conn) +iscsi_check_values(struct spdk_iscsi_conn *conn) { if (conn->sess->FirstBurstLength > conn->sess->MaxBurstLength) { SPDK_ERRLOG("FirstBurstLength(%d) > MaxBurstLength(%d)\n", @@ -1203,8 +1198,8 @@ spdk_iscsi_check_values(struct spdk_iscsi_conn *conn) * -1:error; */ static int -spdk_iscsi_op_login_response(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_pdu *rsp_pdu, struct iscsi_param *params) +iscsi_op_login_response(struct spdk_iscsi_conn *conn, + struct spdk_iscsi_pdu *rsp_pdu, struct iscsi_param *params) { struct iscsi_bhs_login_rsp *rsph; int rc; @@ -1246,7 +1241,7 @@ spdk_iscsi_op_login_response(struct spdk_iscsi_conn *conn, return -1; } /* check value */ - rc = spdk_iscsi_check_values(conn); + rc = iscsi_check_values(conn); if (rc < 0) { SPDK_ERRLOG("iscsi_check_values() failed\n"); spdk_iscsi_param_free(params); @@ -1266,9 +1261,9 @@ spdk_iscsi_op_login_response(struct spdk_iscsi_conn *conn, * otherwise: error */ static int -spdk_iscsi_op_login_update_param(struct spdk_iscsi_conn *conn, - const char *key, const char *value, - const char *list) +iscsi_op_login_update_param(struct spdk_iscsi_conn *conn, + const char *key, const char *value, + const char *list) { int rc = 0; struct iscsi_param *new_param, *orig_param; @@ -1301,20 +1296,20 @@ spdk_iscsi_op_login_update_param(struct spdk_iscsi_conn *conn, } static int -spdk_iscsi_negotiate_chap_param(struct spdk_iscsi_conn *conn, bool disable_chap, - bool require_chap, bool mutual_chap) +iscsi_negotiate_chap_param(struct spdk_iscsi_conn *conn, bool disable_chap, + bool require_chap, bool mutual_chap) { int rc = 0; if (disable_chap) { conn->require_chap = false; - rc = spdk_iscsi_op_login_update_param(conn, "AuthMethod", "None", "None"); + rc = iscsi_op_login_update_param(conn, "AuthMethod", "None", "None"); if (rc < 0) { return rc; } } else if (require_chap) { conn->require_chap = true; - rc = spdk_iscsi_op_login_update_param(conn, "AuthMethod", "CHAP", "CHAP"); + rc = iscsi_op_login_update_param(conn, "AuthMethod", "CHAP", "CHAP"); if (rc < 0) { return rc; } @@ -1333,11 +1328,11 @@ spdk_iscsi_negotiate_chap_param(struct spdk_iscsi_conn *conn, bool disable_chap, * otherwise: error; */ static int -spdk_iscsi_op_login_session_discovery_chap(struct spdk_iscsi_conn *conn) +iscsi_op_login_session_discovery_chap(struct spdk_iscsi_conn *conn) { - return spdk_iscsi_negotiate_chap_param(conn, g_spdk_iscsi.disable_chap, - g_spdk_iscsi.require_chap, - g_spdk_iscsi.mutual_chap); + return iscsi_negotiate_chap_param(conn, g_spdk_iscsi.disable_chap, + g_spdk_iscsi.require_chap, + g_spdk_iscsi.mutual_chap); } /* @@ -1347,17 +1342,17 @@ spdk_iscsi_op_login_session_discovery_chap(struct spdk_iscsi_conn *conn) * otherwise: error */ static int -spdk_iscsi_op_login_negotiate_chap_param(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_tgt_node *target) +iscsi_op_login_negotiate_chap_param(struct spdk_iscsi_conn *conn, + struct spdk_iscsi_tgt_node *target) { - return spdk_iscsi_negotiate_chap_param(conn, target->disable_chap, - target->require_chap, - target->mutual_chap); + return iscsi_negotiate_chap_param(conn, target->disable_chap, + target->require_chap, + target->mutual_chap); } static int -spdk_iscsi_op_login_negotiate_digest_param(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_tgt_node *target) +iscsi_op_login_negotiate_digest_param(struct spdk_iscsi_conn *conn, + struct spdk_iscsi_tgt_node *target) { int rc; @@ -1367,7 +1362,7 @@ spdk_iscsi_op_login_negotiate_digest_param(struct spdk_iscsi_conn *conn, * HeaderDigest values to remove "None" so that only * initiators who support CRC32C can connect. */ - rc = spdk_iscsi_op_login_update_param(conn, "HeaderDigest", "CRC32C", "CRC32C"); + rc = iscsi_op_login_update_param(conn, "HeaderDigest", "CRC32C", "CRC32C"); if (rc < 0) { return rc; } @@ -1379,7 +1374,7 @@ spdk_iscsi_op_login_negotiate_digest_param(struct spdk_iscsi_conn *conn, * DataDigest values to remove "None" so that only * initiators who support CRC32C can connect. */ - rc = spdk_iscsi_op_login_update_param(conn, "DataDigest", "CRC32C", "CRC32C"); + rc = iscsi_op_login_update_param(conn, "DataDigest", "CRC32C", "CRC32C"); if (rc < 0) { return rc; } @@ -1395,9 +1390,9 @@ spdk_iscsi_op_login_negotiate_digest_param(struct spdk_iscsi_conn *conn, * otherwise: error */ static int -spdk_iscsi_op_login_check_session(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_pdu *rsp_pdu, - char *initiator_port_name, int cid) +iscsi_op_login_check_session(struct spdk_iscsi_conn *conn, + struct spdk_iscsi_pdu *rsp_pdu, + char *initiator_port_name, int cid) { int rc = 0; @@ -1406,15 +1401,15 @@ spdk_iscsi_op_login_check_session(struct spdk_iscsi_conn *conn, rsph = (struct iscsi_bhs_login_rsp *)&rsp_pdu->bhs; /* check existing session */ SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "isid=%"PRIx64", tsih=%u, cid=%u\n", - spdk_iscsi_get_isid(rsph->isid), from_be16(&rsph->tsih), cid); + iscsi_get_isid(rsph->isid), from_be16(&rsph->tsih), cid); if (rsph->tsih != 0) { /* multiple connections */ - rc = spdk_append_iscsi_sess(conn, initiator_port_name, - from_be16(&rsph->tsih), cid); + rc = append_iscsi_sess(conn, initiator_port_name, + from_be16(&rsph->tsih), cid); if (rc < 0) { SPDK_ERRLOG("isid=%"PRIx64", tsih=%u, cid=%u:" "spdk_append_iscsi_sess() failed\n", - spdk_iscsi_get_isid(rsph->isid), from_be16(&rsph->tsih), + iscsi_get_isid(rsph->isid), from_be16(&rsph->tsih), cid); /* Can't include in session */ rsph->status_class = ISCSI_CLASS_INITIATOR_ERROR; @@ -1436,10 +1431,10 @@ spdk_iscsi_op_login_check_session(struct spdk_iscsi_conn *conn, * otherwise: error */ static int -spdk_iscsi_op_login_check_target(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_pdu *rsp_pdu, - const char *target_name, - struct spdk_iscsi_tgt_node **target) +iscsi_op_login_check_target(struct spdk_iscsi_conn *conn, + struct spdk_iscsi_pdu *rsp_pdu, + const char *target_name, + struct spdk_iscsi_tgt_node **target) { bool result; struct iscsi_bhs_login_rsp *rsph; @@ -1474,12 +1469,12 @@ spdk_iscsi_op_login_check_target(struct spdk_iscsi_conn *conn, * SPDK_ISCSI_LOGIN_ERROR_PARAMETER, parameter error; */ static int -spdk_iscsi_op_login_session_normal(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_pdu *rsp_pdu, - char *initiator_port_name, - struct iscsi_param *params, - struct spdk_iscsi_tgt_node **target, - int cid) +iscsi_op_login_session_normal(struct spdk_iscsi_conn *conn, + struct spdk_iscsi_pdu *rsp_pdu, + char *initiator_port_name, + struct iscsi_param *params, + struct spdk_iscsi_tgt_node **target, + int cid) { const char *target_name; const char *target_short_name; @@ -1511,7 +1506,7 @@ spdk_iscsi_op_login_session_normal(struct spdk_iscsi_conn *conn, } pthread_mutex_lock(&g_spdk_iscsi.mutex); - rc = spdk_iscsi_op_login_check_target(conn, rsp_pdu, target_name, target); + rc = iscsi_op_login_check_target(conn, rsp_pdu, target_name, target); pthread_mutex_unlock(&g_spdk_iscsi.mutex); if (rc < 0) { @@ -1523,22 +1518,22 @@ spdk_iscsi_op_login_session_normal(struct spdk_iscsi_conn *conn, conn->target_port = spdk_scsi_dev_find_port_by_id((*target)->dev, conn->portal->group->tag); - rc = spdk_iscsi_op_login_check_session(conn, rsp_pdu, - initiator_port_name, cid); + rc = iscsi_op_login_check_session(conn, rsp_pdu, + initiator_port_name, cid); if (rc < 0) { return rc; } /* force target flags */ pthread_mutex_lock(&((*target)->mutex)); - rc = spdk_iscsi_op_login_negotiate_chap_param(conn, *target); + rc = iscsi_op_login_negotiate_chap_param(conn, *target); pthread_mutex_unlock(&((*target)->mutex)); if (rc != 0) { return rc; } - return spdk_iscsi_op_login_negotiate_digest_param(conn, *target); + return iscsi_op_login_negotiate_digest_param(conn, *target); } /* @@ -1548,10 +1543,10 @@ spdk_iscsi_op_login_session_normal(struct spdk_iscsi_conn *conn, * otherwise, error */ static int -spdk_iscsi_op_login_session_type(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_pdu *rsp_pdu, - enum session_type *session_type, - struct iscsi_param *params) +iscsi_op_login_session_type(struct spdk_iscsi_conn *conn, + struct spdk_iscsi_pdu *rsp_pdu, + enum session_type *session_type, + struct iscsi_param *params) { const char *session_type_str; struct iscsi_bhs_login_rsp *rsph; @@ -1593,11 +1588,11 @@ spdk_iscsi_op_login_session_type(struct spdk_iscsi_conn *conn, * otherwise: error */ static int -spdk_iscsi_op_login_initialize_port(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_pdu *rsp_pdu, - char *initiator_port_name, - uint32_t name_length, - struct iscsi_param *params) +iscsi_op_login_initialize_port(struct spdk_iscsi_conn *conn, + struct spdk_iscsi_pdu *rsp_pdu, + char *initiator_port_name, + uint32_t name_length, + struct iscsi_param *params) { const char *val; struct iscsi_bhs_login_rsp *rsph; @@ -1614,7 +1609,7 @@ spdk_iscsi_op_login_initialize_port(struct spdk_iscsi_conn *conn, } snprintf(conn->initiator_name, sizeof(conn->initiator_name), "%s", val); snprintf(initiator_port_name, name_length, - "%s,i,0x%12.12" PRIx64, val, spdk_iscsi_get_isid(rsph->isid)); + "%s,i,0x%12.12" PRIx64, val, iscsi_get_isid(rsph->isid)); spdk_strlwr(conn->initiator_name); spdk_strlwr(initiator_port_name); SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "Initiator name: %s\n", conn->initiator_name); @@ -1630,11 +1625,11 @@ spdk_iscsi_op_login_initialize_port(struct spdk_iscsi_conn *conn, * otherwise: error */ static int -spdk_iscsi_op_login_set_conn_info(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_pdu *rsp_pdu, - char *initiator_port_name, - enum session_type session_type, - struct spdk_iscsi_tgt_node *target, int cid) +iscsi_op_login_set_conn_info(struct spdk_iscsi_conn *conn, + struct spdk_iscsi_pdu *rsp_pdu, + char *initiator_port_name, + enum session_type session_type, + struct spdk_iscsi_tgt_node *target, int cid) { int rc = 0; struct iscsi_bhs_login_rsp *rsph; @@ -1647,7 +1642,7 @@ spdk_iscsi_op_login_set_conn_info(struct spdk_iscsi_conn *conn, if (conn->sess == NULL) { /* create initiator port */ - initiator_port = spdk_scsi_port_create(spdk_iscsi_get_isid(rsph->isid), 0, initiator_port_name); + initiator_port = spdk_scsi_port_create(iscsi_get_isid(rsph->isid), 0, initiator_port_name); if (initiator_port == NULL) { SPDK_ERRLOG("create_port() failed\n"); rsph->status_class = ISCSI_CLASS_TARGET_ERROR; @@ -1656,7 +1651,7 @@ spdk_iscsi_op_login_set_conn_info(struct spdk_iscsi_conn *conn, } /* new session */ - rc = spdk_create_iscsi_sess(conn, target, session_type); + rc = create_iscsi_sess(conn, target, session_type); if (rc < 0) { spdk_scsi_port_free(&initiator_port); SPDK_ERRLOG("create_sess() failed\n"); @@ -1667,7 +1662,7 @@ spdk_iscsi_op_login_set_conn_info(struct spdk_iscsi_conn *conn, /* initialize parameters */ conn->sess->initiator_port = initiator_port; conn->StatSN = from_be32(&rsph->stat_sn); - conn->sess->isid = spdk_iscsi_get_isid(rsph->isid); + conn->sess->isid = iscsi_get_isid(rsph->isid); conn->sess->target = target; /* Initiator port TransportID */ @@ -1701,11 +1696,11 @@ spdk_iscsi_op_login_set_conn_info(struct spdk_iscsi_conn *conn, * otherwise: error */ static int -spdk_iscsi_op_login_set_target_info(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_pdu *rsp_pdu, - enum session_type session_type, - int alloc_len, - struct spdk_iscsi_tgt_node *target) +iscsi_op_login_set_target_info(struct spdk_iscsi_conn *conn, + struct spdk_iscsi_pdu *rsp_pdu, + enum session_type session_type, + int alloc_len, + struct spdk_iscsi_tgt_node *target) { char buf[MAX_TMPBUF]; const char *val; @@ -1745,20 +1740,20 @@ spdk_iscsi_op_login_set_target_info(struct spdk_iscsi_conn *conn, if (target != NULL) { val = spdk_iscsi_param_get_val(conn->sess->params, "TargetAlias"); if (val != NULL && strlen(val) != 0) { - rsp_pdu->data_segment_len = spdk_iscsi_append_param(conn, + rsp_pdu->data_segment_len = iscsi_append_param(conn, "TargetAlias", rsp_pdu->data, alloc_len, rsp_pdu->data_segment_len); } if (session_type == SESSION_TYPE_DISCOVERY) { - rsp_pdu->data_segment_len = spdk_iscsi_append_param(conn, + rsp_pdu->data_segment_len = iscsi_append_param(conn, "TargetAddress", rsp_pdu->data, alloc_len, rsp_pdu->data_segment_len); } - rsp_pdu->data_segment_len = spdk_iscsi_append_param(conn, + rsp_pdu->data_segment_len = iscsi_append_param(conn, "TargetPortalGroupTag", rsp_pdu->data, alloc_len, @@ -1777,10 +1772,10 @@ spdk_iscsi_op_login_set_target_info(struct spdk_iscsi_conn *conn, * SPDK_ISCSI_LOGIN_ERROR_RESPONSE, used to notify the login fail. */ static int -spdk_iscsi_op_login_phase_none(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_pdu *rsp_pdu, - struct iscsi_param *params, - int alloc_len, int cid) +iscsi_op_login_phase_none(struct spdk_iscsi_conn *conn, + struct spdk_iscsi_pdu *rsp_pdu, + struct iscsi_param *params, + int alloc_len, int cid) { enum session_type session_type; char initiator_port_name[MAX_INITIATOR_PORT_NAME]; @@ -1792,23 +1787,22 @@ spdk_iscsi_op_login_phase_none(struct spdk_iscsi_conn *conn, conn->target = NULL; conn->dev = NULL; - rc = spdk_iscsi_op_login_initialize_port(conn, rsp_pdu, - initiator_port_name, MAX_INITIATOR_PORT_NAME, params); + rc = iscsi_op_login_initialize_port(conn, rsp_pdu, initiator_port_name, + MAX_INITIATOR_PORT_NAME, params); if (rc < 0) { return rc; } - rc = spdk_iscsi_op_login_session_type(conn, rsp_pdu, &session_type, - params); + rc = iscsi_op_login_session_type(conn, rsp_pdu, &session_type, params); if (rc < 0) { return rc; } /* Target Name and Port */ if (session_type == SESSION_TYPE_NORMAL) { - rc = spdk_iscsi_op_login_session_normal(conn, rsp_pdu, - initiator_port_name, - params, &target, cid); + rc = iscsi_op_login_session_normal(conn, rsp_pdu, + initiator_port_name, + params, &target, cid); if (rc < 0) { return rc; } @@ -1819,7 +1813,7 @@ spdk_iscsi_op_login_phase_none(struct spdk_iscsi_conn *conn, /* force target flags */ pthread_mutex_lock(&g_spdk_iscsi.mutex); - rc = spdk_iscsi_op_login_session_discovery_chap(conn); + rc = iscsi_op_login_session_discovery_chap(conn); pthread_mutex_unlock(&g_spdk_iscsi.mutex); if (rc < 0) { return rc; @@ -1832,8 +1826,8 @@ spdk_iscsi_op_login_phase_none(struct spdk_iscsi_conn *conn, return SPDK_ISCSI_LOGIN_ERROR_RESPONSE; } - rc = spdk_iscsi_op_login_set_conn_info(conn, rsp_pdu, initiator_port_name, - session_type, target, cid); + rc = iscsi_op_login_set_conn_info(conn, rsp_pdu, initiator_port_name, + session_type, target, cid); if (rc < 0) { return rc; } @@ -1850,8 +1844,8 @@ spdk_iscsi_op_login_phase_none(struct spdk_iscsi_conn *conn, } } - return spdk_iscsi_op_login_set_target_info(conn, rsp_pdu, session_type, - alloc_len, target); + return iscsi_op_login_set_target_info(conn, rsp_pdu, session_type, + alloc_len, target); } /* @@ -1862,11 +1856,10 @@ spdk_iscsi_op_login_phase_none(struct spdk_iscsi_conn *conn, * otherwise, error; */ static int -spdk_iscsi_op_login_rsp_init(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_pdu *pdu, struct spdk_iscsi_pdu *rsp_pdu, - struct iscsi_param **params, int *alloc_len, int *cid) +iscsi_op_login_rsp_init(struct spdk_iscsi_conn *conn, + struct spdk_iscsi_pdu *pdu, struct spdk_iscsi_pdu *rsp_pdu, + struct iscsi_param **params, int *alloc_len, int *cid) { - struct iscsi_bhs_login_req *reqh; struct iscsi_bhs_login_rsp *rsph; int rc; @@ -1983,9 +1976,9 @@ spdk_iscsi_op_login_rsp_init(struct spdk_iscsi_conn *conn, * otherwise: error */ static int -spdk_iscsi_op_login_rsp_handle_csg_bit(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_pdu *rsp_pdu, - struct iscsi_param *params, int alloc_len) +iscsi_op_login_rsp_handle_csg_bit(struct spdk_iscsi_conn *conn, + struct spdk_iscsi_pdu *rsp_pdu, + struct iscsi_param *params, int alloc_len) { const char *auth_method; int rc; @@ -2006,9 +1999,9 @@ spdk_iscsi_op_login_rsp_handle_csg_bit(struct spdk_iscsi_conn *conn, if (strcasecmp(auth_method, "None") == 0) { conn->authenticated = true; } else { - rc = spdk_iscsi_auth_params(conn, params, auth_method, - rsp_pdu->data, alloc_len, - rsp_pdu->data_segment_len); + rc = iscsi_auth_params(conn, params, auth_method, + rsp_pdu->data, alloc_len, + rsp_pdu->data_segment_len); if (rc < 0) { SPDK_ERRLOG("iscsi_auth_params() failed\n"); /* Authentication failure */ @@ -2078,8 +2071,8 @@ spdk_iscsi_op_login_rsp_handle_csg_bit(struct spdk_iscsi_conn *conn, * otherwise: error */ static int -spdk_iscsi_op_login_notify_session_info(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_pdu *rsp_pdu) +iscsi_op_login_notify_session_info(struct spdk_iscsi_conn *conn, + struct spdk_iscsi_pdu *rsp_pdu) { struct iscsi_bhs_login_rsp *rsph; @@ -2127,8 +2120,8 @@ spdk_iscsi_op_login_notify_session_info(struct spdk_iscsi_conn *conn, * otherwise error */ static int -spdk_iscsi_op_login_rsp_handle_t_bit(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_pdu *rsp_pdu) +iscsi_op_login_rsp_handle_t_bit(struct spdk_iscsi_conn *conn, + struct spdk_iscsi_pdu *rsp_pdu) { int rc; struct iscsi_bhs_login_rsp *rsph; @@ -2150,7 +2143,7 @@ spdk_iscsi_op_login_rsp_handle_t_bit(struct spdk_iscsi_conn *conn, conn->login_phase = ISCSI_FULL_FEATURE_PHASE; to_be16(&rsph->tsih, conn->sess->tsih); - rc = spdk_iscsi_op_login_notify_session_info(conn, rsp_pdu); + rc = iscsi_op_login_notify_session_info(conn, rsp_pdu); if (rc < 0) { return rc; } @@ -2178,9 +2171,9 @@ spdk_iscsi_op_login_rsp_handle_t_bit(struct spdk_iscsi_conn *conn, * SPDK_ISCSI_LOGIN_ERROR_RESPONSE, used to notify a failure login. */ static int -spdk_iscsi_op_login_rsp_handle(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_pdu *rsp_pdu, struct iscsi_param **params, - int alloc_len) +iscsi_op_login_rsp_handle(struct spdk_iscsi_conn *conn, + struct spdk_iscsi_pdu *rsp_pdu, struct iscsi_param **params, + int alloc_len) { int rc; struct iscsi_bhs_login_rsp *rsph; @@ -2204,22 +2197,22 @@ spdk_iscsi_op_login_rsp_handle(struct spdk_iscsi_conn *conn, SPDK_LOGDUMP(SPDK_LOG_ISCSI, "Negotiated Params", rsp_pdu->data, rc); /* handle the CSG bit case */ - rc = spdk_iscsi_op_login_rsp_handle_csg_bit(conn, rsp_pdu, *params, - alloc_len); + rc = iscsi_op_login_rsp_handle_csg_bit(conn, rsp_pdu, *params, + alloc_len); if (rc < 0) { return rc; } /* handle the T bit case */ if (ISCSI_BHS_LOGIN_GET_TBIT(rsph->flags)) { - rc = spdk_iscsi_op_login_rsp_handle_t_bit(conn, rsp_pdu); + rc = iscsi_op_login_rsp_handle_t_bit(conn, rsp_pdu); } return rc; } static int -spdk_iscsi_op_login(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) +iscsi_op_login(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) { int rc; struct spdk_iscsi_pdu *rsp_pdu; @@ -2237,10 +2230,10 @@ spdk_iscsi_op_login(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) if (rsp_pdu == NULL) { return SPDK_ISCSI_CONNECTION_FATAL; } - rc = spdk_iscsi_op_login_rsp_init(conn, pdu, rsp_pdu, params_p, - &alloc_len, &cid); + rc = iscsi_op_login_rsp_init(conn, pdu, rsp_pdu, params_p, + &alloc_len, &cid); if (rc == SPDK_ISCSI_LOGIN_ERROR_RESPONSE || rc == SPDK_ISCSI_LOGIN_ERROR_PARAMETER) { - spdk_iscsi_op_login_response(conn, rsp_pdu, *params_p); + iscsi_op_login_response(conn, rsp_pdu, *params_p); return rc; } @@ -2251,21 +2244,21 @@ spdk_iscsi_op_login(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) } if (conn->state == ISCSI_CONN_STATE_INVALID) { - rc = spdk_iscsi_op_login_phase_none(conn, rsp_pdu, *params_p, - alloc_len, cid); + rc = iscsi_op_login_phase_none(conn, rsp_pdu, *params_p, + alloc_len, cid); if (rc == SPDK_ISCSI_LOGIN_ERROR_RESPONSE || rc == SPDK_ISCSI_LOGIN_ERROR_PARAMETER) { - spdk_iscsi_op_login_response(conn, rsp_pdu, *params_p); + iscsi_op_login_response(conn, rsp_pdu, *params_p); return rc; } } - rc = spdk_iscsi_op_login_rsp_handle(conn, rsp_pdu, params_p, alloc_len); + rc = iscsi_op_login_rsp_handle(conn, rsp_pdu, params_p, alloc_len); if (rc == SPDK_ISCSI_LOGIN_ERROR_RESPONSE) { - spdk_iscsi_op_login_response(conn, rsp_pdu, *params_p); + iscsi_op_login_response(conn, rsp_pdu, *params_p); return rc; } - rc = spdk_iscsi_op_login_response(conn, rsp_pdu, *params_p); + rc = iscsi_op_login_response(conn, rsp_pdu, *params_p); if (rc == 0) { conn->state = ISCSI_CONN_STATE_RUNNING; } else { @@ -2276,7 +2269,7 @@ spdk_iscsi_op_login(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) } static int -spdk_iscsi_op_text(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) +iscsi_op_text(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) { struct iscsi_param *params = NULL; struct iscsi_param **params_p = ¶ms; @@ -2342,7 +2335,7 @@ spdk_iscsi_op_text(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) } else if (conn->sess->current_text_itt != task_tag) { SPDK_ERRLOG("The correct itt is %u, and the current itt is %u...\n", conn->sess->current_text_itt, task_tag); - return spdk_iscsi_reject(conn, pdu, ISCSI_REASON_PROTOCOL_ERROR); + return iscsi_reject(conn, pdu, ISCSI_REASON_PROTOCOL_ERROR); } /* store incoming parameters */ @@ -2392,11 +2385,10 @@ spdk_iscsi_op_text(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) if (strcasecmp(val, "ALL") == 0) { /* not in discovery session */ - data_len = spdk_iscsi_append_text(conn, - "SendTargets", - "Reject", data, - alloc_len, - data_len); + data_len = iscsi_append_text(conn, + "SendTargets", + "Reject", data, + alloc_len, data_len); } else { data_len = spdk_iscsi_send_tgts(conn, conn->initiator_name, @@ -2467,7 +2459,7 @@ spdk_iscsi_op_text(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) } /* check value */ - rc = spdk_iscsi_check_values(conn); + rc = iscsi_check_values(conn); if (rc < 0) { SPDK_ERRLOG("iscsi_check_values() failed\n"); spdk_iscsi_param_free(*params_p); @@ -2479,7 +2471,7 @@ spdk_iscsi_op_text(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) } static int -spdk_iscsi_op_logout(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) +iscsi_op_logout(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) { char buf[MAX_TMPBUF]; struct spdk_iscsi_pdu *rsp_pdu; @@ -2615,8 +2607,7 @@ spdk_iscsi_op_logout(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) * task transfertag and the pdu's opcode */ static struct spdk_iscsi_task * -spdk_get_scsi_task_from_ttt(struct spdk_iscsi_conn *conn, - uint32_t transfer_tag) +get_scsi_task_from_ttt(struct spdk_iscsi_conn *conn, uint32_t transfer_tag) { struct spdk_iscsi_pdu *pdu; struct iscsi_bhs_data_in *datain_bhs; @@ -2637,8 +2628,8 @@ spdk_get_scsi_task_from_ttt(struct spdk_iscsi_conn *conn, * initiator task tag and the pdu's opcode */ static struct spdk_iscsi_task * -spdk_get_scsi_task_from_itt(struct spdk_iscsi_conn *conn, - uint32_t task_tag, enum iscsi_op opcode) +get_scsi_task_from_itt(struct spdk_iscsi_conn *conn, + uint32_t task_tag, enum iscsi_op opcode) { struct spdk_iscsi_pdu *pdu; @@ -2654,9 +2645,9 @@ spdk_get_scsi_task_from_itt(struct spdk_iscsi_conn *conn, } static int -spdk_iscsi_send_datain(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_task *task, int datain_flag, - int residual_len, int offset, int DataSN, int len) +iscsi_send_datain(struct spdk_iscsi_conn *conn, + struct spdk_iscsi_task *task, int datain_flag, + int residual_len, int offset, int DataSN, int len) { struct spdk_iscsi_pdu *rsp_pdu; struct iscsi_bhs_data_in *rsph; @@ -2751,8 +2742,7 @@ spdk_iscsi_send_datain(struct spdk_iscsi_conn *conn, } static int -spdk_iscsi_transfer_in(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_task *task) +iscsi_transfer_in(struct spdk_iscsi_conn *conn, struct spdk_iscsi_task *task) { uint32_t DataSN; int transfer_len; @@ -2842,8 +2832,8 @@ spdk_iscsi_transfer_in(struct spdk_iscsi_conn *conn, SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "StatSN=%u, DataSN=%u, Offset=%u, Len=%d\n", conn->StatSN, DataSN, offset, len); - DataSN = spdk_iscsi_send_datain(conn, task, datain_flag, residual_len, - offset, DataSN, len); + DataSN = iscsi_send_datain(conn, task, datain_flag, residual_len, + offset, DataSN, len); } } @@ -2860,7 +2850,7 @@ spdk_iscsi_transfer_in(struct spdk_iscsi_conn *conn, * active_r2t_tasks and queued_r2t_tasks in a connection */ static bool -spdk_iscsi_compare_pdu_bhs_within_existed_r2t_tasks(struct spdk_iscsi_conn *conn, +iscsi_compare_pdu_bhs_within_existed_r2t_tasks(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) { struct spdk_iscsi_task *task; @@ -2880,8 +2870,8 @@ spdk_iscsi_compare_pdu_bhs_within_existed_r2t_tasks(struct spdk_iscsi_conn *conn return false; } -static void spdk_iscsi_queue_task(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_task *task) +static void +iscsi_queue_task(struct spdk_iscsi_conn *conn, struct spdk_iscsi_task *task) { spdk_trace_record(TRACE_ISCSI_TASK_QUEUE, conn->id, task->scsi.length, (uintptr_t)task, (uintptr_t)task->pdu); @@ -2889,8 +2879,8 @@ static void spdk_iscsi_queue_task(struct spdk_iscsi_conn *conn, spdk_scsi_dev_queue_task(conn->dev, &task->scsi); } -static void spdk_iscsi_queue_mgmt_task(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_task *task) +static void +iscsi_queue_mgmt_task(struct spdk_iscsi_conn *conn, struct spdk_iscsi_task *task) { spdk_scsi_dev_queue_mgmt_task(conn->dev, &task->scsi); } @@ -2914,7 +2904,7 @@ int spdk_iscsi_conn_handle_queued_datain_tasks(struct spdk_iscsi_conn *conn) } task->current_datain_offset = task->scsi.length; conn->data_in_cnt++; - spdk_iscsi_queue_task(conn, task); + iscsi_queue_task(conn, task); continue; } if (task->current_datain_offset < task->scsi.transfer_len) { @@ -2942,7 +2932,7 @@ int spdk_iscsi_conn_handle_queued_datain_tasks(struct spdk_iscsi_conn *conn) return 0; } - spdk_iscsi_queue_task(conn, subtask); + iscsi_queue_task(conn, subtask); } if (task->current_datain_offset == task->scsi.transfer_len) { TAILQ_REMOVE(&conn->queued_datain_tasks, task, link); @@ -2951,8 +2941,8 @@ int spdk_iscsi_conn_handle_queued_datain_tasks(struct spdk_iscsi_conn *conn) return 0; } -static int spdk_iscsi_op_scsi_read(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_task *task) +static int +iscsi_op_scsi_read(struct spdk_iscsi_conn *conn, struct spdk_iscsi_task *task) { int32_t remaining_size; @@ -2967,7 +2957,7 @@ static int spdk_iscsi_op_scsi_read(struct spdk_iscsi_conn *conn, task->current_datain_offset = 0; if (remaining_size == 0) { - spdk_iscsi_queue_task(conn, task); + iscsi_queue_task(conn, task); return 0; } @@ -2977,7 +2967,7 @@ static int spdk_iscsi_op_scsi_read(struct spdk_iscsi_conn *conn, } static int -spdk_iscsi_op_scsi(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) +iscsi_op_scsi(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) { struct spdk_iscsi_task *task; struct spdk_scsi_dev *dev; @@ -3014,7 +3004,7 @@ spdk_iscsi_op_scsi(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) } spdk_iscsi_task_associate_pdu(task, pdu); - lun_i = spdk_islun2lun(lun); + lun_i = islun2lun(lun); task->lun_id = lun_i; dev = conn->dev; task->scsi.lun = spdk_scsi_dev_get_lun(dev, lun_i); @@ -3041,12 +3031,12 @@ spdk_iscsi_op_scsi(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) /* no bi-directional support */ if (R_bit) { - return spdk_iscsi_op_scsi_read(conn, task); + return iscsi_op_scsi_read(conn, task); } else if (W_bit) { task->scsi.dxfer_dir = SPDK_SCSI_DIR_TO_DEV; if ((conn->sess->ErrorRecoveryLevel >= 1) && - (spdk_iscsi_compare_pdu_bhs_within_existed_r2t_tasks(conn, pdu))) { + (iscsi_compare_pdu_bhs_within_existed_r2t_tasks(conn, pdu))) { spdk_iscsi_task_response(conn, task); spdk_iscsi_task_put(task); return 0; @@ -3056,14 +3046,14 @@ spdk_iscsi_op_scsi(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) SPDK_ERRLOG("data segment len(=%d) > task transfer len(=%d)\n", (int)pdu->data_segment_len, transfer_len); spdk_iscsi_task_put(task); - return spdk_iscsi_reject(conn, pdu, ISCSI_REASON_PROTOCOL_ERROR); + return iscsi_reject(conn, pdu, ISCSI_REASON_PROTOCOL_ERROR); } /* check the ImmediateData and also pdu->data_segment_len */ if ((!conn->sess->ImmediateData && (pdu->data_segment_len > 0)) || (pdu->data_segment_len > conn->sess->FirstBurstLength)) { spdk_iscsi_task_put(task); - return spdk_iscsi_reject(conn, pdu, ISCSI_REASON_PROTOCOL_ERROR); + return iscsi_reject(conn, pdu, ISCSI_REASON_PROTOCOL_ERROR); } if (spdk_likely(!pdu->dif_insert_or_strip)) { @@ -3074,7 +3064,7 @@ spdk_iscsi_op_scsi(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) if (F_bit && pdu->data_segment_len < transfer_len) { /* needs R2T */ - rc = spdk_add_transfer_task(conn, task); + rc = add_transfer_task(conn, task); if (rc < 0) { SPDK_ERRLOG("add_transfer_task() failed\n"); spdk_iscsi_task_put(task); @@ -3103,17 +3093,17 @@ spdk_iscsi_op_scsi(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) if (transfer_len > 0) { spdk_iscsi_task_put(task); SPDK_ERRLOG("Reject scsi cmd with EDTL > 0 but (R | W) == 0\n"); - return spdk_iscsi_reject(conn, pdu, ISCSI_REASON_INVALID_PDU_FIELD); + return iscsi_reject(conn, pdu, ISCSI_REASON_INVALID_PDU_FIELD); } } - spdk_iscsi_queue_task(conn, task); + iscsi_queue_task(conn, task); return 0; } static void -spdk_abort_transfer_task_in_task_mgmt_resp(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_task *task) +abort_transfer_task_in_task_mgmt_resp(struct spdk_iscsi_conn *conn, + struct spdk_iscsi_task *task) { struct spdk_iscsi_pdu *pdu; @@ -3160,11 +3150,11 @@ spdk_iscsi_task_mgmt_response(struct spdk_iscsi_conn *conn, rsph->flags |= 0x80; /* bit 0 default to 1 */ switch (task->scsi.response) { case SPDK_SCSI_TASK_MGMT_RESP_COMPLETE: - spdk_abort_transfer_task_in_task_mgmt_resp(conn, task); + abort_transfer_task_in_task_mgmt_resp(conn, task); rsph->response = ISCSI_TASK_FUNC_RESP_COMPLETE; break; case SPDK_SCSI_TASK_MGMT_RESP_SUCCESS: - spdk_abort_transfer_task_in_task_mgmt_resp(conn, task); + abort_transfer_task_in_task_mgmt_resp(conn, task); rsph->response = ISCSI_TASK_FUNC_RESP_COMPLETE; break; case SPDK_SCSI_TASK_MGMT_RESP_REJECT: @@ -3216,7 +3206,7 @@ void spdk_iscsi_task_response(struct spdk_iscsi_conn *conn, /* transfer data from logical unit */ /* (direction is view of initiator side) */ if (spdk_iscsi_task_is_read(primary)) { - rc = spdk_iscsi_transfer_in(conn, task); + rc = iscsi_transfer_in(conn, task); if (rc > 0) { /* sent status by last DATAIN PDU */ return; @@ -3300,7 +3290,7 @@ void spdk_iscsi_task_response(struct spdk_iscsi_conn *conn, } static struct spdk_iscsi_task * -spdk_get_transfer_task(struct spdk_iscsi_conn *conn, uint32_t transfer_tag) +get_transfer_task(struct spdk_iscsi_conn *conn, uint32_t transfer_tag) { int i; @@ -3314,8 +3304,8 @@ spdk_get_transfer_task(struct spdk_iscsi_conn *conn, uint32_t transfer_tag) } static int -_spdk_iscsi_conn_abort_queued_datain_task(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_task *task) +_iscsi_conn_abort_queued_datain_task(struct spdk_iscsi_conn *conn, + struct spdk_iscsi_task *task) { struct spdk_iscsi_task *subtask; uint32_t remaining_size; @@ -3358,14 +3348,14 @@ _spdk_iscsi_conn_abort_queued_datain_task(struct spdk_iscsi_conn *conn, } static int -spdk_iscsi_conn_abort_queued_datain_task(struct spdk_iscsi_conn *conn, - uint32_t ref_task_tag) +iscsi_conn_abort_queued_datain_task(struct spdk_iscsi_conn *conn, + uint32_t ref_task_tag) { struct spdk_iscsi_task *task; TAILQ_FOREACH(task, &conn->queued_datain_tasks, link) { if (task->tag == ref_task_tag) { - return _spdk_iscsi_conn_abort_queued_datain_task(conn, task); + return _iscsi_conn_abort_queued_datain_task(conn, task); } } @@ -3373,9 +3363,9 @@ spdk_iscsi_conn_abort_queued_datain_task(struct spdk_iscsi_conn *conn, } static int -spdk_iscsi_conn_abort_queued_datain_tasks(struct spdk_iscsi_conn *conn, - struct spdk_scsi_lun *lun, - struct spdk_iscsi_pdu *pdu) +iscsi_conn_abort_queued_datain_tasks(struct spdk_iscsi_conn *conn, + struct spdk_scsi_lun *lun, + struct spdk_iscsi_pdu *pdu) { struct spdk_iscsi_task *task, *task_tmp; struct spdk_iscsi_pdu *pdu_tmp; @@ -3385,7 +3375,7 @@ spdk_iscsi_conn_abort_queued_datain_tasks(struct spdk_iscsi_conn *conn, pdu_tmp = spdk_iscsi_task_get_pdu(task); if ((lun == NULL || lun == task->scsi.lun) && (pdu == NULL || (SN32_LT(pdu_tmp->cmd_sn, pdu->cmd_sn)))) { - rc = _spdk_iscsi_conn_abort_queued_datain_task(conn, task); + rc = _iscsi_conn_abort_queued_datain_task(conn, task); if (rc != 0) { return rc; } @@ -3396,44 +3386,43 @@ spdk_iscsi_conn_abort_queued_datain_tasks(struct spdk_iscsi_conn *conn, } static int -_spdk_iscsi_op_abort_task(void *arg) +_iscsi_op_abort_task(void *arg) { struct spdk_iscsi_task *task = arg; int rc; - rc = spdk_iscsi_conn_abort_queued_datain_task(task->conn, - task->scsi.abort_id); + rc = iscsi_conn_abort_queued_datain_task(task->conn, task->scsi.abort_id); if (rc != 0) { return 1; } spdk_poller_unregister(&task->mgmt_poller); - spdk_iscsi_queue_mgmt_task(task->conn, task); + iscsi_queue_mgmt_task(task->conn, task); return 1; } static void -spdk_iscsi_op_abort_task(struct spdk_iscsi_task *task, uint32_t ref_task_tag) +iscsi_op_abort_task(struct spdk_iscsi_task *task, uint32_t ref_task_tag) { task->scsi.abort_id = ref_task_tag; task->scsi.function = SPDK_SCSI_TASK_FUNC_ABORT_TASK; - task->mgmt_poller = spdk_poller_register(_spdk_iscsi_op_abort_task, task, 10); + task->mgmt_poller = spdk_poller_register(_iscsi_op_abort_task, task, 10); } static int -_spdk_iscsi_op_abort_task_set(void *arg) +_iscsi_op_abort_task_set(void *arg) { struct spdk_iscsi_task *task = arg; int rc; - rc = spdk_iscsi_conn_abort_queued_datain_tasks(task->conn, task->scsi.lun, + rc = iscsi_conn_abort_queued_datain_tasks(task->conn, task->scsi.lun, task->pdu); if (rc != 0) { return 1; } spdk_poller_unregister(&task->mgmt_poller); - spdk_iscsi_queue_mgmt_task(task->conn, task); + iscsi_queue_mgmt_task(task->conn, task); return 1; } @@ -3441,11 +3430,11 @@ void spdk_iscsi_op_abort_task_set(struct spdk_iscsi_task *task, uint8_t function) { task->scsi.function = function; - task->mgmt_poller = spdk_poller_register(_spdk_iscsi_op_abort_task_set, task, 10); + task->mgmt_poller = spdk_poller_register(_iscsi_op_abort_task_set, task, 10); } static int -spdk_iscsi_op_task(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) +iscsi_op_task(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) { struct iscsi_bhs_task_req *reqh; uint64_t lun; @@ -3473,7 +3462,7 @@ spdk_iscsi_op_task(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "StatSN=%u, ExpCmdSN=%u, MaxCmdSN=%u\n", conn->StatSN, conn->sess->ExpCmdSN, conn->sess->MaxCmdSN); - lun_i = spdk_islun2lun(lun); + lun_i = islun2lun(lun); dev = conn->dev; task = spdk_iscsi_task_get(conn, NULL, spdk_iscsi_task_mgmt_cpl); @@ -3500,8 +3489,7 @@ spdk_iscsi_op_task(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) case ISCSI_TASK_FUNC_ABORT_TASK: SPDK_NOTICELOG("ABORT_TASK\n"); - spdk_iscsi_op_abort_task(task, ref_task_tag); - + iscsi_op_abort_task(task, ref_task_tag); return SPDK_SUCCESS; /* abort all tasks issued via this session on the LUN */ @@ -3575,7 +3563,7 @@ spdk_iscsi_op_task(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) } static int -spdk_iscsi_op_nopout(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) +iscsi_op_nopout(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) { struct spdk_iscsi_pdu *rsp_pdu; struct iscsi_bhs_nop_out *reqh; @@ -3686,8 +3674,7 @@ spdk_iscsi_op_nopout(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) } static int -spdk_add_transfer_task(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_task *task) +add_transfer_task(struct spdk_iscsi_conn *conn, struct spdk_iscsi_task *task) { uint32_t transfer_len; size_t max_burst_len; @@ -3732,8 +3719,8 @@ spdk_add_transfer_task(struct spdk_iscsi_conn *conn, while (data_len != transfer_len) { len = DMIN32(max_burst_len, (transfer_len - data_len)); - rc = spdk_iscsi_send_r2t(conn, task, data_len, len, - task->ttt, &task->R2TSN); + rc = iscsi_send_r2t(conn, task, data_len, len, + task->ttt, &task->R2TSN); if (rc < 0) { SPDK_ERRLOG("iscsi_send_r2t() failed\n"); return rc; @@ -3755,14 +3742,14 @@ spdk_add_transfer_task(struct spdk_iscsi_conn *conn, * are attached and large write tasks for the specific LUN are cleared. */ static void -spdk_start_queued_transfer_tasks(struct spdk_iscsi_conn *conn) +start_queued_transfer_tasks(struct spdk_iscsi_conn *conn) { struct spdk_iscsi_task *task, *tmp; TAILQ_FOREACH_SAFE(task, &conn->queued_r2t_tasks, link, tmp) { if (conn->pending_r2t < DEFAULT_MAXR2T) { TAILQ_REMOVE(&conn->queued_r2t_tasks, task, link); - spdk_add_transfer_task(conn, task); + add_transfer_task(conn, task); } else { break; } @@ -3788,13 +3775,13 @@ void spdk_del_transfer_task(struct spdk_iscsi_conn *conn, uint32_t task_tag) } } - spdk_start_queued_transfer_tasks(conn); + start_queued_transfer_tasks(conn); } static void -spdk_del_connection_queued_task(struct spdk_iscsi_conn *conn, void *tailq, - struct spdk_scsi_lun *lun, - struct spdk_iscsi_pdu *pdu) +del_connection_queued_task(struct spdk_iscsi_conn *conn, void *tailq, + struct spdk_scsi_lun *lun, + struct spdk_iscsi_pdu *pdu) { struct spdk_iscsi_task *task, *task_tmp; struct spdk_iscsi_pdu *pdu_tmp; @@ -3856,18 +3843,18 @@ void spdk_clear_all_transfer_task(struct spdk_iscsi_conn *conn, } } - spdk_del_connection_queued_task(conn, &conn->active_r2t_tasks, lun, pdu); - spdk_del_connection_queued_task(conn, &conn->queued_r2t_tasks, lun, pdu); + del_connection_queued_task(conn, &conn->active_r2t_tasks, lun, pdu); + del_connection_queued_task(conn, &conn->queued_r2t_tasks, lun, pdu); - spdk_start_queued_transfer_tasks(conn); + start_queued_transfer_tasks(conn); } /* This function is used to handle the r2t snack */ static int -spdk_iscsi_handle_r2t_snack(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_task *task, - struct spdk_iscsi_pdu *pdu, uint32_t beg_run, - uint32_t run_length, int32_t task_tag) +iscsi_handle_r2t_snack(struct spdk_iscsi_conn *conn, + struct spdk_iscsi_task *task, + struct spdk_iscsi_pdu *pdu, uint32_t beg_run, + uint32_t run_length, int32_t task_tag) { int32_t last_r2tsn; int i; @@ -3878,7 +3865,7 @@ spdk_iscsi_handle_r2t_snack(struct spdk_iscsi_conn *conn, "ack to R2TSN:0x%08x, protocol error.\n", task_tag, beg_run, (beg_run + run_length), (task->acked_r2tsn - 1)); - return spdk_iscsi_reject(conn, pdu, ISCSI_REASON_PROTOCOL_ERROR); + return iscsi_reject(conn, pdu, ISCSI_REASON_PROTOCOL_ERROR); } if (run_length) { @@ -3889,8 +3876,7 @@ spdk_iscsi_handle_r2t_snack(struct spdk_iscsi_conn *conn, task_tag, beg_run, run_length, task->R2TSN); - return spdk_iscsi_reject(conn, pdu, - ISCSI_REASON_INVALID_PDU_FIELD); + return iscsi_reject(conn, pdu, ISCSI_REASON_INVALID_PDU_FIELD); } last_r2tsn = (beg_run + run_length); } else { @@ -3898,7 +3884,7 @@ spdk_iscsi_handle_r2t_snack(struct spdk_iscsi_conn *conn, } for (i = beg_run; i < last_r2tsn; i++) { - if (spdk_iscsi_send_r2t_recovery(conn, task, i, false) < 0) { + if (iscsi_send_r2t_recovery(conn, task, i, false) < 0) { SPDK_ERRLOG("The r2t_sn=%d of r2t_task=%p is not sent\n", i, task); } } @@ -3907,10 +3893,10 @@ spdk_iscsi_handle_r2t_snack(struct spdk_iscsi_conn *conn, /* This function is used to recover the data in packet */ static int -spdk_iscsi_handle_recovery_datain(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_task *task, - struct spdk_iscsi_pdu *pdu, uint32_t beg_run, - uint32_t run_length, uint32_t task_tag) +iscsi_handle_recovery_datain(struct spdk_iscsi_conn *conn, + struct spdk_iscsi_task *task, + struct spdk_iscsi_pdu *pdu, uint32_t beg_run, + uint32_t run_length, uint32_t task_tag) { struct spdk_iscsi_pdu *old_pdu, *pdu_temp; uint32_t i; @@ -3919,7 +3905,7 @@ spdk_iscsi_handle_recovery_datain(struct spdk_iscsi_conn *conn, task = spdk_iscsi_task_get_primary(task); - SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "spdk_iscsi_handle_recovery_datain\n"); + SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "iscsi_handle_recovery_datain\n"); if (beg_run < task->acked_data_sn) { SPDK_ERRLOG("ITT: 0x%08x, DATA IN SNACK requests retransmission of" @@ -3928,7 +3914,7 @@ spdk_iscsi_handle_recovery_datain(struct spdk_iscsi_conn *conn, task_tag, beg_run, (beg_run + run_length), (task->acked_data_sn - 1)); - return spdk_iscsi_reject(conn, pdu, ISCSI_REASON_PROTOCOL_ERROR); + return iscsi_reject(conn, pdu, ISCSI_REASON_PROTOCOL_ERROR); } if (run_length == 0) { @@ -3964,8 +3950,7 @@ spdk_iscsi_handle_recovery_datain(struct spdk_iscsi_conn *conn, /* This function is used to handle the status snack */ static int -spdk_iscsi_handle_status_snack(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_pdu *pdu) +iscsi_handle_status_snack(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) { uint32_t beg_run; uint32_t run_length; @@ -3990,7 +3975,7 @@ spdk_iscsi_handle_status_snack(struct spdk_iscsi_conn *conn, "but already got ExpStatSN: 0x%08x on CID:%hu.\n", beg_run, run_length, conn->StatSN, conn->cid); - return spdk_iscsi_reject(conn, pdu, ISCSI_REASON_INVALID_PDU_FIELD); + return iscsi_reject(conn, pdu, ISCSI_REASON_INVALID_PDU_FIELD); } last_statsn = (!run_length) ? conn->StatSN : (beg_run + run_length); @@ -4020,8 +4005,7 @@ spdk_iscsi_handle_status_snack(struct spdk_iscsi_conn *conn, /* This function is used to handle the data ack snack */ static int -spdk_iscsi_handle_data_ack(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_pdu *pdu) +iscsi_handle_data_ack(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) { uint32_t transfer_tag; uint32_t beg_run; @@ -4043,7 +4027,7 @@ spdk_iscsi_handle_data_ack(struct spdk_iscsi_conn *conn, SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "beg_run=%d,transfer_tag=%d,run_len=%d\n", beg_run, transfer_tag, run_length); - task = spdk_get_scsi_task_from_ttt(conn, transfer_tag); + task = get_scsi_task_from_ttt(conn, transfer_tag); if (!task) { SPDK_ERRLOG("Data ACK SNACK for TTT: 0x%08x is invalid.\n", transfer_tag); @@ -4084,14 +4068,14 @@ spdk_iscsi_handle_data_ack(struct spdk_iscsi_conn *conn, return 0; reject_return: - return spdk_iscsi_reject(conn, pdu, ISCSI_REASON_INVALID_SNACK); + return iscsi_reject(conn, pdu, ISCSI_REASON_INVALID_SNACK); } /* This function is used to remove the r2t pdu from snack_pdu_list by < task, r2t_sn> info */ static struct spdk_iscsi_pdu * -spdk_iscsi_remove_r2t_pdu_from_snack_list(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_task *task, - uint32_t r2t_sn) +iscsi_remove_r2t_pdu_from_snack_list(struct spdk_iscsi_conn *conn, + struct spdk_iscsi_task *task, + uint32_t r2t_sn) { struct spdk_iscsi_pdu *pdu; struct iscsi_bhs_r2t *r2t_header; @@ -4112,9 +4096,9 @@ spdk_iscsi_remove_r2t_pdu_from_snack_list(struct spdk_iscsi_conn *conn, /* This function is used re-send the r2t packet */ static int -spdk_iscsi_send_r2t_recovery(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_task *task, uint32_t r2t_sn, - bool send_new_r2tsn) +iscsi_send_r2t_recovery(struct spdk_iscsi_conn *conn, + struct spdk_iscsi_task *task, uint32_t r2t_sn, + bool send_new_r2tsn) { struct spdk_iscsi_pdu *pdu; struct iscsi_bhs_r2t *rsph; @@ -4123,7 +4107,7 @@ spdk_iscsi_send_r2t_recovery(struct spdk_iscsi_conn *conn, int rc; /* remove the r2t pdu from the snack_list */ - pdu = spdk_iscsi_remove_r2t_pdu_from_snack_list(conn, task, r2t_sn); + pdu = iscsi_remove_r2t_pdu_from_snack_list(conn, task, r2t_sn); if (!pdu) { SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "No pdu is found\n"); return -1; @@ -4152,8 +4136,8 @@ spdk_iscsi_send_r2t_recovery(struct spdk_iscsi_conn *conn, spdk_put_pdu(pdu); /* re-send a new r2t pdu */ - rc = spdk_iscsi_send_r2t(conn, task, task->next_expected_r2t_offset, - len, task->ttt, &task->R2TSN); + rc = iscsi_send_r2t(conn, task, task->next_expected_r2t_offset, + len, task->ttt, &task->R2TSN); if (rc < 0) { return SPDK_ISCSI_CONNECTION_FATAL; } @@ -4164,7 +4148,7 @@ spdk_iscsi_send_r2t_recovery(struct spdk_iscsi_conn *conn, /* This function is used to handle the snack request from the initiator */ static int -spdk_iscsi_op_snack(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) +iscsi_op_snack(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) { struct iscsi_bhs_snack_req *reqh; struct spdk_iscsi_task *task; @@ -4182,7 +4166,7 @@ spdk_iscsi_op_snack(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) reqh = (struct iscsi_bhs_snack_req *)&pdu->bhs; if (!conn->sess->ErrorRecoveryLevel) { SPDK_ERRLOG("Got a SNACK request in ErrorRecoveryLevel=0\n"); - return spdk_iscsi_reject(conn, pdu, ISCSI_REASON_PROTOCOL_ERROR); + return iscsi_reject(conn, pdu, ISCSI_REASON_PROTOCOL_ERROR); } type = reqh->flags & ISCSI_FLAG_SNACK_TYPE_MASK; @@ -4199,33 +4183,33 @@ spdk_iscsi_op_snack(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) "task_tag=%x, transfer_tag=%u\n", beg_run, run_length, task_tag, from_be32(&reqh->ttt)); - task = spdk_get_scsi_task_from_itt(conn, task_tag, - ISCSI_OP_SCSI_DATAIN); + task = get_scsi_task_from_itt(conn, task_tag, + ISCSI_OP_SCSI_DATAIN); if (task) { - return spdk_iscsi_handle_recovery_datain(conn, task, pdu, - beg_run, run_length, task_tag); + return iscsi_handle_recovery_datain(conn, task, pdu, + beg_run, run_length, task_tag); } - task = spdk_get_scsi_task_from_itt(conn, task_tag, ISCSI_OP_R2T); + task = get_scsi_task_from_itt(conn, task_tag, ISCSI_OP_R2T); if (task) { - return spdk_iscsi_handle_r2t_snack(conn, task, pdu, beg_run, - run_length, task_tag); + return iscsi_handle_r2t_snack(conn, task, pdu, beg_run, + run_length, task_tag); } SPDK_ERRLOG("It is Neither datain nor r2t recovery request\n"); rc = -1; break; case ISCSI_FLAG_SNACK_TYPE_STATUS: - rc = spdk_iscsi_handle_status_snack(conn, pdu); + rc = iscsi_handle_status_snack(conn, pdu); break; case ISCSI_FLAG_SNACK_TYPE_DATA_ACK: - rc = spdk_iscsi_handle_data_ack(conn, pdu); + rc = iscsi_handle_data_ack(conn, pdu); break; case ISCSI_FLAG_SNACK_TYPE_RDATA: SPDK_ERRLOG("R-Data SNACK is Not Supported int spdk\n"); - rc = spdk_iscsi_reject(conn, pdu, ISCSI_REASON_PROTOCOL_ERROR); + rc = iscsi_reject(conn, pdu, ISCSI_REASON_PROTOCOL_ERROR); break; default: SPDK_ERRLOG("Unknown SNACK type %d, protocol error\n", type); - rc = spdk_iscsi_reject(conn, pdu, ISCSI_REASON_PROTOCOL_ERROR); + rc = iscsi_reject(conn, pdu, ISCSI_REASON_PROTOCOL_ERROR); break; } @@ -4234,8 +4218,7 @@ spdk_iscsi_op_snack(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) /* This function is used to refree the pdu when it is acknowledged */ static void -spdk_remove_acked_pdu(struct spdk_iscsi_conn *conn, - uint32_t ExpStatSN) +remove_acked_pdu(struct spdk_iscsi_conn *conn, uint32_t ExpStatSN) { struct spdk_iscsi_pdu *pdu, *pdu_temp; uint32_t stat_sn; @@ -4250,8 +4233,8 @@ spdk_remove_acked_pdu(struct spdk_iscsi_conn *conn, } } -static int spdk_iscsi_op_data(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_pdu *pdu) +static int +iscsi_op_data(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) { struct spdk_iscsi_task *task, *subtask; struct iscsi_bhs_data_out *reqh; @@ -4278,7 +4261,7 @@ static int spdk_iscsi_op_data(struct spdk_iscsi_conn *conn, DataSN = from_be32(&reqh->data_sn); buffer_offset = from_be32(&reqh->buffer_offset); - task = spdk_get_transfer_task(conn, transfer_tag); + task = get_transfer_task(conn, transfer_tag); if (task == NULL) { SPDK_ERRLOG("Not found task for transfer_tag=%x\n", transfer_tag); goto reject_return; @@ -4352,8 +4335,8 @@ static int spdk_iscsi_op_data(struct spdk_iscsi_conn *conn, task->acked_r2tsn++; len = DMIN32(conn->sess->MaxBurstLength, (transfer_len - task->next_r2t_offset)); - rc = spdk_iscsi_send_r2t(conn, task, task->next_r2t_offset, len, - task->ttt, &task->R2TSN); + rc = iscsi_send_r2t(conn, task, task->next_r2t_offset, len, + task->ttt, &task->R2TSN); if (rc < 0) { SPDK_ERRLOG("iscsi_send_r2t() failed\n"); } @@ -4369,23 +4352,23 @@ static int spdk_iscsi_op_data(struct spdk_iscsi_conn *conn, return 0; } - spdk_iscsi_queue_task(conn, subtask); + iscsi_queue_task(conn, subtask); return 0; send_r2t_recovery_return: - rc = spdk_iscsi_send_r2t_recovery(conn, task, task->acked_r2tsn, true); + rc = iscsi_send_r2t_recovery(conn, task, task->acked_r2tsn, true); if (rc == 0) { return 0; } reject_return: - return spdk_iscsi_reject(conn, pdu, reject_reason); + return iscsi_reject(conn, pdu, reject_reason); } static int -spdk_iscsi_send_r2t(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_task *task, int offset, - int len, uint32_t transfer_tag, uint32_t *R2TSN) +iscsi_send_r2t(struct spdk_iscsi_conn *conn, + struct spdk_iscsi_task *task, int offset, + int len, uint32_t transfer_tag, uint32_t *R2TSN) { struct spdk_iscsi_pdu *rsp_pdu; struct iscsi_bhs_r2t *rsph; @@ -4470,7 +4453,7 @@ void spdk_iscsi_send_nopin(struct spdk_iscsi_conn *conn) } static void -spdk_init_login_reject_response(struct spdk_iscsi_pdu *pdu, struct spdk_iscsi_pdu *rsp_pdu) +init_login_reject_response(struct spdk_iscsi_pdu *pdu, struct spdk_iscsi_pdu *rsp_pdu) { struct iscsi_bhs_login_rsp *rsph; @@ -4506,7 +4489,7 @@ spdk_iscsi_execute(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "opcode %x\n", opcode); if (opcode == ISCSI_OP_LOGIN) { - rc = spdk_iscsi_op_login(conn, pdu); + rc = iscsi_op_login(conn, pdu); if (rc < 0) { SPDK_ERRLOG("iscsi_op_login() failed\n"); } @@ -4521,7 +4504,7 @@ spdk_iscsi_execute(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) if (rsp_pdu == NULL) { return SPDK_ISCSI_CONNECTION_FATAL; } - spdk_init_login_reject_response(pdu, rsp_pdu); + init_login_reject_response(pdu, rsp_pdu); spdk_iscsi_conn_write_pdu(conn, rsp_pdu); SPDK_ERRLOG("Received opcode %d in login phase\n", opcode); return SPDK_ISCSI_LOGIN_ERROR_RESPONSE; @@ -4573,7 +4556,7 @@ spdk_iscsi_execute(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) } if (sess->ErrorRecoveryLevel >= 1) { - spdk_remove_acked_pdu(conn, ExpStatSN); + remove_acked_pdu(conn, ExpStatSN); } if (!I_bit && opcode != ISCSI_OP_SCSI_DATAOUT) { @@ -4582,7 +4565,7 @@ spdk_iscsi_execute(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) switch (opcode) { case ISCSI_OP_NOPOUT: - rc = spdk_iscsi_op_nopout(conn, pdu); + rc = iscsi_op_nopout(conn, pdu); if (rc < 0) { SPDK_ERRLOG("spdk_iscsi_op_nopout() failed\n"); return rc; @@ -4590,14 +4573,14 @@ spdk_iscsi_execute(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) break; case ISCSI_OP_SCSI: - rc = spdk_iscsi_op_scsi(conn, pdu); + rc = iscsi_op_scsi(conn, pdu); if (rc < 0) { SPDK_ERRLOG("spdk_iscsi_op_scsi() failed\n"); return rc; } break; case ISCSI_OP_TASK: - rc = spdk_iscsi_op_task(conn, pdu); + rc = iscsi_op_task(conn, pdu); if (rc < 0) { SPDK_ERRLOG("spdk_iscsi_op_task() failed\n"); return rc; @@ -4605,7 +4588,7 @@ spdk_iscsi_execute(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) break; case ISCSI_OP_TEXT: - rc = spdk_iscsi_op_text(conn, pdu); + rc = iscsi_op_text(conn, pdu); if (rc < 0) { SPDK_ERRLOG("spdk_iscsi_op_text() failed\n"); return rc; @@ -4613,7 +4596,7 @@ spdk_iscsi_execute(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) break; case ISCSI_OP_LOGOUT: - rc = spdk_iscsi_op_logout(conn, pdu); + rc = iscsi_op_logout(conn, pdu); if (rc < 0) { SPDK_ERRLOG("spdk_iscsi_op_logout() failed\n"); return rc; @@ -4621,7 +4604,7 @@ spdk_iscsi_execute(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) break; case ISCSI_OP_SCSI_DATAOUT: - rc = spdk_iscsi_op_data(conn, pdu); + rc = iscsi_op_data(conn, pdu); if (rc < 0) { SPDK_ERRLOG("spdk_iscsi_op_data() failed\n"); return rc; @@ -4629,7 +4612,7 @@ spdk_iscsi_execute(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) break; case ISCSI_OP_SNACK: - rc = spdk_iscsi_op_snack(conn, pdu); + rc = iscsi_op_snack(conn, pdu); if (rc < 0) { SPDK_ERRLOG("spdk_iscsi_op_snack() failed\n"); return rc; @@ -4638,7 +4621,7 @@ spdk_iscsi_execute(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) default: SPDK_ERRLOG("unsupported opcode %x\n", opcode); - return spdk_iscsi_reject(conn, pdu, ISCSI_REASON_PROTOCOL_ERROR); + return iscsi_reject(conn, pdu, ISCSI_REASON_PROTOCOL_ERROR); } return 0; @@ -4679,7 +4662,7 @@ spdk_iscsi_get_dif_ctx(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu, offset = 0; cdb = sbhs->cdb; lun = from_be64(&sbhs->lun); - lun_id = spdk_islun2lun(lun); + lun_id = islun2lun(lun); break; } case ISCSI_OP_SCSI_DATAOUT: { @@ -4690,7 +4673,7 @@ spdk_iscsi_get_dif_ctx(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu, dbhs = (struct iscsi_bhs_data_out *)bhs; offset = from_be32(&dbhs->buffer_offset); transfer_tag = from_be32(&dbhs->ttt); - task = spdk_get_transfer_task(conn, transfer_tag); + task = get_transfer_task(conn, transfer_tag); if (task == NULL) { return false; } @@ -4738,9 +4721,9 @@ void spdk_free_sess(struct spdk_iscsi_sess *sess) } static int -spdk_create_iscsi_sess(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_tgt_node *target, - enum session_type session_type) +create_iscsi_sess(struct spdk_iscsi_conn *conn, + struct spdk_iscsi_tgt_node *target, + enum session_type session_type) { struct spdk_iscsi_sess *sess; int rc; @@ -4892,7 +4875,7 @@ error_return: } static struct spdk_iscsi_sess * -spdk_get_iscsi_sess_by_tsih(uint16_t tsih) +get_iscsi_sess_by_tsih(uint16_t tsih) { struct spdk_iscsi_sess *session; @@ -4907,15 +4890,15 @@ spdk_get_iscsi_sess_by_tsih(uint16_t tsih) } static int -spdk_append_iscsi_sess(struct spdk_iscsi_conn *conn, - const char *initiator_port_name, uint16_t tsih, uint16_t cid) +append_iscsi_sess(struct spdk_iscsi_conn *conn, + const char *initiator_port_name, uint16_t tsih, uint16_t cid) { struct spdk_iscsi_sess *sess; SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "append session: init port name=%s, tsih=%u, cid=%u\n", initiator_port_name, tsih, cid); - sess = spdk_get_iscsi_sess_by_tsih(tsih); + sess = get_iscsi_sess_by_tsih(tsih); if (sess == NULL) { SPDK_ERRLOG("spdk_get_iscsi_sess_by_tsih failed\n"); return -1; diff --git a/lib/iscsi/iscsi_subsystem.c b/lib/iscsi/iscsi_subsystem.c index 5c3aedffce..5c44cd5689 100644 --- a/lib/iscsi/iscsi_subsystem.c +++ b/lib/iscsi/iscsi_subsystem.c @@ -87,7 +87,7 @@ static void *g_fini_cb_arg; "\n" static void -spdk_iscsi_globals_config_text(FILE *fp) +iscsi_globals_config_text(FILE *fp) { const char *authmethod = "None"; char authgroup[32] = "None"; @@ -126,8 +126,8 @@ spdk_iscsi_globals_config_text(FILE *fp) #define ISCSI_DATA_BUFFER_MASK (ISCSI_DATA_BUFFER_ALIGNMENT - 1) static void -spdk_mobj_ctor(struct spdk_mempool *mp, __attribute__((unused)) void *arg, - void *_m, __attribute__((unused)) unsigned i) +mobj_ctor(struct spdk_mempool *mp, __attribute__((unused)) void *arg, + void *_m, __attribute__((unused)) unsigned i) { struct spdk_mobj *m = _m; @@ -142,7 +142,8 @@ spdk_mobj_ctor(struct spdk_mempool *mp, __attribute__((unused)) void *arg, #define IMMEDIATE_DATA_POOL_SIZE(iscsi) (iscsi->MaxConnections * 128) #define DATA_OUT_POOL_SIZE(iscsi) (iscsi->MaxConnections * MAX_DATA_OUT_PER_CONNECTION) -static int spdk_iscsi_initialize_pdu_pool(void) +static int +iscsi_initialize_pdu_pool(void) { struct spdk_iscsi_globals *iscsi = &g_spdk_iscsi; int imm_mobj_size = SPDK_BDEV_BUF_SIZE_WITH_MD(spdk_get_max_immediate_data_size()) + @@ -164,7 +165,7 @@ static int spdk_iscsi_initialize_pdu_pool(void) IMMEDIATE_DATA_POOL_SIZE(iscsi), imm_mobj_size, 256, spdk_env_get_socket_id(spdk_env_get_current_core()), - spdk_mobj_ctor, NULL); + mobj_ctor, NULL); if (!iscsi->pdu_immediate_data_pool) { SPDK_ERRLOG("create PDU immediate data pool failed\n"); return -1; @@ -174,7 +175,7 @@ static int spdk_iscsi_initialize_pdu_pool(void) DATA_OUT_POOL_SIZE(iscsi), dout_mobj_size, 256, spdk_env_get_socket_id(spdk_env_get_current_core()), - spdk_mobj_ctor, NULL); + mobj_ctor, NULL); if (!iscsi->pdu_data_out_pool) { SPDK_ERRLOG("create PDU data out pool failed\n"); return -1; @@ -183,8 +184,9 @@ static int spdk_iscsi_initialize_pdu_pool(void) return 0; } -static void spdk_iscsi_sess_ctor(struct spdk_mempool *pool, void *arg, - void *session_buf, unsigned index) +static void +iscsi_sess_ctor(struct spdk_mempool *pool, void *arg, void *session_buf, + unsigned index) { struct spdk_iscsi_globals *iscsi = arg; struct spdk_iscsi_sess *sess = session_buf; @@ -198,7 +200,7 @@ static void spdk_iscsi_sess_ctor(struct spdk_mempool *pool, void *arg, #define DEFAULT_TASK_POOL_SIZE 32768 static int -spdk_iscsi_initialize_task_pool(void) +iscsi_initialize_task_pool(void) { struct spdk_iscsi_globals *iscsi = &g_spdk_iscsi; @@ -216,7 +218,8 @@ spdk_iscsi_initialize_task_pool(void) } #define SESSION_POOL_SIZE(iscsi) (iscsi->MaxSessions) -static int spdk_iscsi_initialize_session_pool(void) +static int +iscsi_initialize_session_pool(void) { struct spdk_iscsi_globals *iscsi = &g_spdk_iscsi; @@ -224,7 +227,7 @@ static int spdk_iscsi_initialize_session_pool(void) SESSION_POOL_SIZE(iscsi), sizeof(struct spdk_iscsi_sess), 0, SPDK_ENV_SOCKET_ID_ANY, - spdk_iscsi_sess_ctor, iscsi); + iscsi_sess_ctor, iscsi); if (!iscsi->session_pool) { SPDK_ERRLOG("create session pool failed\n"); return -1; @@ -234,17 +237,17 @@ static int spdk_iscsi_initialize_session_pool(void) } static int -spdk_iscsi_initialize_all_pools(void) +iscsi_initialize_all_pools(void) { - if (spdk_iscsi_initialize_pdu_pool() != 0) { + if (iscsi_initialize_pdu_pool() != 0) { return -1; } - if (spdk_iscsi_initialize_session_pool() != 0) { + if (iscsi_initialize_session_pool() != 0) { return -1; } - if (spdk_iscsi_initialize_task_pool() != 0) { + if (iscsi_initialize_task_pool() != 0) { return -1; } @@ -252,7 +255,7 @@ spdk_iscsi_initialize_all_pools(void) } static void -spdk_iscsi_check_pool(struct spdk_mempool *pool, size_t count) +iscsi_check_pool(struct spdk_mempool *pool, size_t count) { if (spdk_mempool_count(pool) != count) { SPDK_ERRLOG("spdk_mempool_count(%s) == %zu, should be %zu\n", @@ -261,19 +264,19 @@ spdk_iscsi_check_pool(struct spdk_mempool *pool, size_t count) } static void -spdk_iscsi_check_pools(void) +iscsi_check_pools(void) { struct spdk_iscsi_globals *iscsi = &g_spdk_iscsi; - spdk_iscsi_check_pool(iscsi->pdu_pool, PDU_POOL_SIZE(iscsi)); - spdk_iscsi_check_pool(iscsi->session_pool, SESSION_POOL_SIZE(iscsi)); - spdk_iscsi_check_pool(iscsi->pdu_immediate_data_pool, IMMEDIATE_DATA_POOL_SIZE(iscsi)); - spdk_iscsi_check_pool(iscsi->pdu_data_out_pool, DATA_OUT_POOL_SIZE(iscsi)); - spdk_iscsi_check_pool(iscsi->task_pool, DEFAULT_TASK_POOL_SIZE); + iscsi_check_pool(iscsi->pdu_pool, PDU_POOL_SIZE(iscsi)); + iscsi_check_pool(iscsi->session_pool, SESSION_POOL_SIZE(iscsi)); + iscsi_check_pool(iscsi->pdu_immediate_data_pool, IMMEDIATE_DATA_POOL_SIZE(iscsi)); + iscsi_check_pool(iscsi->pdu_data_out_pool, DATA_OUT_POOL_SIZE(iscsi)); + iscsi_check_pool(iscsi->task_pool, DEFAULT_TASK_POOL_SIZE); } static void -spdk_iscsi_free_pools(void) +iscsi_free_pools(void) { struct spdk_iscsi_globals *iscsi = &g_spdk_iscsi; @@ -328,7 +331,7 @@ struct spdk_iscsi_pdu *spdk_get_pdu(void) } static void -spdk_iscsi_log_globals(void) +iscsi_log_globals(void) { SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "AuthFile %s\n", g_spdk_iscsi.authfile ? g_spdk_iscsi.authfile : "(none)"); @@ -379,7 +382,7 @@ spdk_iscsi_log_globals(void) } static void -spdk_iscsi_opts_init(struct spdk_iscsi_opts *opts) +iscsi_opts_init(struct spdk_iscsi_opts *opts) { opts->MaxSessions = DEFAULT_MAX_SESSIONS; opts->MaxConnectionsPerSession = DEFAULT_MAX_CONNECTIONS_PER_SESSION; @@ -412,7 +415,7 @@ spdk_iscsi_opts_alloc(void) return NULL; } - spdk_iscsi_opts_init(opts); + iscsi_opts_init(opts); return opts; } @@ -477,8 +480,8 @@ spdk_iscsi_opts_copy(struct spdk_iscsi_opts *src) } static int -spdk_iscsi_read_config_file_params(struct spdk_conf_section *sp, - struct spdk_iscsi_opts *opts) +iscsi_read_config_file_params(struct spdk_conf_section *sp, + struct spdk_iscsi_opts *opts) { const char *val; int MaxSessions; @@ -625,7 +628,7 @@ spdk_iscsi_read_config_file_params(struct spdk_conf_section *sp, } static int -spdk_iscsi_opts_verify(struct spdk_iscsi_opts *opts) +iscsi_opts_verify(struct spdk_iscsi_opts *opts) { if (!opts->nodebase) { opts->nodebase = strdup(SPDK_ISCSI_DEFAULT_NODEBASE); @@ -703,7 +706,7 @@ spdk_iscsi_opts_verify(struct spdk_iscsi_opts *opts) } static int -spdk_iscsi_parse_options(struct spdk_iscsi_opts **popts) +iscsi_parse_options(struct spdk_iscsi_opts **popts) { struct spdk_iscsi_opts *opts; struct spdk_conf_section *sp; @@ -716,13 +719,13 @@ spdk_iscsi_parse_options(struct spdk_iscsi_opts **popts) } /* Process parameters */ - SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "spdk_iscsi_read_config_file_parmas\n"); + SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "iscsi_read_config_file_parmas\n"); sp = spdk_conf_find_section(NULL, "iSCSI"); if (sp != NULL) { - rc = spdk_iscsi_read_config_file_params(sp, opts); + rc = iscsi_read_config_file_params(sp, opts); if (rc != 0) { free(opts); - SPDK_ERRLOG("spdk_iscsi_read_config_file_params() failed\n"); + SPDK_ERRLOG("iscsi_read_config_file_params() failed\n"); return rc; } } @@ -733,11 +736,11 @@ spdk_iscsi_parse_options(struct spdk_iscsi_opts **popts) } static int -spdk_iscsi_set_global_params(struct spdk_iscsi_opts *opts) +iscsi_set_global_params(struct spdk_iscsi_opts *opts) { int rc; - rc = spdk_iscsi_opts_verify(opts); + rc = iscsi_opts_verify(opts); if (rc != 0) { SPDK_ERRLOG("spdk_iscsi_opts_verify() failed\n"); return rc; @@ -775,7 +778,7 @@ spdk_iscsi_set_global_params(struct spdk_iscsi_opts *opts) spdk_iscsi_conn_set_min_per_core(opts->min_connections_per_core); - spdk_iscsi_log_globals(); + iscsi_log_globals(); return 0; } @@ -957,7 +960,7 @@ spdk_iscsi_find_auth_group_by_tag(int32_t tag) } static void -spdk_iscsi_auth_groups_destroy(void) +iscsi_auth_groups_destroy(void) { struct spdk_iscsi_auth_group *group, *tmp; @@ -967,7 +970,7 @@ spdk_iscsi_auth_groups_destroy(void) } static int -spdk_iscsi_parse_auth_group(struct spdk_conf_section *sp) +iscsi_parse_auth_group(struct spdk_conf_section *sp) { int rc; int i; @@ -1011,7 +1014,7 @@ spdk_iscsi_parse_auth_group(struct spdk_conf_section *sp) } static int -spdk_iscsi_parse_auth_info(void) +iscsi_parse_auth_info(void) { struct spdk_conf *config; struct spdk_conf_section *sp; @@ -1035,15 +1038,15 @@ spdk_iscsi_parse_auth_info(void) if (spdk_conf_section_match_prefix(sp, "AuthGroup")) { if (spdk_conf_section_get_num(sp) == 0) { SPDK_ERRLOG("Group 0 is invalid\n"); - spdk_iscsi_auth_groups_destroy(); + iscsi_auth_groups_destroy(); spdk_conf_free(config); return -EINVAL; } - rc = spdk_iscsi_parse_auth_group(sp); + rc = iscsi_parse_auth_group(sp); if (rc != 0) { SPDK_ERRLOG("parse_auth_group() failed\n"); - spdk_iscsi_auth_groups_destroy(); + iscsi_auth_groups_destroy(); spdk_conf_free(config); return rc; } @@ -1056,7 +1059,7 @@ spdk_iscsi_parse_auth_info(void) } static struct spdk_iscsi_auth_secret * -spdk_iscsi_find_auth_secret(const char *authuser, int ag_tag) +iscsi_find_auth_secret(const char *authuser, int ag_tag) { struct spdk_iscsi_auth_group *group; struct spdk_iscsi_auth_secret *_secret; @@ -1093,7 +1096,7 @@ spdk_iscsi_chap_get_authinfo(struct iscsi_chap_auth *auth, const char *authuser, pthread_mutex_lock(&g_spdk_iscsi.mutex); - _secret = spdk_iscsi_find_auth_secret(authuser, ag_tag); + _secret = iscsi_find_auth_secret(authuser, ag_tag); if (_secret == NULL) { pthread_mutex_unlock(&g_spdk_iscsi.mutex); @@ -1115,19 +1118,19 @@ spdk_iscsi_chap_get_authinfo(struct iscsi_chap_auth *auth, const char *authuser, } static int -spdk_iscsi_initialize_global_params(void) +iscsi_initialize_global_params(void) { int rc; if (!g_spdk_iscsi_opts) { - rc = spdk_iscsi_parse_options(&g_spdk_iscsi_opts); + rc = iscsi_parse_options(&g_spdk_iscsi_opts); if (rc != 0) { SPDK_ERRLOG("spdk_iscsi_parse_options() failed\n"); return rc; } } - rc = spdk_iscsi_set_global_params(g_spdk_iscsi_opts); + rc = iscsi_set_global_params(g_spdk_iscsi_opts); if (rc != 0) { SPDK_ERRLOG("spdk_iscsi_set_global_params() failed\n"); } @@ -1139,7 +1142,7 @@ spdk_iscsi_initialize_global_params(void) } static void -spdk_iscsi_init_complete(int rc) +iscsi_init_complete(int rc) { spdk_iscsi_init_cb cb_fn = g_init_cb_fn; void *cb_arg = g_init_cb_arg; @@ -1151,7 +1154,7 @@ spdk_iscsi_init_complete(int rc) } static int -spdk_iscsi_poll_group_poll(void *ctx) +iscsi_poll_group_poll(void *ctx) { struct spdk_iscsi_poll_group *group = ctx; struct spdk_iscsi_conn *conn, *tmp; @@ -1176,7 +1179,7 @@ spdk_iscsi_poll_group_poll(void *ctx) } static int -spdk_iscsi_poll_group_handle_nop(void *ctx) +iscsi_poll_group_handle_nop(void *ctx) { struct spdk_iscsi_poll_group *group = ctx; struct spdk_iscsi_conn *conn, *tmp; @@ -1201,9 +1204,9 @@ iscsi_create_poll_group(void *ctx) pg->sock_group = spdk_sock_group_create(); assert(pg->sock_group != NULL); - pg->poller = spdk_poller_register(spdk_iscsi_poll_group_poll, pg, 0); + pg->poller = spdk_poller_register(iscsi_poll_group_poll, pg, 0); /* set the period to 1 sec */ - pg->nop_poller = spdk_poller_register(spdk_iscsi_poll_group_handle_nop, pg, 1000000); + pg->nop_poller = spdk_poller_register(iscsi_poll_group_handle_nop, pg, 1000000); } static void @@ -1222,14 +1225,14 @@ iscsi_unregister_poll_group(void *ctx) } static void -spdk_initialize_iscsi_poll_group(spdk_msg_fn cpl) +initialize_iscsi_poll_group(spdk_msg_fn cpl) { size_t g_num_poll_groups = spdk_env_get_last_core() + 1; g_spdk_iscsi.poll_group = calloc(g_num_poll_groups, sizeof(struct spdk_iscsi_poll_group)); if (!g_spdk_iscsi.poll_group) { SPDK_ERRLOG("Failed to allocated iscsi poll group\n"); - spdk_iscsi_init_complete(-1); + iscsi_init_complete(-1); return; } @@ -1238,7 +1241,7 @@ spdk_initialize_iscsi_poll_group(spdk_msg_fn cpl) } static void -spdk_iscsi_parse_configuration(void *ctx) +iscsi_parse_configuration(void *ctx) { int rc; @@ -1261,7 +1264,7 @@ spdk_iscsi_parse_configuration(void *ctx) if (g_spdk_iscsi.authfile != NULL) { if (access(g_spdk_iscsi.authfile, R_OK) == 0) { - rc = spdk_iscsi_parse_auth_info(); + rc = iscsi_parse_auth_info(); if (rc < 0) { SPDK_ERRLOG("spdk_iscsi_parse_auth_info() failed\n"); } @@ -1272,15 +1275,15 @@ spdk_iscsi_parse_configuration(void *ctx) } end: - spdk_iscsi_init_complete(rc); + iscsi_init_complete(rc); } static int -spdk_iscsi_parse_globals(void) +iscsi_parse_globals(void) { int rc; - rc = spdk_iscsi_initialize_global_params(); + rc = iscsi_initialize_global_params(); if (rc != 0) { SPDK_ERRLOG("spdk_iscsi_initialize_iscsi_global_params() failed\n"); return rc; @@ -1300,7 +1303,7 @@ spdk_iscsi_parse_globals(void) */ g_spdk_iscsi.MaxConnections = g_spdk_iscsi.MaxSessions; - rc = spdk_iscsi_initialize_all_pools(); + rc = iscsi_initialize_all_pools(); if (rc != 0) { SPDK_ERRLOG("spdk_initialize_all_pools() failed\n"); return -1; @@ -1312,7 +1315,7 @@ spdk_iscsi_parse_globals(void) return rc; } - spdk_initialize_iscsi_poll_group(spdk_iscsi_parse_configuration); + initialize_iscsi_poll_group(iscsi_parse_configuration); return 0; } @@ -1325,10 +1328,10 @@ spdk_iscsi_init(spdk_iscsi_init_cb cb_fn, void *cb_arg) g_init_cb_fn = cb_fn; g_init_cb_arg = cb_arg; - rc = spdk_iscsi_parse_globals(); + rc = iscsi_parse_globals(); if (rc < 0) { SPDK_ERRLOG("spdk_iscsi_parse_globals() failed\n"); - spdk_iscsi_init_complete(-1); + iscsi_init_complete(-1); } /* @@ -1349,15 +1352,15 @@ spdk_iscsi_fini(spdk_iscsi_fini_cb cb_fn, void *cb_arg) } static void -spdk_iscsi_fini_done(void *arg) +iscsi_fini_done(void *arg) { - spdk_iscsi_check_pools(); - spdk_iscsi_free_pools(); + iscsi_check_pools(); + iscsi_free_pools(); spdk_iscsi_shutdown_tgt_nodes(); spdk_iscsi_init_grps_destroy(); spdk_iscsi_portal_grps_destroy(); - spdk_iscsi_auth_groups_destroy(); + iscsi_auth_groups_destroy(); free(g_spdk_iscsi.authfile); free(g_spdk_iscsi.nodebase); free(g_spdk_iscsi.poll_group); @@ -1370,16 +1373,16 @@ void spdk_shutdown_iscsi_conns_done(void) { if (g_spdk_iscsi.poll_group) { - spdk_for_each_thread(iscsi_unregister_poll_group, NULL, spdk_iscsi_fini_done); + spdk_for_each_thread(iscsi_unregister_poll_group, NULL, iscsi_fini_done); } else { - spdk_iscsi_fini_done(NULL); + iscsi_fini_done(NULL); } } void spdk_iscsi_config_text(FILE *fp) { - spdk_iscsi_globals_config_text(fp); + iscsi_globals_config_text(fp); spdk_iscsi_portal_grps_config_text(fp); spdk_iscsi_init_grps_config_text(fp); spdk_iscsi_tgt_nodes_config_text(fp); @@ -1427,8 +1430,8 @@ spdk_iscsi_opts_info_json(struct spdk_json_write_ctx *w) } static void -spdk_iscsi_auth_group_info_json(struct spdk_iscsi_auth_group *group, - struct spdk_json_write_ctx *w) +iscsi_auth_group_info_json(struct spdk_iscsi_auth_group *group, + struct spdk_json_write_ctx *w) { struct spdk_iscsi_auth_secret *_secret; @@ -1456,15 +1459,15 @@ spdk_iscsi_auth_group_info_json(struct spdk_iscsi_auth_group *group, } static void -spdk_iscsi_auth_group_config_json(struct spdk_iscsi_auth_group *group, - struct spdk_json_write_ctx *w) +iscsi_auth_group_config_json(struct spdk_iscsi_auth_group *group, + struct spdk_json_write_ctx *w) { spdk_json_write_object_begin(w); spdk_json_write_named_string(w, "method", "add_iscsi_auth_group"); spdk_json_write_name(w, "params"); - spdk_iscsi_auth_group_info_json(group, w); + iscsi_auth_group_info_json(group, w); spdk_json_write_object_end(w); } @@ -1475,22 +1478,22 @@ 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) { - spdk_iscsi_auth_group_info_json(group, w); + iscsi_auth_group_info_json(group, w); } } static void -spdk_iscsi_auth_groups_config_json(struct spdk_json_write_ctx *w) +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) { - spdk_iscsi_auth_group_config_json(group, w); + iscsi_auth_group_config_json(group, w); } } static void -spdk_iscsi_opts_config_json(struct spdk_json_write_ctx *w) +iscsi_opts_config_json(struct spdk_json_write_ctx *w) { spdk_json_write_object_begin(w); @@ -1506,11 +1509,11 @@ void spdk_iscsi_config_json(struct spdk_json_write_ctx *w) { spdk_json_write_array_begin(w); - spdk_iscsi_opts_config_json(w); + iscsi_opts_config_json(w); spdk_iscsi_portal_grps_config_json(w); spdk_iscsi_init_grps_config_json(w); spdk_iscsi_tgt_nodes_config_json(w); - spdk_iscsi_auth_groups_config_json(w); + iscsi_auth_groups_config_json(w); spdk_json_write_array_end(w); } diff --git a/lib/iscsi/param.c b/lib/iscsi/param.c index b90cf879cb..650f38f62a 100644 --- a/lib/iscsi/param.c +++ b/lib/iscsi/param.c @@ -71,7 +71,7 @@ spdk_iscsi_param_free(struct iscsi_param *params) } static int -spdk_iscsi_find_key_in_array(const char *key, const char *array[]) +iscsi_find_key_in_array(const char *key, const char *array[]) { int i; @@ -215,7 +215,7 @@ spdk_iscsi_param_set_int(struct iscsi_param *params, const char *key, uint32_t v * data = "KEY=VAL" */ static int -spdk_iscsi_parse_param(struct iscsi_param **params, const uint8_t *data, uint32_t data_len) +iscsi_parse_param(struct iscsi_param **params, const uint8_t *data, uint32_t data_len) { int rc; uint8_t *key_copy, *val_copy; @@ -270,7 +270,7 @@ spdk_iscsi_parse_param(struct iscsi_param **params, const uint8_t *data, uint32_ * comma or zero is counted in, otherwise we need to iterate each parameter * value */ - max_len = spdk_iscsi_find_key_in_array(key_copy, non_simple_value_params) ? + max_len = iscsi_find_key_in_array(key_copy, non_simple_value_params) ? ISCSI_TEXT_MAX_VAL_LEN : ISCSI_TEXT_MAX_SIMPLE_VAL_LEN; if (val_len > max_len) { SPDK_ERRLOG("Overflow Val %d\n", val_len); @@ -324,7 +324,7 @@ spdk_iscsi_parse_params(struct iscsi_param **params, const uint8_t *data, if (!p) { return -1; } - rc = spdk_iscsi_parse_param(params, p, i + strlen(*partial_parameter)); + rc = iscsi_parse_param(params, p, i + strlen(*partial_parameter)); free(p); if (rc < 0) { return -1; @@ -371,7 +371,7 @@ spdk_iscsi_parse_params(struct iscsi_param **params, const uint8_t *data, } while (offset < len && data[offset] != '\0') { - rc = spdk_iscsi_parse_param(params, data + offset, len - offset); + rc = iscsi_parse_param(params, data + offset, len - offset); if (rc < 0) { return -1; } @@ -459,8 +459,8 @@ static const struct iscsi_param_table sess_param_table[] = { }; static int -spdk_iscsi_params_init_internal(struct iscsi_param **params, - const struct iscsi_param_table *table) +iscsi_params_init_internal(struct iscsi_param **params, + const struct iscsi_param_table *table) { int rc; int i; @@ -488,13 +488,13 @@ spdk_iscsi_params_init_internal(struct iscsi_param **params, int spdk_iscsi_conn_params_init(struct iscsi_param **params) { - return spdk_iscsi_params_init_internal(params, &conn_param_table[0]); + return iscsi_params_init_internal(params, &conn_param_table[0]); } int spdk_iscsi_sess_params_init(struct iscsi_param **params) { - return spdk_iscsi_params_init_internal(params, &sess_param_table[0]); + return iscsi_params_init_internal(params, &sess_param_table[0]); } static const char *chap_type[] = { @@ -537,10 +537,10 @@ static const char *target_declarative_params[] = { * error: -1 */ static int -spdk_iscsi_special_param_construction(struct spdk_iscsi_conn *conn, - struct iscsi_param *param, - bool FirstBurstLength_flag, char *data, - int alloc_len, int total) +iscsi_special_param_construction(struct spdk_iscsi_conn *conn, + struct iscsi_param *param, + bool FirstBurstLength_flag, char *data, + int alloc_len, int total) { int len; struct iscsi_param *param_first; @@ -623,13 +623,13 @@ spdk_iscsi_special_param_construction(struct spdk_iscsi_conn *conn, } /** - * spdk_iscsi_construct_data_from_param: + * iscsi_construct_data_from_param: * To construct the data which will be returned to the initiator * return: length of the negotiated data, -1 indicates error; */ static int -spdk_iscsi_construct_data_from_param(struct iscsi_param *param, char *new_val, - char *data, int alloc_len, int total) +iscsi_construct_data_from_param(struct iscsi_param *param, char *new_val, + char *data, int alloc_len, int total) { int len; @@ -654,10 +654,11 @@ spdk_iscsi_construct_data_from_param(struct iscsi_param *param, char *new_val, * type = ISPT_LIST * return: the negotiated value of the key */ -static char *spdk_iscsi_negotiate_param_list(int *add_param_value, - struct iscsi_param *param, - char *valid_list, char *in_val, - char *cur_val) +static char * +iscsi_negotiate_param_list(int *add_param_value, + struct iscsi_param *param, + char *valid_list, char *in_val, + char *cur_val) { char *val_start, *val_end; char *in_start, *in_end; @@ -705,10 +706,11 @@ static char *spdk_iscsi_negotiate_param_list(int *add_param_value, * type = ISPT_NUMERICAL_MIN/MAX, ISPT_NUMERICAL_DECLARATIVE * return: the negotiated value of the key */ -static char *spdk_iscsi_negotiate_param_numerical(int *add_param_value, - struct iscsi_param *param, - char *valid_list, char *in_val, - char *cur_val) +static char * +iscsi_negotiate_param_numerical(int *add_param_value, + struct iscsi_param *param, + char *valid_list, char *in_val, + char *cur_val) { char *valid_next; char *new_val = NULL; @@ -762,10 +764,11 @@ static char *spdk_iscsi_negotiate_param_numerical(int *add_param_value, * type = ISPT_BOOLEAN_OR, ISPT_BOOLEAN_AND * return: the negotiated value of the key */ -static char *spdk_iscsi_negotiate_param_boolean(int *add_param_value, - struct iscsi_param *param, - char *in_val, char *cur_val, - const char *value) +static char * +iscsi_negotiate_param_boolean(int *add_param_value, + struct iscsi_param *param, + char *in_val, char *cur_val, + const char *value) { char *new_val = NULL; @@ -798,23 +801,23 @@ static char *spdk_iscsi_negotiate_param_boolean(int *add_param_value, * return value: the new negotiated value */ static char * -spdk_iscsi_negotiate_param_all(int *add_param_value, struct iscsi_param *param, - char *valid_list, char *in_val, char *cur_val) +iscsi_negotiate_param_all(int *add_param_value, struct iscsi_param *param, + char *valid_list, char *in_val, char *cur_val) { char *new_val; switch (param->type) { case ISPT_LIST: - new_val = spdk_iscsi_negotiate_param_list(add_param_value, - param, - valid_list, - in_val, - cur_val); + new_val = iscsi_negotiate_param_list(add_param_value, + param, + valid_list, + in_val, + cur_val); break; case ISPT_NUMERICAL_MIN: case ISPT_NUMERICAL_MAX: case ISPT_NUMERICAL_DECLARATIVE: - new_val = spdk_iscsi_negotiate_param_numerical(add_param_value, + new_val = iscsi_negotiate_param_numerical(add_param_value, param, valid_list, in_val, @@ -822,18 +825,18 @@ spdk_iscsi_negotiate_param_all(int *add_param_value, struct iscsi_param *param, break; case ISPT_BOOLEAN_OR: - new_val = spdk_iscsi_negotiate_param_boolean(add_param_value, - param, - in_val, - cur_val, - "Yes"); + new_val = iscsi_negotiate_param_boolean(add_param_value, + param, + in_val, + cur_val, + "Yes"); break; case ISPT_BOOLEAN_AND: - new_val = spdk_iscsi_negotiate_param_boolean(add_param_value, - param, - in_val, - cur_val, - "No"); + new_val = iscsi_negotiate_param_boolean(add_param_value, + param, + in_val, + cur_val, + "No"); break; default: @@ -850,10 +853,10 @@ spdk_iscsi_negotiate_param_all(int *add_param_value, struct iscsi_param *param, * connection's params */ static int -spdk_iscsi_negotiate_param_init(struct spdk_iscsi_conn *conn, - struct iscsi_param **cur_param_p, - struct iscsi_param **params_dst_p, - struct iscsi_param *param) +iscsi_negotiate_param_init(struct spdk_iscsi_conn *conn, + struct iscsi_param **cur_param_p, + struct iscsi_param **params_dst_p, + struct iscsi_param *param) { int index; @@ -875,8 +878,8 @@ spdk_iscsi_negotiate_param_init(struct spdk_iscsi_conn *conn, } else { index = (*cur_param_p)->state_index; if (conn->sess_param_state_negotiated[index] && - !spdk_iscsi_find_key_in_array(param->key, - target_declarative_params)) { + !iscsi_find_key_in_array(param->key, + target_declarative_params)) { return SPDK_ISCSI_PARAMETER_EXCHANGE_NOT_ONCE; } conn->sess_param_state_negotiated[index] = true; @@ -884,8 +887,8 @@ spdk_iscsi_negotiate_param_init(struct spdk_iscsi_conn *conn, } else { index = (*cur_param_p)->state_index; if (conn->conn_param_state_negotiated[index] && - !spdk_iscsi_find_key_in_array(param->key, - multi_negot_conn_params)) { + !iscsi_find_key_in_array(param->key, + multi_negot_conn_params)) { return SPDK_ISCSI_PARAMETER_EXCHANGE_NOT_ONCE; } conn->conn_param_state_negotiated[index] = true; @@ -1001,22 +1004,21 @@ spdk_iscsi_negotiate_params(struct spdk_iscsi_conn *conn, continue; } /* CHAP keys */ - if (spdk_iscsi_find_key_in_array(param->key, chap_type)) { + if (iscsi_find_key_in_array(param->key, chap_type)) { continue; } /* 12.2, 12.10, 12.11, 12.13, 12.14, 12.17, 12.18, 12.19 */ if (discovery && - spdk_iscsi_find_key_in_array(param->key, - discovery_ignored_param)) { + iscsi_find_key_in_array(param->key, discovery_ignored_param)) { snprintf(in_val, ISCSI_TEXT_MAX_VAL_LEN + 1, "%s", "Irrelevant"); new_val = in_val; add_param_value = 1; } else { - rc = spdk_iscsi_negotiate_param_init(conn, - &cur_param, - ¶ms_dst, - param); + rc = iscsi_negotiate_param_init(conn, + &cur_param, + ¶ms_dst, + param); if (rc < 0) { free(valid_list); free(in_val); @@ -1064,15 +1066,15 @@ spdk_iscsi_negotiate_params(struct spdk_iscsi_conn *conn, } /* prevent target's declarative params from being changed by initiator */ - if (spdk_iscsi_find_key_in_array(param->key, target_declarative_params)) { + if (iscsi_find_key_in_array(param->key, target_declarative_params)) { add_param_value = 1; } - new_val = spdk_iscsi_negotiate_param_all(&add_param_value, - param, - valid_list, - in_val, - cur_val); + new_val = iscsi_negotiate_param_all(&add_param_value, + param, + valid_list, + in_val, + cur_val); } /* check the negotiated value of the key */ @@ -1083,16 +1085,16 @@ spdk_iscsi_negotiate_params(struct spdk_iscsi_conn *conn, if (add_param_value == 0) { spdk_iscsi_param_set(params_dst, param->key, new_val); } - total = spdk_iscsi_construct_data_from_param(param, - new_val, - data, - alloc_len, - total); + total = iscsi_construct_data_from_param(param, + new_val, + data, + alloc_len, + total); if (total < 0) { goto final_return; } - total = spdk_iscsi_special_param_construction(conn, + total = iscsi_special_param_construction(conn, param, FirstBurstLength_flag, data, diff --git a/lib/iscsi/portal_grp.c b/lib/iscsi/portal_grp.c index 60a724c9fb..5fdafc1223 100644 --- a/lib/iscsi/portal_grp.c +++ b/lib/iscsi/portal_grp.c @@ -49,7 +49,7 @@ #define PORTNUMSTRLEN 32 static struct spdk_iscsi_portal * -spdk_iscsi_portal_find_by_addr(const char *host, const char *port) +iscsi_portal_find_by_addr(const char *host, const char *port) { struct spdk_iscsi_portal *p; @@ -133,7 +133,7 @@ spdk_iscsi_portal_create(const char *host, const char *port, const char *cpumask p->acceptor_poller = NULL; pthread_mutex_lock(&g_spdk_iscsi.mutex); - tmp = spdk_iscsi_portal_find_by_addr(host, port); + tmp = iscsi_portal_find_by_addr(host, port); if (tmp != NULL) { pthread_mutex_unlock(&g_spdk_iscsi.mutex); SPDK_ERRLOG("portal (%s, %s) already exists\n", host, port); @@ -173,7 +173,7 @@ spdk_iscsi_portal_destroy(struct spdk_iscsi_portal *p) } static int -spdk_iscsi_portal_open(struct spdk_iscsi_portal *p) +iscsi_portal_open(struct spdk_iscsi_portal *p) { struct spdk_sock *sock; int port; @@ -206,7 +206,7 @@ spdk_iscsi_portal_open(struct spdk_iscsi_portal *p) } static void -spdk_iscsi_portal_close(struct spdk_iscsi_portal *p) +iscsi_portal_close(struct spdk_iscsi_portal *p) { if (p->sock) { SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "close portal (%s, %s)\n", @@ -217,8 +217,8 @@ spdk_iscsi_portal_close(struct spdk_iscsi_portal *p) } static int -spdk_iscsi_parse_portal(const char *portalstring, struct spdk_iscsi_portal **ip, - int dry_run) +iscsi_parse_portal(const char *portalstring, struct spdk_iscsi_portal **ip, + int dry_run) { char *host = NULL, *port = NULL, *cpumask = NULL; int len, rc = -1; @@ -393,7 +393,7 @@ spdk_iscsi_portal_grp_add_portal(struct spdk_iscsi_portal_grp *pg, } static int -spdk_iscsi_parse_portal_grp(struct spdk_conf_section *sp) +iscsi_parse_portal_grp(struct spdk_conf_section *sp) { struct spdk_iscsi_portal_grp *pg; struct spdk_iscsi_portal *p; @@ -421,7 +421,7 @@ spdk_iscsi_parse_portal_grp(struct spdk_conf_section *sp) if (label == NULL || portal == NULL) { break; } - rc = spdk_iscsi_parse_portal(portal, &p, 1); + rc = iscsi_parse_portal(portal, &p, 1); if (rc < 0) { SPDK_ERRLOG("parse portal error (%s)\n", portal); return -1; @@ -448,7 +448,7 @@ spdk_iscsi_parse_portal_grp(struct spdk_conf_section *sp) goto error; } - rc = spdk_iscsi_parse_portal(portal, &p, 0); + rc = iscsi_parse_portal(portal, &p, 0); if (rc < 0) { SPDK_ERRLOG("parse portal error (%s)\n", portal); goto error; @@ -510,7 +510,7 @@ spdk_iscsi_parse_portal_grps(void) } /* Build portal group from cfg section PortalGroup */ - rc = spdk_iscsi_parse_portal_grp(sp); + rc = iscsi_parse_portal_grp(sp); if (rc < 0) { SPDK_ERRLOG("parse_portal_group() failed\n"); return -1; @@ -545,7 +545,7 @@ spdk_iscsi_portal_grp_open(struct spdk_iscsi_portal_grp *pg) int rc; TAILQ_FOREACH(p, &pg->head, per_pg_tailq) { - rc = spdk_iscsi_portal_open(p); + rc = iscsi_portal_open(p); if (rc < 0) { return rc; } @@ -554,12 +554,12 @@ spdk_iscsi_portal_grp_open(struct spdk_iscsi_portal_grp *pg) } static void -spdk_iscsi_portal_grp_close(struct spdk_iscsi_portal_grp *pg) +iscsi_portal_grp_close(struct spdk_iscsi_portal_grp *pg) { struct spdk_iscsi_portal *p; TAILQ_FOREACH(p, &pg->head, per_pg_tailq) { - spdk_iscsi_portal_close(p); + iscsi_portal_close(p); } } @@ -571,7 +571,7 @@ spdk_iscsi_portal_grp_close_all(void) 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) { - spdk_iscsi_portal_grp_close(pg); + iscsi_portal_grp_close(pg); } pthread_mutex_unlock(&g_spdk_iscsi.mutex); } @@ -596,7 +596,7 @@ spdk_iscsi_portal_grp_unregister(int tag) void spdk_iscsi_portal_grp_release(struct spdk_iscsi_portal_grp *pg) { - spdk_iscsi_portal_grp_close(pg); + iscsi_portal_grp_close(pg); spdk_iscsi_portal_grp_destroy(pg); } @@ -647,8 +647,8 @@ spdk_iscsi_portal_grps_config_text(FILE *fp) } static void -spdk_iscsi_portal_grp_info_json(struct spdk_iscsi_portal_grp *pg, - struct spdk_json_write_ctx *w) +iscsi_portal_grp_info_json(struct spdk_iscsi_portal_grp *pg, + struct spdk_json_write_ctx *w) { struct spdk_iscsi_portal *portal; @@ -673,15 +673,15 @@ spdk_iscsi_portal_grp_info_json(struct spdk_iscsi_portal_grp *pg, } static void -spdk_iscsi_portal_grp_config_json(struct spdk_iscsi_portal_grp *pg, - struct spdk_json_write_ctx *w) +iscsi_portal_grp_config_json(struct spdk_iscsi_portal_grp *pg, + struct spdk_json_write_ctx *w) { spdk_json_write_object_begin(w); spdk_json_write_named_string(w, "method", "add_portal_group"); spdk_json_write_name(w, "params"); - spdk_iscsi_portal_grp_info_json(pg, w); + iscsi_portal_grp_info_json(pg, w); spdk_json_write_object_end(w); } @@ -692,7 +692,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) { - spdk_iscsi_portal_grp_info_json(pg, w); + iscsi_portal_grp_info_json(pg, w); } } @@ -702,6 +702,6 @@ 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) { - spdk_iscsi_portal_grp_config_json(pg, w); + iscsi_portal_grp_config_json(pg, w); } } diff --git a/lib/iscsi/task.c b/lib/iscsi/task.c index 1a9a192c65..93fa4b1bfa 100644 --- a/lib/iscsi/task.c +++ b/lib/iscsi/task.c @@ -38,7 +38,7 @@ #include "iscsi/task.h" static void -spdk_iscsi_task_free(struct spdk_scsi_task *scsi_task) +iscsi_task_free(struct spdk_scsi_task *scsi_task) { struct spdk_iscsi_task *task = spdk_iscsi_task_from_scsi_task(scsi_task); @@ -71,7 +71,7 @@ spdk_iscsi_task_get(struct spdk_iscsi_conn *conn, struct spdk_iscsi_task *parent conn->pending_task_cnt++; spdk_scsi_task_construct(&task->scsi, cpl_fn, - spdk_iscsi_task_free); + iscsi_task_free); if (parent) { parent->scsi.ref++; task->parent = parent; diff --git a/lib/iscsi/tgt_node.c b/lib/iscsi/tgt_node.c index be106d6bff..9da3a8e8c2 100644 --- a/lib/iscsi/tgt_node.c +++ b/lib/iscsi/tgt_node.c @@ -51,7 +51,7 @@ #define MAX_MASKBUF 128 static bool -spdk_iscsi_ipv6_netmask_allow_addr(const char *netmask, const char *addr) +iscsi_ipv6_netmask_allow_addr(const char *netmask, const char *addr) { struct in6_addr in6_mask; struct in6_addr in6_addr; @@ -115,7 +115,7 @@ spdk_iscsi_ipv6_netmask_allow_addr(const char *netmask, const char *addr) } static bool -spdk_iscsi_ipv4_netmask_allow_addr(const char *netmask, const char *addr) +iscsi_ipv4_netmask_allow_addr(const char *netmask, const char *addr) { struct in_addr in4_mask; struct in_addr in4_addr; @@ -163,7 +163,7 @@ spdk_iscsi_ipv4_netmask_allow_addr(const char *netmask, const char *addr) } static bool -spdk_iscsi_netmask_allow_addr(const char *netmask, const char *addr) +iscsi_netmask_allow_addr(const char *netmask, const char *addr) { if (netmask == NULL || addr == NULL) { return false; @@ -173,12 +173,12 @@ spdk_iscsi_netmask_allow_addr(const char *netmask, const char *addr) } if (netmask[0] == '[') { /* IPv6 */ - if (spdk_iscsi_ipv6_netmask_allow_addr(netmask, addr)) { + if (iscsi_ipv6_netmask_allow_addr(netmask, addr)) { return true; } } else { /* IPv4 */ - if (spdk_iscsi_ipv4_netmask_allow_addr(netmask, addr)) { + if (iscsi_ipv4_netmask_allow_addr(netmask, addr)) { return true; } } @@ -186,15 +186,15 @@ spdk_iscsi_netmask_allow_addr(const char *netmask, const char *addr) } static bool -spdk_iscsi_init_grp_allow_addr(struct spdk_iscsi_init_grp *igp, - const char *addr) +iscsi_init_grp_allow_addr(struct spdk_iscsi_init_grp *igp, + const char *addr) { struct spdk_iscsi_initiator_netmask *imask; TAILQ_FOREACH(imask, &igp->netmask_head, tailq) { SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "netmask=%s, addr=%s\n", imask->mask, addr); - if (spdk_iscsi_netmask_allow_addr(imask->mask, addr)) { + if (iscsi_netmask_allow_addr(imask->mask, addr)) { return true; } } @@ -202,8 +202,8 @@ spdk_iscsi_init_grp_allow_addr(struct spdk_iscsi_init_grp *igp, } static int -spdk_iscsi_init_grp_allow_iscsi_name(struct spdk_iscsi_init_grp *igp, - const char *iqn, bool *result) +iscsi_init_grp_allow_iscsi_name(struct spdk_iscsi_init_grp *igp, + const char *iqn, bool *result) { struct spdk_iscsi_initiator_name *iname; @@ -226,8 +226,8 @@ spdk_iscsi_init_grp_allow_iscsi_name(struct spdk_iscsi_init_grp *igp, } static struct spdk_iscsi_pg_map * -spdk_iscsi_tgt_node_find_pg_map(struct spdk_iscsi_tgt_node *target, - struct spdk_iscsi_portal_grp *pg); +iscsi_tgt_node_find_pg_map(struct spdk_iscsi_tgt_node *target, + struct spdk_iscsi_portal_grp *pg); bool spdk_iscsi_tgt_node_access(struct spdk_iscsi_conn *conn, @@ -246,17 +246,17 @@ spdk_iscsi_tgt_node_access(struct spdk_iscsi_conn *conn, SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "pg=%d, iqn=%s, addr=%s\n", pg->tag, iqn, addr); - pg_map = spdk_iscsi_tgt_node_find_pg_map(target, pg); + pg_map = iscsi_tgt_node_find_pg_map(target, pg); if (pg_map == NULL) { return false; } TAILQ_FOREACH(ig_map, &pg_map->ig_map_head, tailq) { - rc = spdk_iscsi_init_grp_allow_iscsi_name(ig_map->ig, iqn, &allowed); + rc = iscsi_init_grp_allow_iscsi_name(ig_map->ig, iqn, &allowed); if (rc == 0) { if (allowed == false) { goto denied; } else { - if (spdk_iscsi_init_grp_allow_addr(ig_map->ig, addr)) { + if (iscsi_init_grp_allow_addr(ig_map->ig, addr)) { return true; } } @@ -273,7 +273,7 @@ denied: } static bool -spdk_iscsi_tgt_node_allow_iscsi_name(struct spdk_iscsi_tgt_node *target, const char *iqn) +iscsi_tgt_node_allow_iscsi_name(struct spdk_iscsi_tgt_node *target, const char *iqn) { struct spdk_iscsi_pg_map *pg_map; struct spdk_iscsi_ig_map *ig_map; @@ -286,7 +286,7 @@ spdk_iscsi_tgt_node_allow_iscsi_name(struct spdk_iscsi_tgt_node *target, const c TAILQ_FOREACH(pg_map, &target->pg_map_head, tailq) { TAILQ_FOREACH(ig_map, &pg_map->ig_map_head, tailq) { - rc = spdk_iscsi_init_grp_allow_iscsi_name(ig_map->ig, iqn, &result); + rc = iscsi_init_grp_allow_iscsi_name(ig_map->ig, iqn, &result); if (rc == 0) { return result; } @@ -336,7 +336,7 @@ spdk_iscsi_send_tgts(struct spdk_iscsi_conn *conn, const char *iiqn, && strcasecmp(tiqn, target->name) != 0) { continue; } - rc = spdk_iscsi_tgt_node_allow_iscsi_name(target, iiqn); + rc = iscsi_tgt_node_allow_iscsi_name(target, iiqn); if (rc == 0) { continue; } @@ -406,7 +406,7 @@ spdk_iscsi_find_tgt_node(const char *target_name) } static int -spdk_iscsi_tgt_node_register(struct spdk_iscsi_tgt_node *target) +iscsi_tgt_node_register(struct spdk_iscsi_tgt_node *target) { pthread_mutex_lock(&g_spdk_iscsi.mutex); @@ -422,7 +422,7 @@ spdk_iscsi_tgt_node_register(struct spdk_iscsi_tgt_node *target) } static int -spdk_iscsi_tgt_node_unregister(struct spdk_iscsi_tgt_node *target) +iscsi_tgt_node_unregister(struct spdk_iscsi_tgt_node *target) { struct spdk_iscsi_tgt_node *t; @@ -437,8 +437,8 @@ spdk_iscsi_tgt_node_unregister(struct spdk_iscsi_tgt_node *target) } static struct spdk_iscsi_ig_map * -spdk_iscsi_pg_map_find_ig_map(struct spdk_iscsi_pg_map *pg_map, - struct spdk_iscsi_init_grp *ig) +iscsi_pg_map_find_ig_map(struct spdk_iscsi_pg_map *pg_map, + struct spdk_iscsi_init_grp *ig) { struct spdk_iscsi_ig_map *ig_map; @@ -452,12 +452,12 @@ spdk_iscsi_pg_map_find_ig_map(struct spdk_iscsi_pg_map *pg_map, } static struct spdk_iscsi_ig_map * -spdk_iscsi_pg_map_add_ig_map(struct spdk_iscsi_pg_map *pg_map, - struct spdk_iscsi_init_grp *ig) +iscsi_pg_map_add_ig_map(struct spdk_iscsi_pg_map *pg_map, + struct spdk_iscsi_init_grp *ig) { struct spdk_iscsi_ig_map *ig_map; - if (spdk_iscsi_pg_map_find_ig_map(pg_map, ig) != NULL) { + if (iscsi_pg_map_find_ig_map(pg_map, ig) != NULL) { return NULL; } @@ -475,8 +475,8 @@ spdk_iscsi_pg_map_add_ig_map(struct spdk_iscsi_pg_map *pg_map, } static void -_spdk_iscsi_pg_map_delete_ig_map(struct spdk_iscsi_pg_map *pg_map, - struct spdk_iscsi_ig_map *ig_map) +_iscsi_pg_map_delete_ig_map(struct spdk_iscsi_pg_map *pg_map, + struct spdk_iscsi_ig_map *ig_map) { TAILQ_REMOVE(&pg_map->ig_map_head, ig_map, tailq); pg_map->num_ig_maps--; @@ -485,33 +485,33 @@ _spdk_iscsi_pg_map_delete_ig_map(struct spdk_iscsi_pg_map *pg_map, } static int -spdk_iscsi_pg_map_delete_ig_map(struct spdk_iscsi_pg_map *pg_map, - struct spdk_iscsi_init_grp *ig) +iscsi_pg_map_delete_ig_map(struct spdk_iscsi_pg_map *pg_map, + struct spdk_iscsi_init_grp *ig) { struct spdk_iscsi_ig_map *ig_map; - ig_map = spdk_iscsi_pg_map_find_ig_map(pg_map, ig); + ig_map = iscsi_pg_map_find_ig_map(pg_map, ig); if (ig_map == NULL) { return -ENOENT; } - _spdk_iscsi_pg_map_delete_ig_map(pg_map, ig_map); + _iscsi_pg_map_delete_ig_map(pg_map, ig_map); return 0; } static void -spdk_iscsi_pg_map_delete_all_ig_maps(struct spdk_iscsi_pg_map *pg_map) +iscsi_pg_map_delete_all_ig_maps(struct spdk_iscsi_pg_map *pg_map) { struct spdk_iscsi_ig_map *ig_map, *tmp; TAILQ_FOREACH_SAFE(ig_map, &pg_map->ig_map_head, tailq, tmp) { - _spdk_iscsi_pg_map_delete_ig_map(pg_map, ig_map); + _iscsi_pg_map_delete_ig_map(pg_map, ig_map); } } static struct spdk_iscsi_pg_map * -spdk_iscsi_tgt_node_find_pg_map(struct spdk_iscsi_tgt_node *target, - struct spdk_iscsi_portal_grp *pg) +iscsi_tgt_node_find_pg_map(struct spdk_iscsi_tgt_node *target, + struct spdk_iscsi_portal_grp *pg) { struct spdk_iscsi_pg_map *pg_map; @@ -525,14 +525,14 @@ spdk_iscsi_tgt_node_find_pg_map(struct spdk_iscsi_tgt_node *target, } static struct spdk_iscsi_pg_map * -spdk_iscsi_tgt_node_add_pg_map(struct spdk_iscsi_tgt_node *target, - struct spdk_iscsi_portal_grp *pg) +iscsi_tgt_node_add_pg_map(struct spdk_iscsi_tgt_node *target, + struct spdk_iscsi_portal_grp *pg) { struct spdk_iscsi_pg_map *pg_map; char port_name[MAX_TMPBUF]; int rc; - if (spdk_iscsi_tgt_node_find_pg_map(target, pg) != NULL) { + if (iscsi_tgt_node_find_pg_map(target, pg) != NULL) { return NULL; } @@ -566,8 +566,8 @@ spdk_iscsi_tgt_node_add_pg_map(struct spdk_iscsi_tgt_node *target, } static void -_spdk_iscsi_tgt_node_delete_pg_map(struct spdk_iscsi_tgt_node *target, - struct spdk_iscsi_pg_map *pg_map) +_iscsi_tgt_node_delete_pg_map(struct spdk_iscsi_tgt_node *target, + struct spdk_iscsi_pg_map *pg_map) { TAILQ_REMOVE(&target->pg_map_head, pg_map, tailq); target->num_pg_maps--; @@ -579,12 +579,12 @@ _spdk_iscsi_tgt_node_delete_pg_map(struct spdk_iscsi_tgt_node *target, } static int -spdk_iscsi_tgt_node_delete_pg_map(struct spdk_iscsi_tgt_node *target, - struct spdk_iscsi_portal_grp *pg) +iscsi_tgt_node_delete_pg_map(struct spdk_iscsi_tgt_node *target, + struct spdk_iscsi_portal_grp *pg) { struct spdk_iscsi_pg_map *pg_map; - pg_map = spdk_iscsi_tgt_node_find_pg_map(target, pg); + pg_map = iscsi_tgt_node_find_pg_map(target, pg); if (pg_map == NULL) { return -ENOENT; } @@ -594,38 +594,38 @@ spdk_iscsi_tgt_node_delete_pg_map(struct spdk_iscsi_tgt_node *target, pg_map->num_ig_maps); } - spdk_iscsi_pg_map_delete_all_ig_maps(pg_map); - _spdk_iscsi_tgt_node_delete_pg_map(target, pg_map); + iscsi_pg_map_delete_all_ig_maps(pg_map); + _iscsi_tgt_node_delete_pg_map(target, pg_map); return 0; } static void -spdk_iscsi_tgt_node_delete_ig_maps(struct spdk_iscsi_tgt_node *target, - struct spdk_iscsi_init_grp *ig) +iscsi_tgt_node_delete_ig_maps(struct spdk_iscsi_tgt_node *target, + struct spdk_iscsi_init_grp *ig) { struct spdk_iscsi_pg_map *pg_map, *tmp; TAILQ_FOREACH_SAFE(pg_map, &target->pg_map_head, tailq, tmp) { - spdk_iscsi_pg_map_delete_ig_map(pg_map, ig); + iscsi_pg_map_delete_ig_map(pg_map, ig); if (pg_map->num_ig_maps == 0) { - _spdk_iscsi_tgt_node_delete_pg_map(target, pg_map); + _iscsi_tgt_node_delete_pg_map(target, pg_map); } } } static void -spdk_iscsi_tgt_node_delete_all_pg_maps(struct spdk_iscsi_tgt_node *target) +iscsi_tgt_node_delete_all_pg_maps(struct spdk_iscsi_tgt_node *target) { struct spdk_iscsi_pg_map *pg_map, *tmp; TAILQ_FOREACH_SAFE(pg_map, &target->pg_map_head, tailq, tmp) { - spdk_iscsi_pg_map_delete_all_ig_maps(pg_map); - _spdk_iscsi_tgt_node_delete_pg_map(target, pg_map); + iscsi_pg_map_delete_all_ig_maps(pg_map); + _iscsi_tgt_node_delete_pg_map(target, pg_map); } } static void -spdk_iscsi_tgt_node_destruct(struct spdk_iscsi_tgt_node *target) +iscsi_tgt_node_destruct(struct spdk_iscsi_tgt_node *target) { if (target == NULL) { return; @@ -633,7 +633,7 @@ spdk_iscsi_tgt_node_destruct(struct spdk_iscsi_tgt_node *target) free(target->name); free(target->alias); - spdk_iscsi_tgt_node_delete_all_pg_maps(target); + iscsi_tgt_node_delete_all_pg_maps(target); spdk_scsi_dev_destruct(target->dev); pthread_mutex_destroy(&target->mutex); @@ -641,8 +641,8 @@ spdk_iscsi_tgt_node_destruct(struct spdk_iscsi_tgt_node *target) } static int -spdk_iscsi_tgt_node_delete_pg_ig_map(struct spdk_iscsi_tgt_node *target, - int pg_tag, int ig_tag) +iscsi_tgt_node_delete_pg_ig_map(struct spdk_iscsi_tgt_node *target, + int pg_tag, int ig_tag) { struct spdk_iscsi_portal_grp *pg; struct spdk_iscsi_init_grp *ig; @@ -660,28 +660,28 @@ spdk_iscsi_tgt_node_delete_pg_ig_map(struct spdk_iscsi_tgt_node *target, return -ENOENT; } - pg_map = spdk_iscsi_tgt_node_find_pg_map(target, pg); + pg_map = iscsi_tgt_node_find_pg_map(target, pg); if (pg_map == NULL) { SPDK_ERRLOG("%s: PortalGroup%d is not mapped\n", target->name, pg_tag); return -ENOENT; } - ig_map = spdk_iscsi_pg_map_find_ig_map(pg_map, ig); + ig_map = iscsi_pg_map_find_ig_map(pg_map, ig); if (ig_map == NULL) { SPDK_ERRLOG("%s: InitiatorGroup%d is not mapped\n", target->name, pg_tag); return -ENOENT; } - _spdk_iscsi_pg_map_delete_ig_map(pg_map, ig_map); + _iscsi_pg_map_delete_ig_map(pg_map, ig_map); if (pg_map->num_ig_maps == 0) { - _spdk_iscsi_tgt_node_delete_pg_map(target, pg_map); + _iscsi_tgt_node_delete_pg_map(target, pg_map); } return 0; } static int -spdk_iscsi_tgt_node_add_pg_ig_map(struct spdk_iscsi_tgt_node *target, - int pg_tag, int ig_tag) +iscsi_tgt_node_add_pg_ig_map(struct spdk_iscsi_tgt_node *target, + int pg_tag, int ig_tag) { struct spdk_iscsi_portal_grp *pg; struct spdk_iscsi_pg_map *pg_map; @@ -701,9 +701,9 @@ spdk_iscsi_tgt_node_add_pg_ig_map(struct spdk_iscsi_tgt_node *target, } /* get existing pg_map or create new pg_map and add it to target */ - pg_map = spdk_iscsi_tgt_node_find_pg_map(target, pg); + pg_map = iscsi_tgt_node_find_pg_map(target, pg); if (pg_map == NULL) { - pg_map = spdk_iscsi_tgt_node_add_pg_map(target, pg); + pg_map = iscsi_tgt_node_add_pg_map(target, pg); if (pg_map == NULL) { goto failed; } @@ -711,7 +711,7 @@ spdk_iscsi_tgt_node_add_pg_ig_map(struct spdk_iscsi_tgt_node *target, } /* create new ig_map and add it to pg_map */ - ig_map = spdk_iscsi_pg_map_add_ig_map(pg_map, ig); + ig_map = iscsi_pg_map_add_ig_map(pg_map, ig); if (ig_map == NULL) { goto failed; } @@ -720,7 +720,7 @@ spdk_iscsi_tgt_node_add_pg_ig_map(struct spdk_iscsi_tgt_node *target, failed: if (new_pg_map) { - _spdk_iscsi_tgt_node_delete_pg_map(target, pg_map); + _iscsi_tgt_node_delete_pg_map(target, pg_map); } return -1; @@ -735,8 +735,8 @@ spdk_iscsi_tgt_node_add_pg_ig_maps(struct spdk_iscsi_tgt_node *target, pthread_mutex_lock(&g_spdk_iscsi.mutex); for (i = 0; i < num_maps; i++) { - rc = spdk_iscsi_tgt_node_add_pg_ig_map(target, pg_tag_list[i], - ig_tag_list[i]); + rc = iscsi_tgt_node_add_pg_ig_map(target, pg_tag_list[i], + ig_tag_list[i]); if (rc != 0) { SPDK_ERRLOG("could not add map to target\n"); goto invalid; @@ -747,8 +747,8 @@ spdk_iscsi_tgt_node_add_pg_ig_maps(struct spdk_iscsi_tgt_node *target, invalid: for (; i > 0; --i) { - spdk_iscsi_tgt_node_delete_pg_ig_map(target, pg_tag_list[i - 1], - ig_tag_list[i - 1]); + 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); return -1; @@ -763,8 +763,8 @@ spdk_iscsi_tgt_node_delete_pg_ig_maps(struct spdk_iscsi_tgt_node *target, pthread_mutex_lock(&g_spdk_iscsi.mutex); for (i = 0; i < num_maps; i++) { - rc = spdk_iscsi_tgt_node_delete_pg_ig_map(target, pg_tag_list[i], - ig_tag_list[i]); + rc = iscsi_tgt_node_delete_pg_ig_map(target, pg_tag_list[i], + ig_tag_list[i]); if (rc != 0) { SPDK_ERRLOG("could not delete map from target\n"); goto invalid; @@ -775,10 +775,10 @@ spdk_iscsi_tgt_node_delete_pg_ig_maps(struct spdk_iscsi_tgt_node *target, invalid: for (; i > 0; --i) { - rc = spdk_iscsi_tgt_node_add_pg_ig_map(target, pg_tag_list[i - 1], - ig_tag_list[i - 1]); + rc = iscsi_tgt_node_add_pg_ig_map(target, pg_tag_list[i - 1], + ig_tag_list[i - 1]); if (rc != 0) { - spdk_iscsi_tgt_node_delete_all_pg_maps(target); + iscsi_tgt_node_delete_all_pg_maps(target); break; } } @@ -787,7 +787,7 @@ invalid: } static int -spdk_check_iscsi_name(const char *name) +check_iscsi_name(const char *name) { const unsigned char *up = (const unsigned char *) name; size_t n; @@ -893,7 +893,7 @@ spdk_iscsi_tgt_node_construct(int target_index, snprintf(fullname, sizeof(fullname), "%s", name); } - if (spdk_check_iscsi_name(fullname) != 0) { + if (check_iscsi_name(fullname) != 0) { SPDK_ERRLOG("TargetName %s contains an invalid character or format.\n", name); return NULL; @@ -910,7 +910,7 @@ spdk_iscsi_tgt_node_construct(int target_index, rc = pthread_mutex_init(&target->mutex, NULL); if (rc != 0) { SPDK_ERRLOG("tgt_node%d: mutex_init() failed\n", target->num); - spdk_iscsi_tgt_node_destruct(target); + iscsi_tgt_node_destruct(target); return NULL; } @@ -919,7 +919,7 @@ spdk_iscsi_tgt_node_construct(int target_index, target->name = strdup(fullname); if (!target->name) { SPDK_ERRLOG("Could not allocate TargetName\n"); - spdk_iscsi_tgt_node_destruct(target); + iscsi_tgt_node_destruct(target); return NULL; } @@ -929,7 +929,7 @@ spdk_iscsi_tgt_node_construct(int target_index, target->alias = strdup(alias); if (!target->alias) { SPDK_ERRLOG("Could not allocate TargetAlias\n"); - spdk_iscsi_tgt_node_destruct(target); + iscsi_tgt_node_destruct(target); return NULL; } } @@ -938,7 +938,7 @@ spdk_iscsi_tgt_node_construct(int target_index, SPDK_SPC_PROTOCOL_IDENTIFIER_ISCSI, NULL, NULL); if (!target->dev) { SPDK_ERRLOG("Could not construct SCSI device\n"); - spdk_iscsi_tgt_node_destruct(target); + iscsi_tgt_node_destruct(target); return NULL; } @@ -946,7 +946,7 @@ spdk_iscsi_tgt_node_construct(int target_index, rc = spdk_iscsi_tgt_node_add_pg_ig_maps(target, pg_tag_list, ig_tag_list, num_maps); if (rc != 0) { SPDK_ERRLOG("could not add map to target\n"); - spdk_iscsi_tgt_node_destruct(target); + iscsi_tgt_node_destruct(target); return NULL; } @@ -965,10 +965,10 @@ spdk_iscsi_tgt_node_construct(int target_index, target->queue_depth = g_spdk_iscsi.MaxQueueDepth; } - rc = spdk_iscsi_tgt_node_register(target); + rc = iscsi_tgt_node_register(target); if (rc != 0) { SPDK_ERRLOG("register target is failed\n"); - spdk_iscsi_tgt_node_destruct(target); + iscsi_tgt_node_destruct(target); return NULL; } @@ -976,7 +976,7 @@ spdk_iscsi_tgt_node_construct(int target_index, } static int -spdk_iscsi_parse_tgt_node(struct spdk_conf_section *sp) +iscsi_parse_tgt_node(struct spdk_conf_section *sp) { char buf[MAX_TMPBUF]; struct spdk_iscsi_tgt_node *target; @@ -1213,7 +1213,7 @@ int spdk_iscsi_parse_tgt_nodes(void) SPDK_ERRLOG("tag %d is invalid\n", tag); return -1; } - rc = spdk_iscsi_parse_tgt_node(sp); + rc = iscsi_parse_tgt_node(sp); if (rc < 0) { SPDK_ERRLOG("spdk_iscsi_parse_tgt_node() failed\n"); return -1; @@ -1232,7 +1232,7 @@ spdk_iscsi_shutdown_tgt_nodes(void) pthread_mutex_lock(&g_spdk_iscsi.mutex); TAILQ_FOREACH_SAFE(target, &g_spdk_iscsi.target_head, tailq, tmp) { TAILQ_REMOVE(&g_spdk_iscsi.target_head, target, tailq); - spdk_iscsi_tgt_node_destruct(target); + iscsi_tgt_node_destruct(target); } pthread_mutex_unlock(&g_spdk_iscsi.mutex); } @@ -1245,8 +1245,8 @@ spdk_iscsi_shutdown_tgt_node_by_name(const char *target_name) pthread_mutex_lock(&g_spdk_iscsi.mutex); target = spdk_iscsi_find_tgt_node(target_name); if (target != NULL) { - spdk_iscsi_tgt_node_unregister(target); - spdk_iscsi_tgt_node_destruct(target); + iscsi_tgt_node_unregister(target); + iscsi_tgt_node_destruct(target); pthread_mutex_unlock(&g_spdk_iscsi.mutex); return 0; @@ -1295,10 +1295,10 @@ void spdk_iscsi_tgt_node_delete_map(struct spdk_iscsi_portal_grp *portal_group, pthread_mutex_lock(&g_spdk_iscsi.mutex); TAILQ_FOREACH(target, &g_spdk_iscsi.target_head, tailq) { if (portal_group) { - spdk_iscsi_tgt_node_delete_pg_map(target, portal_group); + iscsi_tgt_node_delete_pg_map(target, portal_group); } if (initiator_group) { - spdk_iscsi_tgt_node_delete_ig_maps(target, initiator_group); + iscsi_tgt_node_delete_ig_maps(target, initiator_group); } } pthread_mutex_unlock(&g_spdk_iscsi.mutex); @@ -1456,8 +1456,8 @@ spdk_iscsi_tgt_nodes_config_text(FILE *fp) } static void -spdk_iscsi_tgt_node_info_json(struct spdk_iscsi_tgt_node *target, - struct spdk_json_write_ctx *w) +iscsi_tgt_node_info_json(struct spdk_iscsi_tgt_node *target, + struct spdk_json_write_ctx *w) { struct spdk_iscsi_pg_map *pg_map; struct spdk_iscsi_ig_map *ig_map; @@ -1509,15 +1509,15 @@ spdk_iscsi_tgt_node_info_json(struct spdk_iscsi_tgt_node *target, } static void -spdk_iscsi_tgt_node_config_json(struct spdk_iscsi_tgt_node *target, - struct spdk_json_write_ctx *w) +iscsi_tgt_node_config_json(struct spdk_iscsi_tgt_node *target, + struct spdk_json_write_ctx *w) { spdk_json_write_object_begin(w); spdk_json_write_named_string(w, "method", "construct_target_node"); spdk_json_write_name(w, "params"); - spdk_iscsi_tgt_node_info_json(target, w); + iscsi_tgt_node_info_json(target, w); spdk_json_write_object_end(w); } @@ -1528,7 +1528,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) { - spdk_iscsi_tgt_node_info_json(target, w); + iscsi_tgt_node_info_json(target, w); } } @@ -1538,6 +1538,6 @@ 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) { - spdk_iscsi_tgt_node_config_json(target, w); + iscsi_tgt_node_config_json(target, w); } } diff --git a/test/unit/lib/iscsi/init_grp.c/init_grp_ut.c b/test/unit/lib/iscsi/init_grp.c/init_grp_ut.c index 5fcce81bd1..bd91432ddb 100644 --- a/test/unit/lib/iscsi/init_grp.c/init_grp_ut.c +++ b/test/unit/lib/iscsi/init_grp.c/init_grp_ut.c @@ -74,7 +74,7 @@ create_from_config_file_cases(void) break; } - rc = spdk_iscsi_parse_init_grp(sp); + rc = iscsi_parse_init_grp(sp); CU_ASSERT(rc == 0); spdk_iscsi_init_grps_destroy(); @@ -91,7 +91,7 @@ create_from_config_file_cases(void) break; } - rc = spdk_iscsi_parse_init_grp(sp); + rc = iscsi_parse_init_grp(sp); CU_ASSERT(rc != 0); spdk_iscsi_init_grps_destroy(); @@ -108,7 +108,7 @@ create_initiator_group_success_case(void) { struct spdk_iscsi_init_grp *ig; - ig = spdk_iscsi_init_grp_create(1); + ig = iscsi_init_grp_create(1); CU_ASSERT(ig != NULL); spdk_iscsi_init_grp_destroy(ig); @@ -120,7 +120,7 @@ find_initiator_group_success_case(void) struct spdk_iscsi_init_grp *ig, *tmp; int rc; - ig = spdk_iscsi_init_grp_create(1); + ig = iscsi_init_grp_create(1); CU_ASSERT(ig != NULL); rc = spdk_iscsi_init_grp_register(ig); @@ -143,7 +143,7 @@ register_initiator_group_twice_case(void) struct spdk_iscsi_init_grp *ig, *tmp; int rc; - ig = spdk_iscsi_init_grp_create(1); + ig = iscsi_init_grp_create(1); CU_ASSERT(ig != NULL); rc = spdk_iscsi_init_grp_register(ig); @@ -173,34 +173,34 @@ add_initiator_name_success_case(void) char *name1 = "iqn.2017-10.spdk.io:0001"; char *name2 = "iqn.2017-10.spdk.io:0002"; - ig = spdk_iscsi_init_grp_create(1); + ig = iscsi_init_grp_create(1); CU_ASSERT(ig != NULL); /* add two different names to the empty name list */ - rc = spdk_iscsi_init_grp_add_initiator(ig, name1); + rc = iscsi_init_grp_add_initiator(ig, name1); CU_ASSERT(rc == 0); - rc = spdk_iscsi_init_grp_add_initiator(ig, name2); + rc = iscsi_init_grp_add_initiator(ig, name2); CU_ASSERT(rc == 0); /* check if two names are added correctly. */ - iname = spdk_iscsi_init_grp_find_initiator(ig, name1); + iname = iscsi_init_grp_find_initiator(ig, name1); CU_ASSERT(iname != NULL); - iname = spdk_iscsi_init_grp_find_initiator(ig, name2); + iname = iscsi_init_grp_find_initiator(ig, name2); CU_ASSERT(iname != NULL); /* restore the initial state */ - rc = spdk_iscsi_init_grp_delete_initiator(ig, name1); + rc = iscsi_init_grp_delete_initiator(ig, name1); CU_ASSERT(rc == 0); - iname = spdk_iscsi_init_grp_find_initiator(ig, name1); + iname = iscsi_init_grp_find_initiator(ig, name1); CU_ASSERT(iname == NULL); - rc = spdk_iscsi_init_grp_delete_initiator(ig, name2); + rc = iscsi_init_grp_delete_initiator(ig, name2); CU_ASSERT(rc == 0); - iname = spdk_iscsi_init_grp_find_initiator(ig, name2); + iname = iscsi_init_grp_find_initiator(ig, name2); CU_ASSERT(iname == NULL); spdk_iscsi_init_grp_destroy(ig); @@ -214,29 +214,29 @@ add_initiator_name_fail_case(void) struct spdk_iscsi_initiator_name *iname; char *name1 = "iqn.2017-10.spdk.io:0001"; - ig = spdk_iscsi_init_grp_create(1); + ig = iscsi_init_grp_create(1); CU_ASSERT(ig != NULL); /* add an name to the full name list */ ig->ninitiators = MAX_INITIATOR; - rc = spdk_iscsi_init_grp_add_initiator(ig, name1); + rc = iscsi_init_grp_add_initiator(ig, name1); CU_ASSERT(rc != 0); ig->ninitiators = 0; /* add the same name to the name list twice */ - rc = spdk_iscsi_init_grp_add_initiator(ig, name1); + rc = iscsi_init_grp_add_initiator(ig, name1); CU_ASSERT(rc == 0); - rc = spdk_iscsi_init_grp_add_initiator(ig, name1); + rc = iscsi_init_grp_add_initiator(ig, name1); CU_ASSERT(rc != 0); /* restore the initial state */ - rc = spdk_iscsi_init_grp_delete_initiator(ig, name1); + rc = iscsi_init_grp_delete_initiator(ig, name1); CU_ASSERT(rc == 0); - iname = spdk_iscsi_init_grp_find_initiator(ig, name1); + iname = iscsi_init_grp_find_initiator(ig, name1); CU_ASSERT(iname == NULL); spdk_iscsi_init_grp_destroy(ig); @@ -251,24 +251,24 @@ delete_all_initiator_names_success_case(void) char *name1 = "iqn.2017-10.spdk.io:0001"; char *name2 = "iqn.2017-10.spdk.io:0002"; - ig = spdk_iscsi_init_grp_create(1); + ig = iscsi_init_grp_create(1); CU_ASSERT(ig != NULL); /* add two different names to the empty name list */ - rc = spdk_iscsi_init_grp_add_initiator(ig, name1); + rc = iscsi_init_grp_add_initiator(ig, name1); CU_ASSERT(rc == 0); - rc = spdk_iscsi_init_grp_add_initiator(ig, name2); + rc = iscsi_init_grp_add_initiator(ig, name2); CU_ASSERT(rc == 0); /* delete all initiator names */ - spdk_iscsi_init_grp_delete_all_initiators(ig); + iscsi_init_grp_delete_all_initiators(ig); /* check if two names are deleted correctly. */ - iname = spdk_iscsi_init_grp_find_initiator(ig, name1); + iname = iscsi_init_grp_find_initiator(ig, name1); CU_ASSERT(iname == NULL); - iname = spdk_iscsi_init_grp_find_initiator(ig, name2); + iname = iscsi_init_grp_find_initiator(ig, name2); CU_ASSERT(iname == NULL); /* restore the initial state */ @@ -284,34 +284,34 @@ add_netmask_success_case(void) char *netmask1 = "192.168.2.0"; char *netmask2 = "192.168.2.1"; - ig = spdk_iscsi_init_grp_create(1); + ig = iscsi_init_grp_create(1); CU_ASSERT(ig != NULL); /* add two different netmasks to the empty netmask list */ - rc = spdk_iscsi_init_grp_add_netmask(ig, netmask1); + rc = iscsi_init_grp_add_netmask(ig, netmask1); CU_ASSERT(rc == 0); - rc = spdk_iscsi_init_grp_add_netmask(ig, netmask2); + rc = iscsi_init_grp_add_netmask(ig, netmask2); CU_ASSERT(rc == 0); /* check if two netmasks are added correctly. */ - imask = spdk_iscsi_init_grp_find_netmask(ig, netmask1); + imask = iscsi_init_grp_find_netmask(ig, netmask1); CU_ASSERT(imask != NULL); - imask = spdk_iscsi_init_grp_find_netmask(ig, netmask2); + imask = iscsi_init_grp_find_netmask(ig, netmask2); CU_ASSERT(imask != NULL); /* restore the initial state */ - rc = spdk_iscsi_init_grp_delete_netmask(ig, netmask1); + rc = iscsi_init_grp_delete_netmask(ig, netmask1); CU_ASSERT(rc == 0); - imask = spdk_iscsi_init_grp_find_netmask(ig, netmask1); + imask = iscsi_init_grp_find_netmask(ig, netmask1); CU_ASSERT(imask == NULL); - rc = spdk_iscsi_init_grp_delete_netmask(ig, netmask2); + rc = iscsi_init_grp_delete_netmask(ig, netmask2); CU_ASSERT(rc == 0); - imask = spdk_iscsi_init_grp_find_netmask(ig, netmask2); + imask = iscsi_init_grp_find_netmask(ig, netmask2); CU_ASSERT(imask == NULL); spdk_iscsi_init_grp_destroy(ig); @@ -325,29 +325,29 @@ add_netmask_fail_case(void) struct spdk_iscsi_initiator_netmask *imask; char *netmask1 = "192.168.2.0"; - ig = spdk_iscsi_init_grp_create(1); + ig = iscsi_init_grp_create(1); CU_ASSERT(ig != NULL); /* add an netmask to the full netmask list */ ig->nnetmasks = MAX_NETMASK; - rc = spdk_iscsi_init_grp_add_netmask(ig, netmask1); + rc = iscsi_init_grp_add_netmask(ig, netmask1); CU_ASSERT(rc != 0); ig->nnetmasks = 0; /* add the same netmask to the netmask list twice */ - rc = spdk_iscsi_init_grp_add_netmask(ig, netmask1); + rc = iscsi_init_grp_add_netmask(ig, netmask1); CU_ASSERT(rc == 0); - rc = spdk_iscsi_init_grp_add_netmask(ig, netmask1); + rc = iscsi_init_grp_add_netmask(ig, netmask1); CU_ASSERT(rc != 0); /* restore the initial state */ - rc = spdk_iscsi_init_grp_delete_netmask(ig, netmask1); + rc = iscsi_init_grp_delete_netmask(ig, netmask1); CU_ASSERT(rc == 0); - imask = spdk_iscsi_init_grp_find_netmask(ig, netmask1); + imask = iscsi_init_grp_find_netmask(ig, netmask1); CU_ASSERT(imask == NULL); spdk_iscsi_init_grp_destroy(ig); @@ -362,24 +362,24 @@ delete_all_netmasks_success_case(void) char *netmask1 = "192.168.2.0"; char *netmask2 = "192.168.2.1"; - ig = spdk_iscsi_init_grp_create(1); + ig = iscsi_init_grp_create(1); CU_ASSERT(ig != NULL); /* add two different netmasks to the empty netmask list */ - rc = spdk_iscsi_init_grp_add_netmask(ig, netmask1); + rc = iscsi_init_grp_add_netmask(ig, netmask1); CU_ASSERT(rc == 0); - rc = spdk_iscsi_init_grp_add_netmask(ig, netmask2); + rc = iscsi_init_grp_add_netmask(ig, netmask2); CU_ASSERT(rc == 0); /* delete all netmasks */ - spdk_iscsi_init_grp_delete_all_netmasks(ig); + iscsi_init_grp_delete_all_netmasks(ig); /* check if two netmasks are deleted correctly. */ - imask = spdk_iscsi_init_grp_find_netmask(ig, netmask1); + imask = iscsi_init_grp_find_netmask(ig, netmask1); CU_ASSERT(imask == NULL); - imask = spdk_iscsi_init_grp_find_netmask(ig, netmask2); + imask = iscsi_init_grp_find_netmask(ig, netmask2); CU_ASSERT(imask == NULL); /* restore the initial state */ @@ -397,31 +397,31 @@ initiator_name_overwrite_all_to_any_case(void) char *all_not = "!ALL"; char *any_not = "!ANY"; - ig = spdk_iscsi_init_grp_create(1); + ig = iscsi_init_grp_create(1); CU_ASSERT(ig != NULL); - rc = spdk_iscsi_init_grp_add_initiator(ig, all); + rc = iscsi_init_grp_add_initiator(ig, all); CU_ASSERT(rc == 0); - iname = spdk_iscsi_init_grp_find_initiator(ig, all); + iname = iscsi_init_grp_find_initiator(ig, all); CU_ASSERT(iname == NULL); - iname = spdk_iscsi_init_grp_find_initiator(ig, any); + iname = iscsi_init_grp_find_initiator(ig, any); CU_ASSERT(iname != NULL); - rc = spdk_iscsi_init_grp_delete_initiator(ig, any); + rc = iscsi_init_grp_delete_initiator(ig, any); CU_ASSERT(rc == 0); - rc = spdk_iscsi_init_grp_add_initiator(ig, all_not); + rc = iscsi_init_grp_add_initiator(ig, all_not); CU_ASSERT(rc == 0); - iname = spdk_iscsi_init_grp_find_initiator(ig, all_not); + iname = iscsi_init_grp_find_initiator(ig, all_not); CU_ASSERT(iname == NULL); - iname = spdk_iscsi_init_grp_find_initiator(ig, any_not); + iname = iscsi_init_grp_find_initiator(ig, any_not); CU_ASSERT(iname != NULL); - rc = spdk_iscsi_init_grp_delete_initiator(ig, any_not); + rc = iscsi_init_grp_delete_initiator(ig, any_not); CU_ASSERT(rc == 0); spdk_iscsi_init_grp_destroy(ig); @@ -436,19 +436,19 @@ netmask_overwrite_all_to_any_case(void) char *all = "ALL"; char *any = "ANY"; - ig = spdk_iscsi_init_grp_create(1); + ig = iscsi_init_grp_create(1); CU_ASSERT(ig != NULL); - rc = spdk_iscsi_init_grp_add_netmask(ig, all); + rc = iscsi_init_grp_add_netmask(ig, all); CU_ASSERT(rc == 0); - imask = spdk_iscsi_init_grp_find_netmask(ig, all); + imask = iscsi_init_grp_find_netmask(ig, all); CU_ASSERT(imask == NULL); - imask = spdk_iscsi_init_grp_find_netmask(ig, any); + imask = iscsi_init_grp_find_netmask(ig, any); CU_ASSERT(imask != NULL); - rc = spdk_iscsi_init_grp_delete_netmask(ig, any); + rc = iscsi_init_grp_delete_netmask(ig, any); CU_ASSERT(rc == 0); spdk_iscsi_init_grp_destroy(ig); @@ -462,18 +462,18 @@ add_delete_initiator_names_case(void) struct spdk_iscsi_initiator_name *iname; char *names[3] = {"iqn.2018-02.spdk.io:0001", "iqn.2018-02.spdk.io:0002", "iqn.2018-02.spdk.io:0003"}; - ig = spdk_iscsi_init_grp_create(1); + ig = iscsi_init_grp_create(1); SPDK_CU_ASSERT_FATAL(ig != NULL); - rc = spdk_iscsi_init_grp_add_initiators(ig, 3, names); + rc = iscsi_init_grp_add_initiators(ig, 3, names); CU_ASSERT(rc == 0); for (i = 0; i < 3; i++) { - iname = spdk_iscsi_init_grp_find_initiator(ig, names[i]); + iname = iscsi_init_grp_find_initiator(ig, names[i]); CU_ASSERT(iname != NULL); } - rc = spdk_iscsi_init_grp_delete_initiators(ig, 3, names); + rc = iscsi_init_grp_delete_initiators(ig, 3, names); CU_ASSERT(rc == 0); if (ig != NULL) { @@ -490,10 +490,10 @@ add_duplicated_initiator_names_case(void) struct spdk_iscsi_init_grp *ig; char *names[3] = {"iqn.2018-02.spdk.io:0001", "iqn.2018-02.spdk.io:0002", "iqn.2018-02.spdk.io:0001"}; - ig = spdk_iscsi_init_grp_create(1); + ig = iscsi_init_grp_create(1); SPDK_CU_ASSERT_FATAL(ig != NULL); - rc = spdk_iscsi_init_grp_add_initiators(ig, 3, names); + rc = iscsi_init_grp_add_initiators(ig, 3, names); CU_ASSERT(rc != 0); if (ig != NULL) { @@ -512,26 +512,26 @@ delete_nonexisting_initiator_names_case(void) char *names1[3] = {"iqn.2018-02.spdk.io:0001", "iqn.2018-02.spdk.io:0002", "iqn.2018-02.spdk.io:0003"}; char *names2[3] = {"iqn.2018-02.spdk.io:0001", "iqn.2018-02.spdk.io:0002", "iqn.2018-02.spdk.io:0004"}; - ig = spdk_iscsi_init_grp_create(1); + ig = iscsi_init_grp_create(1); SPDK_CU_ASSERT_FATAL(ig != NULL); - rc = spdk_iscsi_init_grp_add_initiators(ig, 3, names1); + rc = iscsi_init_grp_add_initiators(ig, 3, names1); CU_ASSERT(rc == 0); for (i = 0; i < 3; i++) { - iname = spdk_iscsi_init_grp_find_initiator(ig, names1[i]); + iname = iscsi_init_grp_find_initiator(ig, names1[i]); CU_ASSERT(iname != NULL); } - rc = spdk_iscsi_init_grp_delete_initiators(ig, 3, names2); + rc = iscsi_init_grp_delete_initiators(ig, 3, names2); CU_ASSERT(rc != 0); for (i = 0; i < 3; i++) { - iname = spdk_iscsi_init_grp_find_initiator(ig, names1[i]); + iname = iscsi_init_grp_find_initiator(ig, names1[i]); CU_ASSERT(iname != NULL); } - rc = spdk_iscsi_init_grp_delete_initiators(ig, 3, names1); + rc = iscsi_init_grp_delete_initiators(ig, 3, names1); CU_ASSERT(rc == 0); if (ig != NULL) { @@ -549,18 +549,18 @@ add_delete_netmasks_case(void) struct spdk_iscsi_initiator_netmask *netmask; char *netmasks[3] = {"192.168.2.0", "192.168.2.1", "192.168.2.2"}; - ig = spdk_iscsi_init_grp_create(1); + ig = iscsi_init_grp_create(1); SPDK_CU_ASSERT_FATAL(ig != NULL); - rc = spdk_iscsi_init_grp_add_netmasks(ig, 3, netmasks); + rc = iscsi_init_grp_add_netmasks(ig, 3, netmasks); CU_ASSERT(rc == 0); for (i = 0; i < 3; i++) { - netmask = spdk_iscsi_init_grp_find_netmask(ig, netmasks[i]); + netmask = iscsi_init_grp_find_netmask(ig, netmasks[i]); CU_ASSERT(netmask != NULL); } - rc = spdk_iscsi_init_grp_delete_netmasks(ig, 3, netmasks); + rc = iscsi_init_grp_delete_netmasks(ig, 3, netmasks); CU_ASSERT(rc == 0); if (ig != NULL) { @@ -577,10 +577,10 @@ add_duplicated_netmasks_case(void) struct spdk_iscsi_init_grp *ig; char *netmasks[3] = {"192.168.2.0", "192.168.2.1", "192.168.2.0"}; - ig = spdk_iscsi_init_grp_create(1); + ig = iscsi_init_grp_create(1); SPDK_CU_ASSERT_FATAL(ig != NULL); - rc = spdk_iscsi_init_grp_add_netmasks(ig, 3, netmasks); + rc = iscsi_init_grp_add_netmasks(ig, 3, netmasks); CU_ASSERT(rc != 0); if (ig != NULL) { @@ -599,26 +599,26 @@ delete_nonexisting_netmasks_case(void) char *netmasks1[3] = {"192.168.2.0", "192.168.2.1", "192.168.2.2"}; char *netmasks2[3] = {"192.168.2.0", "192.168.2.1", "192.168.2.3"}; - ig = spdk_iscsi_init_grp_create(1); + ig = iscsi_init_grp_create(1); SPDK_CU_ASSERT_FATAL(ig != NULL); - rc = spdk_iscsi_init_grp_add_netmasks(ig, 3, netmasks1); + rc = iscsi_init_grp_add_netmasks(ig, 3, netmasks1); CU_ASSERT(rc == 0); for (i = 0; i < 3; i++) { - netmask = spdk_iscsi_init_grp_find_netmask(ig, netmasks1[i]); + netmask = iscsi_init_grp_find_netmask(ig, netmasks1[i]); CU_ASSERT(netmask != NULL); } - rc = spdk_iscsi_init_grp_delete_netmasks(ig, 3, netmasks2); + rc = iscsi_init_grp_delete_netmasks(ig, 3, netmasks2); CU_ASSERT(rc != 0); for (i = 0; i < 3; i++) { - netmask = spdk_iscsi_init_grp_find_netmask(ig, netmasks1[i]); + netmask = iscsi_init_grp_find_netmask(ig, netmasks1[i]); CU_ASSERT(netmask != NULL); } - rc = spdk_iscsi_init_grp_delete_netmasks(ig, 3, netmasks1); + rc = iscsi_init_grp_delete_netmasks(ig, 3, netmasks1); CU_ASSERT(rc == 0); if (ig != NULL) { diff --git a/test/unit/lib/iscsi/iscsi.c/iscsi_ut.c b/test/unit/lib/iscsi/iscsi.c/iscsi_ut.c index 5e53e47cd0..3a59d33eba 100644 --- a/test/unit/lib/iscsi/iscsi.c/iscsi_ut.c +++ b/test/unit/lib/iscsi/iscsi.c/iscsi_ut.c @@ -123,24 +123,24 @@ op_login_check_target_test(void) snprintf(conn.initiator_name, sizeof(conn.initiator_name), "%s", UT_INITIATOR_NAME1); - rc = spdk_iscsi_op_login_check_target(&conn, &rsp_pdu, - UT_TARGET_NAME1, &target); + rc = iscsi_op_login_check_target(&conn, &rsp_pdu, + UT_TARGET_NAME1, &target); CU_ASSERT(rc == 0); /* expect failure */ snprintf(conn.initiator_name, sizeof(conn.initiator_name), "%s", UT_INITIATOR_NAME1); - rc = spdk_iscsi_op_login_check_target(&conn, &rsp_pdu, - UT_TARGET_NAME2, &target); + rc = iscsi_op_login_check_target(&conn, &rsp_pdu, + UT_TARGET_NAME2, &target); CU_ASSERT(rc != 0); /* expect failure */ snprintf(conn.initiator_name, sizeof(conn.initiator_name), "%s", UT_INITIATOR_NAME2); - rc = spdk_iscsi_op_login_check_target(&conn, &rsp_pdu, - UT_TARGET_NAME1, &target); + rc = iscsi_op_login_check_target(&conn, &rsp_pdu, + UT_TARGET_NAME1, &target); CU_ASSERT(rc != 0); } @@ -558,7 +558,7 @@ add_transfer_task_test(void) /* The following tests if the task is queued because R2T tasks are full. */ conn.pending_r2t = DEFAULT_MAXR2T; - rc = spdk_add_transfer_task(&conn, &task); + rc = add_transfer_task(&conn, &task); CU_ASSERT(rc == SPDK_SUCCESS); CU_ASSERT(TAILQ_FIRST(&conn.queued_r2t_tasks) == &task); @@ -569,7 +569,7 @@ add_transfer_task_test(void) /* The following tests if multiple R2Ts are issued. */ conn.pending_r2t = 0; - rc = spdk_add_transfer_task(&conn, &task); + rc = add_transfer_task(&conn, &task); CU_ASSERT(rc == SPDK_SUCCESS); CU_ASSERT(TAILQ_FIRST(&conn.active_r2t_tasks) == &task); @@ -637,7 +637,7 @@ get_transfer_task_test(void) task1.scsi.transfer_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH; spdk_iscsi_task_set_pdu(&task1, pdu1); - rc = spdk_add_transfer_task(&conn, &task1); + rc = add_transfer_task(&conn, &task1); CU_ASSERT(rc == SPDK_SUCCESS); pdu2 = spdk_get_pdu(); @@ -647,13 +647,13 @@ get_transfer_task_test(void) task2.scsi.transfer_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH; spdk_iscsi_task_set_pdu(&task2, pdu2); - rc = spdk_add_transfer_task(&conn, &task2); + rc = add_transfer_task(&conn, &task2); CU_ASSERT(rc == SPDK_SUCCESS); - task = spdk_get_transfer_task(&conn, 1); + task = get_transfer_task(&conn, 1); CU_ASSERT(task == &task1); - task = spdk_get_transfer_task(&conn, 2); + task = get_transfer_task(&conn, 2); CU_ASSERT(task == &task2); while (!TAILQ_EMPTY(&conn.active_r2t_tasks)) { @@ -703,7 +703,7 @@ del_transfer_task_test(void) spdk_iscsi_task_set_pdu(&task1, pdu1); task1.tag = 11; - rc = spdk_add_transfer_task(&conn, &task1); + rc = add_transfer_task(&conn, &task1); CU_ASSERT(rc == SPDK_SUCCESS); pdu2 = spdk_get_pdu(); @@ -714,7 +714,7 @@ del_transfer_task_test(void) spdk_iscsi_task_set_pdu(&task2, pdu2); task2.tag = 12; - rc = spdk_add_transfer_task(&conn, &task2); + rc = add_transfer_task(&conn, &task2); CU_ASSERT(rc == SPDK_SUCCESS); pdu3 = spdk_get_pdu(); @@ -725,7 +725,7 @@ del_transfer_task_test(void) spdk_iscsi_task_set_pdu(&task3, pdu3); task3.tag = 13; - rc = spdk_add_transfer_task(&conn, &task3); + rc = add_transfer_task(&conn, &task3); CU_ASSERT(rc == SPDK_SUCCESS); pdu4 = spdk_get_pdu(); @@ -736,7 +736,7 @@ del_transfer_task_test(void) spdk_iscsi_task_set_pdu(&task4, pdu4); task4.tag = 14; - rc = spdk_add_transfer_task(&conn, &task4); + rc = add_transfer_task(&conn, &task4); CU_ASSERT(rc == SPDK_SUCCESS); pdu5 = spdk_get_pdu(); @@ -747,30 +747,30 @@ del_transfer_task_test(void) spdk_iscsi_task_set_pdu(&task5, pdu5); task5.tag = 15; - rc = spdk_add_transfer_task(&conn, &task5); + rc = add_transfer_task(&conn, &task5); CU_ASSERT(rc == SPDK_SUCCESS); - CU_ASSERT(spdk_get_transfer_task(&conn, 1) == &task1); - CU_ASSERT(spdk_get_transfer_task(&conn, 5) == NULL); + CU_ASSERT(get_transfer_task(&conn, 1) == &task1); + CU_ASSERT(get_transfer_task(&conn, 5) == NULL); spdk_del_transfer_task(&conn, 11); - CU_ASSERT(spdk_get_transfer_task(&conn, 1) == NULL); - CU_ASSERT(spdk_get_transfer_task(&conn, 5) == &task5); + CU_ASSERT(get_transfer_task(&conn, 1) == NULL); + CU_ASSERT(get_transfer_task(&conn, 5) == &task5); - CU_ASSERT(spdk_get_transfer_task(&conn, 2) == &task2); + CU_ASSERT(get_transfer_task(&conn, 2) == &task2); spdk_del_transfer_task(&conn, 12); - CU_ASSERT(spdk_get_transfer_task(&conn, 2) == NULL); + CU_ASSERT(get_transfer_task(&conn, 2) == NULL); - CU_ASSERT(spdk_get_transfer_task(&conn, 3) == &task3); + CU_ASSERT(get_transfer_task(&conn, 3) == &task3); spdk_del_transfer_task(&conn, 13); - CU_ASSERT(spdk_get_transfer_task(&conn, 3) == NULL); + CU_ASSERT(get_transfer_task(&conn, 3) == NULL); - CU_ASSERT(spdk_get_transfer_task(&conn, 4) == &task4); + CU_ASSERT(get_transfer_task(&conn, 4) == &task4); spdk_del_transfer_task(&conn, 14); - CU_ASSERT(spdk_get_transfer_task(&conn, 4) == NULL); + CU_ASSERT(get_transfer_task(&conn, 4) == NULL); - CU_ASSERT(spdk_get_transfer_task(&conn, 5) == &task5); + CU_ASSERT(get_transfer_task(&conn, 5) == &task5); spdk_del_transfer_task(&conn, 15); - CU_ASSERT(spdk_get_transfer_task(&conn, 5) == NULL); + CU_ASSERT(get_transfer_task(&conn, 5) == NULL); while (!TAILQ_EMPTY(&conn.active_r2t_tasks)) { task = TAILQ_FIRST(&conn.active_r2t_tasks); @@ -828,7 +828,7 @@ clear_all_transfer_tasks_test(void) task1->scsi.lun = &lun1; spdk_iscsi_task_set_pdu(task1, pdu1); - rc = spdk_add_transfer_task(&conn, task1); + rc = add_transfer_task(&conn, task1); CU_ASSERT(rc == SPDK_SUCCESS); mgmt_pdu1 = spdk_get_pdu(); @@ -849,7 +849,7 @@ clear_all_transfer_tasks_test(void) task2->scsi.lun = &lun1; spdk_iscsi_task_set_pdu(task2, pdu2); - rc = spdk_add_transfer_task(&conn, task2); + rc = add_transfer_task(&conn, task2); CU_ASSERT(rc == SPDK_SUCCESS); task3 = spdk_iscsi_task_get(&conn, NULL, NULL); @@ -864,7 +864,7 @@ clear_all_transfer_tasks_test(void) task3->scsi.lun = &lun1; spdk_iscsi_task_set_pdu(task3, pdu3); - rc = spdk_add_transfer_task(&conn, task3); + rc = add_transfer_task(&conn, task3); CU_ASSERT(rc == SPDK_SUCCESS); task4 = spdk_iscsi_task_get(&conn, NULL, NULL); @@ -879,7 +879,7 @@ clear_all_transfer_tasks_test(void) task4->scsi.lun = &lun2; spdk_iscsi_task_set_pdu(task4, pdu4); - rc = spdk_add_transfer_task(&conn, task4); + rc = add_transfer_task(&conn, task4); CU_ASSERT(rc == SPDK_SUCCESS); task5 = spdk_iscsi_task_get(&conn, NULL, NULL); @@ -894,7 +894,7 @@ clear_all_transfer_tasks_test(void) task5->scsi.lun = &lun2; spdk_iscsi_task_set_pdu(task5, pdu5); - rc = spdk_add_transfer_task(&conn, task5); + rc = add_transfer_task(&conn, task5); CU_ASSERT(rc == SPDK_SUCCESS); mgmt_pdu2 = spdk_get_pdu(); @@ -915,46 +915,46 @@ clear_all_transfer_tasks_test(void) task6->scsi.lun = &lun2; spdk_iscsi_task_set_pdu(task6, pdu6); - rc = spdk_add_transfer_task(&conn, task6); + rc = add_transfer_task(&conn, task6); CU_ASSERT(rc == SPDK_SUCCESS); CU_ASSERT(conn.ttt == 4); - CU_ASSERT(spdk_get_transfer_task(&conn, 1) == task1); - CU_ASSERT(spdk_get_transfer_task(&conn, 2) == task2); - CU_ASSERT(spdk_get_transfer_task(&conn, 3) == task3); - CU_ASSERT(spdk_get_transfer_task(&conn, 4) == task4); - CU_ASSERT(spdk_get_transfer_task(&conn, 5) == NULL); + CU_ASSERT(get_transfer_task(&conn, 1) == task1); + CU_ASSERT(get_transfer_task(&conn, 2) == task2); + CU_ASSERT(get_transfer_task(&conn, 3) == task3); + CU_ASSERT(get_transfer_task(&conn, 4) == task4); + CU_ASSERT(get_transfer_task(&conn, 5) == NULL); spdk_clear_all_transfer_task(&conn, &lun1, mgmt_pdu1); CU_ASSERT(!TAILQ_EMPTY(&conn.queued_r2t_tasks)); - CU_ASSERT(spdk_get_transfer_task(&conn, 1) == NULL); - CU_ASSERT(spdk_get_transfer_task(&conn, 2) == task2); - CU_ASSERT(spdk_get_transfer_task(&conn, 3) == task3); - CU_ASSERT(spdk_get_transfer_task(&conn, 4) == task4); - CU_ASSERT(spdk_get_transfer_task(&conn, 5) == task5); - CU_ASSERT(spdk_get_transfer_task(&conn, 6) == NULL); + CU_ASSERT(get_transfer_task(&conn, 1) == NULL); + CU_ASSERT(get_transfer_task(&conn, 2) == task2); + CU_ASSERT(get_transfer_task(&conn, 3) == task3); + CU_ASSERT(get_transfer_task(&conn, 4) == task4); + CU_ASSERT(get_transfer_task(&conn, 5) == task5); + CU_ASSERT(get_transfer_task(&conn, 6) == NULL); spdk_clear_all_transfer_task(&conn, &lun1, NULL); CU_ASSERT(TAILQ_EMPTY(&conn.queued_r2t_tasks)); - CU_ASSERT(spdk_get_transfer_task(&conn, 1) == NULL); - CU_ASSERT(spdk_get_transfer_task(&conn, 2) == NULL); - CU_ASSERT(spdk_get_transfer_task(&conn, 3) == NULL); - CU_ASSERT(spdk_get_transfer_task(&conn, 4) == task4); - CU_ASSERT(spdk_get_transfer_task(&conn, 5) == task5); - CU_ASSERT(spdk_get_transfer_task(&conn, 6) == task6); + CU_ASSERT(get_transfer_task(&conn, 1) == NULL); + CU_ASSERT(get_transfer_task(&conn, 2) == NULL); + CU_ASSERT(get_transfer_task(&conn, 3) == NULL); + CU_ASSERT(get_transfer_task(&conn, 4) == task4); + CU_ASSERT(get_transfer_task(&conn, 5) == task5); + CU_ASSERT(get_transfer_task(&conn, 6) == task6); spdk_clear_all_transfer_task(&conn, &lun2, mgmt_pdu2); - CU_ASSERT(spdk_get_transfer_task(&conn, 4) == NULL); - CU_ASSERT(spdk_get_transfer_task(&conn, 5) == NULL); - CU_ASSERT(spdk_get_transfer_task(&conn, 6) == task6); + CU_ASSERT(get_transfer_task(&conn, 4) == NULL); + CU_ASSERT(get_transfer_task(&conn, 5) == NULL); + CU_ASSERT(get_transfer_task(&conn, 6) == task6); spdk_clear_all_transfer_task(&conn, NULL, NULL); - CU_ASSERT(spdk_get_transfer_task(&conn, 6) == NULL); + CU_ASSERT(get_transfer_task(&conn, 6) == NULL); CU_ASSERT(TAILQ_EMPTY(&conn.active_r2t_tasks)); while (!TAILQ_EMPTY(&g_write_pdu_list)) { @@ -989,14 +989,14 @@ abort_queued_datain_task_test(void) /* Slot of data in tasks are full */ conn.data_in_cnt = MAX_LARGE_DATAIN_PER_CONNECTION; - rc = _spdk_iscsi_conn_abort_queued_datain_task(&conn, task); + rc = _iscsi_conn_abort_queued_datain_task(&conn, task); CU_ASSERT(rc != 0); /* Only one slot remains and no subtasks are submitted yet. */ conn.data_in_cnt--; task->current_datain_offset = 0; - rc = _spdk_iscsi_conn_abort_queued_datain_task(&conn, task); + rc = _iscsi_conn_abort_queued_datain_task(&conn, task); CU_ASSERT(rc == 0); CU_ASSERT(TAILQ_EMPTY(&conn.queued_datain_tasks)); @@ -1008,7 +1008,7 @@ abort_queued_datain_task_test(void) task->scsi.transfer_len = SPDK_BDEV_LARGE_BUF_MAX_SIZE * 3; task->current_datain_offset = SPDK_BDEV_LARGE_BUF_MAX_SIZE; - rc = _spdk_iscsi_conn_abort_queued_datain_task(&conn, task); + rc = _iscsi_conn_abort_queued_datain_task(&conn, task); CU_ASSERT(rc != 0); CU_ASSERT(task->current_datain_offset == SPDK_BDEV_LARGE_BUF_MAX_SIZE * 2); CU_ASSERT(conn.data_in_cnt == MAX_LARGE_DATAIN_PER_CONNECTION); @@ -1016,7 +1016,7 @@ abort_queued_datain_task_test(void) /* Additional one slot becomes vacant. */ conn.data_in_cnt--; - rc = _spdk_iscsi_conn_abort_queued_datain_task(&conn, task); + rc = _iscsi_conn_abort_queued_datain_task(&conn, task); CU_ASSERT(rc == 0); CU_ASSERT(TAILQ_EMPTY(&conn.queued_datain_tasks)); @@ -1043,13 +1043,13 @@ abort_queued_datain_task_test(void) conn.data_in_cnt--; - rc = spdk_iscsi_conn_abort_queued_datain_task(&conn, 1); + rc = iscsi_conn_abort_queued_datain_task(&conn, 1); CU_ASSERT(rc == 0); - rc = spdk_iscsi_conn_abort_queued_datain_task(&conn, 2); + rc = iscsi_conn_abort_queued_datain_task(&conn, 2); CU_ASSERT(rc == 0); - rc = spdk_iscsi_conn_abort_queued_datain_task(&conn, 3); + rc = iscsi_conn_abort_queued_datain_task(&conn, 3); CU_ASSERT(rc == 0); CU_ASSERT(TAILQ_EMPTY(&conn.queued_datain_tasks)); @@ -1170,7 +1170,7 @@ abort_queued_datain_tasks_test(void) spdk_iscsi_task_set_pdu(task6, pdu6); TAILQ_INSERT_TAIL(&conn.queued_datain_tasks, task6, link); - rc = spdk_iscsi_conn_abort_queued_datain_tasks(&conn, &lun1, mgmt_pdu1); + rc = iscsi_conn_abort_queued_datain_tasks(&conn, &lun1, mgmt_pdu1); CU_ASSERT(rc == 0); CU_ASSERT(!datain_task_is_queued(&conn, task1)); CU_ASSERT(datain_task_is_queued(&conn, task2)); @@ -1179,7 +1179,7 @@ abort_queued_datain_tasks_test(void) CU_ASSERT(datain_task_is_queued(&conn, task5)); CU_ASSERT(datain_task_is_queued(&conn, task6)); - rc = spdk_iscsi_conn_abort_queued_datain_tasks(&conn, &lun2, mgmt_pdu2); + rc = iscsi_conn_abort_queued_datain_tasks(&conn, &lun2, mgmt_pdu2); CU_ASSERT(rc == 0); CU_ASSERT(!datain_task_is_queued(&conn, task2)); CU_ASSERT(datain_task_is_queued(&conn, task3)); diff --git a/test/unit/lib/iscsi/param.c/param_ut.c b/test/unit/lib/iscsi/param.c/param_ut.c index 7d07cf7e87..34807d2dc3 100644 --- a/test/unit/lib/iscsi/param.c/param_ut.c +++ b/test/unit/lib/iscsi/param.c/param_ut.c @@ -170,7 +170,7 @@ list_negotiation_test(void) do { \ snprintf(valid_list_buf, sizeof(valid_list_buf), "%s", valid_list); \ snprintf(in_val_buf, sizeof(in_val_buf), "%s", in_val); \ - new_val = spdk_iscsi_negotiate_param_list(&add_param_value, ¶m, valid_list_buf, in_val_buf, NULL); \ + new_val = iscsi_negotiate_param_list(&add_param_value, ¶m, valid_list_buf, in_val_buf, NULL); \ if (expected_result) { \ SPDK_CU_ASSERT_FATAL(new_val != NULL); \ CU_ASSERT_STRING_EQUAL(new_val, expected_result); \ diff --git a/test/unit/lib/iscsi/portal_grp.c/portal_grp_ut.c b/test/unit/lib/iscsi/portal_grp.c/portal_grp_ut.c index 77351f0ac3..649aed758e 100644 --- a/test/unit/lib/iscsi/portal_grp.c/portal_grp_ut.c +++ b/test/unit/lib/iscsi/portal_grp.c/portal_grp_ut.c @@ -178,7 +178,7 @@ parse_portal_ipv4_normal_case(void) spdk_cpuset_set_cpu(cpumask_val, 0, true); - rc = spdk_iscsi_parse_portal(string, &p, 0); + rc = iscsi_parse_portal(string, &p, 0); CU_ASSERT(rc == 0); SPDK_CU_ASSERT_FATAL(p != NULL); CU_ASSERT(strcmp(p->host, host_str) == 0); @@ -206,7 +206,7 @@ parse_portal_ipv6_normal_case(void) spdk_cpuset_set_cpu(cpumask_val, 0, true); - rc = spdk_iscsi_parse_portal(string, &p, 0); + rc = iscsi_parse_portal(string, &p, 0); CU_ASSERT(rc == 0); SPDK_CU_ASSERT_FATAL(p != NULL); CU_ASSERT(strcmp(p->host, host_str) == 0); @@ -231,7 +231,7 @@ parse_portal_ipv4_skip_cpumask_case(void) cpumask_val = spdk_app_get_core_mask(); - rc = spdk_iscsi_parse_portal(string, &p, 0); + rc = iscsi_parse_portal(string, &p, 0); CU_ASSERT(rc == 0); SPDK_CU_ASSERT_FATAL(p != NULL); CU_ASSERT(strcmp(p->host, host_str) == 0); @@ -254,7 +254,7 @@ parse_portal_ipv6_skip_cpumask_case(void) cpumask_val = spdk_app_get_core_mask(); - rc = spdk_iscsi_parse_portal(string, &p, 0); + rc = iscsi_parse_portal(string, &p, 0); CU_ASSERT(rc == 0); SPDK_CU_ASSERT_FATAL(p != NULL); CU_ASSERT(strcmp(p->host, host_str) == 0); @@ -277,7 +277,7 @@ parse_portal_ipv4_skip_port_and_cpumask_case(void) cpumask_val = spdk_app_get_core_mask(); - rc = spdk_iscsi_parse_portal(string, &p, 0); + rc = iscsi_parse_portal(string, &p, 0); CU_ASSERT(rc == 0); SPDK_CU_ASSERT_FATAL(p != NULL); CU_ASSERT(strcmp(p->host, host_str) == 0); @@ -300,7 +300,7 @@ parse_portal_ipv6_skip_port_and_cpumask_case(void) cpumask_val = spdk_app_get_core_mask(); - rc = spdk_iscsi_parse_portal(string, &p, 0); + rc = iscsi_parse_portal(string, &p, 0); CU_ASSERT(rc == 0); SPDK_CU_ASSERT_FATAL(p != NULL); CU_ASSERT(strcmp(p->host, host_str) == 0); diff --git a/test/unit/lib/iscsi/tgt_node.c/tgt_node_ut.c b/test/unit/lib/iscsi/tgt_node.c/tgt_node_ut.c index 145ca81978..bfaa6963f7 100644 --- a/test/unit/lib/iscsi/tgt_node.c/tgt_node_ut.c +++ b/test/unit/lib/iscsi/tgt_node.c/tgt_node_ut.c @@ -170,7 +170,7 @@ config_file_fail_cases(void) if (sp == NULL) { break; } - rc = spdk_iscsi_parse_tgt_node(sp); + rc = iscsi_parse_tgt_node(sp); CU_ASSERT(rc < 0); section_index++; } @@ -189,10 +189,10 @@ allow_any_allowed(void) addr1 = "2001:ad6:1234:5678:9abc::"; addr2 = "192.168.2.1"; - result = spdk_iscsi_netmask_allow_addr(netmask, addr1); + result = iscsi_netmask_allow_addr(netmask, addr1); CU_ASSERT(result == true); - result = spdk_iscsi_netmask_allow_addr(netmask, addr2); + result = iscsi_netmask_allow_addr(netmask, addr2); CU_ASSERT(result == true); } @@ -206,16 +206,16 @@ allow_ipv6_allowed(void) netmask = "[2001:ad6:1234::]/48"; addr = "2001:ad6:1234:5678:9abc::"; - result = spdk_iscsi_ipv6_netmask_allow_addr(netmask, addr); + result = iscsi_ipv6_netmask_allow_addr(netmask, addr); CU_ASSERT(result == true); - result = spdk_iscsi_netmask_allow_addr(netmask, addr); + result = iscsi_netmask_allow_addr(netmask, addr); CU_ASSERT(result == true); /* Netmask prefix bits == 128 (all bits must match) */ netmask = "[2001:ad6:1234:5678:9abc::1]/128"; addr = "2001:ad6:1234:5678:9abc::1"; - result = spdk_iscsi_ipv6_netmask_allow_addr(netmask, addr); + result = iscsi_ipv6_netmask_allow_addr(netmask, addr); CU_ASSERT(result == true); } @@ -229,16 +229,16 @@ allow_ipv6_denied(void) netmask = "[2001:ad6:1234::]/56"; addr = "2001:ad6:1234:5678:9abc::"; - result = spdk_iscsi_ipv6_netmask_allow_addr(netmask, addr); + result = iscsi_ipv6_netmask_allow_addr(netmask, addr); CU_ASSERT(result == false); - result = spdk_iscsi_netmask_allow_addr(netmask, addr); + result = iscsi_netmask_allow_addr(netmask, addr); CU_ASSERT(result == false); /* Netmask prefix bits == 128 (all bits must match) */ netmask = "[2001:ad6:1234:5678:9abc::1]/128"; addr = "2001:ad6:1234:5678:9abc::2"; - result = spdk_iscsi_ipv6_netmask_allow_addr(netmask, addr); + result = iscsi_ipv6_netmask_allow_addr(netmask, addr); CU_ASSERT(result == false); } @@ -252,19 +252,19 @@ allow_ipv6_invalid(void) /* Netmask prefix bits > 128 */ netmask = "[2001:ad6:1234::]/129"; addr = "2001:ad6:1234:5678:9abc::"; - result = spdk_iscsi_ipv6_netmask_allow_addr(netmask, addr); + result = iscsi_ipv6_netmask_allow_addr(netmask, addr); CU_ASSERT(result == false); /* Netmask prefix bits == 0 */ netmask = "[2001:ad6:1234::]/0"; addr = "2001:ad6:1234:5678:9abc::"; - result = spdk_iscsi_ipv6_netmask_allow_addr(netmask, addr); + result = iscsi_ipv6_netmask_allow_addr(netmask, addr); CU_ASSERT(result == false); /* Netmask prefix bits < 0 */ netmask = "[2001:ad6:1234::]/-1"; addr = "2001:ad6:1234:5678:9abc::"; - result = spdk_iscsi_ipv6_netmask_allow_addr(netmask, addr); + result = iscsi_ipv6_netmask_allow_addr(netmask, addr); CU_ASSERT(result == false); } @@ -278,16 +278,16 @@ allow_ipv4_allowed(void) netmask = "192.168.2.0/24"; addr = "192.168.2.1"; - result = spdk_iscsi_ipv4_netmask_allow_addr(netmask, addr); + result = iscsi_ipv4_netmask_allow_addr(netmask, addr); CU_ASSERT(result == true); - result = spdk_iscsi_netmask_allow_addr(netmask, addr); + result = iscsi_netmask_allow_addr(netmask, addr); CU_ASSERT(result == true); /* Netmask prefix == 32 (all bits must match) */ netmask = "192.168.2.1/32"; addr = "192.168.2.1"; - result = spdk_iscsi_ipv4_netmask_allow_addr(netmask, addr); + result = iscsi_ipv4_netmask_allow_addr(netmask, addr); CU_ASSERT(result == true); } @@ -301,16 +301,16 @@ allow_ipv4_denied(void) netmask = "192.168.2.0"; addr = "192.168.2.1"; - result = spdk_iscsi_ipv4_netmask_allow_addr(netmask, addr); + result = iscsi_ipv4_netmask_allow_addr(netmask, addr); CU_ASSERT(result == false); - result = spdk_iscsi_netmask_allow_addr(netmask, addr); + result = iscsi_netmask_allow_addr(netmask, addr); CU_ASSERT(result == false); /* Netmask prefix == 32 (all bits must match) */ netmask = "192.168.2.1/32"; addr = "192.168.2.2"; - result = spdk_iscsi_ipv4_netmask_allow_addr(netmask, addr); + result = iscsi_ipv4_netmask_allow_addr(netmask, addr); CU_ASSERT(result == false); } @@ -324,19 +324,19 @@ allow_ipv4_invalid(void) /* Netmask prefix bits > 32 */ netmask = "192.168.2.0/33"; addr = "192.168.2.1"; - result = spdk_iscsi_ipv4_netmask_allow_addr(netmask, addr); + result = iscsi_ipv4_netmask_allow_addr(netmask, addr); CU_ASSERT(result == false); /* Netmask prefix bits == 0 */ netmask = "192.168.2.0/0"; addr = "192.168.2.1"; - result = spdk_iscsi_ipv4_netmask_allow_addr(netmask, addr); + result = iscsi_ipv4_netmask_allow_addr(netmask, addr); CU_ASSERT(result == false); /* Netmask prefix bits < 0 */ netmask = "192.168.2.0/-1"; addr = "192.168.2.1"; - result = spdk_iscsi_ipv4_netmask_allow_addr(netmask, addr); + result = iscsi_ipv4_netmask_allow_addr(netmask, addr); CU_ASSERT(result == false); } @@ -382,8 +382,8 @@ node_access_allowed(void) snprintf(scsi_dev.name, sizeof(scsi_dev.name), "iqn.2017-10.spdk.io:0001"); tgtnode.dev = &scsi_dev; - pg_map = spdk_iscsi_tgt_node_add_pg_map(&tgtnode, &pg); - spdk_iscsi_pg_map_add_ig_map(pg_map, &ig); + pg_map = iscsi_tgt_node_add_pg_map(&tgtnode, &pg); + iscsi_pg_map_add_ig_map(pg_map, &ig); /* portal initialization */ memset(&portal, 0, sizeof(struct spdk_iscsi_portal)); @@ -401,8 +401,8 @@ node_access_allowed(void) result = spdk_iscsi_tgt_node_access(&conn, &tgtnode, iqn, addr); CU_ASSERT(result == true); - spdk_iscsi_pg_map_delete_ig_map(pg_map, &ig); - spdk_iscsi_tgt_node_delete_pg_map(&tgtnode, &pg); + iscsi_pg_map_delete_ig_map(pg_map, &ig); + iscsi_tgt_node_delete_pg_map(&tgtnode, &pg); } static void @@ -444,8 +444,8 @@ node_access_denied_by_empty_netmask(void) snprintf(scsi_dev.name, sizeof(scsi_dev.name), "iqn.2017-10.spdk.io:0001"); tgtnode.dev = &scsi_dev; - pg_map = spdk_iscsi_tgt_node_add_pg_map(&tgtnode, &pg); - spdk_iscsi_pg_map_add_ig_map(pg_map, &ig); + pg_map = iscsi_tgt_node_add_pg_map(&tgtnode, &pg); + iscsi_pg_map_add_ig_map(pg_map, &ig); /* portal initialization */ memset(&portal, 0, sizeof(struct spdk_iscsi_portal)); @@ -463,8 +463,8 @@ node_access_denied_by_empty_netmask(void) result = spdk_iscsi_tgt_node_access(&conn, &tgtnode, iqn, addr); CU_ASSERT(result == false); - spdk_iscsi_pg_map_delete_ig_map(pg_map, &ig); - spdk_iscsi_tgt_node_delete_pg_map(&tgtnode, &pg); + iscsi_pg_map_delete_ig_map(pg_map, &ig); + iscsi_tgt_node_delete_pg_map(&tgtnode, &pg); } #define IQN1 "iqn.2017-11.spdk.io:0001" @@ -528,9 +528,9 @@ node_access_multi_initiator_groups_cases(void) memset(&pg, 0, sizeof(struct spdk_iscsi_portal_grp)); pg.tag = 1; - pg_map = spdk_iscsi_tgt_node_add_pg_map(&tgtnode, &pg); - spdk_iscsi_pg_map_add_ig_map(pg_map, &ig1); - spdk_iscsi_pg_map_add_ig_map(pg_map, &ig2); + pg_map = iscsi_tgt_node_add_pg_map(&tgtnode, &pg); + iscsi_pg_map_add_ig_map(pg_map, &ig1); + iscsi_pg_map_add_ig_map(pg_map, &ig2); /* portal initialization */ memset(&portal, 0, sizeof(struct spdk_iscsi_portal)); @@ -722,9 +722,9 @@ node_access_multi_initiator_groups_cases(void) result = spdk_iscsi_tgt_node_access(&conn, &tgtnode, iqn, addr); CU_ASSERT(result == false); - spdk_iscsi_pg_map_delete_ig_map(pg_map, &ig1); - spdk_iscsi_pg_map_delete_ig_map(pg_map, &ig2); - spdk_iscsi_tgt_node_delete_pg_map(&tgtnode, &pg); + iscsi_pg_map_delete_ig_map(pg_map, &ig1); + iscsi_pg_map_delete_ig_map(pg_map, &ig2); + iscsi_tgt_node_delete_pg_map(&tgtnode, &pg); } static void @@ -761,28 +761,28 @@ allow_iscsi_name_multi_maps_case(void) memset(&pg2, 0, sizeof(struct spdk_iscsi_portal_grp)); pg2.tag = 1; - pg_map1 = spdk_iscsi_tgt_node_add_pg_map(&tgtnode, &pg1); - pg_map2 = spdk_iscsi_tgt_node_add_pg_map(&tgtnode, &pg2); - spdk_iscsi_pg_map_add_ig_map(pg_map1, &ig); - spdk_iscsi_pg_map_add_ig_map(pg_map2, &ig); + pg_map1 = iscsi_tgt_node_add_pg_map(&tgtnode, &pg1); + pg_map2 = iscsi_tgt_node_add_pg_map(&tgtnode, &pg2); + iscsi_pg_map_add_ig_map(pg_map1, &ig); + iscsi_pg_map_add_ig_map(pg_map2, &ig); /* test for IG1 <-> PG1, PG2 case */ iqn = IQN1; iname.name = IQN1; - result = spdk_iscsi_tgt_node_allow_iscsi_name(&tgtnode, iqn); + result = iscsi_tgt_node_allow_iscsi_name(&tgtnode, iqn); CU_ASSERT(result == true); iname.name = IQN2; - result = spdk_iscsi_tgt_node_allow_iscsi_name(&tgtnode, iqn); + result = iscsi_tgt_node_allow_iscsi_name(&tgtnode, iqn); CU_ASSERT(result == false); - spdk_iscsi_pg_map_delete_ig_map(pg_map1, &ig); - spdk_iscsi_pg_map_delete_ig_map(pg_map2, &ig); - spdk_iscsi_tgt_node_delete_pg_map(&tgtnode, &pg1); - spdk_iscsi_tgt_node_delete_pg_map(&tgtnode, &pg2); + iscsi_pg_map_delete_ig_map(pg_map1, &ig); + iscsi_pg_map_delete_ig_map(pg_map2, &ig); + iscsi_tgt_node_delete_pg_map(&tgtnode, &pg1); + iscsi_tgt_node_delete_pg_map(&tgtnode, &pg2); } /*