diff --git a/ChangeLog b/ChangeLog index 28e44b35c3dd5c1ecbede61e86d3d457fa628663..f8b13e3d1474ab7d1f2275cfddac2f969cd3728b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Fri Dec 7 14:36:00 UTC 2007 Richard W.M. Jones + + * src/.cvsignore: Ignore *.loT files (generated under Windows). + * proxy/libvirt_proxy.c: Bail out earlier --without-xen. + * src/proxy_internal.c: Don't build proxy client side if + configured --without-xen. + * src/iptables.c, src/iptables.h: Disable this code if + configured --without-qemu. + * src/nodeinfo.c: If no 'uname' function, set model name to + empty string (for Windows). + Fri Dec 7 14:34:00 UTC 2007 Richard W.M. Jones * src/sexpr.c: Cosmetic rearrangement of headers. diff --git a/proxy/libvirt_proxy.c b/proxy/libvirt_proxy.c index 152df562f7726ec0efc606453f4ff408a03a603c..d8f2e645510a1ddd0909745e6bb7655cdcd5a4b4 100644 --- a/proxy/libvirt_proxy.c +++ b/proxy/libvirt_proxy.c @@ -11,6 +11,8 @@ #include "config.h" +#ifdef WITH_XEN + #include #include #include @@ -20,9 +22,9 @@ #include #include #include + #include "internal.h" -#ifdef WITH_XEN #include "proxy_internal.h" #include "xen_internal.h" #include "xend_internal.h" @@ -839,10 +841,12 @@ int main(int argc, char **argv) { } #else /* WITHOUT_XEN */ + int main(void) { fprintf(stderr, "libvirt was compiled without Xen support\n"); exit(1); } + #endif /* WITH_XEN */ /* diff --git a/src/.cvsignore b/src/.cvsignore index c4aa3061f0f18c93cf7f7d0968e2e2cd95b5a47f..81e1d6296c64e4d5010dcbf2c44d95cc7802a0b8 100644 --- a/src/.cvsignore +++ b/src/.cvsignore @@ -3,6 +3,7 @@ Makefile.in .deps .libs *.lo +*.loT *.la virsh *.gcda diff --git a/src/iptables.c b/src/iptables.c index 6de6008bb533450258b15095e12a135349bd82f2..ee9279658f47246894efb8c41d84693a1514d374 100644 --- a/src/iptables.c +++ b/src/iptables.c @@ -19,9 +19,9 @@ * Mark McLoughlin */ -#include +#include "config.h" -#include "iptables.h" +#if WITH_QEMU #include #include @@ -31,12 +31,19 @@ #include #include #include -#include #include #include + +#ifdef HAVE_SYS_WAIT_H #include +#endif + +#ifdef HAVE_PATHS_H +#include +#endif #include "internal.h" +#include "iptables.h" #define qemudLog(level, msg...) fprintf(stderr, msg) @@ -1092,6 +1099,8 @@ iptablesRemoveForwardMasquerade(iptablesContext *ctx, return iptablesForwardMasquerade(ctx, network, physdev, REMOVE); } +#endif /* WITH_QEMU */ + /* * Local variables: * indent-tabs-mode: nil diff --git a/src/iptables.h b/src/iptables.h index c68fef0ea17ff953d2389db754f7322098ca12ab..a5bb8dd46937e3c978c01e9f42dba8730acd464c 100644 --- a/src/iptables.h +++ b/src/iptables.h @@ -22,6 +22,8 @@ #ifndef __QEMUD_IPTABLES_H__ #define __QEMUD_IPTABLES_H__ +#if WITH_QEMU + typedef struct _iptablesContext iptablesContext; iptablesContext *iptablesContextNew (void); @@ -83,6 +85,8 @@ int iptablesRemoveForwardMasquerade (iptablesContext *ctx, const char *network, const char *physdev); +#endif /* WITH_QEMU */ + #endif /* __QEMUD_IPTABLES_H__ */ /* diff --git a/src/nodeinfo.c b/src/nodeinfo.c index 98e72e83abeecf0f2f87d32114e3b34da21b5f41..1b0191b402a918a811fc6cbd2c55f8cf65ebd1f5 100644 --- a/src/nodeinfo.c +++ b/src/nodeinfo.c @@ -26,10 +26,13 @@ #include #include #include -#include #include #include +#ifdef HAVE_SYS_UTSNAME_H +#include +#endif + #include "nodeinfo.h" #include "physmem.h" @@ -120,6 +123,7 @@ int linuxNodeInfoCPUPopulate(virConnectPtr conn, FILE *cpuinfo, virNodeInfoPtr n int virNodeInfoPopulate(virConnectPtr conn, virNodeInfoPtr nodeinfo) { +#ifdef HAVE_UNAME struct utsname info; if (uname(&info) < 0) { @@ -128,10 +132,15 @@ int virNodeInfoPopulate(virConnectPtr conn, "cannot extract machine type %s", strerror(errno)); return -1; } - strncpy(nodeinfo->model, info.machine, sizeof(nodeinfo->model)-1); nodeinfo->model[sizeof(nodeinfo->model)-1] = '\0'; +#else /* !HAVE_UNAME */ + + nodeinfo->model[0] = '\0'; + +#endif /* !HAVE_UNAME */ + #ifdef __linux__ { int ret; diff --git a/src/proxy_internal.c b/src/proxy_internal.c index 2b98c6114e0fe41a55594a834333efbc88f954f8..7f902c5cf9f2a0ae9b2f801c17283f3aff9a2dc6 100644 --- a/src/proxy_internal.c +++ b/src/proxy_internal.c @@ -8,6 +8,8 @@ * Daniel Veillard */ +#ifdef WITH_XEN + #include "config.h" #include @@ -1111,6 +1113,8 @@ xenProxyDomainGetOSType(virDomainPtr domain) return(ostype); } +#endif /* WITH_XEN */ + /* * vim: set tabstop=4: * vim: set shiftwidth=4: diff --git a/src/test.c b/src/test.c index 9926ac17358e80acc1f32ff30d0437c1d5c6b04b..0e85f73236cb12351e234f6771f9e5ca5b9347f6 100644 --- a/src/test.c +++ b/src/test.c @@ -35,8 +35,14 @@ #include #include #include +#include + +#ifndef HAVE_WINSOCK2_H #include #include +#else +#include +#endif #include "internal.h" #include "test.h" diff --git a/src/util.c b/src/util.c index 8472eb85bcd356ceb7818863599131b1d39189be..dff34400f20a4f4909b6fb1966b48543386faa2e 100644 --- a/src/util.c +++ b/src/util.c @@ -30,12 +30,15 @@ #include #include #include -#include #include #include #include #include +#ifdef HAVE_PATHS_H +#include +#endif + #include "libvirt/virterror.h" #include "internal.h" #include "event.h" @@ -65,6 +68,8 @@ ReportError(virConnectPtr conn, NULL, NULL, NULL, -1, -1, "%s", errorMessage); } +#ifndef __MINGW32__ + static int virSetCloseExec(int fd) { int flags; if ((flags = fcntl(fd, F_GETFD)) < 0) @@ -198,6 +203,34 @@ virExecNonBlock(virConnectPtr conn, return(_virExec(conn, argv, retpid, infd, outfd, errfd, 1)); } +#else /* __MINGW32__ */ + +int +virExec(virConnectPtr conn, + char **argv ATTRIBUTE_UNUSED, + int *retpid ATTRIBUTE_UNUSED, + int infd ATTRIBUTE_UNUSED, + int *outfd ATTRIBUTE_UNUSED, + int *errfd ATTRIBUTE_UNUSED) +{ + ReportError (conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, __FUNCTION__); + return -1; +} + +int +virExecNonBlock(virConnectPtr conn, + char **argv ATTRIBUTE_UNUSED, + int *retpid ATTRIBUTE_UNUSED, + int infd ATTRIBUTE_UNUSED, + int *outfd ATTRIBUTE_UNUSED, + int *errfd ATTRIBUTE_UNUSED) +{ + ReportError (conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, __FUNCTION__); + return -1; +} + +#endif /* __MINGW32__ */ + /* Like read(), but restarts after EINTR */ int saferead(int fd, void *buf, size_t count) { @@ -313,6 +346,7 @@ int virFileHasSuffix(const char *str, return strcmp(str + len - suffixlen, suffix) == 0; } +#ifndef __MINGW32__ int virFileLinkPointsTo(const char *checkLink, const char *checkDest) @@ -397,6 +431,22 @@ int virFileLinkPointsTo(const char *checkLink, return 1; } +#else /* !__MINGW32__ */ + +/* Gnulib has an implementation of readlink which could be used + * to implement this, but it requires LGPLv3. + */ + +int +virFileLinkPointsTo (const char *checkLink ATTRIBUTE_UNUSED, + const char *checkDest ATTRIBUTE_UNUSED) +{ + virLog ("%s: not implemented", __FUNCTION__); + return 0; +} + +#endif /*! __MINGW32__ */ + int virFileMakePath(const char *path) { struct stat st; diff --git a/src/xen_unified.h b/src/xen_unified.h index a1249aa747625d3f0d875d36b04a7a3365909012..dda26795059f0131b18b7f59952adc4f29267371 100644 --- a/src/xen_unified.h +++ b/src/xen_unified.h @@ -13,8 +13,12 @@ #include "internal.h" +#ifndef HAVE_WINSOCK2_H #include #include +#else +#include +#endif #ifdef __cplusplus extern "C" {