[PATCH 2/6] Convert nodeGetInfo to virArch APIs

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

 



From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

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

Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
 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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]