[libvirt] [PATCH] virt-host-validate: disable mntent code on Win32

Win32 does not have support for mntent.h header, so the method which uses this must be stubbed out. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- Pushed as a build fix for Mingw tools/virt-host-validate-common.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tools/virt-host-validate-common.c b/tools/virt-host-validate-common.c index a88fc56..dd41fd4 100644 --- a/tools/virt-host-validate-common.c +++ b/tools/virt-host-validate-common.c @@ -26,7 +26,9 @@ #include <stdio.h> #include <unistd.h> #include <sys/utsname.h> -#include <mntent.h> +#ifdef HAVE_MNTENT_H +# include <mntent.h> +#endif /* HAVE_MNTENT_H */ #include "virutil.h" #include "viralloc.h" @@ -287,6 +289,7 @@ static int virHostValidateCGroupSupport(const char *hvname, return -1; } +#ifdef HAVE_MNTENT_H static int virHostValidateCGroupMount(const char *hvname, const char *cg_name, virHostValidateLevel level) @@ -324,6 +327,16 @@ static int virHostValidateCGroupMount(const char *hvname, cg_name, cg_name); return -1; } +#else /* ! HAVE_MNTENT_H */ +static int virHostValidateCGroupMount(const char *hvname, + const char *cg_name, + virHostValidateLevel level) +{ + virHostMsgCheck(hvname, "for cgroup '%s' controller mount-point", cg_name); + virHostMsgFail(level, "%s", "This platform does not support cgroups"); + return -1; +} +#endif /* ! HAVE_MNTENT_H */ int virHostValidateCGroupController(const char *hvname, const char *cg_name, -- 2.4.3

On 10/12/2015 09:43 AM, Daniel P. Berrange wrote:
Win32 does not have support for mntent.h header, so the method which uses this must be stubbed out.
Tested on my AMD machine. Apparently kernels built by the Fedora build system at least have amd_iommu=on by default, so I couldn't check that, but when I disable VT-d in the BIOS, I get the proper WARN, and get success otherwise. ACK.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> ---
Pushed as a build fix for Mingw
tools/virt-host-validate-common.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/tools/virt-host-validate-common.c b/tools/virt-host-validate-common.c index a88fc56..dd41fd4 100644 --- a/tools/virt-host-validate-common.c +++ b/tools/virt-host-validate-common.c @@ -26,7 +26,9 @@ #include <stdio.h> #include <unistd.h> #include <sys/utsname.h> -#include <mntent.h> +#ifdef HAVE_MNTENT_H +# include <mntent.h> +#endif /* HAVE_MNTENT_H */
#include "virutil.h" #include "viralloc.h" @@ -287,6 +289,7 @@ static int virHostValidateCGroupSupport(const char *hvname, return -1; }
+#ifdef HAVE_MNTENT_H static int virHostValidateCGroupMount(const char *hvname, const char *cg_name, virHostValidateLevel level) @@ -324,6 +327,16 @@ static int virHostValidateCGroupMount(const char *hvname, cg_name, cg_name); return -1; } +#else /* ! HAVE_MNTENT_H */ +static int virHostValidateCGroupMount(const char *hvname, + const char *cg_name, + virHostValidateLevel level) +{ + virHostMsgCheck(hvname, "for cgroup '%s' controller mount-point", cg_name); + virHostMsgFail(level, "%s", "This platform does not support cgroups"); + return -1; +} +#endif /* ! HAVE_MNTENT_H */
int virHostValidateCGroupController(const char *hvname, const char *cg_name,
participants (2)
-
Daniel P. Berrange
-
Laine Stump