vhost/scsi: Use spdk_scsi_dev_get_first/next_lun() to iterate LUNs.
This is the same effort as lib/iscsi. By using spdk_scsi_dev_get_first_lun() and spdk_scsi_dev_get_next_lun(), remove the dependency on SPDK_SCSI_DEV_MAX_LUN from lib/vhost. Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: Ib79d2c3f8e7a5027d3d2c03f8f886c588b86009b Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9611 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
8e5be84a82
commit
9fcee8bc37
@ -1527,7 +1527,6 @@ vhost_scsi_dump_info_json(struct spdk_vhost_dev *vdev, struct spdk_json_write_ct
|
|||||||
struct spdk_scsi_dev *sdev;
|
struct spdk_scsi_dev *sdev;
|
||||||
struct spdk_scsi_lun *lun;
|
struct spdk_scsi_lun *lun;
|
||||||
uint32_t dev_idx;
|
uint32_t dev_idx;
|
||||||
uint32_t lun_idx;
|
|
||||||
|
|
||||||
assert(vdev != NULL);
|
assert(vdev != NULL);
|
||||||
spdk_json_write_named_array_begin(w, "scsi");
|
spdk_json_write_named_array_begin(w, "scsi");
|
||||||
@ -1547,12 +1546,8 @@ vhost_scsi_dump_info_json(struct spdk_vhost_dev *vdev, struct spdk_json_write_ct
|
|||||||
|
|
||||||
spdk_json_write_named_array_begin(w, "luns");
|
spdk_json_write_named_array_begin(w, "luns");
|
||||||
|
|
||||||
for (lun_idx = 0; lun_idx < SPDK_SCSI_DEV_MAX_LUN; lun_idx++) {
|
for (lun = spdk_scsi_dev_get_first_lun(sdev); lun != NULL;
|
||||||
lun = spdk_scsi_dev_get_lun(sdev, lun_idx);
|
lun = spdk_scsi_dev_get_next_lun(lun)) {
|
||||||
if (!lun) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
spdk_json_write_object_begin(w);
|
spdk_json_write_object_begin(w);
|
||||||
|
|
||||||
spdk_json_write_named_int32(w, "id", spdk_scsi_lun_get_id(lun));
|
spdk_json_write_named_int32(w, "id", spdk_scsi_lun_get_id(lun));
|
||||||
|
Loading…
Reference in New Issue
Block a user