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;
}
* 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++;
}
}
}
- lun = spdk_scsi_lun_construct(bdev, hotremove_cb, hotremove_ctx);
+ lun = scsi_lun_construct(bdev, hotremove_cb, hotremove_ctx);
if (lun == NULL) {
return -1;
}
}
}
-/* This typedef exists to work around an astyle 2.05 bug.
- * Remove it when astyle is fixed.
- */
-typedef struct spdk_scsi_dev _spdk_scsi_dev;
-
-_spdk_scsi_dev *
-spdk_scsi_dev_construct(const char *name, const char *bdev_name_list[],
- int *lun_id_list, int num_luns, uint8_t protocol_id,
- void (*hotremove_cb)(const struct spdk_scsi_lun *, void *),
- void *hotremove_ctx)
+struct spdk_scsi_dev *spdk_scsi_dev_construct(const char *name, const char *bdev_name_list[],
+ int *lun_id_list, int num_luns, uint8_t protocol_id,
+ void (*hotremove_cb)(const struct spdk_scsi_lun *, void *),
+ void *hotremove_ctx)
{
struct spdk_scsi_dev *dev;
size_t name_len;
{
assert(task != NULL);
- spdk_scsi_lun_append_mgmt_task(task->lun, task);
- spdk_scsi_lun_execute_mgmt_task(task->lun);
+ scsi_lun_execute_mgmt_task(task->lun, task);
}
void
{
assert(task != NULL);
- spdk_scsi_lun_append_task(task->lun, task);
- spdk_scsi_lun_execute_tasks(task->lun);
+ scsi_lun_execute_task(task->lun, task);
}
static struct spdk_scsi_port *
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;
}
return -1;
}
- spdk_scsi_port_destruct(port);
+ scsi_port_destruct(port);
dev->num_ports--;
if (dev->lun[i] == NULL) {
continue;
}
- _spdk_scsi_lun_free_io_channel(dev->lun[i]);
+ scsi_lun_free_io_channel(dev->lun[i]);
}
}
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;
struct spdk_scsi_lun *
spdk_scsi_dev_get_lun(struct spdk_scsi_dev *dev, int lun_id)
{
+ struct spdk_scsi_lun *lun;
+
if (lun_id < 0 || lun_id >= SPDK_SCSI_DEV_MAX_LUN) {
return NULL;
}
- return dev->lun[lun_id];
+ lun = dev->lun[lun_id];
+
+ if (lun != NULL && !spdk_scsi_lun_is_removing(lun)) {
+ return lun;
+ } else {
+ return NULL;
+ }
}
bool
-spdk_scsi_dev_has_pending_tasks(const struct spdk_scsi_dev *dev)
+spdk_scsi_dev_has_pending_tasks(const struct spdk_scsi_dev *dev,
+ const struct spdk_scsi_port *initiator_port)
{
int i;
for (i = 0; i < SPDK_SCSI_DEV_MAX_LUN; ++i) {
if (dev->lun[i] &&
- (spdk_scsi_lun_has_pending_tasks(dev->lun[i]) ||
- spdk_scsi_lun_has_pending_mgmt_tasks(dev->lun[i]))) {
+ (scsi_lun_has_pending_tasks(dev->lun[i], initiator_port) ||
+ scsi_lun_has_pending_mgmt_tasks(dev->lun[i], initiator_port))) {
return true;
}
}