diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index fd71e882586e2c6df65dbde5feea2f2dde1896c8..35cdbc32b1fa360900fc3eae0f93d39790c34c47 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2363,7 +2363,7 @@ void virDomainRedirdevDefFree(virDomainRedirdevDefPtr def) if (!def) return; - virDomainChrSourceDefFree(def->source.chr); + virDomainChrSourceDefFree(def->source); virDomainDeviceInfoClear(&def->info); VIR_FREE(def); @@ -12986,7 +12986,7 @@ virDomainRedirdevDefParseXML(virDomainXMLOptionPtr xmlopt, if (VIR_ALLOC(def) < 0) return NULL; - if (!(def->source.chr = virDomainChrSourceDefNew(xmlopt))) + if (!(def->source = virDomainChrSourceDefNew(xmlopt))) goto error; bus = virXMLPropString(node, "bus"); @@ -13002,7 +13002,7 @@ virDomainRedirdevDefParseXML(virDomainXMLOptionPtr xmlopt, type = virXMLPropString(node, "type"); if (type) { - if ((def->source.chr->type = virDomainChrTypeFromString(type)) < 0) { + if ((def->source->type = virDomainChrTypeFromString(type)) < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown redirdev character device type '%s'"), type); goto error; @@ -13017,13 +13017,13 @@ virDomainRedirdevDefParseXML(virDomainXMLOptionPtr xmlopt, /* boot gets parsed in virDomainDeviceInfoParseXML * source gets parsed in virDomainChrSourceDefParseXML * we don't know any of the elements that might remain */ - remaining = virDomainChrSourceDefParseXML(def->source.chr, cur, flags, + remaining = virDomainChrSourceDefParseXML(def->source, cur, flags, NULL, NULL, NULL, 0); if (remaining < 0) goto error; - if (def->source.chr->type == VIR_DOMAIN_CHR_TYPE_SPICEVMC) - def->source.chr->data.spicevmc = VIR_DOMAIN_CHR_SPICEVMC_USBREDIR; + if (def->source->type == VIR_DOMAIN_CHR_TYPE_SPICEVMC) + def->source->data.spicevmc = VIR_DOMAIN_CHR_SPICEVMC_USBREDIR; if (virDomainDeviceInfoParseXML(node, bootHash, &def->info, flags | VIR_DOMAIN_DEF_PARSE_ALLOW_BOOT) < 0) @@ -14853,8 +14853,7 @@ virDomainRedirdevDefFind(virDomainDefPtr def, if (redirdev->bus != tmp->bus) continue; - if (!virDomainChrSourceDefIsEqual(redirdev->source.chr, - tmp->source.chr)) + if (!virDomainChrSourceDefIsEqual(redirdev->source, tmp->source)) continue; if (redirdev->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && @@ -18670,12 +18669,12 @@ virDomainRedirdevDefCheckABIStability(virDomainRedirdevDefPtr src, switch ((virDomainRedirdevBus) src->bus) { case VIR_DOMAIN_REDIRDEV_BUS_USB: - if (src->source.chr->type != dst->source.chr->type) { + if (src->source->type != dst->source->type) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Target redirected device source type %s does " "not match source device source type %s"), - virDomainChrTypeToString(dst->source.chr->type), - virDomainChrTypeToString(src->source.chr->type)); + virDomainChrTypeToString(dst->source->type), + virDomainChrTypeToString(src->source->type)); return false; } break; @@ -22748,7 +22747,7 @@ virDomainRedirdevDefFormat(virBufferPtr buf, virBufferAsprintf(buf, "source.chr, false, flags) < 0) + if (virDomainChrSourceDefFormat(buf, NULL, def->source, false, flags) < 0) return -1; if (virDomainDeviceInfoFormat(buf, &def->info, flags | VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT) < 0) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 36c2fa5598fef5c71a9fb15cf59b03bc980d04d1..7fc11413226fdbd5bf77f86d0170d2f86bfffb4c 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1517,9 +1517,7 @@ typedef enum { struct _virDomainRedirdevDef { int bus; /* enum virDomainRedirdevBus */ - union { - virDomainChrSourceDefPtr chr; - } source; + virDomainChrSourceDefPtr source; virDomainDeviceInfo info; /* Guest address */ }; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 167ab66094102be99ed0c9f20a2139bfde3b3de3..5713d182a795da747311a10cbd6168bb848e0f4c 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -8833,7 +8833,7 @@ qemuBuildRedirdevCommandLine(virLogManagerPtr logManager, char *devstr; if (!(devstr = qemuBuildChrChardevStr(logManager, cmd, cfg, def, - redirdev->source.chr, + redirdev->source, redirdev->info.alias, qemuCaps, true))) { return -1; diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 95b2f2a8ef2d430497b236a9ac027ca77dfe45d4..706b736b34bf883109a47d76f40e148b215cecca 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1529,7 +1529,7 @@ int qemuDomainAttachRedirdevDevice(virQEMUDriverPtr driver, if (VIR_REALLOC_N(def->redirdevs, def->nredirdevs+1) < 0) goto cleanup; - if (qemuDomainGetChardevTLSObjects(cfg, priv, redirdev->source.chr, + if (qemuDomainGetChardevTLSObjects(cfg, priv, redirdev->source, charAlias, &tlsProps, &tlsAlias) < 0) goto cleanup; @@ -1545,7 +1545,7 @@ int qemuDomainAttachRedirdevDevice(virQEMUDriverPtr driver, if (qemuMonitorAttachCharDev(priv->mon, charAlias, - redirdev->source.chr) < 0) + redirdev->source) < 0) goto exit_monitor; chardevAdded = true;