[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 2/6] Convert nodeGetInfo to virArch APIs



From: "Daniel P. Berrange" <berrange redhat com>

Replace use of uname in nodeGetInfo with virArch APIs to
provide canonicalization of host architecture name

Signed-off-by: Daniel P. Berrange <berrange redhat com>
---
 src/nodeinfo.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index 096000b..89322a4 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -47,6 +47,7 @@
 #include "virterror_internal.h"
 #include "count-one-bits.h"
 #include "intprops.h"
+#include "virarch.h"
 #include "virfile.h"
 #include "virtypedparam.h"
 
@@ -841,13 +842,11 @@ error:
 }
 #endif
 
-int nodeGetInfo(virConnectPtr conn ATTRIBUTE_UNUSED, virNodeInfoPtr nodeinfo) {
-    struct utsname info;
-
-    memset(nodeinfo, 0, sizeof(*nodeinfo));
-    uname(&info);
+int nodeGetInfo(virConnectPtr conn ATTRIBUTE_UNUSED, virNodeInfoPtr nodeinfo)
+{
+    virArch hostarch = virArchFromHost();
 
-    if (virStrcpyStatic(nodeinfo->model, info.machine) == NULL)
+    if (virStrcpyStatic(nodeinfo->model, virArchToString(hostarch)) == NULL)
         return -1;
 
 #ifdef __linux__
-- 
1.7.11.7


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]