# HG changeset patch
# User john.levon(a)sun.com
# Date 1229367890 28800
# Node ID 6a8e82d7d2e166880fed8d7ad860a3e2e93d62be
# Parent c324c231c6a50be9f970f0f6c6d1629a7c09ab3b
Avoid GCC extensions
Anonymous unions are not portable, nor are zero-sizes structures.
Signed-off-by: John Levon <john.levon(a)sun.com>
diff --git a/src/domain_conf.c b/src/domain_conf.c
--- a/src/domain_conf.c
+++ b/src/domain_conf.c
@@ -1437,7 +1437,7 @@ virDomainHostdevSubsysUsbDefParseXML(vir
if (vendor) {
if (virStrToLong_ui(vendor, NULL, 0,
- &def->source.subsys.usb.vendor) < 0) {
+ &def->source.subsys.u.usb.vendor) < 0)
{
virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
_("cannot parse vendor id %s"), vendor);
VIR_FREE(vendor);
@@ -1454,7 +1454,7 @@ virDomainHostdevSubsysUsbDefParseXML(vir
if (product) {
if (virStrToLong_ui(product, NULL, 0,
- &def->source.subsys.usb.product) < 0)
{
+ &def->source.subsys.u.usb.product) < 0)
{
virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
_("cannot parse product %s"),
product);
VIR_FREE(product);
@@ -1472,7 +1472,7 @@ virDomainHostdevSubsysUsbDefParseXML(vir
bus = virXMLPropString(cur, "bus");
if (bus) {
if (virStrToLong_ui(bus, NULL, 0,
- &def->source.subsys.usb.bus) < 0) {
+ &def->source.subsys.u.usb.bus) < 0) {
virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
_("cannot parse bus %s"), bus);
VIR_FREE(bus);
@@ -1488,7 +1488,7 @@ virDomainHostdevSubsysUsbDefParseXML(vir
device = virXMLPropString(cur, "device");
if (device) {
if (virStrToLong_ui(device, NULL, 0,
- &def->source.subsys.usb.device) < 0)
{
+ &def->source.subsys.u.usb.device) < 0)
{
virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
_("cannot parse device %s"),
device);
@@ -1510,14 +1510,14 @@ virDomainHostdevSubsysUsbDefParseXML(vir
cur = cur->next;
}
- if (def->source.subsys.usb.vendor == 0 &&
- def->source.subsys.usb.product != 0) {
+ if (def->source.subsys.u.usb.vendor == 0 &&
+ def->source.subsys.u.usb.product != 0) {
virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
"%s", _("missing vendor"));
goto out;
}
- if (def->source.subsys.usb.vendor != 0 &&
- def->source.subsys.usb.product == 0) {
+ if (def->source.subsys.u.usb.vendor != 0 &&
+ def->source.subsys.u.usb.product == 0) {
virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
"%s", _("missing product"));
goto out;
@@ -2951,15 +2951,15 @@ virDomainHostdevDefFormat(virConnectPtr
virBufferVSprintf(buf, " <hostdev mode='%s'
type='%s'>\n", mode, type);
virBufferAddLit(buf, " <source>\n");
- if (def->source.subsys.usb.vendor) {
+ if (def->source.subsys.u.usb.vendor) {
virBufferVSprintf(buf, " <vendor
id='0x%.4x'/>\n",
- def->source.subsys.usb.vendor);
+ def->source.subsys.u.usb.vendor);
virBufferVSprintf(buf, " <product
id='0x%.4x'/>\n",
- def->source.subsys.usb.product);
+ def->source.subsys.u.usb.product);
} else {
virBufferVSprintf(buf, " <address bus='%d'
device='%d'/>\n",
- def->source.subsys.usb.bus,
- def->source.subsys.usb.device);
+ def->source.subsys.u.usb.bus,
+ def->source.subsys.u.usb.device);
}
virBufferAddLit(buf, " </source>\n");
diff --git a/src/domain_conf.h b/src/domain_conf.h
--- a/src/domain_conf.h
+++ b/src/domain_conf.h
@@ -307,12 +307,13 @@ struct _virDomainHostdevDef {
unsigned slot;
unsigned function;
} pci;
- };
+ } u;
} subsys;
struct {
/* TBD: struct capabilities see:
*
https://www.redhat.com/archives/libvir-list/2008-July/msg00429.html
*/
+ int dummy;
} caps;
} source;
char* target;
diff --git a/src/qemu_conf.c b/src/qemu_conf.c
--- a/src/qemu_conf.c
+++ b/src/qemu_conf.c
@@ -1264,15 +1264,15 @@ int qemudBuildCommandLine(virConnectPtr
if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB) {
- if(hostdev->source.subsys.usb.vendor) {
+ if(hostdev->source.subsys.u.usb.vendor) {
ret = asprintf(&usbdev, "host:%.4x:%.4x",
- hostdev->source.subsys.usb.vendor,
- hostdev->source.subsys.usb.product);
+ hostdev->source.subsys.u.usb.vendor,
+ hostdev->source.subsys.u.usb.product);
} else {
ret = asprintf(&usbdev, "host:%.3d.%.3d",
- hostdev->source.subsys.usb.bus,
- hostdev->source.subsys.usb.device);
+ hostdev->source.subsys.u.usb.bus,
+ hostdev->source.subsys.u.usb.device);
}
if (ret < 0) {
usbdev = NULL;
diff --git a/src/qemu_driver.c b/src/qemu_driver.c
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -2790,14 +2790,14 @@ static int qemudDomainAttachHostDevice(v
return -1;
}
- if (dev->data.hostdev->source.subsys.usb.vendor) {
+ if (dev->data.hostdev->source.subsys.u.usb.vendor) {
ret = asprintf(&cmd, "usb_add host:%.4x:%.4x",
- dev->data.hostdev->source.subsys.usb.vendor,
- dev->data.hostdev->source.subsys.usb.product);
+ dev->data.hostdev->source.subsys.u.usb.vendor,
+ dev->data.hostdev->source.subsys.u.usb.product);
} else {
ret = asprintf(&cmd, "usb_add host:%.3d.%.3d",
- dev->data.hostdev->source.subsys.usb.bus,
- dev->data.hostdev->source.subsys.usb.device);
+ dev->data.hostdev->source.subsys.u.usb.bus,
+ dev->data.hostdev->source.subsys.u.usb.device);
}
if (ret == -1) {
qemudReportError(dom->conn, NULL, NULL, VIR_ERR_NO_MEMORY, NULL);
diff --git a/src/remote_internal.c b/src/remote_internal.c
--- a/src/remote_internal.c
+++ b/src/remote_internal.c
@@ -649,7 +649,7 @@ doRemoteOpen (virConnectPtr conn,
if (username) nr_args += 2; /* For -l username */
if (no_tty) nr_args += 5; /* For -T -o BatchMode=yes -e none */
- command = command ? : strdup ("ssh");
+ command = command ? command : strdup ("ssh");
if (command == NULL)
goto out_of_memory;