qemu: Provide non-linux stub for qemuDomainAttachDeviceMknodRecursive

The way we create devices under /dev is highly linux specific.
For instance we do mknod(), mount(), umount(), etc. Some
platforms are even missing some of these functions. Then again,
as declared in qemuDomainNamespaceAvailable(): namespaces are
linux only. Therefore, to avoid obfuscating the code by trying to
make it compile on weird platforms, just provide a non-linux stub
for qemuDomainAttachDeviceMknodRecursive(). At the same time,
qemuDomainAttachDeviceMknodHelper() which actually calls the
non-existent functions is moved under ifdef __linux__ block since
its only caller is in that block too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
Michal Privoznik 2017-07-11 18:00:08 +02:00
parent fde654be53
commit a4d9c31eac

View File

@ -8542,6 +8542,8 @@ struct qemuDomainAttachDeviceMknodData {
};
/* Our way of creating devices is highly linux specific */
#if defined(__linux__)
static int
qemuDomainAttachDeviceMknodHelper(pid_t pid ATTRIBUTE_UNUSED,
void *opaque)
@ -8811,6 +8813,26 @@ qemuDomainAttachDeviceMknodRecursive(virQEMUDriverPtr driver,
}
#else /* !defined(__linux__) */
static int
qemuDomainAttachDeviceMknodRecursive(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
virDomainObjPtr vm ATTRIBUTE_UNUSED,
const char *file ATTRIBUTE_UNUSED,
char * const *devMountsPath ATTRIBUTE_UNUSED,
size_t ndevMountsPath ATTRIBUTE_UNUSED,
unsigned int ttl ATTRIBUTE_UNUSED)
{
virReportSystemError(ENOSYS, "%s",
_("Namespaces are not supported on this platform."));
return -1;
}
#endif /* !defined(__linux__) */
static int
qemuDomainAttachDeviceMknod(virQEMUDriverPtr driver,
virDomainObjPtr vm,