If building using --without-xen to disable the Xen driver there are a whole bunch of methods in the src/xml.c file which are not used. There are littered with #if WITH_XEN to disable small parts of the API, but not the whole APIs. This is pointless and results in many compile time warnings about unused variables. This patch just disables all the Xen specific APIs in xml.c entirely. src/xml.c | 19 +++++-------------- src/xml.h | 2 ++ tests/xml2sexprtest.c | 10 ++++++++++ 3 files changed, 17 insertions(+), 14 deletions(-) diff -r 8565c5bfacf5 src/xml.c --- a/src/xml.c Thu Nov 29 10:23:48 2007 -0500 +++ b/src/xml.c Thu Nov 29 10:42:15 2007 -0500 @@ -57,7 +57,7 @@ virXMLError(virConnectPtr conn, virError * Parser and converter for the CPUset strings used in libvirt * * * ************************************************************************/ - +#if WITH_XEN /** * skipSpaces: * @str: pointer to the char pointer used @@ -448,6 +448,7 @@ virConvertCpuSet(virConnectPtr conn, con free(cpuset); return (res); } +#endif /* WITH_XEN */ #ifndef PROXY /************************************************************************ @@ -694,7 +695,7 @@ virXPathNodeSet(const char *xpath, xmlXP * Converter functions to go from the XML tree to an S-Expr for Xen * * * ************************************************************************/ - +#if WITH_XEN /** * virtDomainParseXMLGraphicsDescImage: * @conn: pointer to the hypervisor connection @@ -1625,11 +1626,7 @@ virDomainParseXMLDesc(virConnectPtr conn str = virXPathString("string(/domain/vcpu/@cpuset)", ctxt); if (str != NULL) { -#ifdef WITH_XEN int maxcpu = xenNbCpus(conn); -#else - int maxcpu = 64; -#endif char *cpuset = NULL; char *ranges = NULL; const char *cur = str; @@ -1879,6 +1876,7 @@ virParseXMLDevice(virConnectPtr conn, co goto cleanup; } + /** * virDomainXMLDevID: * @domain: pointer to domain object @@ -1901,9 +1899,7 @@ virDomainXMLDevID(virDomainPtr domain, c xmlNodePtr node, cur; xmlChar *attr = NULL; -#ifdef WITH_XEN char *xref; -#endif /* WITH_XEN */ int ret = 0; xml = xmlReadDoc((const xmlChar *) xmldesc, "device.xml", NULL, @@ -1925,7 +1921,6 @@ virDomainXMLDevID(virDomainPtr domain, c attr = xmlGetProp(cur, BAD_CAST "dev"); if (attr == NULL) goto error; -#ifdef WITH_XEN xref = xenStoreDomainGetDiskID(domain->conn, domain->id, (char *) attr); if (xref != NULL) { @@ -1934,11 +1929,9 @@ virDomainXMLDevID(virDomainPtr domain, c ref[ref_len - 1] = '\0'; goto cleanup; } -#else /* !WITH_XEN */ /* hack to avoid the warning that domain is unused */ if (domain->id < 0) ret = -1; -#endif /* !WITH_XEN */ goto error; } @@ -1952,7 +1945,6 @@ virDomainXMLDevID(virDomainPtr domain, c if (attr == NULL) goto error; -#ifdef WITH_XEN xref = xenStoreDomainGetNetworkID(domain->conn, domain->id, (char *) attr); if (xref != NULL) { @@ -1961,11 +1953,9 @@ virDomainXMLDevID(virDomainPtr domain, c ref[ref_len - 1] = '\0'; goto cleanup; } -#else /* !WITH_XEN */ /* hack to avoid the warning that domain is unused */ if (domain->id < 0) ret = -1; -#endif /* !WITH_XEN */ goto error; } @@ -1981,6 +1971,7 @@ virDomainXMLDevID(virDomainPtr domain, c xmlFree(attr); return ret; } +#endif /* WITH_XEN */ #endif /* !PROXY */ /* diff -r 8565c5bfacf5 src/xml.h --- a/src/xml.h Thu Nov 29 10:23:48 2007 -0500 +++ b/src/xml.h Thu Nov 29 10:42:15 2007 -0500 @@ -32,6 +32,7 @@ int virXPathNodeSet (const char *xpath, xmlXPathContextPtr ctxt, xmlNodePtr **list); +#if WITH_XEN int virParseXenCpuTopology(virConnectPtr conn, virBufferPtr xml, const char *str, @@ -60,6 +61,7 @@ int virDomainXMLDevID(virDomainPtr doma char *class, char *ref, int ref_len); +#endif #ifdef __cplusplus } diff -r 8565c5bfacf5 tests/xml2sexprtest.c --- a/tests/xml2sexprtest.c Thu Nov 29 10:23:48 2007 -0500 +++ b/tests/xml2sexprtest.c Thu Nov 29 10:42:15 2007 -0500 @@ -1,7 +1,9 @@ + #include "config.h" #include <stdio.h> #include <string.h> +#include <stdlib.h> #include <sys/types.h> #include <fcntl.h> @@ -9,6 +11,8 @@ #ifdef HAVE_SYS_SYSLIMITS_H #include <sys/syslimits.h> #endif + +#if WITH_XEN #include "xml.h" #include "testutils.h" @@ -354,3 +358,9 @@ main(int argc, char **argv) exit(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE); } + +#else /* WITH_XEN */ + +int main (void) { exit (77); /* means 'test skipped' for automake */ } + +#endif /* ! WITH_XEN */ -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=| -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list