]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
ARMHF: implement /proc/cpuinfo parsing
authorChuck Short <zulcss@gmail.com>
Thu, 26 Jul 2012 13:32:07 +0000 (08:32 -0500)
committerEric Blake <eblake@redhat.com>
Fri, 28 Sep 2012 15:25:12 +0000 (09:25 -0600)
Minimal CPU "parser" for armhf to avoid compile time warning.

Signed-off-by: Chuck Short <chuck.short@canonical.com>
AUTHORS
src/nodeinfo.c

diff --git a/AUTHORS b/AUTHORS
index 75b316c30e6e8ba50d0ee03094139cb8008c44b7..0b818b070902e0d5c152f3ba4ae525ce67cc670e 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -266,6 +266,7 @@ Patches have also been contributed by:
   Paul Eggert          <eggert@cs.ucla.edu>
   Dwight Engen         <dwight.engen@oracle.com>
   liguang              <lig.fnst@cn.fujitsu.com>
+  Chuck Short          <zulcss@gmail.com>
 
   [....send patches to get your name here....]
 
index 021eb054eb8906909dfc9b559cb9071bacfc96b2..4cbfe636f281544cfed167d12ff67863636c7bd4 100644 (file)
@@ -412,6 +412,27 @@ int linuxNodeInfoCPUPopulate(FILE *cpuinfo,
              * and parsed in next iteration, because it is not in expected
              * format and thus lead to error. */
         }
+# elif defined(__arm__)
+        char *buf = line;
+        if (STRPREFIX(buf, "BogoMIPS")) {
+            char *p;
+            unsigned int ui;
+
+            buf += 8;
+            while (*buf && c_isspace(*buf))
+                buf++;
+
+            if (*buf != ':' || !buf[1]) {
+                nodeReportError(VIR_ERR_INTERNAL_ERROR,
+                                "%s", _("parsing cpu MHz from cpuinfo"));
+                goto cleanup;
+            }
+
+            if (virStrToLong_ui(buf+1, &p, 10, &ui) == 0
+                /* Accept trailing fractional part.  */
+                && (*p == '\0' || *p == '.' || c_isspace(*p)))
+                nodeinfo->mhz = ui;
+        }
 # elif defined(__s390__) || \
       defined(__s390x__)
         /* s390x has no realistic value for CPU speed,