lib/scsi: Add lun to the names of descriptors and callback for LUN

The next patch will add the function ponter typedef
spdk_scsi_dev_destruct_cb for SCSI device destruction.
Hence add lun to the names of descriptors and callback for SCSI
LUN for clarification.

This patch doesn't change any behavior.

Change-Id: I73f2bce9129f7a6f16770ab6ed18428b16589108
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450883
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
This commit is contained in:
Shuhei Matsumoto 2019-04-11 11:01:30 +09:00 committed by Jim Harris
parent d039746c64
commit 9470d65e8d
6 changed files with 26 additions and 26 deletions

View File

@ -148,9 +148,9 @@ struct spdk_scsi_task {
struct spdk_scsi_port; struct spdk_scsi_port;
struct spdk_scsi_dev; struct spdk_scsi_dev;
struct spdk_scsi_lun; struct spdk_scsi_lun;
struct spdk_scsi_desc; struct spdk_scsi_lun_desc;
typedef void (*spdk_scsi_remove_cb_t)(struct spdk_scsi_lun *, void *); typedef void (*spdk_scsi_lun_remove_cb_t)(struct spdk_scsi_lun *, void *);
/** /**
* Initialize SCSI layer. * Initialize SCSI layer.
@ -492,15 +492,15 @@ void spdk_scsi_task_process_abort(struct spdk_scsi_task *task);
* \param desc Output parameter for the descriptor when operation is successful. * \param desc Output parameter for the descriptor when operation is successful.
* \return 0 if operation is successful, suitable errno value otherwise * \return 0 if operation is successful, suitable errno value otherwise
*/ */
int spdk_scsi_lun_open(struct spdk_scsi_lun *lun, spdk_scsi_remove_cb_t hotremove_cb, int spdk_scsi_lun_open(struct spdk_scsi_lun *lun, spdk_scsi_lun_remove_cb_t hotremove_cb,
void *hotremove_ctx, struct spdk_scsi_desc **desc); void *hotremove_ctx, struct spdk_scsi_lun_desc **desc);
/** /**
* Close an opened logical unit. * Close an opened logical unit.
* *
* \param desc Descriptor of the logical unit. * \param desc Descriptor of the logical unit.
*/ */
void spdk_scsi_lun_close(struct spdk_scsi_desc *desc); void spdk_scsi_lun_close(struct spdk_scsi_lun_desc *desc);
/** /**
* Allocate I/O channel for the LUN * Allocate I/O channel for the LUN
@ -509,14 +509,14 @@ void spdk_scsi_lun_close(struct spdk_scsi_desc *desc);
* *
* \return 0 on success, -1 on failure. * \return 0 on success, -1 on failure.
*/ */
int spdk_scsi_lun_allocate_io_channel(struct spdk_scsi_desc *desc); int spdk_scsi_lun_allocate_io_channel(struct spdk_scsi_lun_desc *desc);
/** /**
* Free I/O channel from the logical unit * Free I/O channel from the logical unit
* *
* \param desc Descriptor of the logical unit. * \param desc Descriptor of the logical unit.
*/ */
void spdk_scsi_lun_free_io_channel(struct spdk_scsi_desc *desc); void spdk_scsi_lun_free_io_channel(struct spdk_scsi_lun_desc *desc);
/** /**
* Get DIF context for SCSI LUN and SCSI command. * Get DIF context for SCSI LUN and SCSI command.

View File

@ -642,7 +642,7 @@ iscsi_conn_check_shutdown(void *arg)
static void static void
iscsi_conn_close_lun(struct spdk_iscsi_conn *conn, int lun_id) iscsi_conn_close_lun(struct spdk_iscsi_conn *conn, int lun_id)
{ {
struct spdk_scsi_desc *desc; struct spdk_scsi_lun_desc *desc;
desc = conn->open_lun_descs[lun_id]; desc = conn->open_lun_descs[lun_id];
if (desc != NULL) { if (desc != NULL) {
@ -718,7 +718,7 @@ iscsi_conn_open_luns(struct spdk_iscsi_conn *conn)
{ {
int i, rc; int i, rc;
struct spdk_scsi_lun *lun; struct spdk_scsi_lun *lun;
struct spdk_scsi_desc *desc; struct spdk_scsi_lun_desc *desc;
for (i = 0; i < SPDK_SCSI_DEV_MAX_LUN; i++) { for (i = 0; i < SPDK_SCSI_DEV_MAX_LUN; i++) {
lun = spdk_scsi_dev_get_lun(conn->dev, i); lun = spdk_scsi_dev_get_lun(conn->dev, i);

View File

@ -165,7 +165,7 @@ struct spdk_iscsi_conn {
TAILQ_HEAD(active_r2t_tasks, spdk_iscsi_task) active_r2t_tasks; TAILQ_HEAD(active_r2t_tasks, spdk_iscsi_task) active_r2t_tasks;
TAILQ_HEAD(queued_datain_tasks, spdk_iscsi_task) queued_datain_tasks; TAILQ_HEAD(queued_datain_tasks, spdk_iscsi_task) queued_datain_tasks;
struct spdk_scsi_desc *open_lun_descs[SPDK_SCSI_DEV_MAX_LUN]; struct spdk_scsi_lun_desc *open_lun_descs[SPDK_SCSI_DEV_MAX_LUN];
}; };
extern struct spdk_iscsi_conn *g_conns_array; extern struct spdk_iscsi_conn *g_conns_array;

View File

@ -237,7 +237,7 @@ scsi_lun_check_io_channel(void *arg)
static void static void
scsi_lun_notify_hot_remove(struct spdk_scsi_lun *lun) scsi_lun_notify_hot_remove(struct spdk_scsi_lun *lun)
{ {
struct spdk_scsi_desc *desc, *tmp; struct spdk_scsi_lun_desc *desc, *tmp;
if (lun->hotremove_cb) { if (lun->hotremove_cb) {
lun->hotremove_cb(lun, lun->hotremove_ctx); lun->hotremove_cb(lun, lun->hotremove_ctx);
@ -368,10 +368,10 @@ spdk_scsi_lun_destruct(struct spdk_scsi_lun *lun)
} }
int int
spdk_scsi_lun_open(struct spdk_scsi_lun *lun, spdk_scsi_remove_cb_t hotremove_cb, spdk_scsi_lun_open(struct spdk_scsi_lun *lun, spdk_scsi_lun_remove_cb_t hotremove_cb,
void *hotremove_ctx, struct spdk_scsi_desc **_desc) void *hotremove_ctx, struct spdk_scsi_lun_desc **_desc)
{ {
struct spdk_scsi_desc *desc; struct spdk_scsi_lun_desc *desc;
desc = calloc(1, sizeof(*desc)); desc = calloc(1, sizeof(*desc));
if (desc == NULL) { if (desc == NULL) {
@ -390,7 +390,7 @@ spdk_scsi_lun_open(struct spdk_scsi_lun *lun, spdk_scsi_remove_cb_t hotremove_cb
} }
void void
spdk_scsi_lun_close(struct spdk_scsi_desc *desc) spdk_scsi_lun_close(struct spdk_scsi_lun_desc *desc)
{ {
struct spdk_scsi_lun *lun = desc->lun; struct spdk_scsi_lun *lun = desc->lun;
@ -441,7 +441,7 @@ _spdk_scsi_lun_free_io_channel(struct spdk_scsi_lun *lun)
} }
int int
spdk_scsi_lun_allocate_io_channel(struct spdk_scsi_desc *desc) spdk_scsi_lun_allocate_io_channel(struct spdk_scsi_lun_desc *desc)
{ {
struct spdk_scsi_lun *lun = desc->lun; struct spdk_scsi_lun *lun = desc->lun;
@ -449,7 +449,7 @@ spdk_scsi_lun_allocate_io_channel(struct spdk_scsi_desc *desc)
} }
void void
spdk_scsi_lun_free_io_channel(struct spdk_scsi_desc *desc) spdk_scsi_lun_free_io_channel(struct spdk_scsi_lun_desc *desc)
{ {
struct spdk_scsi_lun *lun = desc->lun; struct spdk_scsi_lun *lun = desc->lun;

View File

@ -75,11 +75,11 @@ struct spdk_scsi_dev {
uint8_t protocol_id; uint8_t protocol_id;
}; };
struct spdk_scsi_desc { struct spdk_scsi_lun_desc {
struct spdk_scsi_lun *lun; struct spdk_scsi_lun *lun;
spdk_scsi_remove_cb_t hotremove_cb; spdk_scsi_lun_remove_cb_t hotremove_cb;
void *hotremove_ctx; void *hotremove_ctx;
TAILQ_ENTRY(spdk_scsi_desc) link; TAILQ_ENTRY(spdk_scsi_lun_desc) link;
}; };
struct spdk_scsi_lun { struct spdk_scsi_lun {
@ -114,7 +114,7 @@ struct spdk_scsi_lun {
void *hotremove_ctx; void *hotremove_ctx;
/** List of open descriptors for this LUN. */ /** List of open descriptors for this LUN. */
TAILQ_HEAD(, spdk_scsi_desc) open_descs; TAILQ_HEAD(, spdk_scsi_lun_desc) open_descs;
/** submitted tasks */ /** submitted tasks */
TAILQ_HEAD(tasks, spdk_scsi_task) tasks; TAILQ_HEAD(tasks, spdk_scsi_task) tasks;

View File

@ -107,16 +107,16 @@ DEFINE_STUB(spdk_scsi_dev_has_pending_tasks, bool,
(const struct spdk_scsi_dev *dev), true); (const struct spdk_scsi_dev *dev), true);
DEFINE_STUB(spdk_scsi_lun_open, int, DEFINE_STUB(spdk_scsi_lun_open, int,
(struct spdk_scsi_lun *lun, spdk_scsi_remove_cb_t hotremove_cb, (struct spdk_scsi_lun *lun, spdk_scsi_lun_remove_cb_t hotremove_cb,
void *hotremove_ctx, struct spdk_scsi_desc **desc), void *hotremove_ctx, struct spdk_scsi_lun_desc **desc),
0); 0);
DEFINE_STUB_V(spdk_scsi_lun_close, (struct spdk_scsi_desc *desc)); DEFINE_STUB_V(spdk_scsi_lun_close, (struct spdk_scsi_lun_desc *desc));
DEFINE_STUB(spdk_scsi_lun_allocate_io_channel, int, DEFINE_STUB(spdk_scsi_lun_allocate_io_channel, int,
(struct spdk_scsi_desc *desc), 0); (struct spdk_scsi_lun_desc *desc), 0);
DEFINE_STUB_V(spdk_scsi_lun_free_io_channel, (struct spdk_scsi_desc *desc)); DEFINE_STUB_V(spdk_scsi_lun_free_io_channel, (struct spdk_scsi_lun_desc *desc));
DEFINE_STUB(spdk_scsi_lun_get_id, int, (const struct spdk_scsi_lun *lun), 0); DEFINE_STUB(spdk_scsi_lun_get_id, int, (const struct spdk_scsi_lun *lun), 0);