From eb41c9e15d76088b59569de8565361350f48745f Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 10 Feb 2015 13:03:18 +0000 Subject: [PATCH] scst: Add 64-bit LUN support (merge r5587 from trunk) git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@6041 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/dev_handlers/scst_tape.c | 4 ++-- scst/src/scst_main.c | 24 ++++++++++++------------ scst/src/scst_sysfs.c | 11 ++++++----- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/scst/src/dev_handlers/scst_tape.c b/scst/src/dev_handlers/scst_tape.c index 43707561a..effaba09e 100644 --- a/scst/src/dev_handlers/scst_tape.c +++ b/scst/src/dev_handlers/scst_tape.c @@ -228,8 +228,8 @@ 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, + TRACE_DBG("Tape: lun %lld. bs %d. type 0x%02x mode 0x%02x " + "speed 0x%02x dens 0x%02x", (u64)dev->scsi_dev->lun, params->block_size, medium_type, mode, speed, density); } else { PRINT_ERROR("MODE_SENSE failed: %x", rc); diff --git a/scst/src/scst_main.c b/scst/src/scst_main.c index d54613fd3..8ba50dda3 100644 --- a/scst/src/scst_main.c +++ b/scst/src/scst_main.c @@ -922,9 +922,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; @@ -967,9 +967,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); @@ -1036,9 +1036,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; } @@ -1062,9 +1062,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); diff --git a/scst/src/scst_sysfs.c b/scst/src/scst_sysfs.c index 7d70d9449..fb731b5fe 100644 --- a/scst/src/scst_sysfs.c +++ b/scst/src/scst_sysfs.c @@ -4620,7 +4620,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(); @@ -4642,10 +4643,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) @@ -4662,13 +4663,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;