scsi: Report LUNs use spdk_scsi_dev_get_first/next_lun() to iterate LUNs
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: Ib812c1f4c180f4173c3b3d668a98e3b23ed32899 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9629 Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
27646a08d7
commit
845db70ccc
@ -101,9 +101,9 @@ bdev_scsi_report_luns(struct spdk_scsi_lun *lun,
|
||||
int sel, uint8_t *data, int alloc_len)
|
||||
{
|
||||
struct spdk_scsi_dev *dev;
|
||||
struct spdk_scsi_lun *tmp_lun;
|
||||
uint64_t fmt_lun;
|
||||
int hlen, len = 0;
|
||||
int i;
|
||||
|
||||
if (alloc_len < 8) {
|
||||
return -1;
|
||||
@ -128,16 +128,13 @@ bdev_scsi_report_luns(struct spdk_scsi_lun *lun,
|
||||
|
||||
dev = lun->dev;
|
||||
|
||||
for (i = 0; i < SPDK_SCSI_DEV_MAX_LUN; i++) {
|
||||
if (dev->lun[i] == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (tmp_lun = spdk_scsi_dev_get_first_lun(dev); tmp_lun != NULL;
|
||||
tmp_lun = spdk_scsi_dev_get_next_lun(tmp_lun)) {
|
||||
if (alloc_len - (hlen + len) < 8) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
fmt_lun = spdk_scsi_lun_id_int_to_fmt(i);
|
||||
fmt_lun = spdk_scsi_lun_id_int_to_fmt(tmp_lun->id);
|
||||
|
||||
/* LUN */
|
||||
to_be64(&data[hlen + len], fmt_lun);
|
||||
|
@ -120,6 +120,12 @@ DEFINE_STUB_V(scsi_lun_complete_reset_task,
|
||||
|
||||
DEFINE_STUB(spdk_scsi_lun_id_int_to_fmt, uint64_t, (int lun_id), 0);
|
||||
|
||||
DEFINE_STUB(spdk_scsi_dev_get_first_lun, struct spdk_scsi_lun *,
|
||||
(struct spdk_scsi_dev *dev), NULL);
|
||||
|
||||
DEFINE_STUB(spdk_scsi_dev_get_next_lun, struct spdk_scsi_lun *,
|
||||
(struct spdk_scsi_lun *prev_lun), NULL);
|
||||
|
||||
static void
|
||||
ut_put_task(struct spdk_scsi_task *task)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user