diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c
index 89870443836234aece73c96ca9895748bf0d1e99..2a5582dd2b43f8212821040837dbf11db939558a 100644
--- a/src/conf/domain_audit.c
+++ b/src/conf/domain_audit.c
@@ -427,7 +427,7 @@ virDomainAuditHostdev(virDomainObjPtr vm, virDomainHostdevDefPtr hostdev,
} else {
virDomainHostdevSubsysSCSIHostPtr scsihostsrc =
&scsisrc->u.host;
- if (virAsprintfQuiet(&address, "%s:%u:%u:%u",
+ if (virAsprintfQuiet(&address, "%s:%u:%u:%llu",
scsihostsrc->adapter, scsihostsrc->bus,
scsihostsrc->target,
scsihostsrc->unit) < 0) {
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index a05fc5fdf173f3551166c43819b92c3e5386414a..e592adfa9cc66bd3d039bcd8f8350dd67d23f5b4 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -5037,7 +5037,7 @@ virDomainHostdevSubsysSCSIHostDefParseXML(xmlNodePtr sourcenode,
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,
_("cannot parse unit '%s'"), unit);
goto cleanup;
@@ -19102,7 +19102,7 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf,
virBufferAsprintf(buf, "\n",
scsihostsrc->adapter);
virBufferAsprintf(buf,
- "
\n",
+ "\n",
includeTypeInAddr ? "type='scsi' " : "",
scsihostsrc->bus, scsihostsrc->target,
scsihostsrc->unit);
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 3fd82fa66f9bd8bd61970c175dd75991f084128e..c96a6e420f6429e7f2223b244981dc58af703925 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -463,7 +463,7 @@ struct _virDomainHostdevSubsysSCSIHost {
char *adapter;
unsigned bus;
unsigned target;
- unsigned unit;
+ unsigned long long unit;
};
typedef struct _virDomainHostdevSubsysSCSIiSCSI virDomainHostdevSubsysSCSIiSCSI;
diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h
index 0fc59a84905bac4755e712eefb26b8261c87a942..6e0c3a37c0038296ebf25eb02be77c07bf692099 100644
--- a/src/qemu/qemu_command.h
+++ b/src/qemu/qemu_command.h
@@ -63,7 +63,7 @@ struct _qemuBuildCommandLineCallbacks {
const char *adapter,
unsigned int bus,
unsigned int target,
- unsigned int unit);
+ unsigned long long unit);
};
extern qemuBuildCommandLineCallbacks buildCommandLineCallbacks;
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 01dc7768ff4b3678a9ad196e53530480d1ad4c5e..062896415ed2b57201b9a103104e89043121db4b 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1938,7 +1938,7 @@ qemuDomainAttachHostSCSIDevice(virConnectPtr conn,
} else {
virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
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->target, scsihostsrc->unit);
}
@@ -3873,7 +3873,7 @@ int qemuDomainDetachHostDevice(virQEMUDriverPtr driver,
virDomainHostdevSubsysSCSIHostPtr scsihostsrc =
&scsisrc->u.host;
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->target, scsihostsrc->unit);
}
diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c
index e35ad48b0104fa26f13bf8a48daf6c9e3ad7dd13..809caeda392525f33a539db5a3ddf008ae7646dc 100644
--- a/src/util/virhostdev.c
+++ b/src/util/virhostdev.c
@@ -1482,7 +1482,7 @@ virHostdevReAttachSCSIHostDevices(virHostdevManagerPtr hostdev_mgr,
scsihostsrc->adapter, scsihostsrc->bus,
scsihostsrc->target, scsihostsrc->unit,
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->unit, dom_name);
return;
@@ -1492,7 +1492,7 @@ virHostdevReAttachSCSIHostDevices(virHostdevManagerPtr hostdev_mgr,
* because qemuProcessStart could fail half way through. */
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",
scsihostsrc->adapter, scsihostsrc->bus,
scsihostsrc->target, scsihostsrc->unit);
@@ -1500,7 +1500,7 @@ virHostdevReAttachSCSIHostDevices(virHostdevManagerPtr hostdev_mgr,
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->unit, dom_name);
diff --git a/src/util/virscsi.c b/src/util/virscsi.c
index 288eb324012231915dc54c6c71b441b6b2fe9c6d..66b901791b5961e75de3ef4a2ebc21609d6164a8 100644
--- a/src/util/virscsi.c
+++ b/src/util/virscsi.c
@@ -56,7 +56,7 @@ struct _virSCSIDevice {
unsigned int adapter;
unsigned int bus;
unsigned int target;
- unsigned int unit;
+ unsigned long long unit;
char *name; /* adapter:bus:target:unit */
char *id; /* model:vendor */
@@ -110,7 +110,7 @@ virSCSIDeviceGetSgName(const char *sysfs_prefix,
const char *adapter,
unsigned int bus,
unsigned int target,
- unsigned int unit)
+ unsigned long long unit)
{
DIR *dir = NULL;
struct dirent *entry;
@@ -123,7 +123,7 @@ virSCSIDeviceGetSgName(const char *sysfs_prefix,
return NULL;
if (virAsprintf(&path,
- "%s/%d:%u:%u:%u/scsi_generic",
+ "%s/%d:%u:%u:%llu/scsi_generic",
prefix, adapter_id, bus, target, unit) < 0)
return NULL;
@@ -157,7 +157,7 @@ virSCSIDeviceGetDevName(const char *sysfs_prefix,
const char *adapter,
unsigned int bus,
unsigned int target,
- unsigned int unit)
+ unsigned long long unit)
{
DIR *dir = NULL;
struct dirent *entry;
@@ -170,7 +170,7 @@ virSCSIDeviceGetDevName(const char *sysfs_prefix,
return NULL;
if (virAsprintf(&path,
- "%s/%d:%u:%u:%u/block",
+ "%s/%d:%u:%u:%llu/block",
prefix, adapter_id, bus, target, unit) < 0)
return NULL;
@@ -200,7 +200,7 @@ virSCSIDeviceNew(const char *sysfs_prefix,
const char *adapter,
unsigned int bus,
unsigned int target,
- unsigned int unit,
+ unsigned long long unit,
bool readonly,
bool shareable)
{
@@ -227,7 +227,7 @@ virSCSIDeviceNew(const char *sysfs_prefix,
if (virSCSIDeviceGetAdapterId(adapter, &dev->adapter) < 0)
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 ||
virAsprintf(&dev->sg_path, "%s/%s",
sysfs_prefix ? sysfs_prefix : "/dev", sg) < 0)
@@ -347,7 +347,7 @@ virSCSIDeviceGetTarget(virSCSIDevicePtr dev)
return dev->target;
}
-unsigned int
+unsigned long long
virSCSIDeviceGetUnit(virSCSIDevicePtr dev)
{
return dev->unit;
diff --git a/src/util/virscsi.h b/src/util/virscsi.h
index c67837f145fab8158a52457f5c9604b7f67e679f..df40d7f62fe0477222fec9601b438d0ba1d765b9 100644
--- a/src/util/virscsi.h
+++ b/src/util/virscsi.h
@@ -37,18 +37,18 @@ char *virSCSIDeviceGetSgName(const char *sysfs_prefix,
const char *adapter,
unsigned int bus,
unsigned int target,
- unsigned int unit);
+ unsigned long long unit);
char *virSCSIDeviceGetDevName(const char *sysfs_prefix,
const char *adapter,
unsigned int bus,
unsigned int target,
- unsigned int unit);
+ unsigned long long unit);
virSCSIDevicePtr virSCSIDeviceNew(const char *sysfs_prefix,
const char *adapter,
unsigned int bus,
unsigned int target,
- unsigned int unit,
+ unsigned long long unit,
bool readonly,
bool shareable);
@@ -61,7 +61,7 @@ const char *virSCSIDeviceGetName(virSCSIDevicePtr dev);
unsigned int virSCSIDeviceGetAdapter(virSCSIDevicePtr dev);
unsigned int virSCSIDeviceGetBus(virSCSIDevicePtr dev);
unsigned int virSCSIDeviceGetTarget(virSCSIDevicePtr dev);
-unsigned int virSCSIDeviceGetUnit(virSCSIDevicePtr dev);
+unsigned long long virSCSIDeviceGetUnit(virSCSIDevicePtr dev);
bool virSCSIDeviceGetReadonly(virSCSIDevicePtr dev);
bool virSCSIDeviceGetShareable(virSCSIDevicePtr dev);
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index d067bca2a1ccdbebafd024419c08e045b51f07b4..ceaabb6a240a4254307373efdb8e07498aae8cbd 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -462,7 +462,7 @@ testSCSIDeviceGetSgName(const char *sysfs_prefix ATTRIBUTE_UNUSED,
const char *adapter ATTRIBUTE_UNUSED,
unsigned int bus ATTRIBUTE_UNUSED,
unsigned int target ATTRIBUTE_UNUSED,
- unsigned int unit ATTRIBUTE_UNUSED)
+ unsigned long long unit ATTRIBUTE_UNUSED)
{
char *sg = NULL;
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index cbaf954b66e9c1521d08cd00ebc47c82880464f1..baf4fa3a967103907173dd7fc21d012003f37373 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -415,7 +415,7 @@ struct PCIAddress {
struct SCSIAddress {
unsigned int controller;
unsigned int bus;
- unsigned int unit;
+ unsigned long long unit;
};
struct IDEAddress {
@@ -488,7 +488,7 @@ static int str2SCSIAddress(const char *str, struct SCSIAddress *scsiAddr)
return -1;
unit++;
- if (virStrToLong_uip(unit, NULL, 0, &scsiAddr->unit) != 0)
+ if (virStrToLong_ullp(unit, NULL, 0, &scsiAddr->unit) != 0)
return -1;
return 0;
@@ -725,7 +725,7 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
if (diskAddr.type == DISK_ADDR_TYPE_SCSI) {
virBufferAsprintf(&buf,
"\n",
+ " bus='%u' unit='%llu' />\n",
diskAddr.addr.scsi.controller, diskAddr.addr.scsi.bus,
diskAddr.addr.scsi.unit);
} else {