iscsi: Remove the prefix spdk_ from names of private functions

iSCSI library had used the prefix spdk_ for most functions regardless
of private or public. Using the prefix spdk_ only for public functions
will be helpful to distinguish private and public functions, and
will be helpful to investigate issues or do further improvement.

Besides in iscsi.c static variable spdk_arc4random_initialized had
the prefix spdk_, and change it to g_arc4random_initialized according
to the SPDK's good practice.

iSCSI library still have some issues but is more stable than before
and now will be the good time to adjust the naming rule to other
libraries.

This patch doesn't change any behavior.

Change-Id: Ia0b8585a7ce6662cabc0e6f57b7ccb8a40342297
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/449396
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Shuhei Matsumoto 2019-03-28 06:53:37 +09:00 committed by Changpeng Liu
parent b7039655ce
commit 893e02a54f
14 changed files with 954 additions and 966 deletions

View File

@ -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

View File

@ -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;

View File

@ -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);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -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);
}

View File

@ -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<NUL>"
*/
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,
&params_dst,
param);
rc = iscsi_negotiate_param_init(conn,
&cur_param,
&params_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,

View File

@ -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);
}
}

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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) {

View File

@ -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));

View File

@ -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, &param, valid_list_buf, in_val_buf, NULL); \
new_val = iscsi_negotiate_param_list(&add_param_value, &param, 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); \

View File

@ -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);

View File

@ -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);
}
/*