Re: [PATCH] ARMHF: Fixed Parser for /proc/cpuinfo needs to be adapted for your architecture

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

 



On 07/26/2012 07:32 AM, Chuck Short wrote:

Eeek - I let two months go by without reviewing this.  My apologies.

> Minimal CPU "parser" for armhf to avoid compile time warning.
> 
> Signed-off-by: Chuck Short <chuck.short@xxxxxxxxxxxxx>
> ---
>  src/nodeinfo.c |   21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)

ACK, and will push shortly once I validate that it passes tests.

> 
> diff --git a/src/nodeinfo.c b/src/nodeinfo.c
> index 84a5d66..358fa3b 100644
> --- a/src/nodeinfo.c
> +++ b/src/nodeinfo.c
> @@ -397,6 +397,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,
> --
> 1.7.10.4
> 
> --
> libvir-list mailing list
> libvir-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvir-list
> 
> 

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
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]