From d09eff6a0f4ba5ddd3619419f26f61d86a390d5c Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Wed, 10 Apr 2019 17:01:43 +0900 Subject: [PATCH] lib/iscsi: Make two helper functions from private to public in iSCSI library These change will be used in the next patch. Change-Id: Ifdb4ccf20049b46e850122a4021cbbe7441e1270 Signed-off-by: Shuhei Matsumoto Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450736 Tested-by: SPDK CI Jenkins Reviewed-by: Changpeng Liu Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- lib/iscsi/conn.c | 12 ++++++------ lib/iscsi/conn.h | 2 ++ test/unit/lib/iscsi/common.c | 4 ++++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/iscsi/conn.c b/lib/iscsi/conn.c index 02d74fdf5..f1430326b 100644 --- a/lib/iscsi/conn.c +++ b/lib/iscsi/conn.c @@ -579,8 +579,8 @@ spdk_iscsi_conn_destruct(struct spdk_iscsi_conn *conn) } } -static int -iscsi_get_active_conns(struct spdk_iscsi_tgt_node *target) +int +spdk_iscsi_get_active_conns(struct spdk_iscsi_tgt_node *target) { struct spdk_iscsi_conn *conn; int num = 0; @@ -626,7 +626,7 @@ iscsi_conn_check_shutdown(void *arg) { struct spdk_event *event; - if (iscsi_get_active_conns(NULL) != 0) { + if (spdk_iscsi_get_active_conns(NULL) != 0) { return 1; } @@ -770,8 +770,8 @@ iscsi_conn_stop(struct spdk_iscsi_conn *conn) iscsi_poll_group_remove_conn(conn); } -static void -iscsi_conns_start_exit(struct spdk_iscsi_tgt_node *target) +void +spdk_iscsi_conns_start_exit(struct spdk_iscsi_tgt_node *target) { struct spdk_iscsi_conn *conn; int i; @@ -802,7 +802,7 @@ iscsi_conns_start_exit(struct spdk_iscsi_tgt_node *target) void spdk_shutdown_iscsi_conns(void) { - iscsi_conns_start_exit(NULL); + spdk_iscsi_conns_start_exit(NULL); g_shutdown_timer = spdk_poller_register(iscsi_conn_check_shutdown, NULL, 1000); } diff --git a/lib/iscsi/conn.h b/lib/iscsi/conn.h index 8e7ec6dfc..27a5a7ad5 100644 --- a/lib/iscsi/conn.h +++ b/lib/iscsi/conn.h @@ -172,6 +172,8 @@ extern struct spdk_iscsi_conn *g_conns_array; int spdk_initialize_iscsi_conns(void); void spdk_shutdown_iscsi_conns(void); +void spdk_iscsi_conns_start_exit(struct spdk_iscsi_tgt_node *target); +int spdk_iscsi_get_active_conns(struct spdk_iscsi_tgt_node *target); int spdk_iscsi_conn_construct(struct spdk_iscsi_portal *portal, struct spdk_sock *sock); void spdk_iscsi_conn_destruct(struct spdk_iscsi_conn *conn); diff --git a/test/unit/lib/iscsi/common.c b/test/unit/lib/iscsi/common.c index 758dbec20..8b3f81d9b 100644 --- a/test/unit/lib/iscsi/common.c +++ b/test/unit/lib/iscsi/common.c @@ -175,6 +175,10 @@ DEFINE_STUB(spdk_scsi_dev_delete_port, int, DEFINE_STUB_V(spdk_shutdown_iscsi_conns, (void)); +DEFINE_STUB_V(spdk_iscsi_conns_start_exit, (struct spdk_iscsi_tgt_node *target)); + +DEFINE_STUB(spdk_iscsi_get_active_conns, int, (struct spdk_iscsi_tgt_node *target), 0); + void spdk_iscsi_task_cpl(struct spdk_scsi_task *scsi_task) {