[libvirt] [PATCH 02/10] nodeinfo: Introduce linuxGetCPUOnlinePath()

Peter Krempa pkrempa at redhat.com
Mon Jul 20 09:34:13 UTC 2015


On Fri, Jul 17, 2015 at 18:13:21 +0200, Andrea Bolognani wrote:
> ---
>  src/nodeinfo.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/src/nodeinfo.c b/src/nodeinfo.c
> index 64b12e6..7a12d54 100644
> --- a/src/nodeinfo.c
> +++ b/src/nodeinfo.c
> @@ -973,6 +973,9 @@ linuxGetCPUGlobalPath(const char *sysfs_prefix,
>  # define linuxGetCPUPresentPath(sysfs_prefix)            \
>      linuxGetCPUGlobalPath(sysfs_prefix, "present")
>  
> +# define linuxGetCPUOnlinePath(sysfs_prefix)             \
> +    linuxGetCPUGlobalPath(sysfs_prefix, "online")

Either add a function ...

> +
>  /* Determine the maximum cpu id from a Linux sysfs cpu/present file. */
>  static int
>  linuxParseCPUmax(const char *path)
> @@ -1313,7 +1316,7 @@ nodeGetCPUBitmap(const char *sysfs_prefix ATTRIBUTE_UNUSED,
>      if (present < 0)
>          return NULL;
>  
> -    if (virAsprintf(&online_path, "%s/cpu/online", prefix) < 0)
> +    if (!(online_path = linuxGetCPUOnlinePath(sysfs_prefix)))

Or use the global helper here directly.

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/c96834ed/attachment-0001.sig>


More information about the libvir-list mailing list