scst: Add support for 64-bit LUNs

The datatype of scsi_device.lun will be changed from u32 into u64
in the near future. Update SCST accordingly. These changes have
been implemented such that these are compatible with 32-bit and
64-bit LUNs.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5587 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2014-06-11 20:57:03 +00:00
parent 325efae944
commit 3f2485ede0
3 changed files with 21 additions and 20 deletions

View File

@@ -214,9 +214,9 @@ static int tape_attach(struct scst_device *dev)
mode = (buffer[2] & 0x70) >> 4;
speed = buffer[2] & 0x0f;
density = buffer[4];
TRACE_DBG("Tape: lun %d. bs %d. type 0x%02x mode 0x%02x "
"speed 0x%02x dens 0x%02x", dev->scsi_dev->lun,
dev->block_size, medium_type, mode, speed, density);
TRACE_DBG("Tape: lun %lld. bs %d. type 0x%02x mode 0x%02x "
"speed 0x%02x dens 0x%02x", (u64)dev->scsi_dev->lun,
dev->block_size, medium_type, mode, speed, density);
} else {
PRINT_ERROR("MODE_SENSE failed: %x", rc);
res = -ENODEV;

View File

@@ -1145,9 +1145,9 @@ static int scst_register_device(struct scsi_device *scsidp)
dev->type = scsidp->type;
dev->virt_name = kasprintf(GFP_KERNEL, "%d:%d:%d:%d",
scsidp->host->host_no,
scsidp->channel, scsidp->id, scsidp->lun);
dev->virt_name = kasprintf(GFP_KERNEL, "%d:%d:%d:%lld",
scsidp->host->host_no, scsidp->channel,
scsidp->id, (u64)scsidp->lun);
if (dev->virt_name == NULL) {
PRINT_ERROR("%s", "Unable to alloc device name");
res = -ENOMEM;
@@ -1190,9 +1190,9 @@ static int scst_register_device(struct scsi_device *scsidp)
goto out_del_unlocked;
#endif
PRINT_INFO("Attached to scsi%d, channel %d, id %d, lun %d, "
"type %d", scsidp->host->host_no, scsidp->channel,
scsidp->id, scsidp->lun, scsidp->type);
PRINT_INFO("Attached to scsi%d, channel %d, id %d, lun %lld, type %d",
scsidp->host->host_no, scsidp->channel, scsidp->id,
(u64)scsidp->lun, scsidp->type);
out:
TRACE_EXIT_RES(res);
@@ -1259,9 +1259,9 @@ static void scst_unregister_device(struct scsi_device *scsidp)
}
if (dev == NULL) {
PRINT_ERROR("SCST device for SCSI device %d:%d:%d:%d not found",
scsidp->host->host_no, scsidp->channel, scsidp->id,
scsidp->lun);
PRINT_ERROR("SCST device for SCSI device %d:%d:%d:%lld not found",
scsidp->host->host_no, scsidp->channel, scsidp->id,
(u64)scsidp->lun);
goto out_unlock;
}
@@ -1285,9 +1285,9 @@ static void scst_unregister_device(struct scsi_device *scsidp)
scst_dev_sysfs_del(dev);
PRINT_INFO("Detached from scsi%d, channel %d, id %d, lun %d, type %d",
scsidp->host->host_no, scsidp->channel, scsidp->id,
scsidp->lun, scsidp->type);
PRINT_INFO("Detached from scsi%d, channel %d, id %d, lun %lld, type %d",
scsidp->host->host_no, scsidp->channel, scsidp->id,
(u64)scsidp->lun, scsidp->type);
scst_free_device(dev);

View File

@@ -5081,7 +5081,8 @@ static int scst_process_devt_pass_through_mgmt_store(char *buffer,
{
int res = 0;
char *pp, *action, *devstr;
unsigned int host, channel, id, lun;
unsigned int host, channel, id;
u64 lun;
struct scst_device *d, *dev = NULL;
TRACE_ENTRY();
@@ -5103,10 +5104,10 @@ static int scst_process_devt_pass_through_mgmt_store(char *buffer,
goto out_syntax_err;
}
if (sscanf(devstr, "%u:%u:%u:%u", &host, &channel, &id, &lun) != 4)
if (sscanf(devstr, "%u:%u:%u:%llu", &host, &channel, &id, &lun) != 4)
goto out_syntax_err;
TRACE_DBG("Dev %d:%d:%d:%d", host, channel, id, lun);
TRACE_DBG("Dev %d:%d:%d:%lld", host, channel, id, lun);
res = mutex_lock_interruptible(&scst_mutex);
if (res != 0)
@@ -5123,13 +5124,13 @@ static int scst_process_devt_pass_through_mgmt_store(char *buffer,
d->scsi_dev->id == id &&
d->scsi_dev->lun == lun) {
dev = d;
TRACE_DBG("Dev %p (%d:%d:%d:%d) found",
TRACE_DBG("Dev %p (%d:%d:%d:%lld) found",
dev, host, channel, id, lun);
break;
}
}
if (dev == NULL) {
PRINT_ERROR("Device %d:%d:%d:%d not found",
PRINT_ERROR("Device %d:%d:%d:%lld not found",
host, channel, id, lun);
res = -EINVAL;
goto out_unlock;