]> xenbits.xensource.com Git - libvirt.git/commitdiff
Move test-local declarations to nodeinfopriv.h
authorJán Tomko <jtomko@redhat.com>
Wed, 22 Jan 2014 11:56:06 +0000 (12:56 +0100)
committerJán Tomko <jtomko@redhat.com>
Mon, 27 Jan 2014 10:04:02 +0000 (11:04 +0100)
linuxNodeInfoCPUPopulate is only used in the nodeinfo.c file
and in the test suite.

src/Makefile.am
src/nodeinfo.c
src/nodeinfopriv.h [new file with mode: 0644]
tests/nodeinfotest.c

index 7844efa60a2ecea0b630df2459879e7f36132b26..abe0a512936be383e75840bcddb32b0c8a7c2b3f 100644 (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                                       \
index cf6d29b9890b23fd67e405bc823329076b0234e7..af049cb414bac6a3b5428c70cdc5ce6f047090b1 100644 (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;
diff --git a/src/nodeinfopriv.h b/src/nodeinfopriv.h
new file mode 100644 (file)
index 0000000..9aa3262
--- /dev/null
@@ -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__ */
index 74f6d4d2fbf3ae13789c326fd75c183d4789b51b..a6247ce7d77ebd42af44fe0646e7ce9847c9d8ec 100644 (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,