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

Andrea Bolognani abologna at redhat.com
Mon Jul 20 11:04:17 UTC 2015


On Mon, 2015-07-20 at 11:34 +0200, Peter Krempa wrote:
> 
> > @@ -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.

I'll send v2 converting both this and linuxGetCPUPresentPath()
to functions once you're done reviewing the series :)

Cheers.

-- 
Andrea Bolognani
Software Engineer - Virtualization Team




More information about the libvir-list mailing list