lib/scsi: Remove spdk_ prefix from internal APIs

Remove spdk_ prefix from the name of internal APIs.

Add single underscore as the prefix of the function name to the
private functions if we see any conflict as a result of this change.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: If0eabffbdb750db02866c1aa2b29b0c89fab1040
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1824
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 2020-04-14 02:23:48 +09:00 committed by Tomasz Zawadzki
parent 6ee4bdab18
commit 18dec40111
12 changed files with 199 additions and 201 deletions

View File

@ -37,7 +37,7 @@
static struct spdk_scsi_dev g_devs[SPDK_SCSI_MAX_DEVS];
struct spdk_scsi_dev *
spdk_scsi_dev_get_list(void)
scsi_dev_get_list(void)
{
return g_devs;
}
@ -110,7 +110,7 @@ spdk_scsi_dev_destruct(struct spdk_scsi_dev *dev,
* LUN will remove itself from this dev when all outstanding IO
* is done. When no more LUNs, dev will be deleted.
*/
spdk_scsi_lun_destruct(dev->lun[i]);
scsi_lun_destruct(dev->lun[i]);
lun_cnt++;
}
@ -158,7 +158,7 @@ spdk_scsi_dev_add_lun(struct spdk_scsi_dev *dev, const char *bdev_name, int lun_
}
}
lun = spdk_scsi_lun_construct(bdev, hotremove_cb, hotremove_ctx);
lun = scsi_lun_construct(bdev, hotremove_cb, hotremove_ctx);
if (lun == NULL) {
return -1;
}
@ -262,7 +262,7 @@ spdk_scsi_dev_queue_mgmt_task(struct spdk_scsi_dev *dev,
{
assert(task != NULL);
spdk_scsi_lun_execute_mgmt_task(task->lun, task);
scsi_lun_execute_mgmt_task(task->lun, task);
}
void
@ -271,7 +271,7 @@ spdk_scsi_dev_queue_task(struct spdk_scsi_dev *dev,
{
assert(task != NULL);
spdk_scsi_lun_execute_task(task->lun, task);
scsi_lun_execute_task(task->lun, task);
}
static struct spdk_scsi_port *
@ -311,7 +311,7 @@ spdk_scsi_dev_add_port(struct spdk_scsi_dev *dev, uint64_t id, const char *name)
return -1;
}
rc = spdk_scsi_port_construct(port, id, dev->num_ports, name);
rc = scsi_port_construct(port, id, dev->num_ports, name);
if (rc != 0) {
return rc;
}
@ -331,7 +331,7 @@ spdk_scsi_dev_delete_port(struct spdk_scsi_dev *dev, uint64_t id)
return -1;
}
spdk_scsi_port_destruct(port);
scsi_port_destruct(port);
dev->num_ports--;
@ -365,7 +365,7 @@ spdk_scsi_dev_free_io_channels(struct spdk_scsi_dev *dev)
if (dev->lun[i] == NULL) {
continue;
}
_spdk_scsi_lun_free_io_channel(dev->lun[i]);
scsi_lun_free_io_channel(dev->lun[i]);
}
}
@ -378,7 +378,7 @@ spdk_scsi_dev_allocate_io_channels(struct spdk_scsi_dev *dev)
if (dev->lun[i] == NULL) {
continue;
}
rc = _spdk_scsi_lun_allocate_io_channel(dev->lun[i]);
rc = scsi_lun_allocate_io_channel(dev->lun[i]);
if (rc < 0) {
spdk_scsi_dev_free_io_channels(dev);
return -1;
@ -426,8 +426,8 @@ spdk_scsi_dev_has_pending_tasks(const struct spdk_scsi_dev *dev,
for (i = 0; i < SPDK_SCSI_DEV_MAX_LUN; ++i) {
if (dev->lun[i] &&
(spdk_scsi_lun_has_pending_tasks(dev->lun[i], initiator_port) ||
spdk_scsi_lun_has_pending_mgmt_tasks(dev->lun[i], initiator_port))) {
(scsi_lun_has_pending_tasks(dev->lun[i], initiator_port) ||
scsi_lun_has_pending_mgmt_tasks(dev->lun[i], initiator_port))) {
return true;
}
}

View File

@ -41,10 +41,10 @@
#include "spdk/likely.h"
static void scsi_lun_execute_tasks(struct spdk_scsi_lun *lun);
static void scsi_lun_execute_mgmt_task(struct spdk_scsi_lun *lun);
static void _scsi_lun_execute_mgmt_task(struct spdk_scsi_lun *lun);
void
spdk_scsi_lun_complete_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task)
scsi_lun_complete_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task)
{
if (lun) {
TAILQ_REMOVE(&lun->tasks, task, scsi_link);
@ -61,11 +61,11 @@ scsi_lun_complete_mgmt_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *ta
task->cpl_fn(task);
/* Try to execute the first pending mgmt task if it exists. */
scsi_lun_execute_mgmt_task(lun);
_scsi_lun_execute_mgmt_task(lun);
}
static bool
scsi_lun_has_pending_mgmt_tasks(const struct spdk_scsi_lun *lun)
_scsi_lun_has_pending_mgmt_tasks(const struct spdk_scsi_lun *lun)
{
return !TAILQ_EMPTY(&lun->pending_mgmt_tasks);
}
@ -77,7 +77,7 @@ scsi_lun_has_outstanding_mgmt_tasks(const struct spdk_scsi_lun *lun)
}
static bool
scsi_lun_has_pending_tasks(const struct spdk_scsi_lun *lun)
_scsi_lun_has_pending_tasks(const struct spdk_scsi_lun *lun)
{
return !TAILQ_EMPTY(&lun->pending_tasks);
}
@ -105,7 +105,7 @@ scsi_lun_reset_check_outstanding_tasks(void *arg)
}
void
spdk_scsi_lun_complete_reset_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task)
scsi_lun_complete_reset_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task)
{
if (task->status == SPDK_SCSI_STATUS_GOOD) {
if (scsi_lun_has_outstanding_tasks(lun)) {
@ -127,7 +127,7 @@ scsi_lun_append_mgmt_task(struct spdk_scsi_lun *lun,
}
static void
scsi_lun_execute_mgmt_task(struct spdk_scsi_lun *lun)
_scsi_lun_execute_mgmt_task(struct spdk_scsi_lun *lun)
{
struct spdk_scsi_task *task;
@ -163,7 +163,7 @@ scsi_lun_execute_mgmt_task(struct spdk_scsi_lun *lun)
break;
case SPDK_SCSI_TASK_FUNC_LUN_RESET:
spdk_bdev_scsi_reset(task);
bdev_scsi_reset(task);
return;
default:
@ -181,11 +181,11 @@ scsi_lun_execute_mgmt_task(struct spdk_scsi_lun *lun)
}
void
spdk_scsi_lun_execute_mgmt_task(struct spdk_scsi_lun *lun,
struct spdk_scsi_task *task)
scsi_lun_execute_mgmt_task(struct spdk_scsi_lun *lun,
struct spdk_scsi_task *task)
{
scsi_lun_append_mgmt_task(lun, task);
scsi_lun_execute_mgmt_task(lun);
_scsi_lun_execute_mgmt_task(lun);
}
static void
@ -198,12 +198,12 @@ _scsi_lun_execute_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task)
TAILQ_INSERT_TAIL(&lun->tasks, task, scsi_link);
if (!lun->removed) {
/* Check the command is allowed or not when reservation is exist */
rc = spdk_scsi_pr_check(task);
rc = scsi_pr_check(task);
if (spdk_unlikely(rc < 0)) {
/* Reservation Conflict */
rc = SPDK_SCSI_TASK_COMPLETE;
} else {
rc = spdk_bdev_scsi_execute(task);
rc = bdev_scsi_execute(task);
}
} else {
spdk_scsi_task_process_abort(task);
@ -215,7 +215,7 @@ _scsi_lun_execute_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task)
break;
case SPDK_SCSI_TASK_COMPLETE:
spdk_scsi_lun_complete_task(lun, task);
scsi_lun_complete_task(lun, task);
break;
default:
@ -241,14 +241,14 @@ scsi_lun_execute_tasks(struct spdk_scsi_lun *lun)
}
void
spdk_scsi_lun_execute_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task)
scsi_lun_execute_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task)
{
if (spdk_unlikely(scsi_lun_has_pending_mgmt_tasks(lun))) {
if (spdk_unlikely(_scsi_lun_has_pending_mgmt_tasks(lun))) {
/* Add the IO task to pending list and wait for completion of
* existing mgmt tasks.
*/
scsi_lun_append_task(lun, task);
} else if (spdk_unlikely(scsi_lun_has_pending_tasks(lun))) {
} else if (spdk_unlikely(_scsi_lun_has_pending_tasks(lun))) {
/* If there is any pending IO task, append the IO task to the
* tail of the pending list, and then execute all pending IO tasks
* from the head to submit IO tasks in order.
@ -398,7 +398,7 @@ scsi_lun_hot_remove(void *remove_ctx)
* \return NULL if bdev == NULL
* \return pointer to the new spdk_scsi_lun object otherwise
*/
struct spdk_scsi_lun *spdk_scsi_lun_construct(struct spdk_bdev *bdev,
struct spdk_scsi_lun *scsi_lun_construct(struct spdk_bdev *bdev,
void (*hotremove_cb)(const struct spdk_scsi_lun *, void *),
void *hotremove_ctx)
{
@ -442,7 +442,7 @@ struct spdk_scsi_lun *spdk_scsi_lun_construct(struct spdk_bdev *bdev,
}
void
spdk_scsi_lun_destruct(struct spdk_scsi_lun *lun)
scsi_lun_destruct(struct spdk_scsi_lun *lun)
{
scsi_lun_hot_remove(lun);
}
@ -481,7 +481,7 @@ spdk_scsi_lun_close(struct spdk_scsi_lun_desc *desc)
}
int
_spdk_scsi_lun_allocate_io_channel(struct spdk_scsi_lun *lun)
scsi_lun_allocate_io_channel(struct spdk_scsi_lun *lun)
{
if (lun->io_channel != NULL) {
if (spdk_get_thread() == spdk_io_channel_get_thread(lun->io_channel)) {
@ -502,7 +502,7 @@ _spdk_scsi_lun_allocate_io_channel(struct spdk_scsi_lun *lun)
}
void
_spdk_scsi_lun_free_io_channel(struct spdk_scsi_lun *lun)
scsi_lun_free_io_channel(struct spdk_scsi_lun *lun)
{
if (lun->io_channel == NULL) {
return;
@ -525,7 +525,7 @@ spdk_scsi_lun_allocate_io_channel(struct spdk_scsi_lun_desc *desc)
{
struct spdk_scsi_lun *lun = desc->lun;
return _spdk_scsi_lun_allocate_io_channel(lun);
return scsi_lun_allocate_io_channel(lun);
}
void
@ -533,7 +533,7 @@ spdk_scsi_lun_free_io_channel(struct spdk_scsi_lun_desc *desc)
{
struct spdk_scsi_lun *lun = desc->lun;
_spdk_scsi_lun_free_io_channel(lun);
scsi_lun_free_io_channel(lun);
}
int
@ -555,13 +555,13 @@ spdk_scsi_lun_get_dev(const struct spdk_scsi_lun *lun)
}
bool
spdk_scsi_lun_has_pending_mgmt_tasks(const struct spdk_scsi_lun *lun,
const struct spdk_scsi_port *initiator_port)
scsi_lun_has_pending_mgmt_tasks(const struct spdk_scsi_lun *lun,
const struct spdk_scsi_port *initiator_port)
{
struct spdk_scsi_task *task;
if (initiator_port == NULL) {
return scsi_lun_has_pending_mgmt_tasks(lun) ||
return _scsi_lun_has_pending_mgmt_tasks(lun) ||
scsi_lun_has_outstanding_mgmt_tasks(lun);
}
@ -581,13 +581,13 @@ spdk_scsi_lun_has_pending_mgmt_tasks(const struct spdk_scsi_lun *lun,
}
/* This check includes both pending and submitted (outstanding) tasks. */
bool
spdk_scsi_lun_has_pending_tasks(const struct spdk_scsi_lun *lun,
const struct spdk_scsi_port *initiator_port)
scsi_lun_has_pending_tasks(const struct spdk_scsi_lun *lun,
const struct spdk_scsi_port *initiator_port)
{
struct spdk_scsi_task *task;
if (initiator_port == NULL) {
return scsi_lun_has_pending_tasks(lun) ||
return _scsi_lun_has_pending_tasks(lun) ||
scsi_lun_has_outstanding_tasks(lun);
}
@ -616,5 +616,5 @@ bool
spdk_scsi_lun_get_dif_ctx(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task,
struct spdk_dif_ctx *dif_ctx)
{
return spdk_scsi_bdev_get_dif_ctx(lun->bdev, task, dif_ctx);
return bdev_scsi_get_dif_ctx(lun->bdev, task, dif_ctx);
}

View File

@ -47,7 +47,7 @@ spdk_scsi_port_create(uint64_t id, uint16_t index, const char *name)
return NULL;
}
if (spdk_scsi_port_construct(port, id, index, name) != 0) {
if (scsi_port_construct(port, id, index, name) != 0) {
spdk_scsi_port_free(&port);
return NULL;
}
@ -70,8 +70,8 @@ spdk_scsi_port_free(struct spdk_scsi_port **pport)
}
int
spdk_scsi_port_construct(struct spdk_scsi_port *port, uint64_t id, uint16_t index,
const char *name)
scsi_port_construct(struct spdk_scsi_port *port, uint64_t id, uint16_t index,
const char *name)
{
if (strlen(name) >= sizeof(port->name)) {
SPDK_ERRLOG("port name too long\n");
@ -86,7 +86,7 @@ spdk_scsi_port_construct(struct spdk_scsi_port *port, uint64_t id, uint16_t inde
}
void
spdk_scsi_port_destruct(struct spdk_scsi_port *port)
scsi_port_destruct(struct spdk_scsi_port *port)
{
memset(port, 0, sizeof(struct spdk_scsi_port));
}

View File

@ -34,14 +34,14 @@
#include "scsi_internal.h"
struct spdk_scsi_globals g_spdk_scsi;
struct spdk_scsi_globals g_scsi;
int
spdk_scsi_init(void)
{
int rc;
rc = pthread_mutex_init(&g_spdk_scsi.mutex, NULL);
rc = pthread_mutex_init(&g_scsi.mutex, NULL);
if (rc != 0) {
SPDK_ERRLOG("mutex_init() failed\n");
return -1;
@ -53,7 +53,7 @@ spdk_scsi_init(void)
void
spdk_scsi_fini(void)
{
pthread_mutex_destroy(&g_spdk_scsi.mutex);
pthread_mutex_destroy(&g_scsi.mutex);
}
SPDK_TRACE_REGISTER_FN(scsi_trace, "scsi", TRACE_GROUP_SCSI)

View File

@ -1171,7 +1171,7 @@ bdev_scsi_task_complete_cmd(struct spdk_bdev_io *bdev_io, bool success,
spdk_bdev_free_io(bdev_io);
spdk_scsi_task_set_status(task, sc, sk, asc, ascq);
spdk_scsi_lun_complete_task(task->lun, task);
scsi_lun_complete_task(task->lun, task);
}
static void
@ -1186,7 +1186,7 @@ bdev_scsi_read_task_complete_cmd(struct spdk_bdev_io *bdev_io, bool success,
spdk_bdev_io_get_scsi_status(bdev_io, &sc, &sk, &asc, &ascq);
spdk_scsi_task_set_status(task, sc, sk, asc, ascq);
spdk_scsi_lun_complete_task(task->lun, task);
scsi_lun_complete_task(task->lun, task);
}
static void
@ -1201,7 +1201,7 @@ bdev_scsi_task_complete_reset(struct spdk_bdev_io *bdev_io, bool success,
task->response = SPDK_SCSI_TASK_MGMT_RESP_SUCCESS;
}
spdk_scsi_lun_complete_reset_task(task->lun, task);
scsi_lun_complete_reset_task(task->lun, task);
}
static void
@ -1405,7 +1405,7 @@ bdev_scsi_task_complete_unmap_cmd(struct spdk_bdev_io *bdev_io, bool success,
}
if (ctx->count == 0) {
spdk_scsi_lun_complete_task(task->lun, task);
scsi_lun_complete_task(task->lun, task);
free(ctx);
}
}
@ -1915,7 +1915,7 @@ bdev_scsi_process_primary(struct spdk_scsi_task *task)
break;
}
rc = spdk_scsi_pr_out(task, cdb, data, data_len);
rc = scsi_pr_out(task, cdb, data, data_len);
if (rc < 0) {
break;
}
@ -1928,7 +1928,7 @@ bdev_scsi_process_primary(struct spdk_scsi_task *task)
data_len = alloc_len;
data = calloc(1, data_len);
assert(data != NULL);
rc = spdk_scsi_pr_in(task, cdb, data, data_len);
rc = scsi_pr_in(task, cdb, data, data_len);
break;
default:
@ -1954,7 +1954,7 @@ bdev_scsi_process_primary(struct spdk_scsi_task *task)
}
int
spdk_bdev_scsi_execute(struct spdk_scsi_task *task)
bdev_scsi_execute(struct spdk_scsi_task *task)
{
int rc;
@ -1978,11 +1978,11 @@ bdev_scsi_reset_resubmit(void *arg)
{
struct spdk_scsi_task *task = arg;
spdk_bdev_scsi_reset(task);
bdev_scsi_reset(task);
}
void
spdk_bdev_scsi_reset(struct spdk_scsi_task *task)
bdev_scsi_reset(struct spdk_scsi_task *task)
{
struct spdk_scsi_lun *lun = task->lun;
int rc;
@ -1995,8 +1995,8 @@ spdk_bdev_scsi_reset(struct spdk_scsi_task *task)
}
bool
spdk_scsi_bdev_get_dif_ctx(struct spdk_bdev *bdev, struct spdk_scsi_task *task,
struct spdk_dif_ctx *dif_ctx)
bdev_scsi_get_dif_ctx(struct spdk_bdev *bdev, struct spdk_scsi_task *task,
struct spdk_dif_ctx *dif_ctx)
{
uint32_t ref_tag = 0, dif_check_flags = 0, data_offset;
uint8_t *cdb;

View File

@ -164,42 +164,42 @@ struct spdk_scsi_lun {
struct spdk_poller *reset_poller;
};
struct spdk_scsi_lun *spdk_scsi_lun_construct(struct spdk_bdev *bdev,
struct spdk_scsi_lun *scsi_lun_construct(struct spdk_bdev *bdev,
void (*hotremove_cb)(const struct spdk_scsi_lun *, void *),
void *hotremove_ctx);
void spdk_scsi_lun_destruct(struct spdk_scsi_lun *lun);
void scsi_lun_destruct(struct spdk_scsi_lun *lun);
void spdk_scsi_lun_execute_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task);
void spdk_scsi_lun_execute_mgmt_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task);
bool spdk_scsi_lun_has_pending_mgmt_tasks(const struct spdk_scsi_lun *lun,
const struct spdk_scsi_port *initiator_port);
void spdk_scsi_lun_complete_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task);
void spdk_scsi_lun_complete_reset_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task);
bool spdk_scsi_lun_has_pending_tasks(const struct spdk_scsi_lun *lun,
void scsi_lun_execute_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task);
void scsi_lun_execute_mgmt_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task);
bool scsi_lun_has_pending_mgmt_tasks(const struct spdk_scsi_lun *lun,
const struct spdk_scsi_port *initiator_port);
int _spdk_scsi_lun_allocate_io_channel(struct spdk_scsi_lun *lun);
void _spdk_scsi_lun_free_io_channel(struct spdk_scsi_lun *lun);
void scsi_lun_complete_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task);
void scsi_lun_complete_reset_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task);
bool scsi_lun_has_pending_tasks(const struct spdk_scsi_lun *lun,
const struct spdk_scsi_port *initiator_port);
int scsi_lun_allocate_io_channel(struct spdk_scsi_lun *lun);
void scsi_lun_free_io_channel(struct spdk_scsi_lun *lun);
struct spdk_scsi_dev *spdk_scsi_dev_get_list(void);
struct spdk_scsi_dev *scsi_dev_get_list(void);
int spdk_scsi_port_construct(struct spdk_scsi_port *port, uint64_t id,
uint16_t index, const char *name);
void spdk_scsi_port_destruct(struct spdk_scsi_port *port);
int scsi_port_construct(struct spdk_scsi_port *port, uint64_t id,
uint16_t index, const char *name);
void scsi_port_destruct(struct spdk_scsi_port *port);
int spdk_bdev_scsi_execute(struct spdk_scsi_task *task);
void spdk_bdev_scsi_reset(struct spdk_scsi_task *task);
int bdev_scsi_execute(struct spdk_scsi_task *task);
void bdev_scsi_reset(struct spdk_scsi_task *task);
bool spdk_scsi_bdev_get_dif_ctx(struct spdk_bdev *bdev, struct spdk_scsi_task *task,
struct spdk_dif_ctx *dif_ctx);
bool bdev_scsi_get_dif_ctx(struct spdk_bdev *bdev, struct spdk_scsi_task *task,
struct spdk_dif_ctx *dif_ctx);
int spdk_scsi_pr_out(struct spdk_scsi_task *task, uint8_t *cdb, uint8_t *data, uint16_t data_len);
int spdk_scsi_pr_in(struct spdk_scsi_task *task, uint8_t *cdb, uint8_t *data, uint16_t data_len);
int spdk_scsi_pr_check(struct spdk_scsi_task *task);
int scsi_pr_out(struct spdk_scsi_task *task, uint8_t *cdb, uint8_t *data, uint16_t data_len);
int scsi_pr_in(struct spdk_scsi_task *task, uint8_t *cdb, uint8_t *data, uint16_t data_len);
int scsi_pr_check(struct spdk_scsi_task *task);
struct spdk_scsi_globals {
pthread_mutex_t mutex;
};
extern struct spdk_scsi_globals g_spdk_scsi;
extern struct spdk_scsi_globals g_scsi;
#endif /* SPDK_SCSI_INTERNAL_H */

View File

@ -507,9 +507,8 @@ conflict:
}
int
spdk_scsi_pr_out(struct spdk_scsi_task *task,
uint8_t *cdb, uint8_t *data,
uint16_t data_len)
scsi_pr_out(struct spdk_scsi_task *task, uint8_t *cdb,
uint8_t *data, uint16_t data_len)
{
int rc = -1;
uint64_t rkey, sa_rkey;
@ -700,9 +699,8 @@ spdk_scsi_pr_in_read_full_status(struct spdk_scsi_task *task,
}
int
spdk_scsi_pr_in(struct spdk_scsi_task *task,
uint8_t *cdb, uint8_t *data,
uint16_t data_len)
scsi_pr_in(struct spdk_scsi_task *task, uint8_t *cdb,
uint8_t *data, uint16_t data_len)
{
enum spdk_scsi_pr_in_action_code action;
int rc = 0;
@ -743,7 +741,7 @@ invalid:
}
int
spdk_scsi_pr_check(struct spdk_scsi_task *task)
scsi_pr_check(struct spdk_scsi_task *task)
{
struct spdk_scsi_lun *lun = task->lun;
uint8_t *cdb = task->cdb;

View File

@ -42,7 +42,7 @@ spdk_rpc_scsi_get_devices(struct spdk_jsonrpc_request *request,
const struct spdk_json_val *params)
{
struct spdk_json_write_ctx *w;
struct spdk_scsi_dev *devs = spdk_scsi_dev_get_list();
struct spdk_scsi_dev *devs = scsi_dev_get_list();
int i;
if (params != NULL) {

View File

@ -81,7 +81,7 @@ spdk_scsi_task_put(struct spdk_scsi_task *task)
free(task);
}
struct spdk_scsi_lun *spdk_scsi_lun_construct(struct spdk_bdev *bdev,
struct spdk_scsi_lun *scsi_lun_construct(struct spdk_bdev *bdev,
void (*hotremove_cb)(const struct spdk_scsi_lun *, void *),
void *hotremove_ctx)
{
@ -96,7 +96,7 @@ struct spdk_scsi_lun *spdk_scsi_lun_construct(struct spdk_bdev *bdev,
}
void
spdk_scsi_lun_destruct(struct spdk_scsi_lun *lun)
scsi_lun_destruct(struct spdk_scsi_lun *lun)
{
free(lun);
}
@ -115,27 +115,27 @@ spdk_bdev_get_by_name(const char *bdev_name)
return NULL;
}
DEFINE_STUB_V(spdk_scsi_lun_execute_mgmt_task,
DEFINE_STUB_V(scsi_lun_execute_mgmt_task,
(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task));
DEFINE_STUB_V(spdk_scsi_lun_execute_task,
DEFINE_STUB_V(scsi_lun_execute_task,
(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task));
DEFINE_STUB(_spdk_scsi_lun_allocate_io_channel, int,
DEFINE_STUB(scsi_lun_allocate_io_channel, int,
(struct spdk_scsi_lun *lun), 0);
DEFINE_STUB_V(_spdk_scsi_lun_free_io_channel, (struct spdk_scsi_lun *lun));
DEFINE_STUB_V(scsi_lun_free_io_channel, (struct spdk_scsi_lun *lun));
bool
spdk_scsi_lun_has_pending_mgmt_tasks(const struct spdk_scsi_lun *lun,
const struct spdk_scsi_port *initiator_port)
scsi_lun_has_pending_mgmt_tasks(const struct spdk_scsi_lun *lun,
const struct spdk_scsi_port *initiator_port)
{
return (g_initiator_port_with_pending_mgmt_tasks == initiator_port);
}
bool
spdk_scsi_lun_has_pending_tasks(const struct spdk_scsi_lun *lun,
const struct spdk_scsi_port *initiator_port)
scsi_lun_has_pending_tasks(const struct spdk_scsi_lun *lun,
const struct spdk_scsi_port *initiator_port)
{
return (g_initiator_port_with_pending_tasks == initiator_port);
}

View File

@ -106,19 +106,19 @@ DEFINE_STUB_V(spdk_scsi_dev_queue_mgmt_task,
DEFINE_STUB_V(spdk_scsi_dev_delete_lun,
(struct spdk_scsi_dev *dev, struct spdk_scsi_lun *lun));
DEFINE_STUB(spdk_scsi_pr_check, int, (struct spdk_scsi_task *task), 0);
DEFINE_STUB(scsi_pr_check, int, (struct spdk_scsi_task *task), 0);
void
spdk_bdev_scsi_reset(struct spdk_scsi_task *task)
bdev_scsi_reset(struct spdk_scsi_task *task)
{
task->status = SPDK_SCSI_STATUS_GOOD;
task->response = SPDK_SCSI_TASK_MGMT_RESP_SUCCESS;
spdk_scsi_lun_complete_reset_task(task->lun, task);
scsi_lun_complete_reset_task(task->lun, task);
}
int
spdk_bdev_scsi_execute(struct spdk_scsi_task *task)
bdev_scsi_execute(struct spdk_scsi_task *task)
{
if (g_lun_execute_fail) {
return -EINVAL;
@ -143,7 +143,7 @@ static struct spdk_scsi_lun *lun_construct(void)
struct spdk_scsi_lun *lun;
struct spdk_bdev bdev;
lun = spdk_scsi_lun_construct(&bdev, NULL, NULL);
lun = scsi_lun_construct(&bdev, NULL, NULL);
SPDK_CU_ASSERT_FATAL(lun != NULL);
return lun;
@ -155,7 +155,7 @@ lun_destruct(struct spdk_scsi_lun *lun)
/* LUN will defer its removal if there are any unfinished tasks */
SPDK_CU_ASSERT_FATAL(TAILQ_EMPTY(&lun->tasks));
spdk_scsi_lun_destruct(lun);
scsi_lun_destruct(lun);
}
static void
@ -181,12 +181,12 @@ lun_task_mgmt_execute_abort_task_not_supported(void)
task.lun = lun;
task.cdb = cdb;
spdk_scsi_lun_execute_task(lun, &task);
scsi_lun_execute_task(lun, &task);
/* task should now be on the tasks list */
CU_ASSERT(!TAILQ_EMPTY(&lun->tasks));
spdk_scsi_lun_execute_mgmt_task(lun, &mgmt_task);
scsi_lun_execute_mgmt_task(lun, &mgmt_task);
/* task abort is not supported */
CU_ASSERT(mgmt_task.response == SPDK_SCSI_TASK_MGMT_RESP_REJECT_FUNC_NOT_SUPPORTED);
@ -194,7 +194,7 @@ lun_task_mgmt_execute_abort_task_not_supported(void)
/* task is still on the tasks list */
CU_ASSERT_EQUAL(g_task_count, 1);
spdk_scsi_lun_complete_task(lun, &task);
scsi_lun_complete_task(lun, &task);
CU_ASSERT_EQUAL(g_task_count, 0);
lun_destruct(lun);
@ -224,12 +224,12 @@ lun_task_mgmt_execute_abort_task_all_not_supported(void)
task.lun = lun;
task.cdb = cdb;
spdk_scsi_lun_execute_task(lun, &task);
scsi_lun_execute_task(lun, &task);
/* task should now be on the tasks list */
CU_ASSERT(!TAILQ_EMPTY(&lun->tasks));
spdk_scsi_lun_execute_mgmt_task(lun, &mgmt_task);
scsi_lun_execute_mgmt_task(lun, &mgmt_task);
/* task abort is not supported */
CU_ASSERT(mgmt_task.response == SPDK_SCSI_TASK_MGMT_RESP_REJECT_FUNC_NOT_SUPPORTED);
@ -237,7 +237,7 @@ lun_task_mgmt_execute_abort_task_all_not_supported(void)
/* task is still on the tasks list */
CU_ASSERT_EQUAL(g_task_count, 1);
spdk_scsi_lun_complete_task(lun, &task);
scsi_lun_complete_task(lun, &task);
CU_ASSERT_EQUAL(g_task_count, 0);
@ -258,7 +258,7 @@ lun_task_mgmt_execute_lun_reset(void)
mgmt_task.lun = lun;
mgmt_task.function = SPDK_SCSI_TASK_FUNC_LUN_RESET;
spdk_scsi_lun_execute_mgmt_task(lun, &mgmt_task);
scsi_lun_execute_mgmt_task(lun, &mgmt_task);
/* Returns success */
CU_ASSERT_EQUAL(mgmt_task.status, SPDK_SCSI_STATUS_GOOD);
@ -283,7 +283,7 @@ lun_task_mgmt_execute_invalid_case(void)
mgmt_task.function = 5;
/* Pass an invalid value to the switch statement */
spdk_scsi_lun_execute_mgmt_task(lun, &mgmt_task);
scsi_lun_execute_mgmt_task(lun, &mgmt_task);
/* function code is invalid */
CU_ASSERT_EQUAL(mgmt_task.response, SPDK_SCSI_TASK_MGMT_RESP_REJECT_FUNC_NOT_SUPPORTED);
@ -385,7 +385,7 @@ lun_execute_scsi_task_pending(void)
*/
CU_ASSERT(TAILQ_EMPTY(&lun->tasks));
spdk_scsi_lun_execute_task(lun, &task);
scsi_lun_execute_task(lun, &task);
/* Assert the task has been successfully added to the tasks queue */
CU_ASSERT(!TAILQ_EMPTY(&lun->tasks));
@ -394,7 +394,7 @@ lun_execute_scsi_task_pending(void)
CU_ASSERT_EQUAL(g_task_count, 1);
/* Need to complete task so LUN might be removed right now */
spdk_scsi_lun_complete_task(lun, &task);
scsi_lun_complete_task(lun, &task);
CU_ASSERT_EQUAL(g_task_count, 0);
@ -422,7 +422,7 @@ lun_execute_scsi_task_complete(void)
*/
CU_ASSERT(TAILQ_EMPTY(&lun->tasks));
spdk_scsi_lun_execute_task(lun, &task);
scsi_lun_execute_task(lun, &task);
/* Assert the task has not been added to the tasks queue */
CU_ASSERT(TAILQ_EMPTY(&lun->tasks));
@ -439,7 +439,7 @@ lun_destruct_success(void)
lun = lun_construct();
spdk_scsi_lun_destruct(lun);
scsi_lun_destruct(lun);
CU_ASSERT_EQUAL(g_task_count, 0);
}
@ -449,7 +449,7 @@ lun_construct_null_ctx(void)
{
struct spdk_scsi_lun *lun;
lun = spdk_scsi_lun_construct(NULL, NULL, NULL);
lun = scsi_lun_construct(NULL, NULL, NULL);
/* lun should be NULL since we passed NULL for the ctx pointer. */
CU_ASSERT(lun == NULL);
@ -488,13 +488,13 @@ lun_reset_task_wait_scsi_task_complete(void)
mgmt_task.function = SPDK_SCSI_TASK_FUNC_LUN_RESET;
/* Execute the task but it is still in the task list. */
spdk_scsi_lun_execute_task(lun, &task);
scsi_lun_execute_task(lun, &task);
CU_ASSERT(TAILQ_EMPTY(&lun->pending_tasks));
CU_ASSERT(!TAILQ_EMPTY(&lun->tasks));
/* Execute the reset task */
spdk_scsi_lun_execute_mgmt_task(lun, &mgmt_task);
scsi_lun_execute_mgmt_task(lun, &mgmt_task);
/* The reset task should be on the submitted mgmt task list and
* a poller is created because the task prior to the reset task is pending.
@ -509,7 +509,7 @@ lun_reset_task_wait_scsi_task_complete(void)
CU_ASSERT(lun->reset_poller != NULL);
/* Complete the task. */
spdk_scsi_lun_complete_task(lun, &task);
scsi_lun_complete_task(lun, &task);
CU_ASSERT(TAILQ_EMPTY(&lun->tasks));
@ -553,12 +553,12 @@ lun_reset_task_suspend_scsi_task(void)
CU_ASSERT(!TAILQ_EMPTY(&lun->pending_mgmt_tasks));
/* Execute the task but it is on the pending task list. */
spdk_scsi_lun_execute_task(lun, &task);
scsi_lun_execute_task(lun, &task);
CU_ASSERT(!TAILQ_EMPTY(&lun->pending_tasks));
/* Execute the reset task. The task will be executed then. */
scsi_lun_execute_mgmt_task(lun);
_scsi_lun_execute_mgmt_task(lun);
CU_ASSERT(TAILQ_EMPTY(&lun->mgmt_tasks));
CU_ASSERT(lun->reset_poller == NULL);
@ -584,7 +584,7 @@ lun_check_pending_tasks_only_for_specific_initiator(void)
struct spdk_scsi_port initiator_port2 = {};
struct spdk_scsi_port initiator_port3 = {};
lun = spdk_scsi_lun_construct(&bdev, NULL, NULL);
lun = scsi_lun_construct(&bdev, NULL, NULL);
task1.initiator_port = &initiator_port1;
task2.initiator_port = &initiator_port2;
@ -592,53 +592,53 @@ lun_check_pending_tasks_only_for_specific_initiator(void)
TAILQ_INSERT_TAIL(&lun->tasks, &task1, scsi_link);
TAILQ_INSERT_TAIL(&lun->tasks, &task2, scsi_link);
CU_ASSERT(scsi_lun_has_outstanding_tasks(lun) == true);
CU_ASSERT(scsi_lun_has_pending_tasks(lun) == false);
CU_ASSERT(spdk_scsi_lun_has_pending_tasks(lun, NULL) == true);
CU_ASSERT(spdk_scsi_lun_has_pending_tasks(lun, &initiator_port1) == true);
CU_ASSERT(spdk_scsi_lun_has_pending_tasks(lun, &initiator_port2) == true);
CU_ASSERT(spdk_scsi_lun_has_pending_tasks(lun, &initiator_port3) == false);
CU_ASSERT(_scsi_lun_has_pending_tasks(lun) == false);
CU_ASSERT(scsi_lun_has_pending_tasks(lun, NULL) == true);
CU_ASSERT(scsi_lun_has_pending_tasks(lun, &initiator_port1) == true);
CU_ASSERT(scsi_lun_has_pending_tasks(lun, &initiator_port2) == true);
CU_ASSERT(scsi_lun_has_pending_tasks(lun, &initiator_port3) == false);
TAILQ_REMOVE(&lun->tasks, &task1, scsi_link);
TAILQ_REMOVE(&lun->tasks, &task2, scsi_link);
CU_ASSERT(scsi_lun_has_pending_tasks(lun) == false);
CU_ASSERT(spdk_scsi_lun_has_pending_tasks(lun, NULL) == false);
CU_ASSERT(_scsi_lun_has_pending_tasks(lun) == false);
CU_ASSERT(scsi_lun_has_pending_tasks(lun, NULL) == false);
TAILQ_INSERT_TAIL(&lun->pending_tasks, &task1, scsi_link);
TAILQ_INSERT_TAIL(&lun->pending_tasks, &task2, scsi_link);
CU_ASSERT(scsi_lun_has_outstanding_tasks(lun) == false);
CU_ASSERT(scsi_lun_has_pending_tasks(lun) == true);
CU_ASSERT(spdk_scsi_lun_has_pending_tasks(lun, NULL) == true);
CU_ASSERT(spdk_scsi_lun_has_pending_tasks(lun, &initiator_port1) == true);
CU_ASSERT(spdk_scsi_lun_has_pending_tasks(lun, &initiator_port2) == true);
CU_ASSERT(spdk_scsi_lun_has_pending_tasks(lun, &initiator_port3) == false);
CU_ASSERT(_scsi_lun_has_pending_tasks(lun) == true);
CU_ASSERT(scsi_lun_has_pending_tasks(lun, NULL) == true);
CU_ASSERT(scsi_lun_has_pending_tasks(lun, &initiator_port1) == true);
CU_ASSERT(scsi_lun_has_pending_tasks(lun, &initiator_port2) == true);
CU_ASSERT(scsi_lun_has_pending_tasks(lun, &initiator_port3) == false);
TAILQ_REMOVE(&lun->pending_tasks, &task1, scsi_link);
TAILQ_REMOVE(&lun->pending_tasks, &task2, scsi_link);
CU_ASSERT(scsi_lun_has_pending_tasks(lun) == false);
CU_ASSERT(spdk_scsi_lun_has_pending_tasks(lun, NULL) == false);
CU_ASSERT(_scsi_lun_has_pending_tasks(lun) == false);
CU_ASSERT(scsi_lun_has_pending_tasks(lun, NULL) == false);
TAILQ_INSERT_TAIL(&lun->mgmt_tasks, &task1, scsi_link);
TAILQ_INSERT_TAIL(&lun->mgmt_tasks, &task2, scsi_link);
CU_ASSERT(scsi_lun_has_outstanding_mgmt_tasks(lun) == true);
CU_ASSERT(scsi_lun_has_pending_mgmt_tasks(lun) == false);
CU_ASSERT(spdk_scsi_lun_has_pending_mgmt_tasks(lun, NULL) == true);
CU_ASSERT(spdk_scsi_lun_has_pending_mgmt_tasks(lun, &initiator_port1) == true);
CU_ASSERT(spdk_scsi_lun_has_pending_mgmt_tasks(lun, &initiator_port2) == true);
CU_ASSERT(spdk_scsi_lun_has_pending_mgmt_tasks(lun, &initiator_port3) == false);
CU_ASSERT(_scsi_lun_has_pending_mgmt_tasks(lun) == false);
CU_ASSERT(scsi_lun_has_pending_mgmt_tasks(lun, NULL) == true);
CU_ASSERT(scsi_lun_has_pending_mgmt_tasks(lun, &initiator_port1) == true);
CU_ASSERT(scsi_lun_has_pending_mgmt_tasks(lun, &initiator_port2) == true);
CU_ASSERT(scsi_lun_has_pending_mgmt_tasks(lun, &initiator_port3) == false);
TAILQ_REMOVE(&lun->mgmt_tasks, &task1, scsi_link);
TAILQ_REMOVE(&lun->mgmt_tasks, &task2, scsi_link);
CU_ASSERT(scsi_lun_has_pending_mgmt_tasks(lun) == false);
CU_ASSERT(spdk_scsi_lun_has_pending_mgmt_tasks(lun, NULL) == false);
CU_ASSERT(_scsi_lun_has_pending_mgmt_tasks(lun) == false);
CU_ASSERT(scsi_lun_has_pending_mgmt_tasks(lun, NULL) == false);
TAILQ_INSERT_TAIL(&lun->pending_mgmt_tasks, &task1, scsi_link);
TAILQ_INSERT_TAIL(&lun->pending_mgmt_tasks, &task2, scsi_link);
CU_ASSERT(scsi_lun_has_pending_mgmt_tasks(lun) == true);
CU_ASSERT(spdk_scsi_lun_has_pending_mgmt_tasks(lun, NULL) == true);
CU_ASSERT(spdk_scsi_lun_has_pending_mgmt_tasks(lun, &initiator_port1) == true);
CU_ASSERT(spdk_scsi_lun_has_pending_mgmt_tasks(lun, &initiator_port2) == true);
CU_ASSERT(spdk_scsi_lun_has_pending_mgmt_tasks(lun, &initiator_port3) == false);
CU_ASSERT(_scsi_lun_has_pending_mgmt_tasks(lun) == true);
CU_ASSERT(scsi_lun_has_pending_mgmt_tasks(lun, NULL) == true);
CU_ASSERT(scsi_lun_has_pending_mgmt_tasks(lun, &initiator_port1) == true);
CU_ASSERT(scsi_lun_has_pending_mgmt_tasks(lun, &initiator_port2) == true);
CU_ASSERT(scsi_lun_has_pending_mgmt_tasks(lun, &initiator_port3) == false);
TAILQ_REMOVE(&lun->pending_mgmt_tasks, &task1, scsi_link);
TAILQ_REMOVE(&lun->pending_mgmt_tasks, &task2, scsi_link);
CU_ASSERT(scsi_lun_has_pending_mgmt_tasks(lun) == false);
CU_ASSERT(spdk_scsi_lun_has_pending_mgmt_tasks(lun, NULL) == false);
CU_ASSERT(_scsi_lun_has_pending_mgmt_tasks(lun) == false);
CU_ASSERT(scsi_lun_has_pending_mgmt_tasks(lun, NULL) == false);
scsi_lun_remove(lun);
}
@ -650,7 +650,7 @@ abort_pending_mgmt_tasks_when_lun_is_removed(void)
struct spdk_scsi_lun *lun;
struct spdk_scsi_task task1, task2, task3;
lun = spdk_scsi_lun_construct(&bdev, NULL, NULL);
lun = scsi_lun_construct(&bdev, NULL, NULL);
/* Normal case */
ut_init_task(&task1);
@ -671,7 +671,7 @@ abort_pending_mgmt_tasks_when_lun_is_removed(void)
CU_ASSERT(!TAILQ_EMPTY(&lun->pending_mgmt_tasks));
scsi_lun_execute_mgmt_task(lun);
_scsi_lun_execute_mgmt_task(lun);
CU_ASSERT(TAILQ_EMPTY(&lun->pending_mgmt_tasks));
CU_ASSERT(TAILQ_EMPTY(&lun->mgmt_tasks));
@ -698,7 +698,7 @@ abort_pending_mgmt_tasks_when_lun_is_removed(void)
lun->removed = true;
scsi_lun_execute_mgmt_task(lun);
_scsi_lun_execute_mgmt_task(lun);
CU_ASSERT(TAILQ_EMPTY(&lun->pending_mgmt_tasks));
CU_ASSERT(TAILQ_EMPTY(&lun->mgmt_tasks));

View File

@ -98,19 +98,19 @@ DEFINE_STUB(spdk_bdev_is_dif_head_of_md, bool,
DEFINE_STUB(spdk_bdev_is_dif_check_enabled, bool,
(const struct spdk_bdev *bdev, enum spdk_dif_check_type check_type), false);
DEFINE_STUB(spdk_scsi_pr_out, int, (struct spdk_scsi_task *task,
uint8_t *cdb, uint8_t *data, uint16_t data_len), 0);
DEFINE_STUB(scsi_pr_out, int, (struct spdk_scsi_task *task,
uint8_t *cdb, uint8_t *data, uint16_t data_len), 0);
DEFINE_STUB(spdk_scsi_pr_in, int, (struct spdk_scsi_task *task, uint8_t *cdb,
uint8_t *data, uint16_t data_len), 0);
DEFINE_STUB(scsi_pr_in, int, (struct spdk_scsi_task *task, uint8_t *cdb,
uint8_t *data, uint16_t data_len), 0);
void
spdk_scsi_lun_complete_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task)
scsi_lun_complete_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task)
{
g_scsi_cb_called++;
}
DEFINE_STUB_V(spdk_scsi_lun_complete_reset_task,
DEFINE_STUB_V(scsi_lun_complete_reset_task,
(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task));
DEFINE_STUB(spdk_scsi_lun_id_int_to_fmt, uint64_t, (int lun_id), 0);
@ -310,7 +310,7 @@ mode_select_6_test(void)
data[5] = 0x02;
spdk_scsi_task_set_data(&task, data, sizeof(data));
rc = spdk_bdev_scsi_execute(&task);
rc = bdev_scsi_execute(&task);
CU_ASSERT_EQUAL(rc, 0);
@ -346,7 +346,7 @@ mode_select_6_test2(void)
lun.dev = &dev;
task.lun = &lun;
rc = spdk_bdev_scsi_execute(&task);
rc = bdev_scsi_execute(&task);
CU_ASSERT_EQUAL(rc, 0);
@ -386,7 +386,7 @@ mode_sense_6_test(void)
lun.dev = &dev;
task.lun = &lun;
rc = spdk_bdev_scsi_execute(&task);
rc = bdev_scsi_execute(&task);
SPDK_CU_ASSERT_FATAL(rc == 0);
data = task.iovs[0].iov_base;
@ -435,7 +435,7 @@ mode_sense_10_test(void)
lun.dev = &dev;
task.lun = &lun;
rc = spdk_bdev_scsi_execute(&task);
rc = bdev_scsi_execute(&task);
SPDK_CU_ASSERT_FATAL(rc == 0);
data = task.iovs[0].iov_base;
@ -482,7 +482,7 @@ inquiry_evpd_test(void)
lun.dev = &dev;
task.lun = &lun;
rc = spdk_bdev_scsi_execute(&task);
rc = bdev_scsi_execute(&task);
SPDK_CU_ASSERT_FATAL(rc == 0);
CU_ASSERT_EQUAL(task.status, SPDK_SCSI_STATUS_CHECK_CONDITION);
@ -524,7 +524,7 @@ inquiry_standard_test(void)
lun.dev = &dev;
task.lun = &lun;
rc = spdk_bdev_scsi_execute(&task);
rc = bdev_scsi_execute(&task);
data = task.iovs[0].iov_base;
inq_data = (struct spdk_scsi_cdb_inquiry_data *)&data[0];
@ -567,7 +567,7 @@ _inquiry_overflow_test(uint8_t alloc_len)
spdk_scsi_task_set_data(&task, data, sizeof(data));
rc = spdk_bdev_scsi_execute(&task);
rc = bdev_scsi_execute(&task);
SPDK_CU_ASSERT_FATAL(rc == 0);
CU_ASSERT_EQUAL(memcmp(data + alloc_len, data_compare + alloc_len, sizeof(data) - alloc_len), 0);
@ -699,7 +699,7 @@ lba_range_test(void)
task.transfer_len = 1 * 512;
task.offset = 0;
task.length = 1 * 512;
rc = spdk_bdev_scsi_execute(&task);
rc = bdev_scsi_execute(&task);
CU_ASSERT(rc == SPDK_SCSI_TASK_PENDING);
CU_ASSERT(task.status == 0xFF);
SPDK_CU_ASSERT_FATAL(!TAILQ_EMPTY(&g_bdev_io_queue));
@ -714,7 +714,7 @@ lba_range_test(void)
task.transfer_len = 1 * 512;
task.offset = 0;
task.length = 1 * 512;
rc = spdk_bdev_scsi_execute(&task);
rc = bdev_scsi_execute(&task);
CU_ASSERT(rc == SPDK_SCSI_TASK_COMPLETE);
CU_ASSERT(task.status == SPDK_SCSI_STATUS_CHECK_CONDITION);
CU_ASSERT(task.sense_data[12] == SPDK_SCSI_ASC_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE);
@ -727,7 +727,7 @@ lba_range_test(void)
task.status = 0xFF;
task.offset = 0;
task.length = 1 * 512;
rc = spdk_bdev_scsi_execute(&task);
rc = bdev_scsi_execute(&task);
CU_ASSERT(rc == SPDK_SCSI_TASK_PENDING);
CU_ASSERT(task.status == 0xFF);
SPDK_CU_ASSERT_FATAL(!TAILQ_EMPTY(&g_bdev_io_queue));
@ -742,7 +742,7 @@ lba_range_test(void)
task.transfer_len = 5 * 512;
task.offset = 0;
task.length = 1 * 512;
rc = spdk_bdev_scsi_execute(&task);
rc = bdev_scsi_execute(&task);
CU_ASSERT(rc == SPDK_SCSI_TASK_COMPLETE);
CU_ASSERT(task.status == SPDK_SCSI_STATUS_CHECK_CONDITION);
CU_ASSERT(task.sense_data[12] == SPDK_SCSI_ASC_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE);
@ -780,7 +780,7 @@ xfer_len_test(void)
task.transfer_len = 1 * 512;
task.offset = 0;
task.length = 1 * 512;
rc = spdk_bdev_scsi_execute(&task);
rc = bdev_scsi_execute(&task);
CU_ASSERT(rc == SPDK_SCSI_TASK_PENDING);
CU_ASSERT(task.status == 0xFF);
SPDK_CU_ASSERT_FATAL(!TAILQ_EMPTY(&g_bdev_io_queue));
@ -796,7 +796,7 @@ xfer_len_test(void)
task.status = 0xFF;
task.offset = 0;
task.length = 1 * 512;
rc = spdk_bdev_scsi_execute(&task);
rc = bdev_scsi_execute(&task);
CU_ASSERT(rc == SPDK_SCSI_TASK_PENDING);
CU_ASSERT(task.status == 0xFF);
SPDK_CU_ASSERT_FATAL(!TAILQ_EMPTY(&g_bdev_io_queue));
@ -811,7 +811,7 @@ xfer_len_test(void)
task.transfer_len = SPDK_WORK_BLOCK_SIZE + 512;
task.offset = 0;
task.length = 1 * 512;
rc = spdk_bdev_scsi_execute(&task);
rc = bdev_scsi_execute(&task);
CU_ASSERT(rc == SPDK_SCSI_TASK_COMPLETE);
CU_ASSERT(task.status == SPDK_SCSI_STATUS_CHECK_CONDITION);
CU_ASSERT((task.sense_data[2] & 0xf) == SPDK_SCSI_SENSE_ILLEGAL_REQUEST);
@ -824,7 +824,7 @@ xfer_len_test(void)
task.transfer_len = 0;
task.offset = 0;
task.length = 0;
rc = spdk_bdev_scsi_execute(&task);
rc = bdev_scsi_execute(&task);
CU_ASSERT(rc == SPDK_SCSI_TASK_COMPLETE);
CU_ASSERT(task.status == SPDK_SCSI_STATUS_GOOD);
CU_ASSERT(task.data_transferred == 0);
@ -836,7 +836,7 @@ xfer_len_test(void)
task.transfer_len = 0;
task.offset = 0;
task.length = 0;
rc = spdk_bdev_scsi_execute(&task);
rc = bdev_scsi_execute(&task);
CU_ASSERT(rc == SPDK_SCSI_TASK_COMPLETE);
CU_ASSERT(task.status == SPDK_SCSI_STATUS_CHECK_CONDITION);
CU_ASSERT(task.sense_data[12] == SPDK_SCSI_ASC_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE);
@ -874,7 +874,7 @@ _xfer_test(bool bdev_io_pool_full)
task.offset = 0;
task.length = 1 * 512;
g_bdev_io_pool_full = bdev_io_pool_full;
rc = spdk_bdev_scsi_execute(&task);
rc = bdev_scsi_execute(&task);
CU_ASSERT(rc == SPDK_SCSI_TASK_PENDING);
CU_ASSERT(task.status == 0xFF);
@ -896,7 +896,7 @@ _xfer_test(bool bdev_io_pool_full)
task.offset = 0;
task.length = 1 * 512;
g_bdev_io_pool_full = bdev_io_pool_full;
rc = spdk_bdev_scsi_execute(&task);
rc = bdev_scsi_execute(&task);
CU_ASSERT(rc == SPDK_SCSI_TASK_PENDING);
CU_ASSERT(task.status == 0xFF);
@ -922,7 +922,7 @@ _xfer_test(bool bdev_io_pool_full)
spdk_scsi_task_set_data(&task, data, sizeof(data));
task.status = SPDK_SCSI_STATUS_GOOD;
g_bdev_io_pool_full = bdev_io_pool_full;
rc = spdk_bdev_scsi_execute(&task);
rc = bdev_scsi_execute(&task);
CU_ASSERT(rc == SPDK_SCSI_TASK_PENDING);
CU_ASSERT(task.status == SPDK_SCSI_STATUS_GOOD);
@ -941,7 +941,7 @@ _xfer_test(bool bdev_io_pool_full)
to_be64(&cdb[2], 0); /* LBA */
to_be32(&cdb[10], 1); /* 1 blocks */
g_bdev_io_pool_full = bdev_io_pool_full;
rc = spdk_bdev_scsi_execute(&task);
rc = bdev_scsi_execute(&task);
CU_ASSERT(rc == SPDK_SCSI_TASK_PENDING);
CU_ASSERT(task.status == 0xFF);
@ -977,7 +977,7 @@ get_dif_ctx_test(void)
task.cdb = cdb;
task.offset = 0x6 * 512;
ret = spdk_scsi_bdev_get_dif_ctx(&bdev, &task, &dif_ctx);
ret = bdev_scsi_get_dif_ctx(&bdev, &task, &dif_ctx);
CU_ASSERT(ret == true);
CU_ASSERT(dif_ctx.init_ref_tag + dif_ctx.ref_tag_offset == 0x123456);
@ -985,7 +985,7 @@ get_dif_ctx_test(void)
to_be32(&cdb[2], 0x12345670);
task.offset = 0x8 * 512;
ret = spdk_scsi_bdev_get_dif_ctx(&bdev, &task, &dif_ctx);
ret = bdev_scsi_get_dif_ctx(&bdev, &task, &dif_ctx);
CU_ASSERT(ret == true);
CU_ASSERT(dif_ctx.init_ref_tag + dif_ctx.ref_tag_offset == 0x12345678);
@ -993,7 +993,7 @@ get_dif_ctx_test(void)
to_be64(&cdb[2], 0x0000000012345670);
task.offset = 0x8 * 512;
ret = spdk_scsi_bdev_get_dif_ctx(&bdev, &task, &dif_ctx);
ret = bdev_scsi_get_dif_ctx(&bdev, &task, &dif_ctx);
CU_ASSERT(ret == true);
CU_ASSERT(dif_ctx.init_ref_tag + dif_ctx.ref_tag_offset == 0x12345678);
}

View File

@ -103,26 +103,26 @@ ut_port_init(void)
int rc;
/* g_i_port_a */
rc = spdk_scsi_port_construct(&g_i_port_a, 0xa, 0,
"iqn.2016-06.io.spdk:fe5aacf7420a,i,0x00023d00000a");
rc = scsi_port_construct(&g_i_port_a, 0xa, 0,
"iqn.2016-06.io.spdk:fe5aacf7420a,i,0x00023d00000a");
SPDK_CU_ASSERT_FATAL(rc == 0);
spdk_scsi_port_set_iscsi_transport_id(&g_i_port_a,
"iqn.2016-06.io.spdk:fe5aacf7420a", 0x00023d00000a);
/* g_i_port_b */
rc = spdk_scsi_port_construct(&g_i_port_b, 0xb, 0,
"iqn.2016-06.io.spdk:fe5aacf7420b,i,0x00023d00000b");
rc = scsi_port_construct(&g_i_port_b, 0xb, 0,
"iqn.2016-06.io.spdk:fe5aacf7420b,i,0x00023d00000b");
SPDK_CU_ASSERT_FATAL(rc == 0);
spdk_scsi_port_set_iscsi_transport_id(&g_i_port_b,
"iqn.2016-06.io.spdk:fe5aacf7420b", 0x00023d00000b);
/* g_i_port_c */
rc = spdk_scsi_port_construct(&g_i_port_c, 0xc, 0,
"iqn.2016-06.io.spdk:fe5aacf7420c,i,0x00023d00000c");
rc = scsi_port_construct(&g_i_port_c, 0xc, 0,
"iqn.2016-06.io.spdk:fe5aacf7420c,i,0x00023d00000c");
SPDK_CU_ASSERT_FATAL(rc == 0);
spdk_scsi_port_set_iscsi_transport_id(&g_i_port_c,
"iqn.2016-06.io.spdk:fe5aacf7420c", 0x00023d00000c);
/* g_t_port_0 */
rc = spdk_scsi_port_construct(&g_t_port_0, 0x0, 1,
"iqn.2016-06.io.spdk:fe5aacf74200,t,0x00023d000000");
rc = scsi_port_construct(&g_t_port_0, 0x0, 1,
"iqn.2016-06.io.spdk:fe5aacf74200,t,0x00023d000000");
SPDK_CU_ASSERT_FATAL(rc == 0);
spdk_scsi_port_set_iscsi_transport_id(&g_t_port_0,
"iqn.2016-06.io.spdk:fe5aacf74200", 0x00023d000000);
@ -478,11 +478,11 @@ test_reservation_cmds_conflict(void)
*/
task.cdb[0] = SPDK_SBC_READ_10;
task.status = 0;
rc = spdk_scsi_pr_check(&task);
rc = scsi_pr_check(&task);
SPDK_CU_ASSERT_FATAL(rc == 0);
task.cdb[0] = SPDK_SBC_WRITE_10;
task.status = 0;
rc = spdk_scsi_pr_check(&task);
rc = scsi_pr_check(&task);
SPDK_CU_ASSERT_FATAL(rc < 0);
SPDK_CU_ASSERT_FATAL(task.status == SPDK_SCSI_STATUS_RESERVATION_CONFLICT);
@ -490,11 +490,11 @@ test_reservation_cmds_conflict(void)
task.initiator_port = &g_i_port_c;
task.cdb[0] = SPDK_SBC_READ_10;
task.status = 0;
rc = spdk_scsi_pr_check(&task);
rc = scsi_pr_check(&task);
SPDK_CU_ASSERT_FATAL(rc == 0);
task.cdb[0] = SPDK_SBC_WRITE_10;
task.status = 0;
rc = spdk_scsi_pr_check(&task);
rc = scsi_pr_check(&task);
SPDK_CU_ASSERT_FATAL(rc == 0);
/* Host A preempts itself with SPDK_SCSI_PR_EXCLUSIVE_ACCESS */
@ -510,12 +510,12 @@ test_reservation_cmds_conflict(void)
task.initiator_port = &g_i_port_c;
task.cdb[0] = SPDK_SBC_READ_10;
task.status = 0;
rc = spdk_scsi_pr_check(&task);
rc = scsi_pr_check(&task);
SPDK_CU_ASSERT_FATAL(rc < 0);
SPDK_CU_ASSERT_FATAL(task.status == SPDK_SCSI_STATUS_RESERVATION_CONFLICT);
task.cdb[0] = SPDK_SBC_WRITE_10;
task.status = 0;
rc = spdk_scsi_pr_check(&task);
rc = scsi_pr_check(&task);
SPDK_CU_ASSERT_FATAL(rc < 0);
SPDK_CU_ASSERT_FATAL(task.status == SPDK_SCSI_STATUS_RESERVATION_CONFLICT);
@ -523,12 +523,12 @@ test_reservation_cmds_conflict(void)
task.initiator_port = &g_i_port_b;
task.cdb[0] = SPDK_SBC_READ_10;
task.status = 0;
rc = spdk_scsi_pr_check(&task);
rc = scsi_pr_check(&task);
SPDK_CU_ASSERT_FATAL(rc < 0);
SPDK_CU_ASSERT_FATAL(task.status == SPDK_SCSI_STATUS_RESERVATION_CONFLICT);
task.cdb[0] = SPDK_SBC_WRITE_10;
task.status = 0;
rc = spdk_scsi_pr_check(&task);
rc = scsi_pr_check(&task);
SPDK_CU_ASSERT_FATAL(rc < 0);
SPDK_CU_ASSERT_FATAL(task.status == SPDK_SCSI_STATUS_RESERVATION_CONFLICT);