~ubuntu-branches/ubuntu/quantal/libvirt/quantal

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Description: Fix compile warning about armhf /proc/cpuinfo
Author: Chuck Short <zulcss@ubuntu.com>
Forwarded: No
--- libvirt-0.9.13.orig/src/nodeinfo.c
+++ libvirt-0.9.13/src/nodeinfo.c
@@ -315,6 +315,27 @@ int linuxNodeInfoCPUPopulate(FILE *cpuin
              * 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,