[libvirt] [PATCH 01/10] nodeinfo: Introduce linuxGetCPUGlobalPath()

Peter Krempa pkrempa at redhat.com
Mon Jul 20 09:33:28 UTC 2015


On Fri, Jul 17, 2015 at 18:13:20 +0200, Andrea Bolognani wrote:
> This is just a more generic version of linuxGetCPUPresentPath(),
> which is now implemented by calling the new function appropriately.
> ---
>  src/nodeinfo.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/src/nodeinfo.c b/src/nodeinfo.c
> index 105d7ab..64b12e6 100644
> --- a/src/nodeinfo.c
> +++ b/src/nodeinfo.c
> @@ -958,16 +958,21 @@ linuxNodeGetMemoryStats(FILE *meminfo,
>  }
>  
>  static char *
> -linuxGetCPUPresentPath(const char *sysfs_prefix)
> +linuxGetCPUGlobalPath(const char *sysfs_prefix,
> +                      const char *file)
>  {
>      const char *prefix = sysfs_prefix ? sysfs_prefix : SYSFS_SYSTEM_PATH;
>      char *path = NULL;
>  
> -    if (virAsprintf(&path, "%s/cpu/present", prefix) < 0)
> +    if (virAsprintf(&path, "%s/cpu/%s", prefix, file) < 0)
>          return NULL;
> +
>      return path;
>  }
>  
> +# define linuxGetCPUPresentPath(sysfs_prefix)            \
> +    linuxGetCPUGlobalPath(sysfs_prefix, "present")

I'd rather see a wrapper function that adds the argument rather than a
macro.

ACK with that change.

Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150720/f8386d49/attachment-0001.sig>


More information about the libvir-list mailing list