From 314d4265d153c59fd61ab45d669d806d448baf2b Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Fri, 5 Dec 2014 12:55:32 +0000 Subject: [PATCH] scst: Add 64-bit LUN support (kernel 3.17 - merge r5587 from trunk) git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/3.0.x@5924 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/dev_handlers/scst_tape.c | 6 +++--- scst/src/scst_main.c | 24 ++++++++++++------------ scst/src/scst_sysfs.c | 11 ++++++----- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/scst/src/dev_handlers/scst_tape.c b/scst/src/dev_handlers/scst_tape.c index 1d4b34faf..ec4e85bc8 100644 --- a/scst/src/dev_handlers/scst_tape.c +++ b/scst/src/dev_handlers/scst_tape.c @@ -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; diff --git a/scst/src/scst_main.c b/scst/src/scst_main.c index 858d39f0f..e89642510 100644 --- a/scst/src/scst_main.c +++ b/scst/src/scst_main.c @@ -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); diff --git a/scst/src/scst_sysfs.c b/scst/src/scst_sysfs.c index f87085045..16072fc86 100644 --- a/scst/src/scst_sysfs.c +++ b/scst/src/scst_sysfs.c @@ -5083,7 +5083,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(); @@ -5105,10 +5106,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) @@ -5125,13 +5126,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;