From 4bfdb77aae749daedb508eaff381c662be9258e5 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Wed, 5 Dec 2007 13:56:22 +0000 Subject: [PATCH] Wed Dec 5 13:48:00 UTC 2007 Richard W.M. Jones * python/libvir.c, python/libvirt_wrap.h, qemud/qemud.c, qemud/remote.c, src/internal.h, src/openvz_conf.c, src/openvz_driver.c, src/proxy_internal.h, src/qemu_conf.c, src/qemu_driver.c, src/remote_internal.h, src/test.h, src/util.c, src/xen_unified.c, src/xen_unified.h, tests/nodeinfotest.c, tests/qemuxml2argvtest.c, tests/qemuxml2xmltest.c, tests/reconnect.c, tests/sexpr2xmltest.c, tests/virshtest.c, tests/xencapstest.c, tests/xmconfigtest.c, tests/xml2sexprtest.c: Change #include <> to #include "" for local includes. Removed many includes from src/internal.h and put them in the C files which actually use them. Removed - unused. Added a comment around __func__. Removed a clashing redefinition of VERSION symbol. All limits (PATH_MAX etc) now done in src/internal.h, so we don't need to include those headers in other files. --- ChangeLog | 19 +++++++++++++++++++ python/libvir.c | 4 ++-- python/libvirt_wrap.h | 4 ++-- qemud/qemud.c | 2 +- qemud/remote.c | 2 +- src/internal.h | 35 ++++++++++++++--------------------- src/openvz_conf.c | 2 +- src/openvz_driver.c | 2 +- src/proxy_internal.h | 2 +- src/qemu_conf.c | 2 +- src/qemu_driver.c | 2 +- src/remote_internal.h | 2 +- src/test.h | 2 +- src/util.c | 7 ++----- src/xen_unified.c | 10 ++++++---- src/xen_unified.h | 3 +++ tests/nodeinfotest.c | 5 ----- tests/qemuxml2argvtest.c | 6 +----- tests/qemuxml2xmltest.c | 6 +----- tests/reconnect.c | 4 ++-- tests/sexpr2xmltest.c | 7 ++----- tests/virshtest.c | 7 +------ tests/xencapstest.c | 9 ++------- tests/xmconfigtest.c | 7 ++----- tests/xml2sexprtest.c | 9 ++------- 25 files changed, 70 insertions(+), 90 deletions(-) diff --git a/ChangeLog b/ChangeLog index f6227d990b..578d9e3326 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +Wed Dec 5 13:48:00 UTC 2007 Richard W.M. Jones + + * python/libvir.c, python/libvirt_wrap.h, qemud/qemud.c, + qemud/remote.c, src/internal.h, src/openvz_conf.c, + src/openvz_driver.c, src/proxy_internal.h, src/qemu_conf.c, + src/qemu_driver.c, src/remote_internal.h, src/test.h, src/util.c, + src/xen_unified.c, src/xen_unified.h, tests/nodeinfotest.c, + tests/qemuxml2argvtest.c, tests/qemuxml2xmltest.c, tests/reconnect.c, + tests/sexpr2xmltest.c, tests/virshtest.c, tests/xencapstest.c, + tests/xmconfigtest.c, tests/xml2sexprtest.c: + Change #include <> to #include "" for local includes. + Removed many includes from src/internal.h and put them in + the C files which actually use them. + Removed - unused. + Added a comment around __func__. + Removed a clashing redefinition of VERSION symbol. + All limits (PATH_MAX etc) now done in src/internal.h, so we + don't need to include those headers in other files. + Tue Dec 4 18:25:01 UTC 2007 Richard W.M. Jones * configure.in: Fix configure if rpcgen program is missing. diff --git a/python/libvir.c b/python/libvir.c index 9969c80323..54dca79ffd 100644 --- a/python/libvir.c +++ b/python/libvir.c @@ -10,8 +10,8 @@ */ #include -#include -#include +#include "libvirt/libvirt.h" +#include "libvirt/virterror.h" #include "libvirt_wrap.h" #include "libvirt-py.h" diff --git a/python/libvirt_wrap.h b/python/libvirt_wrap.h index d7f43c2773..ef5fa68199 100644 --- a/python/libvirt_wrap.h +++ b/python/libvirt_wrap.h @@ -7,8 +7,8 @@ */ #include -#include -#include +#include "libvirt/libvirt.h" +#include "libvirt/virterror.h" #ifdef __GNUC__ #ifdef ATTRIBUTE_UNUSED diff --git a/qemud/qemud.c b/qemud/qemud.c index f88ed42cb8..b983e54786 100644 --- a/qemud/qemud.c +++ b/qemud/qemud.c @@ -50,7 +50,7 @@ #include #include -#include +#include "libvirt/virterror.h" #include "internal.h" #include "../src/internal.h" diff --git a/qemud/remote.c b/qemud/remote.c index 047cae73c9..93af5104b6 100644 --- a/qemud/remote.c +++ b/qemud/remote.c @@ -45,7 +45,7 @@ #include #include -#include +#include "libvirt/virterror.h" #include "internal.h" #include "../src/internal.h" diff --git a/src/internal.h b/src/internal.h index 3fc111634f..0ef32a0b51 100644 --- a/src/internal.h +++ b/src/internal.h @@ -6,16 +6,22 @@ #define __VIR_INTERNAL_H__ #include -#include -#include -#include -#include -#include -#include +#include + #ifdef HAVE_SYS_SYSLIMITS_H #include #endif +#include "hash.h" +#include "libvirt/libvirt.h" +#include "libvirt/virterror.h" +#include "driver.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + /* On architectures which lack these limits, define them (ie. Cygwin). * Note that the libvirt code should be robust enough to handle the * case where actual value is longer than these limits (eg. by setting @@ -30,16 +36,6 @@ #define IF_NAMESIZE 16 #endif -#include "hash.h" -#include "libvirt/libvirt.h" -#include "libvirt/virterror.h" -#include "driver.h" -#include - -#ifdef __cplusplus -extern "C" { -#endif - #define _(str) dgettext(GETTEXT_PACKAGE, (str)) #define N_(str) dgettext(GETTEXT_PACKAGE, (str)) #define gettext_noop(str) (str) @@ -52,15 +48,12 @@ extern "C" { #define STREQLEN(a,b,n) (strncmp((a),(b),(n)) == 0) #define STRNEQLEN(a,b,n) (strncmp((a),(b),(n)) != 0) +/* C99 uses __func__. __FUNCTION__ is legacy. */ #ifndef __GNUC__ -#define __FUNCTION__ __func__ +#define __FUNCTION__ __func__ #endif #ifdef __GNUC__ -#ifdef HAVE_ANSIDECL_H -#include -#endif - /** * ATTRIBUTE_UNUSED: * diff --git a/src/openvz_conf.c b/src/openvz_conf.c index c9f8536c56..88491f7ae3 100644 --- a/src/openvz_conf.c +++ b/src/openvz_conf.c @@ -45,7 +45,7 @@ #include #include -#include +#include "libvirt/virterror.h" #include "openvz_driver.h" #include "openvz_conf.h" diff --git a/src/openvz_driver.c b/src/openvz_driver.c index aa554f2f4d..7c4a46d844 100644 --- a/src/openvz_driver.c +++ b/src/openvz_driver.c @@ -52,7 +52,7 @@ #include #include -#include +#include "libvirt/virterror.h" #include "openvz_driver.h" #include "event.h" diff --git a/src/proxy_internal.h b/src/proxy_internal.h index fa8e48abd4..47cc790a74 100644 --- a/src/proxy_internal.h +++ b/src/proxy_internal.h @@ -12,7 +12,7 @@ #ifndef __LIBVIR_PROXY_H__ #define __LIBVIR_PROXY_H__ -#include +#include "libvirt/libvirt.h" #ifdef __cplusplus extern "C" { diff --git a/src/qemu_conf.c b/src/qemu_conf.c index 2635b334d4..0c43e57dd4 100644 --- a/src/qemu_conf.c +++ b/src/qemu_conf.c @@ -42,7 +42,7 @@ #include #include -#include +#include "libvirt/virterror.h" #include "qemu_conf.h" #include "uuid.h" diff --git a/src/qemu_driver.c b/src/qemu_driver.c index 0be71a5631..4cdf0b4dfe 100644 --- a/src/qemu_driver.c +++ b/src/qemu_driver.c @@ -49,7 +49,7 @@ #include #include -#include +#include "libvirt/virterror.h" #include "event.h" #include "buf.h" diff --git a/src/remote_internal.h b/src/remote_internal.h index da4b0b0f82..ce8f400dce 100644 --- a/src/remote_internal.h +++ b/src/remote_internal.h @@ -24,7 +24,7 @@ #ifndef __VIR_REMOTE_INTERNAL_H__ #define __VIR_REMOTE_INTERNAL_H__ -#include +#include "libvirt/virterror.h" #ifdef __cplusplus extern "C" { diff --git a/src/test.h b/src/test.h index b542c27786..a20ee22fae 100644 --- a/src/test.h +++ b/src/test.h @@ -24,7 +24,7 @@ #ifndef __VIR_TEST_INTERNAL_H__ #define __VIR_TEST_INTERNAL_H__ -#include +#include "libvirt/virterror.h" #ifdef __cplusplus extern "C" { diff --git a/src/util.c b/src/util.c index 50ddcffcfb..8472eb85bc 100644 --- a/src/util.c +++ b/src/util.c @@ -36,11 +36,8 @@ #include #include -#ifdef HAVE_SYS_SYSLIMITS_H -#include -#endif - -#include +#include "libvirt/virterror.h" +#include "internal.h" #include "event.h" #include "buf.h" #include "util.h" diff --git a/src/xen_unified.c b/src/xen_unified.c index 336b7ec8a3..c38b11d693 100644 --- a/src/xen_unified.c +++ b/src/xen_unified.c @@ -8,6 +8,8 @@ * Richard W.M. Jones */ +#include "config.h" + #ifdef WITH_XEN /* Note: @@ -1193,15 +1195,15 @@ xenUnifiedNodeGetFreeMemory (virConnectPtr conn) /*----- Register with libvirt.c, and initialise Xen drivers. -----*/ -#define VERSION ((DOM0_INTERFACE_VERSION >> 24) * 1000000 + \ - ((DOM0_INTERFACE_VERSION >> 16) & 0xFF) * 1000 + \ - (DOM0_INTERFACE_VERSION & 0xFFFF)) +#define HV_VERSION ((DOM0_INTERFACE_VERSION >> 24) * 1000000 + \ + ((DOM0_INTERFACE_VERSION >> 16) & 0xFF) * 1000 + \ + (DOM0_INTERFACE_VERSION & 0xFFFF)) /* The interface which we export upwards to libvirt.c. */ static virDriver xenUnifiedDriver = { .no = VIR_DRV_XEN_UNIFIED, .name = "Xen", - .ver = VERSION, + .ver = HV_VERSION, .open = xenUnifiedOpen, .close = xenUnifiedClose, .supports_feature = xenUnifiedSupportsFeature, diff --git a/src/xen_unified.h b/src/xen_unified.h index 5d5e073449..a1249aa747 100644 --- a/src/xen_unified.h +++ b/src/xen_unified.h @@ -13,6 +13,9 @@ #include "internal.h" +#include +#include + #ifdef __cplusplus extern "C" { #endif diff --git a/tests/nodeinfotest.c b/tests/nodeinfotest.c index 7275cc3fdd..1caef11d98 100644 --- a/tests/nodeinfotest.c +++ b/tests/nodeinfotest.c @@ -2,11 +2,6 @@ #include #include - -#ifdef HAVE_SYS_SYSLIMITS_H -#include -#endif - #include #include "testutils.h" diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 966f67c324..95b4679ec8 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -8,15 +8,11 @@ #include #include -#ifdef HAVE_SYS_SYSLIMITS_H -#include -#endif - #ifdef WITH_QEMU +#include "internal.h" #include "testutils.h" #include "qemu_conf.h" -#include "internal.h" static char *progname; static char *abs_top_srcdir; diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index a448ee244f..c42e6fb68d 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -8,15 +8,11 @@ #include #include -#ifdef HAVE_SYS_SYSLIMITS_H -#include -#endif - #ifdef WITH_QEMU +#include "internal.h" #include "testutils.h" #include "qemu_conf.h" -#include "internal.h" static char *progname; static char *abs_top_srcdir; diff --git a/tests/reconnect.c b/tests/reconnect.c index 6a6a1d22d5..246e3bbd70 100644 --- a/tests/reconnect.c +++ b/tests/reconnect.c @@ -1,7 +1,7 @@ #include #include -#include -#include +#include "libvirt/libvirt.h" +#include "libvirt/virterror.h" #include "internal.h" static void errorHandler(void *userData ATTRIBUTE_UNUSED, diff --git a/tests/sexpr2xmltest.c b/tests/sexpr2xmltest.c index 3744801c38..6586e92a69 100644 --- a/tests/sexpr2xmltest.c +++ b/tests/sexpr2xmltest.c @@ -3,15 +3,12 @@ #include #include -#ifdef HAVE_SYS_SYSLIMITS_H -#include -#endif - #ifdef WITH_XEN + +#include "internal.h" #include "xml.h" #include "xend_internal.h" #include "testutils.h" -#include "internal.h" static char *progname; static char *abs_top_srcdir; diff --git a/tests/virshtest.c b/tests/virshtest.c index b58a4e3556..fd6dcbb2a3 100644 --- a/tests/virshtest.c +++ b/tests/virshtest.c @@ -3,15 +3,10 @@ #include #include #include -#include - -#ifdef HAVE_SYS_SYSLIMITS_H -#include -#endif +#include "internal.h" #include "xml.h" #include "testutils.h" -#include "internal.h" static char *progname; static char *abs_top_srcdir; diff --git a/tests/xencapstest.c b/tests/xencapstest.c index bbf5976e2f..dd1c386c82 100644 --- a/tests/xencapstest.c +++ b/tests/xencapstest.c @@ -2,18 +2,13 @@ #include #include - -#ifdef HAVE_SYS_SYSLIMITS_H -#include -#endif +#include #ifdef WITH_XEN -#include - +#include "internal.h" #include "xml.h" #include "testutils.h" -#include "internal.h" #include "xen_internal.h" static char *progname; diff --git a/tests/xmconfigtest.c b/tests/xmconfigtest.c index 4ed9eb1116..d66b66015c 100644 --- a/tests/xmconfigtest.c +++ b/tests/xmconfigtest.c @@ -26,15 +26,12 @@ #include #include -#ifdef HAVE_SYS_SYSLIMITS_H -#include -#endif - #ifdef WITH_XEN + +#include "internal.h" #include "xen_unified.h" #include "xm_internal.h" #include "testutils.h" -#include "internal.h" #include "conf.h" static char *progname; diff --git a/tests/xml2sexprtest.c b/tests/xml2sexprtest.c index 1f37b21cd5..2d18e608b2 100644 --- a/tests/xml2sexprtest.c +++ b/tests/xml2sexprtest.c @@ -2,21 +2,16 @@ #include "config.h" #include -#include #include - +#include #include #include -#ifdef HAVE_SYS_SYSLIMITS_H -#include -#endif - #if WITH_XEN +#include "internal.h" #include "xml.h" #include "testutils.h" -#include "internal.h" static char *progname; static char *abs_top_srcdir;