Convert SCSI logical unit from unsigned int to unsigned long long

The SCSI Architecture Model defines a logical unit address
as 64-bits in length, so change the field accordingly so
that the entire value could be stored.

Signed-off-by: Eric Farman <farman@linux.vnet.ibm.com>
This commit is contained in:
Eric Farman 2015-06-16 23:29:53 -04:00 committed by John Ferlan
parent 3b7983ad6d
commit 22b8a61756
10 changed files with 26 additions and 26 deletions

View File

@ -427,7 +427,7 @@ virDomainAuditHostdev(virDomainObjPtr vm, virDomainHostdevDefPtr hostdev,
} else { } else {
virDomainHostdevSubsysSCSIHostPtr scsihostsrc = virDomainHostdevSubsysSCSIHostPtr scsihostsrc =
&scsisrc->u.host; &scsisrc->u.host;
if (virAsprintfQuiet(&address, "%s:%u:%u:%u", if (virAsprintfQuiet(&address, "%s:%u:%u:%llu",
scsihostsrc->adapter, scsihostsrc->bus, scsihostsrc->adapter, scsihostsrc->bus,
scsihostsrc->target, scsihostsrc->target,
scsihostsrc->unit) < 0) { scsihostsrc->unit) < 0) {

View File

@ -5037,7 +5037,7 @@ virDomainHostdevSubsysSCSIHostDefParseXML(xmlNodePtr sourcenode,
goto cleanup; goto cleanup;
} }
if (virStrToLong_uip(unit, NULL, 0, &scsihostsrc->unit) < 0) { if (virStrToLong_ullp(unit, NULL, 0, &scsihostsrc->unit) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse unit '%s'"), unit); _("cannot parse unit '%s'"), unit);
goto cleanup; goto cleanup;
@ -19102,7 +19102,7 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf,
virBufferAsprintf(buf, "<adapter name='%s'/>\n", virBufferAsprintf(buf, "<adapter name='%s'/>\n",
scsihostsrc->adapter); scsihostsrc->adapter);
virBufferAsprintf(buf, virBufferAsprintf(buf,
"<address %sbus='%u' target='%u' unit='%u'/>\n", "<address %sbus='%u' target='%u' unit='%llu'/>\n",
includeTypeInAddr ? "type='scsi' " : "", includeTypeInAddr ? "type='scsi' " : "",
scsihostsrc->bus, scsihostsrc->target, scsihostsrc->bus, scsihostsrc->target,
scsihostsrc->unit); scsihostsrc->unit);

View File

@ -463,7 +463,7 @@ struct _virDomainHostdevSubsysSCSIHost {
char *adapter; char *adapter;
unsigned bus; unsigned bus;
unsigned target; unsigned target;
unsigned unit; unsigned long long unit;
}; };
typedef struct _virDomainHostdevSubsysSCSIiSCSI virDomainHostdevSubsysSCSIiSCSI; typedef struct _virDomainHostdevSubsysSCSIiSCSI virDomainHostdevSubsysSCSIiSCSI;

View File

@ -63,7 +63,7 @@ struct _qemuBuildCommandLineCallbacks {
const char *adapter, const char *adapter,
unsigned int bus, unsigned int bus,
unsigned int target, unsigned int target,
unsigned int unit); unsigned long long unit);
}; };
extern qemuBuildCommandLineCallbacks buildCommandLineCallbacks; extern qemuBuildCommandLineCallbacks buildCommandLineCallbacks;

View File

@ -1938,7 +1938,7 @@ qemuDomainAttachHostSCSIDevice(virConnectPtr conn,
} else { } else {
virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host; virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unable to prepare scsi hostdev: %s:%u:%u:%u"), _("Unable to prepare scsi hostdev: %s:%u:%u:%llu"),
scsihostsrc->adapter, scsihostsrc->bus, scsihostsrc->adapter, scsihostsrc->bus,
scsihostsrc->target, scsihostsrc->unit); scsihostsrc->target, scsihostsrc->unit);
} }
@ -3873,7 +3873,7 @@ int qemuDomainDetachHostDevice(virQEMUDriverPtr driver,
virDomainHostdevSubsysSCSIHostPtr scsihostsrc = virDomainHostdevSubsysSCSIHostPtr scsihostsrc =
&scsisrc->u.host; &scsisrc->u.host;
virReportError(VIR_ERR_OPERATION_FAILED, virReportError(VIR_ERR_OPERATION_FAILED,
_("host scsi device %s:%u:%u.%u not found"), _("host scsi device %s:%u:%u.%llu not found"),
scsihostsrc->adapter, scsihostsrc->bus, scsihostsrc->adapter, scsihostsrc->bus,
scsihostsrc->target, scsihostsrc->unit); scsihostsrc->target, scsihostsrc->unit);
} }

View File

@ -1482,7 +1482,7 @@ virHostdevReAttachSCSIHostDevices(virHostdevManagerPtr hostdev_mgr,
scsihostsrc->adapter, scsihostsrc->bus, scsihostsrc->adapter, scsihostsrc->bus,
scsihostsrc->target, scsihostsrc->unit, scsihostsrc->target, scsihostsrc->unit,
hostdev->readonly, hostdev->shareable))) { hostdev->readonly, hostdev->shareable))) {
VIR_WARN("Unable to reattach SCSI device %s:%u:%u:%u on domain %s", VIR_WARN("Unable to reattach SCSI device %s:%u:%u:%llu on domain %s",
scsihostsrc->adapter, scsihostsrc->bus, scsihostsrc->target, scsihostsrc->adapter, scsihostsrc->bus, scsihostsrc->target,
scsihostsrc->unit, dom_name); scsihostsrc->unit, dom_name);
return; return;
@ -1492,7 +1492,7 @@ virHostdevReAttachSCSIHostDevices(virHostdevManagerPtr hostdev_mgr,
* because qemuProcessStart could fail half way through. */ * because qemuProcessStart could fail half way through. */
if (!(tmp = virSCSIDeviceListFind(hostdev_mgr->activeSCSIHostdevs, scsi))) { if (!(tmp = virSCSIDeviceListFind(hostdev_mgr->activeSCSIHostdevs, scsi))) {
VIR_WARN("Unable to find device %s:%u:%u:%u " VIR_WARN("Unable to find device %s:%u:%u:%llu "
"in list of active SCSI devices", "in list of active SCSI devices",
scsihostsrc->adapter, scsihostsrc->bus, scsihostsrc->adapter, scsihostsrc->bus,
scsihostsrc->target, scsihostsrc->unit); scsihostsrc->target, scsihostsrc->unit);
@ -1500,7 +1500,7 @@ virHostdevReAttachSCSIHostDevices(virHostdevManagerPtr hostdev_mgr,
return; return;
} }
VIR_DEBUG("Removing %s:%u:%u:%u dom=%s from activeSCSIHostdevs", VIR_DEBUG("Removing %s:%u:%u:%llu dom=%s from activeSCSIHostdevs",
scsihostsrc->adapter, scsihostsrc->bus, scsihostsrc->target, scsihostsrc->adapter, scsihostsrc->bus, scsihostsrc->target,
scsihostsrc->unit, dom_name); scsihostsrc->unit, dom_name);

View File

@ -56,7 +56,7 @@ struct _virSCSIDevice {
unsigned int adapter; unsigned int adapter;
unsigned int bus; unsigned int bus;
unsigned int target; unsigned int target;
unsigned int unit; unsigned long long unit;
char *name; /* adapter:bus:target:unit */ char *name; /* adapter:bus:target:unit */
char *id; /* model:vendor */ char *id; /* model:vendor */
@ -110,7 +110,7 @@ virSCSIDeviceGetSgName(const char *sysfs_prefix,
const char *adapter, const char *adapter,
unsigned int bus, unsigned int bus,
unsigned int target, unsigned int target,
unsigned int unit) unsigned long long unit)
{ {
DIR *dir = NULL; DIR *dir = NULL;
struct dirent *entry; struct dirent *entry;
@ -123,7 +123,7 @@ virSCSIDeviceGetSgName(const char *sysfs_prefix,
return NULL; return NULL;
if (virAsprintf(&path, if (virAsprintf(&path,
"%s/%d:%u:%u:%u/scsi_generic", "%s/%d:%u:%u:%llu/scsi_generic",
prefix, adapter_id, bus, target, unit) < 0) prefix, adapter_id, bus, target, unit) < 0)
return NULL; return NULL;
@ -157,7 +157,7 @@ virSCSIDeviceGetDevName(const char *sysfs_prefix,
const char *adapter, const char *adapter,
unsigned int bus, unsigned int bus,
unsigned int target, unsigned int target,
unsigned int unit) unsigned long long unit)
{ {
DIR *dir = NULL; DIR *dir = NULL;
struct dirent *entry; struct dirent *entry;
@ -170,7 +170,7 @@ virSCSIDeviceGetDevName(const char *sysfs_prefix,
return NULL; return NULL;
if (virAsprintf(&path, if (virAsprintf(&path,
"%s/%d:%u:%u:%u/block", "%s/%d:%u:%u:%llu/block",
prefix, adapter_id, bus, target, unit) < 0) prefix, adapter_id, bus, target, unit) < 0)
return NULL; return NULL;
@ -200,7 +200,7 @@ virSCSIDeviceNew(const char *sysfs_prefix,
const char *adapter, const char *adapter,
unsigned int bus, unsigned int bus,
unsigned int target, unsigned int target,
unsigned int unit, unsigned long long unit,
bool readonly, bool readonly,
bool shareable) bool shareable)
{ {
@ -227,7 +227,7 @@ virSCSIDeviceNew(const char *sysfs_prefix,
if (virSCSIDeviceGetAdapterId(adapter, &dev->adapter) < 0) if (virSCSIDeviceGetAdapterId(adapter, &dev->adapter) < 0)
goto cleanup; goto cleanup;
if (virAsprintf(&dev->name, "%d:%u:%u:%u", dev->adapter, if (virAsprintf(&dev->name, "%d:%u:%u:%llu", dev->adapter,
dev->bus, dev->target, dev->unit) < 0 || dev->bus, dev->target, dev->unit) < 0 ||
virAsprintf(&dev->sg_path, "%s/%s", virAsprintf(&dev->sg_path, "%s/%s",
sysfs_prefix ? sysfs_prefix : "/dev", sg) < 0) sysfs_prefix ? sysfs_prefix : "/dev", sg) < 0)
@ -347,7 +347,7 @@ virSCSIDeviceGetTarget(virSCSIDevicePtr dev)
return dev->target; return dev->target;
} }
unsigned int unsigned long long
virSCSIDeviceGetUnit(virSCSIDevicePtr dev) virSCSIDeviceGetUnit(virSCSIDevicePtr dev)
{ {
return dev->unit; return dev->unit;

View File

@ -37,18 +37,18 @@ char *virSCSIDeviceGetSgName(const char *sysfs_prefix,
const char *adapter, const char *adapter,
unsigned int bus, unsigned int bus,
unsigned int target, unsigned int target,
unsigned int unit); unsigned long long unit);
char *virSCSIDeviceGetDevName(const char *sysfs_prefix, char *virSCSIDeviceGetDevName(const char *sysfs_prefix,
const char *adapter, const char *adapter,
unsigned int bus, unsigned int bus,
unsigned int target, unsigned int target,
unsigned int unit); unsigned long long unit);
virSCSIDevicePtr virSCSIDeviceNew(const char *sysfs_prefix, virSCSIDevicePtr virSCSIDeviceNew(const char *sysfs_prefix,
const char *adapter, const char *adapter,
unsigned int bus, unsigned int bus,
unsigned int target, unsigned int target,
unsigned int unit, unsigned long long unit,
bool readonly, bool readonly,
bool shareable); bool shareable);
@ -61,7 +61,7 @@ const char *virSCSIDeviceGetName(virSCSIDevicePtr dev);
unsigned int virSCSIDeviceGetAdapter(virSCSIDevicePtr dev); unsigned int virSCSIDeviceGetAdapter(virSCSIDevicePtr dev);
unsigned int virSCSIDeviceGetBus(virSCSIDevicePtr dev); unsigned int virSCSIDeviceGetBus(virSCSIDevicePtr dev);
unsigned int virSCSIDeviceGetTarget(virSCSIDevicePtr dev); unsigned int virSCSIDeviceGetTarget(virSCSIDevicePtr dev);
unsigned int virSCSIDeviceGetUnit(virSCSIDevicePtr dev); unsigned long long virSCSIDeviceGetUnit(virSCSIDevicePtr dev);
bool virSCSIDeviceGetReadonly(virSCSIDevicePtr dev); bool virSCSIDeviceGetReadonly(virSCSIDevicePtr dev);
bool virSCSIDeviceGetShareable(virSCSIDevicePtr dev); bool virSCSIDeviceGetShareable(virSCSIDevicePtr dev);

View File

@ -462,7 +462,7 @@ testSCSIDeviceGetSgName(const char *sysfs_prefix ATTRIBUTE_UNUSED,
const char *adapter ATTRIBUTE_UNUSED, const char *adapter ATTRIBUTE_UNUSED,
unsigned int bus ATTRIBUTE_UNUSED, unsigned int bus ATTRIBUTE_UNUSED,
unsigned int target ATTRIBUTE_UNUSED, unsigned int target ATTRIBUTE_UNUSED,
unsigned int unit ATTRIBUTE_UNUSED) unsigned long long unit ATTRIBUTE_UNUSED)
{ {
char *sg = NULL; char *sg = NULL;

View File

@ -415,7 +415,7 @@ struct PCIAddress {
struct SCSIAddress { struct SCSIAddress {
unsigned int controller; unsigned int controller;
unsigned int bus; unsigned int bus;
unsigned int unit; unsigned long long unit;
}; };
struct IDEAddress { struct IDEAddress {
@ -488,7 +488,7 @@ static int str2SCSIAddress(const char *str, struct SCSIAddress *scsiAddr)
return -1; return -1;
unit++; unit++;
if (virStrToLong_uip(unit, NULL, 0, &scsiAddr->unit) != 0) if (virStrToLong_ullp(unit, NULL, 0, &scsiAddr->unit) != 0)
return -1; return -1;
return 0; return 0;
@ -725,7 +725,7 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
if (diskAddr.type == DISK_ADDR_TYPE_SCSI) { if (diskAddr.type == DISK_ADDR_TYPE_SCSI) {
virBufferAsprintf(&buf, virBufferAsprintf(&buf,
"<address type='drive' controller='%u'" "<address type='drive' controller='%u'"
" bus='%u' unit='%u' />\n", " bus='%u' unit='%llu' />\n",
diskAddr.addr.scsi.controller, diskAddr.addr.scsi.bus, diskAddr.addr.scsi.controller, diskAddr.addr.scsi.bus,
diskAddr.addr.scsi.unit); diskAddr.addr.scsi.unit);
} else { } else {