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

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

 



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

Attachment: signature.asc
Description: 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]