Re: [libvirt] [PATCH v2 2/4] util: virhostcpu: factor out frequency parsing

2017-12-14 Thread Andrea Bolognani
On Thu, 2017-12-14 at 11:07 +0100, Pino Toscano wrote: > On Thursday, 14 December 2017 10:46:33 CET Andrea Bolognani wrote: > > On Wed, 2017-12-13 at 17:35 +0100, Pino Toscano wrote: > > > > +while (fgets(line, sizeof(line), cpuinfo) != NULL) { > > > > +if (!STRPREFIX(line, prefix)) > >

Re: [libvirt] [PATCH v2 2/4] util: virhostcpu: factor out frequency parsing

2017-12-14 Thread Pino Toscano
On Thursday, 14 December 2017 10:46:33 CET Andrea Bolognani wrote: > On Wed, 2017-12-13 at 17:35 +0100, Pino Toscano wrote: > > > +while (fgets(line, sizeof(line), cpuinfo) != NULL) { > > > +if (!STRPREFIX(line, prefix)) > > > +continue; > > > > IMHO here it would be a good

Re: [libvirt] [PATCH v2 2/4] util: virhostcpu: factor out frequency parsing

2017-12-14 Thread Andrea Bolognani
On Wed, 2017-12-13 at 17:35 +0100, Pino Toscano wrote: > > +if (!prefix) { > > +VIR_WARN("Parser for /proc/cpuinfo needs to be adapted for your > > architecture"); > > +return 1; > > I'd print the architecture in the warning, so sysadmins can see easily > which architecture it

Re: [libvirt] [PATCH v2 2/4] util: virhostcpu: factor out frequency parsing

2017-12-13 Thread Bjoern Walk
Pino Toscano [2017-12-13, 05:35PM +0100]: > On Wednesday, 13 December 2017 17:10:19 CET Andrea Bolognani wrote: > > From: Bjoern Walk > > > > All different architectures use the same copy-pasted code to parse > > processor frequency information from /proc/cpuinfo. Let's extract that > > code int

Re: [libvirt] [PATCH v2 2/4] util: virhostcpu: factor out frequency parsing

2017-12-13 Thread Pino Toscano
On Wednesday, 13 December 2017 17:10:19 CET Andrea Bolognani wrote: > From: Bjoern Walk > > All different architectures use the same copy-pasted code to parse > processor frequency information from /proc/cpuinfo. Let's extract that > code into a function to avoid repetition. > > We now also tole

[libvirt] [PATCH v2 2/4] util: virhostcpu: factor out frequency parsing

2017-12-13 Thread Andrea Bolognani
From: Bjoern Walk All different architectures use the same copy-pasted code to parse processor frequency information from /proc/cpuinfo. Let's extract that code into a function to avoid repetition. We now also tolerate if the parsing of /proc/cpuinfo is not successful and just report a warning i