render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
7a3408
From 1693e23be444bd7adf9d65062cddb906855bbf24 Mon Sep 17 00:00:00 2001
7a3408
Message-Id: <1693e23be444bd7adf9d65062cddb906855bbf24@dist-git>
7a3408
From: Andrea Bolognani <abologna@redhat.com>
7a3408
Date: Wed, 5 Aug 2015 18:18:40 +0200
7a3408
Subject: [PATCH] nodeinfo: Fix build failure when KVM headers are not
7a3408
 available
7a3408
7a3408
Compiler error:
7a3408
7a3408
  ../../src/nodeinfo.c: In function 'nodeGetThreadsPerSubcore':
7a3408
  ../../src/nodeinfo.c:2393: error: label 'out' defined but not used [-Wunused-label]
7a3408
  ../../src/nodeinfo.c:2352: error: unused parameter 'arch' [-Wunused-parameter]
7a3408
7a3408
(cherry picked from commit 88c4c32af17adfc21b810b62b71de8b2d245fef9)
7a3408
7a3408
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1213713
7a3408
7a3408
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7a3408
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7a3408
---
7a3408
 src/nodeinfo.c | 17 ++++++++++++++---
7a3408
 1 file changed, 14 insertions(+), 3 deletions(-)
7a3408
7a3408
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
7a3408
index ec78f65..d662be5 100644
7a3408
--- a/src/nodeinfo.c
7a3408
+++ b/src/nodeinfo.c
7a3408
@@ -2340,6 +2340,8 @@ nodeAllocPages(unsigned int npages,
7a3408
     return ret;
7a3408
 }
7a3408
 
7a3408
+#if HAVE_LINUX_KVM_H && defined(KVM_CAP_PPC_SMT)
7a3408
+
7a3408
 /* Get the number of threads per subcore.
7a3408
  *
7a3408
  * This will be 2, 4 or 8 on POWER hosts, depending on the current
7a3408
@@ -2351,8 +2353,6 @@ int
7a3408
 nodeGetThreadsPerSubcore(virArch arch)
7a3408
 {
7a3408
     int threads_per_subcore = 0;
7a3408
-
7a3408
-#if HAVE_LINUX_KVM_H && defined(KVM_CAP_PPC_SMT)
7a3408
     const char *kvmpath = "/dev/kvm";
7a3408
     int kvmfd;
7a3408
 
7a3408
@@ -2387,8 +2387,19 @@ nodeGetThreadsPerSubcore(virArch arch)
7a3408
 
7a3408
         VIR_FORCE_CLOSE(kvmfd);
7a3408
     }
7a3408
-#endif /* HAVE_LINUX_KVM_H && defined(KVM_CAP_PPC_SMT) */
7a3408
 
7a3408
  out:
7a3408
     return threads_per_subcore;
7a3408
 }
7a3408
+
7a3408
+#else
7a3408
+
7a3408
+/* Fallback for nodeGetThreadsPerSubcore() used when KVM headers
7a3408
+ * are not available on the system */
7a3408
+int
7a3408
+nodeGetThreadsPerSubcore(virArch arch ATTRIBUTE_UNUSED)
7a3408
+{
7a3408
+    return 0;
7a3408
+}
7a3408
+
7a3408
+#endif /* HAVE_LINUX_KVM_H && defined(KVM_CAP_PPC_SMT) */
7a3408
-- 
7a3408
2.5.0
7a3408