diff --git a/include/spdk/scsi.h b/include/spdk/scsi.h index ded624407..5172d9e67 100644 --- a/include/spdk/scsi.h +++ b/include/spdk/scsi.h @@ -206,7 +206,6 @@ void spdk_scsi_task_construct(struct spdk_scsi_task *task, spdk_scsi_task_free free_fn); void spdk_scsi_task_put(struct spdk_scsi_task *task); -void spdk_scsi_task_free_data(struct spdk_scsi_task *task); /** * Set internal buffer to given one. Caller is owner of that buffer. * @@ -216,20 +215,6 @@ void spdk_scsi_task_free_data(struct spdk_scsi_task *task); */ void spdk_scsi_task_set_data(struct spdk_scsi_task *task, void *data, uint32_t len); -/** - * Allocate internal buffer of requested size. Caller is not owner of - * returned buffer and must not free it. Caller is permitted to call - * spdk_scsi_task_free_data() to free internal buffer if it is not required - * anymore, but must assert that task is done and not used by library. - * - * Allocated buffer is stored in iov field of task object. - * - * \param task Task struct - * \param alloc_len Size of allocated buffer. - * \return Pointer to buffer or NULL on error. - */ -void *spdk_scsi_task_alloc_data(struct spdk_scsi_task *task, uint32_t alloc_len); - int spdk_scsi_task_scatter_data(struct spdk_scsi_task *task, const void *src, size_t len); void *spdk_scsi_task_gather_data(struct spdk_scsi_task *task, int *len); void spdk_scsi_task_build_sense_data(struct spdk_scsi_task *task, int sk, int asc, diff --git a/lib/scsi/task.c b/lib/scsi/task.c index 72546c2ec..b192da6ed 100644 --- a/lib/scsi/task.c +++ b/lib/scsi/task.c @@ -37,6 +37,9 @@ #include "spdk/env.h" #include "spdk/util.h" +static void +spdk_scsi_task_free_data(struct spdk_scsi_task *task); + void spdk_scsi_task_put(struct spdk_scsi_task *task) { @@ -81,7 +84,7 @@ spdk_scsi_task_construct(struct spdk_scsi_task *task, task->iovcnt = 1; } -void +static void spdk_scsi_task_free_data(struct spdk_scsi_task *task) { if (task->alloc_len != 0) { @@ -93,7 +96,7 @@ spdk_scsi_task_free_data(struct spdk_scsi_task *task) task->iov.iov_len = 0; } -void * +static void * spdk_scsi_task_alloc_data(struct spdk_scsi_task *task, uint32_t alloc_len) { assert(task->alloc_len == 0); diff --git a/test/unit/lib/scsi/lun.c/lun_ut.c b/test/unit/lib/scsi/lun.c/lun_ut.c index 61b2a62e5..3e2cd0168 100644 --- a/test/unit/lib/scsi/lun.c/lun_ut.c +++ b/test/unit/lib/scsi/lun.c/lun_ut.c @@ -86,8 +86,6 @@ spdk_lun_ut_cpl_task(struct spdk_scsi_task *task) static void spdk_lun_ut_free_task(struct spdk_scsi_task *task) { - /* This should never get called since we never call spdk_scsi_task_put(). */ - SPDK_CU_ASSERT_FATAL(0); } static void @@ -442,7 +440,7 @@ lun_append_task_null_lun_task_cdb_spc_inquiry(void) CU_ASSERT_EQUAL(task.status, SPDK_SCSI_STATUS_GOOD); - spdk_scsi_task_free_data(&task); + spdk_scsi_task_put(&task); /* spdk_scsi_task_process_null_lun() does not call cpl_fn */ CU_ASSERT_EQUAL(g_task_count, 1); @@ -467,6 +465,8 @@ lun_append_task_null_lun_alloc_len_lt_4096(void) CU_ASSERT_EQUAL(task.status, SPDK_SCSI_STATUS_GOOD); + spdk_scsi_task_put(&task); + /* spdk_scsi_task_process_null_lun() does not call cpl_fn */ CU_ASSERT_EQUAL(g_task_count, 1); g_task_count = 0;