From beb9dd9cd90a38d1de10ed133a444f5c67938de1 Mon Sep 17 00:00:00 2001 From: Chuck Short Date: Thu, 26 Jul 2012 08:32:07 -0500 Subject: [PATCH] ARMHF: implement /proc/cpuinfo parsing Minimal CPU "parser" for armhf to avoid compile time warning. Signed-off-by: Chuck Short (cherry picked from commit 2d0a777b3dc16cd85eac95d7b52c36b16c7a1d2c) --- AUTHORS | 1 + src/nodeinfo.c | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/AUTHORS b/AUTHORS index 75b316c30e..0b818b0709 100644 --- a/AUTHORS +++ b/AUTHORS @@ -266,6 +266,7 @@ Patches have also been contributed by: Paul Eggert Dwight Engen liguang + Chuck Short [....send patches to get your name here....] diff --git a/src/nodeinfo.c b/src/nodeinfo.c index 021eb054eb..4cbfe636f2 100644 --- a/src/nodeinfo.c +++ b/src/nodeinfo.c @@ -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, -- GitLab