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

[Xen-changelog] [xen-unstable] libxl: move a lot more includes into libxl_internal.h



# HG changeset patch
# User Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
# Date 1326473659 0
# Node ID 2231bc032192d9fdada4a6415f8814dff3bdd14d
# Parent  19a0a2e26137f3f1d436f84a55c24d473eef21fd
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@xxxxxxxxxxxxx>
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Committed-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---


diff -r 19a0a2e26137 -r 2231bc032192 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Fri Jan 13 16:54:11 2012 +0000
+++ b/tools/libxl/libxl.c       Fri Jan 13 16:54:19 2012 +0000
@@ -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 -r 19a0a2e26137 -r 2231bc032192 tools/libxl/libxl_blktap2.c
--- a/tools/libxl/libxl_blktap2.c       Fri Jan 13 16:54:11 2012 +0000
+++ b/tools/libxl/libxl_blktap2.c       Fri Jan 13 16:54:19 2012 +0000
@@ -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 -r 19a0a2e26137 -r 2231bc032192 tools/libxl/libxl_bootloader.c
--- a/tools/libxl/libxl_bootloader.c    Fri Jan 13 16:54:11 2012 +0000
+++ b/tools/libxl/libxl_bootloader.c    Fri Jan 13 16:54:19 2012 +0000
@@ -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 -r 19a0a2e26137 -r 2231bc032192 tools/libxl/libxl_cpuid.c
--- a/tools/libxl/libxl_cpuid.c Fri Jan 13 16:54:11 2012 +0000
+++ b/tools/libxl/libxl_cpuid.c Fri Jan 13 16:54:19 2012 +0000
@@ -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 -r 19a0a2e26137 -r 2231bc032192 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c        Fri Jan 13 16:54:11 2012 +0000
+++ b/tools/libxl/libxl_create.c        Fri Jan 13 16:54:19 2012 +0000
@@ -15,19 +15,12 @@
  * 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 <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <xenctrl.h>
+#include "libxl_internal.h"
+
 #include <xc_dom.h>
 #include <xenguest.h>
-#include <assert.h>
-
-#include "libxl_internal.h"
 
 void libxl_domain_config_dispose(libxl_domain_config *d_config)
 {
diff -r 19a0a2e26137 -r 2231bc032192 tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c        Fri Jan 13 16:54:11 2012 +0000
+++ b/tools/libxl/libxl_device.c        Fri Jan 13 16:54:19 2012 +0000
@@ -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 -r 19a0a2e26137 -r 2231bc032192 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c    Fri Jan 13 16:54:11 2012 +0000
+++ b/tools/libxl/libxl_dm.c    Fri Jan 13 16:54:19 2012 +0000
@@ -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 -r 19a0a2e26137 -r 2231bc032192 tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c   Fri Jan 13 16:54:11 2012 +0000
+++ b/tools/libxl/libxl_dom.c   Fri Jan 13 16:54:19 2012 +0000
@@ -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 -r 19a0a2e26137 -r 2231bc032192 tools/libxl/libxl_exec.c
--- a/tools/libxl/libxl_exec.c  Fri Jan 13 16:54:11 2012 +0000
+++ b/tools/libxl/libxl_exec.c  Fri Jan 13 16:54:19 2012 +0000
@@ -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 -r 19a0a2e26137 -r 2231bc032192 tools/libxl/libxl_flask.c
--- a/tools/libxl/libxl_flask.c Fri Jan 13 16:54:11 2012 +0000
+++ b/tools/libxl/libxl_flask.c Fri Jan 13 16:54:19 2012 +0000
@@ -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 -r 19a0a2e26137 -r 2231bc032192 tools/libxl/libxl_internal.c
--- a/tools/libxl/libxl_internal.c      Fri Jan 13 16:54:11 2012 +0000
+++ b/tools/libxl/libxl_internal.c      Fri Jan 13 16:54:19 2012 +0000
@@ -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 -r 19a0a2e26137 -r 2231bc032192 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h      Fri Jan 13 16:54:11 2012 +0000
+++ b/tools/libxl/libxl_internal.h      Fri Jan 13 16:54:19 2012 +0000
@@ -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 <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 <stdarg.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 -r 19a0a2e26137 -r 2231bc032192 tools/libxl/libxl_json.c
--- a/tools/libxl/libxl_json.c  Fri Jan 13 16:54:11 2012 +0000
+++ b/tools/libxl/libxl_json.c  Fri Jan 13 16:54:19 2012 +0000
@@ -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 -r 19a0a2e26137 -r 2231bc032192 tools/libxl/libxl_linux.c
--- a/tools/libxl/libxl_linux.c Fri Jan 13 16:54:11 2012 +0000
+++ b/tools/libxl/libxl_linux.c Fri Jan 13 16:54:19 2012 +0000
@@ -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 -r 19a0a2e26137 -r 2231bc032192 tools/libxl/libxl_netbsd.c
--- a/tools/libxl/libxl_netbsd.c        Fri Jan 13 16:54:11 2012 +0000
+++ b/tools/libxl/libxl_netbsd.c        Fri Jan 13 16:54:19 2012 +0000
@@ -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 -r 19a0a2e26137 -r 2231bc032192 tools/libxl/libxl_noblktap2.c
--- a/tools/libxl/libxl_noblktap2.c     Fri Jan 13 16:54:11 2012 +0000
+++ b/tools/libxl/libxl_noblktap2.c     Fri Jan 13 16:54:19 2012 +0000
@@ -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 -r 19a0a2e26137 -r 2231bc032192 tools/libxl/libxl_nocpuid.c
--- a/tools/libxl/libxl_nocpuid.c       Fri Jan 13 16:54:11 2012 +0000
+++ b/tools/libxl/libxl_nocpuid.c       Fri Jan 13 16:54:19 2012 +0000
@@ -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 -r 19a0a2e26137 -r 2231bc032192 tools/libxl/libxl_paths.c
--- a/tools/libxl/libxl_paths.c Fri Jan 13 16:54:11 2012 +0000
+++ b/tools/libxl/libxl_paths.c Fri Jan 13 16:54:19 2012 +0000
@@ -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 -r 19a0a2e26137 -r 2231bc032192 tools/libxl/libxl_pci.c
--- a/tools/libxl/libxl_pci.c   Fri Jan 13 16:54:11 2012 +0000
+++ b/tools/libxl/libxl_pci.c   Fri Jan 13 16:54:19 2012 +0000
@@ -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 -r 19a0a2e26137 -r 2231bc032192 tools/libxl/libxl_qmp.c
--- a/tools/libxl/libxl_qmp.c   Fri Jan 13 16:54:11 2012 +0000
+++ b/tools/libxl/libxl_qmp.c   Fri Jan 13 16:54:19 2012 +0000
@@ -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 -r 19a0a2e26137 -r 2231bc032192 tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c Fri Jan 13 16:54:11 2012 +0000
+++ b/tools/libxl/libxl_utils.c Fri Jan 13 16:54:19 2012 +0000
@@ -13,20 +13,9 @@
  * 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 <stdlib.h>
-#include <stdint.h>
-#include <string.h>
-#include <xs.h>
-#include <xenctrl.h>
 #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 -r 19a0a2e26137 -r 2231bc032192 tools/libxl/libxl_uuid.c
--- a/tools/libxl/libxl_uuid.c  Fri Jan 13 16:54:11 2012 +0000
+++ b/tools/libxl/libxl_uuid.c  Fri Jan 13 16:54:19 2012 +0000
@@ -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 -r 19a0a2e26137 -r 2231bc032192 tools/libxl/libxl_xshelp.c
--- a/tools/libxl/libxl_xshelp.c        Fri Jan 13 16:54:11 2012 +0000
+++ b/tools/libxl/libxl_xshelp.c        Fri Jan 13 16:54:19 2012 +0000
@@ -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 -r 19a0a2e26137 -r 2231bc032192 tools/libxl/libxlu_cfg.c
--- a/tools/libxl/libxlu_cfg.c  Fri Jan 13 16:54:11 2012 +0000
+++ b/tools/libxl/libxlu_cfg.c  Fri Jan 13 16:54:19 2012 +0000
@@ -16,6 +16,8 @@
  */
 
 
+#include "libxl_osdeps.h" /* must come before any other headers */
+
 #include <limits.h>
 
 #include "libxlu_internal.h"
diff -r 19a0a2e26137 -r 2231bc032192 tools/libxl/libxlu_cfg_i.h
--- a/tools/libxl/libxlu_cfg_i.h        Fri Jan 13 16:54:11 2012 +0000
+++ b/tools/libxl/libxlu_cfg_i.h        Fri Jan 13 16:54:19 2012 +0000
@@ -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 -r 19a0a2e26137 -r 2231bc032192 tools/libxl/libxlu_disk.c
--- a/tools/libxl/libxlu_disk.c Fri Jan 13 16:54:11 2012 +0000
+++ b/tools/libxl/libxlu_disk.c Fri Jan 13 16:54:19 2012 +0000
@@ -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 -r 19a0a2e26137 -r 2231bc032192 tools/libxl/libxlu_disk_i.h
--- a/tools/libxl/libxlu_disk_i.h       Fri Jan 13 16:54:11 2012 +0000
+++ b/tools/libxl/libxlu_disk_i.h       Fri Jan 13 16:54:19 2012 +0000
@@ -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"
 
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.