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

Re: [Xen-devel] [PATCH RFC v2 08/13] libxl: Rationalise #includes



On Fri, 2011-10-28 at 19:37 +0100, Ian Jackson wrote:
> libxl_internal.h now #includes libxl.h and various system headers.
> 
> This
>  1. makes the order of header inclusion more predictable
>  2. explicitly allows libxl_internal.h to use objects defined in libxl.h
>  3. removes the need for individual files to include these headers
> 
> Also
>  - remove some unnecessary #includes of libxl_utils.h,
>    flexarray.h, etc. in some libxl*.c files,
>  - include libxl_osdeps.h at the top of libxl_internal.h
>  - add missing includes of libxl_osdeps.h to a couple of files
>  - change libxl.h to libxl_internal.h in a couple of files
> 
> Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>

Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

> ---
>  tools/libxl/libxl.c            |    3 ---
>  tools/libxl/libxl_blktap2.c    |    1 -
>  tools/libxl/libxl_bootloader.c |    4 ----
>  tools/libxl/libxl_cpuid.c      |    4 ----
>  tools/libxl/libxl_create.c     |    4 +---
>  tools/libxl/libxl_device.c     |    2 --
>  tools/libxl/libxl_dm.c         |    4 +---
>  tools/libxl/libxl_dom.c        |    1 -
>  tools/libxl/libxl_exec.c       |    1 -
>  tools/libxl/libxl_flask.c      |    3 ++-
>  tools/libxl/libxl_internal.c   |    4 ----
>  tools/libxl/libxl_internal.h   |    5 +++++
>  tools/libxl/libxl_json.c       |    4 ++--
>  tools/libxl/libxl_noblktap2.c  |    2 --
>  tools/libxl/libxl_nocpuid.c    |    2 +-
>  tools/libxl/libxl_paths.c      |    2 +-
>  tools/libxl/libxl_pci.c        |    5 -----
>  tools/libxl/libxl_qmp.c        |    2 ++
>  tools/libxl/libxl_utils.c      |    1 -
>  tools/libxl/libxl_uuid.c       |    4 ++++
>  tools/libxl/libxl_xshelp.c     |    1 -
>  21 files changed, 19 insertions(+), 40 deletions(-)
> 
> diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
> index 064fbc4..5d448af 100644
> --- a/tools/libxl/libxl.c
> +++ b/tools/libxl/libxl.c
> @@ -31,10 +31,7 @@
>  #include <inttypes.h>
>  #include <assert.h>
> 
> -#include "libxl.h"
> -#include "libxl_utils.h"
>  #include "libxl_internal.h"
> -#include "flexarray.h"
> 
>  #define PAGE_TO_MEMKB(pages) ((pages) * 4)
>  #define BACKEND_STRING_SIZE 5
> diff --git a/tools/libxl/libxl_blktap2.c b/tools/libxl/libxl_blktap2.c
> index c8d9148..acf4110 100644
> --- a/tools/libxl/libxl_blktap2.c
> +++ b/tools/libxl/libxl_blktap2.c
> @@ -12,7 +12,6 @@
>   * GNU Lesser General Public License for more details.
>   */
> 
> -#include "libxl.h"
>  #include "libxl_osdeps.h"
>  #include "libxl_internal.h"
> 
> diff --git a/tools/libxl/libxl_bootloader.c b/tools/libxl/libxl_bootloader.c
> index 1e735a8..396aac6 100644
> --- a/tools/libxl/libxl_bootloader.c
> +++ b/tools/libxl/libxl_bootloader.c
> @@ -14,7 +14,6 @@
> 
>  #include "libxl_osdeps.h"
> 
> -#include <string.h>
>  #include <unistd.h>
>  #include <fcntl.h>
>  #include <termios.h>
> @@ -22,11 +21,8 @@
>  #include <sys/stat.h>
>  #include <sys/types.h>
> 
> -#include "libxl.h"
>  #include "libxl_internal.h"
> 
> -#include "flexarray.h"
> -
>  #define XENCONSOLED_BUF_SIZE 16
>  #define BOOTLOADER_BUF_SIZE 1024
> 
> diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c
> index 12cc0b1..f65a898 100644
> --- a/tools/libxl/libxl_cpuid.c
> +++ b/tools/libxl/libxl_cpuid.c
> @@ -10,10 +10,6 @@
>   * GNU Lesser General Public License for more details.
>   */
> 
> -#include <string.h>
> -
> -#include "libxl.h"
> -#include "libxl_osdeps.h"
>  #include "libxl_internal.h"
> 
>  void libxl_cpuid_destroy(libxl_cpuid_policy_list *p_cpuid_list)
> diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
> index 68d0fc3..70705af 100644
> --- a/tools/libxl/libxl_create.c
> +++ b/tools/libxl/libxl_create.c
> @@ -26,10 +26,8 @@
>  #include <xc_dom.h>
>  #include <xenguest.h>
>  #include <assert.h>
> -#include "libxl.h"
> -#include "libxl_utils.h"
> +
>  #include "libxl_internal.h"
> -#include "flexarray.h"
> 
>  void libxl_domain_config_destroy(libxl_domain_config *d_config)
>  {
> diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c
> index 88cd990..8b5fc4a 100644
> --- a/tools/libxl/libxl_device.c
> +++ b/tools/libxl/libxl_device.c
> @@ -24,8 +24,6 @@
>  #include <unistd.h>
>  #include <fcntl.h>
> 
> -
> -#include "libxl.h"
>  #include "libxl_internal.h"
> 
>  static const char *string_of_kinds[] = {
> diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
> index d6ad85b..e18bac7 100644
> --- a/tools/libxl/libxl_dm.c
> +++ b/tools/libxl/libxl_dm.c
> @@ -24,10 +24,8 @@
>  #include <unistd.h>
>  #include <fcntl.h>
>  #include <assert.h>
> -#include "libxl_utils.h"
> +
>  #include "libxl_internal.h"
> -#include "libxl.h"
> -#include "flexarray.h"
> 
>  static const char *libxl_tapif_script(libxl__gc *gc)
>  {
> diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
> index 718281a..430b3d0 100644
> --- a/tools/libxl/libxl_dom.c
> +++ b/tools/libxl/libxl_dom.c
> @@ -32,7 +32,6 @@
> 
>  #include <xen/hvm/hvm_info_table.h>
> 
> -#include "libxl.h"
>  #include "libxl_internal.h"
> 
>  libxl_domain_type libxl__domain_type(libxl__gc *gc, uint32_t domid)
> diff --git a/tools/libxl/libxl_exec.c b/tools/libxl/libxl_exec.c
> index d6199d4..e981679 100644
> --- a/tools/libxl/libxl_exec.c
> +++ b/tools/libxl/libxl_exec.c
> @@ -28,7 +28,6 @@
>  #include <signal.h> /* for SIGKILL */
>  #include <fcntl.h>
> 
> -#include "libxl.h"
>  #include "libxl_internal.h"
> 
>  static int call_waitpid(pid_t (*waitpid_cb)(pid_t, int *, int), pid_t pid, 
> int *status, int options)
> diff --git a/tools/libxl/libxl_flask.c b/tools/libxl/libxl_flask.c
> index c8d0594..6b548dd 100644
> --- a/tools/libxl/libxl_flask.c
> +++ b/tools/libxl/libxl_flask.c
> @@ -7,13 +7,14 @@
>   *  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.h"
>  #include "libxl_internal.h"
> 
>  int libxl_flask_context_to_sid(libxl_ctx *ctx, char *buf, size_t len,
> diff --git a/tools/libxl/libxl_internal.c b/tools/libxl/libxl_internal.c
> index 3993d8e..dd31f25 100644
> --- a/tools/libxl/libxl_internal.c
> +++ b/tools/libxl/libxl_internal.c
> @@ -16,8 +16,6 @@
>  #include "libxl_osdeps.h"
> 
>  #include <stdio.h>
> -#include <stdarg.h>
> -#include <string.h>
> 
>  #include <sys/types.h>
>  #include <sys/stat.h>
> @@ -25,9 +23,7 @@
>  #include <sys/mman.h>
>  #include <unistd.h>
> 
> -#include "libxl.h"
>  #include "libxl_internal.h"
> -#include "libxl_utils.h"
> 
>  int libxl__error_set(libxl__gc *gc, int code)
>  {
> diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
> index 8649788..6d9da2c 100644
> --- a/tools/libxl/libxl_internal.h
> +++ b/tools/libxl/libxl_internal.h
> @@ -17,14 +17,19 @@
>  #ifndef LIBXL_INTERNAL_H
>  #define LIBXL_INTERNAL_H
> 
> +#include "libxl_osdeps.h"
> +
>  #include <stdint.h>
>  #include <stdarg.h>
>  #include <stdlib.h>
> +#include <string.h>
> 
>  #include <xs.h>
>  #include <xenctrl.h>
>  #include "xentoollog.h"
> 
> +#include "libxl.h"
> +
>  #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
>  #define _hidden __attribute__((visibility("hidden")))
>  #define _protected __attribute__((visibility("protected")))
> diff --git a/tools/libxl/libxl_json.c b/tools/libxl/libxl_json.c
> index 11f65fc..a4208f3 100644
> --- a/tools/libxl/libxl_json.c
> +++ b/tools/libxl/libxl_json.c
> @@ -12,13 +12,13 @@
>   * GNU Lesser General Public License for more details.
>   */
> 
> +#include "libxl_osdeps.h"
> +
>  #include <assert.h>
> -#include <string.h>
> 
>  #include <yajl/yajl_parse.h>
>  #include <yajl/yajl_gen.h>
> 
> -#include <libxl.h>
>  #include "libxl_internal.h"
> 
>  /* #define DEBUG_ANSWER */
> diff --git a/tools/libxl/libxl_noblktap2.c b/tools/libxl/libxl_noblktap2.c
> index 704d03f..3307551 100644
> --- a/tools/libxl/libxl_noblktap2.c
> +++ b/tools/libxl/libxl_noblktap2.c
> @@ -12,8 +12,6 @@
>   * GNU Lesser General Public License for more details.
>   */
> 
> -#include "libxl.h"
> -#include "libxl_osdeps.h"
>  #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 d63757f..2e9490c 100644
> --- a/tools/libxl/libxl_nocpuid.c
> +++ b/tools/libxl/libxl_nocpuid.c
> @@ -10,7 +10,7 @@
>   * GNU Lesser General Public License for more details.
>   */
> 
> -#include "libxl.h"
> +#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 64f662d..fa80056 100644
> --- a/tools/libxl/libxl_paths.c
> +++ b/tools/libxl/libxl_paths.c
> @@ -12,7 +12,7 @@
>   * GNU Lesser General Public License for more details.
>   */
> 
> -#include "libxl.h"
> +#include "libxl_internal.h"
>  #include "_libxl_paths.h"
> 
>  const char *libxl_sbindir_path(void)
> diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c
> index 33dd060..9eac108 100644
> --- a/tools/libxl/libxl_pci.c
> +++ b/tools/libxl/libxl_pci.c
> @@ -17,7 +17,6 @@
>  #include "libxl_osdeps.h"
> 
>  #include <stdio.h>
> -#include <string.h>
>  #include <stdlib.h>
>  #include <sys/types.h>
>  #include <fcntl.h>
> @@ -27,15 +26,11 @@
>  #include <sys/stat.h>
>  #include <signal.h>
>  #include <unistd.h> /* for write, unlink and close */
> -#include <stdint.h>
>  #include <inttypes.h>
>  #include <dirent.h>
>  #include <assert.h>
> 
> -#include "libxl.h"
> -#include "libxl_utils.h"
>  #include "libxl_internal.h"
> -#include "flexarray.h"
> 
>  #define PCI_BDF                "%04x:%02x:%02x.%01x"
>  #define PCI_BDF_SHORT          "%02x:%02x.%01x"
> diff --git a/tools/libxl/libxl_qmp.c b/tools/libxl/libxl_qmp.c
> index 618f20f..0eefe4d 100644
> --- a/tools/libxl/libxl_qmp.c
> +++ b/tools/libxl/libxl_qmp.c
> @@ -18,6 +18,8 @@
>   * Specification, see in the QEMU repository.
>   */
> 
> +#include "libxl_osdeps.h"
> +
>  #include <unistd.h>
>  #include <sys/un.h>
>  #include <sys/queue.h>
> diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c
> index dce9d8b..7ea2d2c 100644
> --- a/tools/libxl/libxl_utils.c
> +++ b/tools/libxl/libxl_utils.c
> @@ -28,7 +28,6 @@
>  #include <unistd.h>
>  #include <assert.h>
> 
> -#include "libxl_utils.h"
>  #include "libxl_internal.h"
> 
>  struct schedid_name {
> diff --git a/tools/libxl/libxl_uuid.c b/tools/libxl/libxl_uuid.c
> index e837228..80ab789 100644
> --- a/tools/libxl/libxl_uuid.c
> +++ b/tools/libxl/libxl_uuid.c
> @@ -12,8 +12,12 @@
>   * GNU Lesser General Public License for more details.
>   */
> 
> +#include "libxl_osdeps.h"
> +
>  #include <libxl_uuid.h>
> 
> +#include "libxl_internal.h"
> +
>  #if defined(__linux__)
> 
>  int libxl_uuid_is_nil(libxl_uuid *uuid)
> diff --git a/tools/libxl/libxl_xshelp.c b/tools/libxl/libxl_xshelp.c
> index 56a7c7b..f85e867 100644
> --- a/tools/libxl/libxl_xshelp.c
> +++ b/tools/libxl/libxl_xshelp.c
> @@ -21,7 +21,6 @@
>  #include <stdarg.h>
>  #include <inttypes.h>
> 
> -#include "libxl.h"
>  #include "libxl_internal.h"
> 
>  char **libxl__xs_kvs_of_flexarray(libxl__gc *gc, flexarray_t *array, int 
> length)
> --
> 1.7.2.5
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel



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


 


Rackspace

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