Move test-local declarations to nodeinfopriv.h

linuxNodeInfoCPUPopulate is only used in the nodeinfo.c file
and in the test suite.
This commit is contained in:
Ján Tomko 2014-01-22 12:56:06 +01:00
parent 237a088ba4
commit b3b44c572c
4 changed files with 36 additions and 12 deletions

View File

@ -168,7 +168,7 @@ util/virkeymaps.h: $(srcdir)/util/keymaps.csv \
EXTRA_DIST += util/virthreadpthread.c util/virthreadwin32.c
# Internal generic driver infrastructure
NODE_INFO_SOURCES = nodeinfo.h nodeinfo.c
NODE_INFO_SOURCES = nodeinfo.h nodeinfo.c nodeinfopriv.h
DATATYPES_SOURCES = datatypes.h datatypes.c
DRIVER_SOURCES = \
driver.c driver.h \

View File

@ -40,7 +40,7 @@
#include "c-ctype.h"
#include "viralloc.h"
#include "nodeinfo.h"
#include "nodeinfopriv.h"
#include "physmem.h"
#include "virlog.h"
#include "virerror.h"
@ -189,11 +189,6 @@ freebsdNodeGetMemoryStats(virNodeMemoryStatsPtr params,
# 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);
/* Return the positive decimal contents of the given
* DIR/cpu%u/FILE, or -1 on error. If DEFAULT_VALUE is non-negative
* and the file could not be found, return that instead of an error;

33
src/nodeinfopriv.h Normal file
View File

@ -0,0 +1,33 @@
/*
* nodeinfopriv.h: internal APIs for testing nodeinfo code
*
* Copyright (C) 2014 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#ifndef __NODEINFO_PRIV_H__
# define __NODEINFO_PRIV_H__
# include "nodeinfo.h"
# ifdef __linux__
int linuxNodeInfoCPUPopulate(FILE *cpuinfo,
const char *sysfs_dir,
virNodeInfoPtr nodeinfo);
# endif
#endif /* __NODEINFO_PRIV_H__ */

View File

@ -7,7 +7,7 @@
#include "testutils.h"
#include "internal.h"
#include "nodeinfo.h"
#include "nodeinfopriv.h"
#include "virfile.h"
#include "virstring.h"
@ -27,10 +27,6 @@ main(void)
#else
extern int linuxNodeInfoCPUPopulate(FILE *cpuinfo,
char *sysfs_dir,
virNodeInfoPtr nodeinfo);
static int
linuxTestCompareFiles(const char *cpuinfofile,
char *sysfs_dir,