[libvirt] [PATCHv2 01/10] nodeinfo: Rename linuxNodeInfoCPUPopulate and export it properly

Daniel P. Berrange berrange at redhat.com
Mon Oct 28 12:13:38 UTC 2013


On Fri, Oct 18, 2013 at 05:05:41PM +0200, Peter Krempa wrote:
> Call it virNodeInfoLinuxPopulateCPU and use the header file to export
> it instead of extern definition in the test file.
> ---
>  src/libvirt_linux.syms |  2 +-
>  src/nodeinfo.c         | 14 +++++---------
>  src/nodeinfo.h         |  5 +++++
>  tests/nodeinfotest.c   |  6 +-----
>  4 files changed, 12 insertions(+), 15 deletions(-)
> 
> diff --git a/src/libvirt_linux.syms b/src/libvirt_linux.syms
> index 3500898..bfef3ec 100644
> --- a/src/libvirt_linux.syms
> +++ b/src/libvirt_linux.syms
> @@ -3,7 +3,7 @@
>  #
> 
>  # nodeinfo.h
> -linuxNodeInfoCPUPopulate;
> +virNodeInfoLinuxPopulateCPU;
> 
>  # util/virstatslinux.h
>  linuxDomainInterfaceStats;
> diff --git a/src/nodeinfo.c b/src/nodeinfo.c
> index 70814c2..232b465 100644
> --- a/src/nodeinfo.c
> +++ b/src/nodeinfo.c
> @@ -88,11 +88,6 @@ appleFreebsdNodeGetCPUCount(void)
>  # define LINUX_NB_MEMORY_STATS_ALL 4
>  # define LINUX_NB_MEMORY_STATS_CELL 2
> 
> -/* NB, this is not static as we need to call it from the testsuite */
> -int linuxNodeInfoCPUPopulate(FILE *cpuinfo,
> -                             const char *sysfs_dir,
> -                             virNodeInfoPtr nodeinfo);
> -
>  static int linuxNodeGetCPUStats(FILE *procstat,
>                                  int cpuNum,
>                                  virNodeCPUStatsPtr params,
> @@ -376,9 +371,10 @@ cleanup:
>      return ret;
>  }
> 
> -int linuxNodeInfoCPUPopulate(FILE *cpuinfo,
> -                             const char *sysfs_dir,
> -                             virNodeInfoPtr nodeinfo)
> +int
> +virNodeInfoLinuxPopulateCPU(FILE *cpuinfo,
> +                            const char *sysfs_dir,
> +                            virNodeInfoPtr nodeinfo)
>  {
>      char line[1024];
>      DIR *nodedir = NULL;
> @@ -872,7 +868,7 @@ int nodeGetInfo(virNodeInfoPtr nodeinfo)
>          return -1;
>      }
> 
> -    ret = linuxNodeInfoCPUPopulate(cpuinfo, SYSFS_SYSTEM_PATH, nodeinfo);
> +    ret = virNodeInfoLinuxPopulateCPU(cpuinfo, SYSFS_SYSTEM_PATH, nodeinfo);
>      if (ret < 0)
>          goto cleanup;
> 
> diff --git a/src/nodeinfo.h b/src/nodeinfo.h
> index 413fddd..a13cf28 100644
> --- a/src/nodeinfo.h
> +++ b/src/nodeinfo.h
> @@ -57,4 +57,9 @@ int nodeGetCPUMap(unsigned char **cpumap,
>                    unsigned int *online,
>                    unsigned int flags);
> 
> +
> +int virNodeInfoLinuxPopulateCPU(FILE *cpuinfo,
> +                                const char *sysfs_dir,
> +                                virNodeInfoPtr nodeinfo);

I think it would be desirable to crate a nodeinfopriv.h header for
this, since it isn't intended to be part of the internal API.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list