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

[libvirt] [PATCHv3 1/4] Move test-local declarations to nodeinfopriv.h



linuxNodeInfoCPUPopulate is only used in the nodeinfo.c file
and in the test suite.
---
 src/Makefile.am      |  2 +-
 src/nodeinfo.c       |  7 +------
 src/nodeinfopriv.h   | 33 +++++++++++++++++++++++++++++++++
 tests/nodeinfotest.c |  6 +-----
 4 files changed, 36 insertions(+), 12 deletions(-)
 create mode 100644 src/nodeinfopriv.h

diff --git a/src/Makefile.am b/src/Makefile.am
index 8f77658..e33cf8a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -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					\
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index cba2fc1..775ea75 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -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;
diff --git a/src/nodeinfopriv.h b/src/nodeinfopriv.h
new file mode 100644
index 0000000..9aa3262
--- /dev/null
+++ b/src/nodeinfopriv.h
@@ -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__ */
diff --git a/tests/nodeinfotest.c b/tests/nodeinfotest.c
index 74f6d4d..a6247ce 100644
--- a/tests/nodeinfotest.c
+++ b/tests/nodeinfotest.c
@@ -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,
-- 
1.8.3.2


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