+Fri Nov 30 17:50:34 EST 2007 Daniel P. Berrange <berrange@redhat.com>
+
+ * src/xml.c, src/xml.h: Disable xen specific functions if
+ Xen driver is disabled.
+ * tests/xml2sexprtest.c: Disable if xen driver is disabled
+
Fri Nov 30 16:36:34 CET 2007 Jim Meyering <meyering@redhat.com>
Detect heap allocation failure; factor out some duplication.
* Parser and converter for the CPUset strings used in libvirt *
* *
************************************************************************/
-
+#if WITH_XEN
/**
* skipSpaces:
* @str: pointer to the char pointer used
free(cpuset);
return (res);
}
+#endif /* WITH_XEN */
#ifndef PROXY
/************************************************************************
* Converter functions to go from the XML tree to an S-Expr for Xen *
* *
************************************************************************/
-
+#if WITH_XEN
/**
* virtDomainParseXMLGraphicsDescImage:
* @conn: pointer to the hypervisor connection
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;
goto cleanup;
}
+
/**
* virDomainXMLDevID:
* @domain: pointer to domain object
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,
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) {
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;
}
if (attr == NULL)
goto error;
-#ifdef WITH_XEN
xref = xenStoreDomainGetNetworkID(domain->conn, domain->id,
(char *) attr);
if (xref != NULL) {
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;
}
xmlFree(attr);
return ret;
}
+#endif /* WITH_XEN */
#endif /* !PROXY */
/*