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

« back to all changes in this revision

Viewing changes to debian/patches/add-armhf-cpuinfo-parser.patch

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-07-19 14:54:47 UTC
  • Revision ID: package-import@ubuntu.com-20120719145447-ksf59r7lsc2df56l
Tags: 0.9.13-0ubuntu4
* debian/patches/add-armhf-sysinfo-infomration.patch:
  Provides cpuinfo for armhf cpus.
* debian/patches/add-armhf-cpuinfo-parser.patch:
  Fixes compile time warning about armhf cpus.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Description: Fix compile warning about armhf /proc/cpuinfo
 
2
Author: Chuck Short <zulcss@ubuntu.com>
 
3
Forwarded: No
 
4
--- libvirt-0.9.13.orig/src/nodeinfo.c
 
5
+++ libvirt-0.9.13/src/nodeinfo.c
 
6
@@ -315,6 +315,27 @@ int linuxNodeInfoCPUPopulate(FILE *cpuin
 
7
              * and parsed in next iteration, because it is not in expected
 
8
              * format and thus lead to error. */
 
9
         }
 
10
+# elif defined(__arm__)
 
11
+         char *buf = line;
 
12
+         if (STRPREFIX(buf, "BogoMIPS")) {
 
13
+             char *p;
 
14
+             unsigned int ui;
 
15
 
16
+             buf += 8;
 
17
+             while (*buf && c_isspace(*buf))
 
18
+                 buf++;
 
19
+
 
20
+             if (*buf != ':' || !buf[1]) {
 
21
+               nodeReportError(VIR_ERR_INTERNAL_ERROR,
 
22
+                               "%s", _("parsing cpu MHz from cpuinfo"));
 
23
+               goto cleanup;
 
24
+            }
 
25
+
 
26
+           if (virStrToLong_ui(buf+1, &p, 10, &ui) == 0
 
27
+               /* Accept trailing fractional part.  */
 
28
+               && (*p == '\0' || *p == '.' || c_isspace(*p)))
 
29
+               nodeinfo->mhz = ui;
 
30
+         }
 
31
 # elif defined(__s390__) || \
 
32
       defined(__s390x__)
 
33
         /* s390x has no realistic value for CPU speed,