mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
Fix build in qemu_capabilities
Commit f05b6a91 added virQEMUDriverConfigPtr argument to the virQEMUCapsFillDomainCaps function and it uses forward declaration of virQEMUDriverConfig and virQEMUDriverConfigPtr that casues clang build to fail: gmake[3]: Entering directory `/usr/home/novel/code/libvirt/src' CC qemu/libvirt_driver_qemu_impl_la-qemu_capabilities.lo In file included from qemu/qemu_capabilities.c:43: In file included from qemu/qemu_hostdev.h:27: qemu/qemu_conf.h:63:37: error: redefinition of typedef 'virQEMUDriverConfig' is a C11 feature [-Werror,-Wtypedef-redefinition] typedef struct _virQEMUDriverConfig virQEMUDriverConfig; ^ qemu/qemu_capabilities.h:328:37: note: previous definition is here typedef struct _virQEMUDriverConfig virQEMUDriverConfig; ^ Fix that by passing loader and nloader config attributes directly instead of passing complete config.
This commit is contained in:
parent
d0d344cfdb
commit
3b3947ea37
@ -3610,43 +3610,44 @@ virQEMUCapsGetDefaultMachine(virQEMUCapsPtr qemuCaps)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
virQEMUCapsFillDomainLoaderCaps(virQEMUCapsPtr qemuCaps,
|
virQEMUCapsFillDomainLoaderCaps(virQEMUCapsPtr qemuCaps,
|
||||||
virDomainCapsLoaderPtr loader,
|
virDomainCapsLoaderPtr capsLoader,
|
||||||
virArch arch,
|
virArch arch,
|
||||||
virQEMUDriverConfigPtr cfg)
|
char **loader,
|
||||||
|
size_t nloader)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
loader->device.supported = true;
|
capsLoader->device.supported = true;
|
||||||
|
|
||||||
if (VIR_ALLOC_N(loader->values.values, cfg->nloader) < 0)
|
if (VIR_ALLOC_N(capsLoader->values.values, nloader) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
for (i = 0; i < cfg->nloader; i++) {
|
for (i = 0; i < nloader; i++) {
|
||||||
const char *filename = cfg->loader[i];
|
const char *filename = loader[i];
|
||||||
|
|
||||||
if (!virFileExists(filename)) {
|
if (!virFileExists(filename)) {
|
||||||
VIR_DEBUG("loader filename=%s does not exist", filename);
|
VIR_DEBUG("loader filename=%s does not exist", filename);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VIR_STRDUP(loader->values.values[loader->values.nvalues],
|
if (VIR_STRDUP(capsLoader->values.values[capsLoader->values.nvalues],
|
||||||
filename) < 0)
|
filename) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
loader->values.nvalues++;
|
capsLoader->values.nvalues++;
|
||||||
}
|
}
|
||||||
|
|
||||||
VIR_DOMAIN_CAPS_ENUM_SET(loader->type,
|
VIR_DOMAIN_CAPS_ENUM_SET(capsLoader->type,
|
||||||
VIR_DOMAIN_LOADER_TYPE_ROM);
|
VIR_DOMAIN_LOADER_TYPE_ROM);
|
||||||
|
|
||||||
if (arch == VIR_ARCH_X86_64 &&
|
if (arch == VIR_ARCH_X86_64 &&
|
||||||
virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE) &&
|
virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE) &&
|
||||||
virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_FORMAT))
|
virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_FORMAT))
|
||||||
VIR_DOMAIN_CAPS_ENUM_SET(loader->type,
|
VIR_DOMAIN_CAPS_ENUM_SET(capsLoader->type,
|
||||||
VIR_DOMAIN_LOADER_TYPE_PFLASH);
|
VIR_DOMAIN_LOADER_TYPE_PFLASH);
|
||||||
|
|
||||||
|
|
||||||
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_READONLY))
|
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_READONLY))
|
||||||
VIR_DOMAIN_CAPS_ENUM_SET(loader->readonly,
|
VIR_DOMAIN_CAPS_ENUM_SET(capsLoader->readonly,
|
||||||
VIR_TRISTATE_BOOL_YES,
|
VIR_TRISTATE_BOOL_YES,
|
||||||
VIR_TRISTATE_BOOL_NO);
|
VIR_TRISTATE_BOOL_NO);
|
||||||
return 0;
|
return 0;
|
||||||
@ -3657,12 +3658,14 @@ static int
|
|||||||
virQEMUCapsFillDomainOSCaps(virQEMUCapsPtr qemuCaps,
|
virQEMUCapsFillDomainOSCaps(virQEMUCapsPtr qemuCaps,
|
||||||
virDomainCapsOSPtr os,
|
virDomainCapsOSPtr os,
|
||||||
virArch arch,
|
virArch arch,
|
||||||
virQEMUDriverConfigPtr cfg)
|
char **loader,
|
||||||
|
size_t nloader)
|
||||||
{
|
{
|
||||||
virDomainCapsLoaderPtr loader = &os->loader;
|
virDomainCapsLoaderPtr capsLoader = &os->loader;
|
||||||
|
|
||||||
os->device.supported = true;
|
os->device.supported = true;
|
||||||
if (virQEMUCapsFillDomainLoaderCaps(qemuCaps, loader, arch, cfg) < 0)
|
if (virQEMUCapsFillDomainLoaderCaps(qemuCaps, capsLoader, arch,
|
||||||
|
loader, nloader) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -3747,7 +3750,8 @@ virQEMUCapsFillDomainDeviceHostdevCaps(virQEMUCapsPtr qemuCaps,
|
|||||||
int
|
int
|
||||||
virQEMUCapsFillDomainCaps(virDomainCapsPtr domCaps,
|
virQEMUCapsFillDomainCaps(virDomainCapsPtr domCaps,
|
||||||
virQEMUCapsPtr qemuCaps,
|
virQEMUCapsPtr qemuCaps,
|
||||||
virQEMUDriverConfigPtr cfg)
|
char **loader,
|
||||||
|
size_t nloader)
|
||||||
{
|
{
|
||||||
virDomainCapsOSPtr os = &domCaps->os;
|
virDomainCapsOSPtr os = &domCaps->os;
|
||||||
virDomainCapsDeviceDiskPtr disk = &domCaps->disk;
|
virDomainCapsDeviceDiskPtr disk = &domCaps->disk;
|
||||||
@ -3756,7 +3760,8 @@ virQEMUCapsFillDomainCaps(virDomainCapsPtr domCaps,
|
|||||||
|
|
||||||
domCaps->maxvcpus = maxvcpus;
|
domCaps->maxvcpus = maxvcpus;
|
||||||
|
|
||||||
if (virQEMUCapsFillDomainOSCaps(qemuCaps, os, domCaps->arch, cfg) < 0 ||
|
if (virQEMUCapsFillDomainOSCaps(qemuCaps, os, domCaps->arch,
|
||||||
|
loader, nloader) < 0 ||
|
||||||
virQEMUCapsFillDomainDeviceDiskCaps(qemuCaps, disk) < 0 ||
|
virQEMUCapsFillDomainDeviceDiskCaps(qemuCaps, disk) < 0 ||
|
||||||
virQEMUCapsFillDomainDeviceHostdevCaps(qemuCaps, hostdev) < 0)
|
virQEMUCapsFillDomainDeviceHostdevCaps(qemuCaps, hostdev) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -324,12 +324,9 @@ int virQEMUCapsInitGuestFromBinary(virCapsPtr caps,
|
|||||||
virQEMUCapsPtr kvmbinCaps,
|
virQEMUCapsPtr kvmbinCaps,
|
||||||
virArch guestarch);
|
virArch guestarch);
|
||||||
|
|
||||||
/* Forward declaration */
|
|
||||||
typedef struct _virQEMUDriverConfig virQEMUDriverConfig;
|
|
||||||
typedef virQEMUDriverConfig *virQEMUDriverConfigPtr;
|
|
||||||
|
|
||||||
int virQEMUCapsFillDomainCaps(virDomainCapsPtr domCaps,
|
int virQEMUCapsFillDomainCaps(virDomainCapsPtr domCaps,
|
||||||
virQEMUCapsPtr qemuCaps,
|
virQEMUCapsPtr qemuCaps,
|
||||||
virQEMUDriverConfigPtr cfg);
|
char **loader,
|
||||||
|
size_t nloader);
|
||||||
|
|
||||||
#endif /* __QEMU_CAPABILITIES_H__*/
|
#endif /* __QEMU_CAPABILITIES_H__*/
|
||||||
|
@ -17373,7 +17373,8 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn,
|
|||||||
if (!(domCaps = virDomainCapsNew(emulatorbin, machine, arch, virttype)))
|
if (!(domCaps = virDomainCapsNew(emulatorbin, machine, arch, virttype)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virQEMUCapsFillDomainCaps(domCaps, qemuCaps, cfg) < 0)
|
if (virQEMUCapsFillDomainCaps(domCaps, qemuCaps,
|
||||||
|
cfg->loader, cfg->nloader) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
ret = virDomainCapsFormat(domCaps);
|
ret = virDomainCapsFormat(domCaps);
|
||||||
|
@ -106,7 +106,8 @@ fillQemuCaps(virDomainCapsPtr domCaps,
|
|||||||
virQEMUCapsPtr qemuCaps = data->qemuCaps;
|
virQEMUCapsPtr qemuCaps = data->qemuCaps;
|
||||||
virQEMUDriverConfigPtr cfg = data->cfg;
|
virQEMUDriverConfigPtr cfg = data->cfg;
|
||||||
|
|
||||||
if (virQEMUCapsFillDomainCaps(domCaps, qemuCaps, cfg) < 0)
|
if (virQEMUCapsFillDomainCaps(domCaps, qemuCaps,
|
||||||
|
cfg->loader, cfg->nloader) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* The function above tries to query host's KVM & VFIO capabilities by
|
/* The function above tries to query host's KVM & VFIO capabilities by
|
||||||
|
Loading…
x
Reference in New Issue
Block a user