aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorIan Jackson <ian.jackson@eu.citrix.com>2012-01-13 16:54:19 +0000
committerIan Jackson <ian.jackson@eu.citrix.com>2012-01-13 16:54:19 +0000
commit8fc051a10f0df8e0030b2d6cbddb720f4322c7d3 (patch)
treeb084dd44fc9703591febed56091b8c6429520298 /tools
parent3607a75236b37abe350bf52f4700355be963a60d (diff)
downloadxen-8fc051a10f0df8e0030b2d6cbddb720f4322c7d3.tar.gz
xen-8fc051a10f0df8e0030b2d6cbddb720f4322c7d3.tar.bz2
xen-8fc051a10f0df8e0030b2d6cbddb720f4322c7d3.zip
libxl: move a lot more includes into libxl_internal.h
Move a lot of #include <stdfoo.h> from individual files into libxl_internal.h. This helps avoid portability mistakes where necessary system headers are omitted from individual files, and is also of course a convenience when developing. Also add #include "libxl_osdeps.h" /* must come before any other headers */ to the top of most libxl*.c files, so that anyone who adds any headers before libxl_internal.h will put the in the right place. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/libxl/libxl.c15
-rw-r--r--tools/libxl/libxl_blktap2.c4
-rw-r--r--tools/libxl/libxl_bootloader.c7
-rw-r--r--tools/libxl/libxl_cpuid.c2
-rw-r--r--tools/libxl/libxl_create.c15
-rw-r--r--tools/libxl/libxl_device.c10
-rw-r--r--tools/libxl/libxl_dm.c10
-rw-r--r--tools/libxl/libxl_dom.c11
-rw-r--r--tools/libxl/libxl_exec.c13
-rw-r--r--tools/libxl/libxl_flask.c8
-rw-r--r--tools/libxl/libxl_internal.c10
-rw-r--r--tools/libxl/libxl_internal.h22
-rw-r--r--tools/libxl/libxl_json.c4
-rw-r--r--tools/libxl/libxl_linux.c2
-rw-r--r--tools/libxl/libxl_netbsd.c2
-rw-r--r--tools/libxl/libxl_noblktap2.c2
-rw-r--r--tools/libxl/libxl_nocpuid.c2
-rw-r--r--tools/libxl/libxl_paths.c1
-rw-r--r--tools/libxl/libxl_pci.c16
-rw-r--r--tools/libxl/libxl_qmp.c4
-rw-r--r--tools/libxl/libxl_utils.c15
-rw-r--r--tools/libxl/libxl_uuid.c2
-rw-r--r--tools/libxl/libxl_xshelp.c8
-rw-r--r--tools/libxl/libxlu_cfg.c2
-rw-r--r--tools/libxl/libxlu_cfg_i.h1
-rw-r--r--tools/libxl/libxlu_disk.c1
-rw-r--r--tools/libxl/libxlu_disk_i.h2
27 files changed, 53 insertions, 138 deletions
diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 3c086d5655..6e3c5a872d 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -16,21 +16,6 @@
#include "libxl_osdeps.h"
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/select.h>
-#include <sys/wait.h>
-#include <sys/time.h>
-#include <signal.h>
-#include <unistd.h> /* for write, unlink and close */
-#include <stdint.h>
-#include <inttypes.h>
-#include <assert.h>
-
#include "libxl_internal.h"
#define PAGE_TO_MEMKB(pages) ((pages) * 4)
diff --git a/tools/libxl/libxl_blktap2.c b/tools/libxl/libxl_blktap2.c
index acf4110ea8..2c40182057 100644
--- a/tools/libxl/libxl_blktap2.c
+++ b/tools/libxl/libxl_blktap2.c
@@ -12,13 +12,11 @@
* GNU Lesser General Public License for more details.
*/
-#include "libxl_osdeps.h"
+#include "libxl_osdeps.h" /* must come before any other headers */
#include "libxl_internal.h"
#include "tap-ctl.h"
-#include <string.h>
-
int libxl__blktap_enabled(libxl__gc *gc)
{
const char *msg;
diff --git a/tools/libxl/libxl_bootloader.c b/tools/libxl/libxl_bootloader.c
index ce83b8eb47..2da1d90f34 100644
--- a/tools/libxl/libxl_bootloader.c
+++ b/tools/libxl/libxl_bootloader.c
@@ -12,15 +12,10 @@
* GNU Lesser General Public License for more details.
*/
-#include "libxl_osdeps.h"
+#include "libxl_osdeps.h" /* must come before any other headers */
-#include <unistd.h>
-#include <fcntl.h>
#include <termios.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-
#include "libxl_internal.h"
#define XENCONSOLED_BUF_SIZE 16
diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c
index 56a00cdf38..dcdb9d0216 100644
--- a/tools/libxl/libxl_cpuid.c
+++ b/tools/libxl/libxl_cpuid.c
@@ -10,6 +10,8 @@
* GNU Lesser General Public License for more details.
*/
+#include "libxl_osdeps.h" /* must come before any other headers */
+
#include "libxl_internal.h"
void libxl_cpuid_dispose(libxl_cpuid_policy_list *p_cpuid_list)
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index 815ee7951b..e1c615fb60 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -15,20 +15,13 @@
* GNU Lesser General Public License for more details.
*/
-#include "libxl_osdeps.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <xenctrl.h>
-#include <xc_dom.h>
-#include <xenguest.h>
-#include <assert.h>
+#include "libxl_osdeps.h" /* must come before any other headers */
#include "libxl_internal.h"
+#include <xc_dom.h>
+#include <xenguest.h>
+
void libxl_domain_config_dispose(libxl_domain_config *d_config)
{
int i;
diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c
index 9b1fc5789c..5d05e90cb4 100644
--- a/tools/libxl/libxl_device.c
+++ b/tools/libxl/libxl_device.c
@@ -14,15 +14,7 @@
* GNU Lesser General Public License for more details.
*/
-#include "libxl_osdeps.h"
-
-#include <string.h>
-#include <stdio.h>
-#include <sys/time.h> /* for struct timeval */
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <fcntl.h>
+#include "libxl_osdeps.h" /* must come before any other headers */
#include "libxl_internal.h"
diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index 3ebd806522..cf84dabf69 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -15,15 +15,7 @@
* GNU Lesser General Public License for more details.
*/
-#include "libxl_osdeps.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <assert.h>
+#include "libxl_osdeps.h" /* must come before any other headers */
#include "libxl_internal.h"
diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
index a4725fea32..91643a26b2 100644
--- a/tools/libxl/libxl_dom.c
+++ b/tools/libxl/libxl_dom.c
@@ -13,22 +13,13 @@
* GNU Lesser General Public License for more details.
*/
-#include "libxl_osdeps.h"
+#include "libxl_osdeps.h" /* must come before any other headers */
-#include <stdio.h>
-#include <assert.h>
#include <glob.h>
-#include <inttypes.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <sys/time.h> /* for struct timeval */
-#include <sys/stat.h> /* for stat */
-#include <unistd.h> /* for sleep(2) */
#include <xenctrl.h>
#include <xc_dom.h>
#include <xenguest.h>
-#include <fcntl.h>
#include <xen/hvm/hvm_info_table.h>
diff --git a/tools/libxl/libxl_exec.c b/tools/libxl/libxl_exec.c
index 52d40d13a0..b10e79f03d 100644
--- a/tools/libxl/libxl_exec.c
+++ b/tools/libxl/libxl_exec.c
@@ -15,18 +15,7 @@
* GNU Lesser General Public License for more details.
*/
-#include "libxl_osdeps.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <assert.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <signal.h> /* for SIGKILL */
-#include <fcntl.h>
+#include "libxl_osdeps.h" /* must come before any other headers */
#include "libxl_internal.h"
diff --git a/tools/libxl/libxl_flask.c b/tools/libxl/libxl_flask.c
index 6b548dd727..23f24766e9 100644
--- a/tools/libxl/libxl_flask.c
+++ b/tools/libxl/libxl_flask.c
@@ -7,13 +7,7 @@
* as published by the Free Software Foundation.
*/
-#include "libxl_osdeps.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <xenctrl.h>
+#include "libxl_osdeps.h" /* must come before any other headers */
#include "libxl_internal.h"
diff --git a/tools/libxl/libxl_internal.c b/tools/libxl/libxl_internal.c
index cfa8c61bed..49b0dabea7 100644
--- a/tools/libxl/libxl_internal.c
+++ b/tools/libxl/libxl_internal.c
@@ -13,15 +13,7 @@
* GNU Lesser General Public License for more details.
*/
-#include "libxl_osdeps.h"
-
-#include <stdio.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-#include <unistd.h>
+#include "libxl_osdeps.h" /* must come before any other headers */
#include "libxl_internal.h"
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 01d8ca8cbb..1b03929b2a 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -17,17 +17,33 @@
#ifndef LIBXL_INTERNAL_H
#define LIBXL_INTERNAL_H
-#include "libxl_osdeps.h"
+#include "libxl_osdeps.h" /* must come before any other headers */
-#include <stdint.h>
+#include <assert.h>
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <inttypes.h>
+#include <pthread.h>
+#include <signal.h>
#include <stdarg.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <pthread.h>
+#include <unistd.h>
+
+#include <sys/mman.h>
+#include <sys/select.h>
+#include <sys/stat.h>
#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/wait.h>
#include <xs.h>
#include <xenctrl.h>
+
#include "xentoollog.h"
#include <xen/io/xenbus.h>
diff --git a/tools/libxl/libxl_json.c b/tools/libxl/libxl_json.c
index c0f869e1eb..6ff2910806 100644
--- a/tools/libxl/libxl_json.c
+++ b/tools/libxl/libxl_json.c
@@ -12,10 +12,8 @@
* GNU Lesser General Public License for more details.
*/
-#include "libxl_osdeps.h"
+#include "libxl_osdeps.h" /* must come before any other headers */
-#include <assert.h>
-#include <string.h>
#include <math.h>
#include <yajl/yajl_parse.h>
diff --git a/tools/libxl/libxl_linux.c b/tools/libxl/libxl_linux.c
index 786c6b5f15..925248b8ff 100644
--- a/tools/libxl/libxl_linux.c
+++ b/tools/libxl/libxl_linux.c
@@ -13,7 +13,7 @@
* GNU Lesser General Public License for more details.
*/
-#include <sys/stat.h>
+#include "libxl_osdeps.h" /* must come before any other headers */
#include "libxl_internal.h"
diff --git a/tools/libxl/libxl_netbsd.c b/tools/libxl/libxl_netbsd.c
index 1e8d622835..9e0ed6d952 100644
--- a/tools/libxl/libxl_netbsd.c
+++ b/tools/libxl/libxl_netbsd.c
@@ -13,7 +13,7 @@
* GNU Lesser General Public License for more details.
*/
-#include <sys/stat.h>
+#include "libxl_osdeps.h" /* must come before any other headers */
#include "libxl_internal.h"
diff --git a/tools/libxl/libxl_noblktap2.c b/tools/libxl/libxl_noblktap2.c
index 3307551b2c..246b0de63b 100644
--- a/tools/libxl/libxl_noblktap2.c
+++ b/tools/libxl/libxl_noblktap2.c
@@ -12,6 +12,8 @@
* GNU Lesser General Public License for more details.
*/
+#include "libxl_osdeps.h" /* must come before any other headers */
+
#include "libxl_internal.h"
int libxl__blktap_enabled(libxl__gc *gc)
diff --git a/tools/libxl/libxl_nocpuid.c b/tools/libxl/libxl_nocpuid.c
index 2e9490cd1c..9e52f8d1cd 100644
--- a/tools/libxl/libxl_nocpuid.c
+++ b/tools/libxl/libxl_nocpuid.c
@@ -10,6 +10,8 @@
* GNU Lesser General Public License for more details.
*/
+#include "libxl_osdeps.h" /* must come before any other headers */
+
#include "libxl_internal.h"
void libxl_cpuid_destroy(libxl_cpuid_policy_list *p_cpuid_list)
diff --git a/tools/libxl/libxl_paths.c b/tools/libxl/libxl_paths.c
index e7bd1a25fe..a95d29f199 100644
--- a/tools/libxl/libxl_paths.c
+++ b/tools/libxl/libxl_paths.c
@@ -12,6 +12,7 @@
* GNU Lesser General Public License for more details.
*/
+#include "libxl_osdeps.h" /* must come before any other headers */
#include "libxl_internal.h"
#include "_libxl_paths.h"
diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c
index 8b2a1c5b77..c3828f6068 100644
--- a/tools/libxl/libxl_pci.c
+++ b/tools/libxl/libxl_pci.c
@@ -14,21 +14,7 @@
* GNU Lesser General Public License for more details.
*/
-#include "libxl_osdeps.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <sys/select.h>
-#include <sys/mman.h>
-#include <sys/wait.h>
-#include <sys/stat.h>
-#include <signal.h>
-#include <unistd.h> /* for write, unlink and close */
-#include <inttypes.h>
-#include <dirent.h>
-#include <assert.h>
+#include "libxl_osdeps.h" /* must come before any other headers */
#include "libxl_internal.h"
diff --git a/tools/libxl/libxl_qmp.c b/tools/libxl/libxl_qmp.c
index 3dfa43a366..61d976932b 100644
--- a/tools/libxl/libxl_qmp.c
+++ b/tools/libxl/libxl_qmp.c
@@ -18,12 +18,10 @@
* Specification, see in the QEMU repository.
*/
-#include "libxl_osdeps.h"
+#include "libxl_osdeps.h" /* must come before any other headers */
-#include <unistd.h>
#include <sys/un.h>
#include <sys/queue.h>
-#include <fcntl.h>
#include <yajl/yajl_gen.h>
diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c
index d36c737e9b..dbe8891ee9 100644
--- a/tools/libxl/libxl_utils.c
+++ b/tools/libxl/libxl_utils.c
@@ -13,20 +13,9 @@
* GNU Lesser General Public License for more details.
*/
-#include "libxl_osdeps.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <string.h>
-#include <xs.h>
-#include <xenctrl.h>
+#include "libxl_osdeps.h" /* must come before any other headers */
+
#include <ctype.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <assert.h>
#include "libxl_internal.h"
diff --git a/tools/libxl/libxl_uuid.c b/tools/libxl/libxl_uuid.c
index 80ab789c8f..7c18d719da 100644
--- a/tools/libxl/libxl_uuid.c
+++ b/tools/libxl/libxl_uuid.c
@@ -12,7 +12,7 @@
* GNU Lesser General Public License for more details.
*/
-#include "libxl_osdeps.h"
+#include "libxl_osdeps.h" /* must come before any other headers */
#include <libxl_uuid.h>
diff --git a/tools/libxl/libxl_xshelp.c b/tools/libxl/libxl_xshelp.c
index f3d4c8e60a..3ea8d08861 100644
--- a/tools/libxl/libxl_xshelp.c
+++ b/tools/libxl/libxl_xshelp.c
@@ -13,13 +13,7 @@
* GNU Lesser General Public License for more details.
*/
-#include "libxl_osdeps.h"
-
-#include <string.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <inttypes.h>
+#include "libxl_osdeps.h" /* must come before any other headers */
#include "libxl_internal.h"
diff --git a/tools/libxl/libxlu_cfg.c b/tools/libxl/libxlu_cfg.c
index 0d1c5d385a..e3659c7654 100644
--- a/tools/libxl/libxlu_cfg.c
+++ b/tools/libxl/libxlu_cfg.c
@@ -16,6 +16,8 @@
*/
+#include "libxl_osdeps.h" /* must come before any other headers */
+
#include <limits.h>
#include "libxlu_internal.h"
diff --git a/tools/libxl/libxlu_cfg_i.h b/tools/libxl/libxlu_cfg_i.h
index ea6a326f52..54d033c9a4 100644
--- a/tools/libxl/libxlu_cfg_i.h
+++ b/tools/libxl/libxlu_cfg_i.h
@@ -18,6 +18,7 @@
#ifndef LIBXLU_CFG_I_H
#define LIBXLU_CFG_I_H
+#include "libxl_osdeps.h" /* must come before any other headers */
#include "libxlu_internal.h"
#include "libxlu_cfg_y.h"
diff --git a/tools/libxl/libxlu_disk.c b/tools/libxl/libxlu_disk.c
index 88b79acc4b..6cd86e94bc 100644
--- a/tools/libxl/libxlu_disk.c
+++ b/tools/libxl/libxlu_disk.c
@@ -1,3 +1,4 @@
+#include "libxl_osdeps.h" /* must come before any other headers */
#include "libxlu_internal.h"
#include "libxlu_disk_l.h"
#include "libxlu_disk_i.h"
diff --git a/tools/libxl/libxlu_disk_i.h b/tools/libxl/libxlu_disk_i.h
index 4fccd4a2e5..37246f22bf 100644
--- a/tools/libxl/libxlu_disk_i.h
+++ b/tools/libxl/libxlu_disk_i.h
@@ -1,6 +1,8 @@
#ifndef LIBXLU_DISK_I_H
#define LIBXLU_DISK_I_H
+#include "libxl_osdeps.h" /* must come before any other headers */
+
#include "libxlu_internal.h"