diff options
author | Markus Groß <gross@univention.de> | 2011-02-21 14:40:12 +0100 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2011-02-21 11:15:08 -0700 |
commit | 3e53c7f9540e52cb0dc7c08b14b73d2889927f12 (patch) | |
tree | b18b953202b7bf7c3ec3681d5abddcb37b699c92 | |
parent | Moved XM formatting functions to xenxs (diff) | |
download | libvirt-3e53c7f9540e52cb0dc7c08b14b73d2889927f12.tar.gz libvirt-3e53c7f9540e52cb0dc7c08b14b73d2889927f12.tar.bz2 libvirt-3e53c7f9540e52cb0dc7c08b14b73d2889927f12.zip |
Renamed functions in xenxs
-rw-r--r-- | src/xen/xen_driver.c | 8 | ||||
-rw-r--r-- | src/xen/xend_internal.c | 54 | ||||
-rw-r--r-- | src/xen/xm_internal.c | 6 | ||||
-rw-r--r-- | src/xenxs/xen_sxpr.c | 184 | ||||
-rw-r--r-- | src/xenxs/xen_sxpr.h | 60 | ||||
-rw-r--r-- | src/xenxs/xen_xm.c | 35 | ||||
-rw-r--r-- | src/xenxs/xen_xm.h | 8 | ||||
-rw-r--r-- | tests/sexpr2xmltest.c | 3 | ||||
-rw-r--r-- | tests/xmconfigtest.c | 4 | ||||
-rw-r--r-- | tests/xml2sexprtest.c | 2 |
10 files changed, 168 insertions, 196 deletions
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c index 881b3d00c..979f9e085 100644 --- a/src/xen/xen_driver.c +++ b/src/xen/xen_driver.c @@ -1217,14 +1217,14 @@ xenUnifiedDomainXMLFromNative(virConnectPtr conn, if (!conf) goto cleanup; - def = xenXMDomainConfigParse(conf, priv->xendConfigVersion, priv->caps); + def = xenParseXM(conf, priv->xendConfigVersion, priv->caps); } else if (STREQ(format, XEN_CONFIG_FORMAT_SEXPR)) { id = xenGetDomIdFromSxprString(config, priv->xendConfigVersion); xenUnifiedLock(priv); tty = xenStoreDomainGetConsolePath(conn, id); vncport = xenStoreDomainGetVNCPort(conn, id); xenUnifiedUnlock(priv); - def = xenDaemonParseSxprString(config, priv->xendConfigVersion, tty, + def = xenParseSxprString(config, priv->xendConfigVersion, tty, vncport); } if (!def) @@ -1266,7 +1266,7 @@ xenUnifiedDomainXMLToNative(virConnectPtr conn, if (STREQ(format, XEN_CONFIG_FORMAT_XM)) { int len = MAX_CONFIG_SIZE; - conf = xenXMDomainConfigFormat(conn, def, priv->xendConfigVersion); + conf = xenFormatXM(conn, def, priv->xendConfigVersion); if (!conf) goto cleanup; @@ -1280,7 +1280,7 @@ xenUnifiedDomainXMLToNative(virConnectPtr conn, goto cleanup; } } else if (STREQ(format, XEN_CONFIG_FORMAT_SEXPR)) { - ret = xenDaemonFormatSxpr(conn, def, priv->xendConfigVersion); + ret = xenFormatSxpr(conn, def, priv->xendConfigVersion); } cleanup: diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c index 9b228c433..e811b860e 100644 --- a/src/xen/xend_internal.c +++ b/src/xen/xend_internal.c @@ -1793,11 +1793,11 @@ xenDaemonDomainFetch(virConnectPtr conn, tty = xenStoreDomainGetConsolePath(conn, id); vncport = xenStoreDomainGetVNCPort(conn, id); xenUnifiedUnlock(priv); - if (!(def = xenDaemonParseSxpr(root, - priv->xendConfigVersion, - cpus, - tty, - vncport))) + if (!(def = xenParseSxpr(root, + priv->xendConfigVersion, + cpus, + tty, + vncport))) goto cleanup; cleanup: @@ -2525,7 +2525,7 @@ xenDaemonCreateXML(virConnectPtr conn, const char *xmlDesc, VIR_DOMAIN_XML_INACTIVE))) return (NULL); - if (!(sexpr = xenDaemonFormatSxpr(conn, def, priv->xendConfigVersion))) { + if (!(sexpr = xenFormatSxpr(conn, def, priv->xendConfigVersion))) { virDomainDefFree(def); return (NULL); } @@ -2641,11 +2641,11 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const char *xml, switch (dev->type) { case VIR_DOMAIN_DEVICE_DISK: - if (xenDaemonFormatSxprDisk(domain->conn, - dev->data.disk, - &buf, - STREQ(def->os.type, "hvm") ? 1 : 0, - priv->xendConfigVersion, 1) < 0) + if (xenFormatSxprDisk(domain->conn, + dev->data.disk, + &buf, + STREQ(def->os.type, "hvm") ? 1 : 0, + priv->xendConfigVersion, 1) < 0) goto cleanup; if (dev->data.disk->device != VIR_DOMAIN_DISK_DEVICE_CDROM) { @@ -2657,11 +2657,11 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const char *xml, break; case VIR_DOMAIN_DEVICE_NET: - if (xenDaemonFormatSxprNet(domain->conn, - dev->data.net, - &buf, - STREQ(def->os.type, "hvm") ? 1 : 0, - priv->xendConfigVersion, 1) < 0) + if (xenFormatSxprNet(domain->conn, + dev->data.net, + &buf, + STREQ(def->os.type, "hvm") ? 1 : 0, + priv->xendConfigVersion, 1) < 0) goto cleanup; char macStr[VIR_MAC_STRING_BUFLEN]; @@ -2676,8 +2676,7 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const char *xml, case VIR_DOMAIN_DEVICE_HOSTDEV: if (dev->data.hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS && dev->data.hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) { - if (xenDaemonFormatSxprOnePCI(dev->data.hostdev, - &buf, 0) < 0) + if (xenFormatSxprOnePCI(dev->data.hostdev, &buf, 0) < 0) goto cleanup; virDomainDevicePCIAddress PCIAddr; @@ -2812,11 +2811,11 @@ xenDaemonUpdateDeviceFlags(virDomainPtr domain, const char *xml, switch (dev->type) { case VIR_DOMAIN_DEVICE_DISK: - if (xenDaemonFormatSxprDisk(domain->conn, - dev->data.disk, - &buf, - STREQ(def->os.type, "hvm") ? 1 : 0, - priv->xendConfigVersion, 1) < 0) + if (xenFormatSxprDisk(domain->conn, + dev->data.disk, + &buf, + STREQ(def->os.type, "hvm") ? 1 : 0, + priv->xendConfigVersion, 1) < 0) goto cleanup; break; @@ -2927,8 +2926,7 @@ xenDaemonDetachDeviceFlags(virDomainPtr domain, const char *xml, if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) { if (dev->data.hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS && dev->data.hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) { - if (xenDaemonFormatSxprOnePCI(dev->data.hostdev, - &buf, 1) < 0) + if (xenFormatSxprOnePCI(dev->data.hostdev, &buf, 1) < 0) goto cleanup; } else { virXendError(VIR_ERR_NO_SUPPORT, "%s", @@ -3267,7 +3265,7 @@ virDomainPtr xenDaemonDomainDefineXML(virConnectPtr conn, const char *xmlDesc) { return (NULL); } - if (!(sexpr = xenDaemonFormatSxpr(conn, def, priv->xendConfigVersion))) { + if (!(sexpr = xenFormatSxpr(conn, def, priv->xendConfigVersion))) { virXendError(VIR_ERR_XML_ERROR, "%s", _("failed to build sexpr")); goto error; @@ -3759,8 +3757,8 @@ xenDaemonDomainBlockPeek (virDomainPtr domain, const char *path, vncport = xenStoreDomainGetVNCPort(domain->conn, id); xenUnifiedUnlock(priv); - if (!(def = xenDaemonParseSxpr(root, priv->xendConfigVersion, NULL, tty, - vncport))) + if (!(def = xenParseSxpr(root, priv->xendConfigVersion, NULL, tty, + vncport))) goto cleanup; for (i = 0 ; i < def->ndisks ; i++) { diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c index 96014ed18..27cc387e8 100644 --- a/src/xen/xm_internal.c +++ b/src/xen/xm_internal.c @@ -178,7 +178,7 @@ xenXMConfigReadFile(virConnectPtr conn, const char *filename) { if (!(conf = virConfReadFile(filename, 0))) return NULL; - def = xenXMDomainConfigParse(conf, priv->xendConfigVersion, priv->caps); + def = xenParseXM(conf, priv->xendConfigVersion, priv->caps); virConfFree(conf); return def; @@ -190,7 +190,7 @@ xenXMConfigSaveFile(virConnectPtr conn, const char *filename, virDomainDefPtr de xenUnifiedPrivatePtr priv = conn->privateData; int ret; - if (!(conf = xenXMDomainConfigFormat(conn, def, priv->xendConfigVersion))) + if (!(conf = xenFormatXM(conn, def, priv->xendConfigVersion))) return -1; ret = virConfWriteFile(filename, conf); @@ -1011,7 +1011,7 @@ int xenXMDomainCreate(virDomainPtr domain) { if (!(entry = virHashLookup(priv->configCache, filename))) goto error; - if (!(sexpr = xenDaemonFormatSxpr(domain->conn, entry->def, priv->xendConfigVersion))) + if (!(sexpr = xenFormatSxpr(domain->conn, entry->def, priv->xendConfigVersion))) goto error; ret = xenDaemonDomainCreateXML(domain->conn, sexpr); diff --git a/src/xenxs/xen_sxpr.c b/src/xenxs/xen_sxpr.c index d0b28c928..aac2585b3 100644 --- a/src/xenxs/xen_sxpr.c +++ b/src/xenxs/xen_sxpr.c @@ -71,7 +71,7 @@ int xenGetDomIdFromSxpr(const struct sexpr *root, int xendConfigVersion) *****************************************************************/ /** - * xenDaemonParseSxprOS + * xenParseSxprOS * @node: the root of the parsed S-Expression * @def: the domain config * @hvm: true or 1 if no contains HVM S-Expression @@ -82,9 +82,9 @@ int xenGetDomIdFromSxpr(const struct sexpr *root, int xendConfigVersion) * Returns 0 in case of success and -1 in case of error */ static int -xenDaemonParseSxprOS(const struct sexpr *node, - virDomainDefPtr def, - int hvm) +xenParseSxprOS(const struct sexpr *node, + virDomainDefPtr def, + int hvm) { if (hvm) { if (sexpr_node_copy(node, "domain/image/hvm/loader", &def->os.loader) < 0) @@ -161,8 +161,8 @@ no_memory: } virDomainChrDefPtr -xenDaemonParseSxprChar(const char *value, - const char *tty) +xenParseSxprChar(const char *value, + const char *tty) { const char *prefix; char *tmp; @@ -321,10 +321,10 @@ error: * Returns 0 if successful or -1 if failed. */ static int -xenDaemonParseSxprDisks(virDomainDefPtr def, - const struct sexpr *root, - int hvm, - int xendConfigVersion) +xenParseSxprDisks(virDomainDefPtr def, + const struct sexpr *root, + int hvm, + int xendConfigVersion) { const struct sexpr *cur, *node; virDomainDiskDefPtr disk = NULL; @@ -497,8 +497,8 @@ error: static int -xenDaemonParseSxprNets(virDomainDefPtr def, - const struct sexpr *root) +xenParseSxprNets(virDomainDefPtr def, + const struct sexpr *root) { virDomainNetDefPtr net = NULL; const struct sexpr *cur, *node; @@ -590,8 +590,8 @@ cleanup: int -xenDaemonParseSxprSound(virDomainDefPtr def, - const char *str) +xenParseSxprSound(virDomainDefPtr def, + const char *str) { if (STREQ(str, "all")) { int i; @@ -668,8 +668,8 @@ error: static int -xenDaemonParseSxprUSB(virDomainDefPtr def, - const struct sexpr *root) +xenParseSxprUSB(virDomainDefPtr def, + const struct sexpr *root) { struct sexpr *cur, *node; const char *tmp; @@ -709,10 +709,10 @@ no_memory: } static int -xenDaemonParseSxprGraphicsOld(virDomainDefPtr def, - const struct sexpr *root, - int hvm, - int xendConfigVersion, int vncport) +xenParseSxprGraphicsOld(virDomainDefPtr def, + const struct sexpr *root, + int hvm, + int xendConfigVersion, int vncport) { const char *tmp; virDomainGraphicsDefPtr graphics = NULL; @@ -796,8 +796,8 @@ no_memory: static int -xenDaemonParseSxprGraphicsNew(virDomainDefPtr def, - const struct sexpr *root, int vncport) +xenParseSxprGraphicsNew(virDomainDefPtr def, + const struct sexpr *root, int vncport) { virDomainGraphicsDefPtr graphics = NULL; const struct sexpr *cur, *node; @@ -893,7 +893,7 @@ error: } /** - * xenDaemonParseSxprPCI + * xenParseSxprPCI * @root: root sexpr * * This parses out block devices from the domain sexpr @@ -901,8 +901,8 @@ error: * Returns 0 if successful or -1 if failed. */ static int -xenDaemonParseSxprPCI(virDomainDefPtr def, - const struct sexpr *root) +xenParseSxprPCI(virDomainDefPtr def, + const struct sexpr *root) { const struct sexpr *cur, *tmp = NULL, *node; virDomainHostdevDefPtr dev = NULL; @@ -1017,7 +1017,7 @@ error: /** - * xenDaemonParseSxpr: + * xenParseSxpr: * @conn: the connection associated with the XML * @root: the root of the parsed S-Expression * @xendConfigVersion: version of xend @@ -1030,9 +1030,9 @@ error: * the caller must free() the returned value. */ virDomainDefPtr -xenDaemonParseSxpr(const struct sexpr *root, - int xendConfigVersion, - const char *cpus, char *tty, int vncport) +xenParseSxpr(const struct sexpr *root, + int xendConfigVersion, + const char *cpus, char *tty, int vncport) { const char *tmp; virDomainDefPtr def; @@ -1094,7 +1094,7 @@ xenDaemonParseSxpr(const struct sexpr *root, if (def->id != 0) { if (sexpr_lookup(root, "domain/image")) { - if (xenDaemonParseSxprOS(root, def, hvm) < 0) + if (xenParseSxprOS(root, def, hvm) < 0) goto error; } } @@ -1184,22 +1184,22 @@ xenDaemonParseSxpr(const struct sexpr *root, goto no_memory; /* append block devices */ - if (xenDaemonParseSxprDisks(def, root, hvm, xendConfigVersion) < 0) + if (xenParseSxprDisks(def, root, hvm, xendConfigVersion) < 0) goto error; - if (xenDaemonParseSxprNets(def, root) < 0) + if (xenParseSxprNets(def, root) < 0) goto error; - if (xenDaemonParseSxprPCI(def, root) < 0) + if (xenParseSxprPCI(def, root) < 0) goto error; /* New style graphics device config */ - if (xenDaemonParseSxprGraphicsNew(def, root, vncport) < 0) + if (xenParseSxprGraphicsNew(def, root, vncport) < 0) goto error; /* Graphics device (HVM <= 3.0.4, or PV <= 3.0.3) vnc config */ if ((def->ngraphics == 0) && - xenDaemonParseSxprGraphicsOld(def, root, hvm, xendConfigVersion, + xenParseSxprGraphicsOld(def, root, hvm, xendConfigVersion, vncport) < 0) goto error; @@ -1275,7 +1275,7 @@ xenDaemonParseSxpr(const struct sexpr *root, /* in case of HVM we have USB device emulation */ if (hvm && - xenDaemonParseSxprUSB(def, root) < 0) + xenParseSxprUSB(def, root) < 0) goto error; /* Character device config */ @@ -1283,7 +1283,7 @@ xenDaemonParseSxpr(const struct sexpr *root, tmp = sexpr_node(root, "domain/image/hvm/serial"); if (tmp && STRNEQ(tmp, "none")) { virDomainChrDefPtr chr; - if ((chr = xenDaemonParseSxprChar(tmp, tty)) == NULL) + if ((chr = xenParseSxprChar(tmp, tty)) == NULL) goto error; if (VIR_REALLOC_N(def->serials, def->nserials+1) < 0) { virDomainChrDefFree(chr); @@ -1296,7 +1296,7 @@ xenDaemonParseSxpr(const struct sexpr *root, if (tmp && STRNEQ(tmp, "none")) { virDomainChrDefPtr chr; /* XXX does XenD stuff parallel port tty info into xenstore somewhere ? */ - if ((chr = xenDaemonParseSxprChar(tmp, NULL)) == NULL) + if ((chr = xenParseSxprChar(tmp, NULL)) == NULL) goto error; if (VIR_REALLOC_N(def->parallels, def->nparallels+1) < 0) { virDomainChrDefFree(chr); @@ -1307,7 +1307,7 @@ xenDaemonParseSxpr(const struct sexpr *root, } } else { /* Fake a paravirt console, since that's not in the sexpr */ - if (!(def->console = xenDaemonParseSxprChar("pty", tty))) + if (!(def->console = xenParseSxprChar("pty", tty))) goto error; def->console->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE; def->console->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN; @@ -1319,7 +1319,7 @@ xenDaemonParseSxpr(const struct sexpr *root, if (hvm && (tmp = sexpr_node(root, "domain/image/hvm/soundhw")) != NULL && *tmp) { - if (xenDaemonParseSxprSound(def, tmp) < 0) + if (xenParseSxprSound(def, tmp) < 0) goto error; } @@ -1334,7 +1334,7 @@ error: } virDomainDefPtr -xenDaemonParseSxprString(const char *sexpr, +xenParseSxprString(const char *sexpr, int xendConfigVersion, char *tty, int vncport) { struct sexpr *root = string2sexpr(sexpr); @@ -1343,7 +1343,7 @@ xenDaemonParseSxprString(const char *sexpr, if (!root) return NULL; - def = xenDaemonParseSxpr(root, xendConfigVersion, NULL, tty, vncport); + def = xenParseSxpr(root, xendConfigVersion, NULL, tty, vncport); sexpr_free(root); @@ -1371,8 +1371,8 @@ xenDaemonParseSxprString(const char *sexpr, * Returns 0 in case of success, -1 in case of error */ static int -xenDaemonFormatSxprGraphicsNew(virDomainGraphicsDefPtr def, - virBufferPtr buf) +xenFormatSxprGraphicsNew(virDomainGraphicsDefPtr def, + virBufferPtr buf) { if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_SDL && def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) { @@ -1415,9 +1415,9 @@ xenDaemonFormatSxprGraphicsNew(virDomainGraphicsDefPtr def, static int -xenDaemonFormatSxprGraphicsOld(virDomainGraphicsDefPtr def, - virBufferPtr buf, - int xendConfigVersion) +xenFormatSxprGraphicsOld(virDomainGraphicsDefPtr def, + virBufferPtr buf, + int xendConfigVersion) { if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_SDL && def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) { @@ -1457,8 +1457,8 @@ xenDaemonFormatSxprGraphicsOld(virDomainGraphicsDefPtr def, } int -xenDaemonFormatSxprChr(virDomainChrDefPtr def, - virBufferPtr buf) +xenFormatSxprChr(virDomainChrDefPtr def, + virBufferPtr buf) { const char *type = virDomainChrTypeToString(def->source.type); @@ -1531,7 +1531,6 @@ xenDaemonFormatSxprChr(virDomainChrDefPtr def, /** * virDomainParseXMLDiskDesc: * @node: node containing disk description - * @conn: pointer to the hypervisor connection * @buf: a buffer for the result S-Expr * @xendConfigVersion: xend configuration file format * @@ -1543,12 +1542,12 @@ xenDaemonFormatSxprChr(virDomainChrDefPtr def, * Returns 0 in case of success, -1 in case of error. */ int -xenDaemonFormatSxprDisk(virConnectPtr conn ATTRIBUTE_UNUSED, - virDomainDiskDefPtr def, - virBufferPtr buf, - int hvm, - int xendConfigVersion, - int isAttach) +xenFormatSxprDisk(virConnectPtr conn ATTRIBUTE_UNUSED, + virDomainDiskDefPtr def, + virBufferPtr buf, + int hvm, + int xendConfigVersion, + int isAttach) { /* Xend (all versions) put the floppy device config * under the hvm (image (os)) block @@ -1652,8 +1651,7 @@ xenDaemonFormatSxprDisk(virConnectPtr conn ATTRIBUTE_UNUSED, } /** - * xenDaemonFormatSxprNet - * @conn: pointer to the hypervisor connection + * xenFormatSxprNet * @node: node containing the interface description * @buf: a buffer for the result S-Expr * @xendConfigVersion: xend configuration file format @@ -1666,12 +1664,12 @@ xenDaemonFormatSxprDisk(virConnectPtr conn ATTRIBUTE_UNUSED, * Returns 0 in case of success, -1 in case of error. */ int -xenDaemonFormatSxprNet(virConnectPtr conn, - virDomainNetDefPtr def, - virBufferPtr buf, - int hvm, - int xendConfigVersion, - int isAttach) +xenFormatSxprNet(virConnectPtr conn, + virDomainNetDefPtr def, + virBufferPtr buf, + int hvm, + int xendConfigVersion, + int isAttach) { const char *script = DEFAULT_VIF_SCRIPT; @@ -1782,8 +1780,8 @@ xenDaemonFormatSxprNet(virConnectPtr conn, static void -xenDaemonFormatSxprPCI(virDomainHostdevDefPtr def, - virBufferPtr buf) +xenFormatSxprPCI(virDomainHostdevDefPtr def, + virBufferPtr buf) { virBufferVSprintf(buf, "(dev (domain 0x%04x)(bus 0x%02x)(slot 0x%02x)(func 0x%x))", def->source.subsys.u.pci.domain, @@ -1793,9 +1791,9 @@ xenDaemonFormatSxprPCI(virDomainHostdevDefPtr def, } int -xenDaemonFormatSxprOnePCI(virDomainHostdevDefPtr def, - virBufferPtr buf, - int detach) +xenFormatSxprOnePCI(virDomainHostdevDefPtr def, + virBufferPtr buf, + int detach) { if (def->managed) { XENXS_ERROR(VIR_ERR_NO_SUPPORT, "%s", @@ -1804,7 +1802,7 @@ xenDaemonFormatSxprOnePCI(virDomainHostdevDefPtr def, } virBufferAddLit(buf, "(pci "); - xenDaemonFormatSxprPCI(def, buf); + xenFormatSxprPCI(def, buf); if (detach) virBufferAddLit(buf, "(state 'Closing')"); else @@ -1815,8 +1813,8 @@ xenDaemonFormatSxprOnePCI(virDomainHostdevDefPtr def, } static int -xenDaemonFormatSxprAllPCI(virDomainDefPtr def, - virBufferPtr buf) +xenFormatSxprAllPCI(virDomainDefPtr def, + virBufferPtr buf) { int hasPCI = 0; int i; @@ -1853,7 +1851,7 @@ xenDaemonFormatSxprAllPCI(virDomainDefPtr def, return -1; } - xenDaemonFormatSxprPCI(def->hostdevs[i], buf); + xenFormatSxprPCI(def->hostdevs[i], buf); } } virBufferAddLit(buf, "))"); @@ -1862,8 +1860,8 @@ xenDaemonFormatSxprAllPCI(virDomainDefPtr def, } int -xenDaemonFormatSxprSound(virDomainDefPtr def, - virBufferPtr buf) +xenFormatSxprSound(virDomainDefPtr def, + virBufferPtr buf) { const char *str; int i; @@ -1890,8 +1888,8 @@ xenDaemonFormatSxprSound(virDomainDefPtr def, static int -xenDaemonFormatSxprInput(virDomainInputDefPtr input, - virBufferPtr buf) +xenFormatSxprInput(virDomainInputDefPtr input, + virBufferPtr buf) { if (input->bus != VIR_DOMAIN_INPUT_BUS_USB) return 0; @@ -1916,7 +1914,7 @@ xenDaemonFormatSxprInput(virDomainInputDefPtr input, verify(MAX_VIRT_CPUS <= sizeof(1UL) * CHAR_BIT); /** - * xenDaemonFormatSxpr: + * xenFormatSxpr: * @conn: pointer to the hypervisor connection * @def: domain config definition * @xendConfigVersion: xend configuration file format @@ -1927,9 +1925,9 @@ verify(MAX_VIRT_CPUS <= sizeof(1UL) * CHAR_BIT); * the caller must free() the returned value. */ char * -xenDaemonFormatSxpr(virConnectPtr conn, - virDomainDefPtr def, - int xendConfigVersion) +xenFormatSxpr(virConnectPtr conn, + virDomainDefPtr def, + int xendConfigVersion) { virBuffer buf = VIR_BUFFER_INITIALIZER; char uuidstr[VIR_UUID_STRING_BUFLEN]; @@ -2111,12 +2109,12 @@ xenDaemonFormatSxpr(virConnectPtr conn, virBufferAddLit(&buf, "(usb 1)"); for (i = 0 ; i < def->ninputs ; i++) - if (xenDaemonFormatSxprInput(def->inputs[i], &buf) < 0) + if (xenFormatSxprInput(def->inputs[i], &buf) < 0) goto error; if (def->parallels) { virBufferAddLit(&buf, "(parallel "); - if (xenDaemonFormatSxprChr(def->parallels[0], &buf) < 0) + if (xenFormatSxprChr(def->parallels[0], &buf) < 0) goto error; virBufferAddLit(&buf, ")"); } else { @@ -2124,7 +2122,7 @@ xenDaemonFormatSxpr(virConnectPtr conn, } if (def->serials) { virBufferAddLit(&buf, "(serial "); - if (xenDaemonFormatSxprChr(def->serials[0], &buf) < 0) + if (xenFormatSxprChr(def->serials[0], &buf) < 0) goto error; virBufferAddLit(&buf, ")"); } else { @@ -2137,7 +2135,7 @@ xenDaemonFormatSxpr(virConnectPtr conn, if (def->sounds) { virBufferAddLit(&buf, "(soundhw '"); - if (xenDaemonFormatSxprSound(def, &buf) < 0) + if (xenFormatSxprSound(def, &buf) < 0) goto error; virBufferAddLit(&buf, "')"); } @@ -2152,8 +2150,8 @@ xenDaemonFormatSxpr(virConnectPtr conn, if ((!hvm && xendConfigVersion < XEND_CONFIG_MIN_VERS_PVFB_NEWCONF) || (hvm && xendConfigVersion < 4)) { if ((def->ngraphics == 1) && - xenDaemonFormatSxprGraphicsOld(def->graphics[0], - &buf, xendConfigVersion) < 0) + xenFormatSxprGraphicsOld(def->graphics[0], + &buf, xendConfigVersion) < 0) goto error; } @@ -2161,16 +2159,16 @@ xenDaemonFormatSxpr(virConnectPtr conn, } for (i = 0 ; i < def->ndisks ; i++) - if (xenDaemonFormatSxprDisk(conn, def->disks[i], - &buf, hvm, xendConfigVersion, 0) < 0) + if (xenFormatSxprDisk(conn, def->disks[i], + &buf, hvm, xendConfigVersion, 0) < 0) goto error; for (i = 0 ; i < def->nnets ; i++) - if (xenDaemonFormatSxprNet(conn, def->nets[i], - &buf, hvm, xendConfigVersion, 0) < 0) + if (xenFormatSxprNet(conn, def->nets[i], + &buf, hvm, xendConfigVersion, 0) < 0) goto error; - if (xenDaemonFormatSxprAllPCI(def, &buf) < 0) + if (xenFormatSxprAllPCI(def, &buf) < 0) goto error; /* New style PV graphics config xen >= 3.0.4, @@ -2178,7 +2176,7 @@ xenDaemonFormatSxpr(virConnectPtr conn, if ((xendConfigVersion >= XEND_CONFIG_MIN_VERS_PVFB_NEWCONF && !hvm) || (xendConfigVersion >= 4 && hvm)) { if ((def->ngraphics == 1) && - xenDaemonFormatSxprGraphicsNew(def->graphics[0], &buf) < 0) + xenFormatSxprGraphicsNew(def->graphics[0], &buf) < 0) goto error; } diff --git a/src/xenxs/xen_sxpr.h b/src/xenxs/xen_sxpr.h index 5cff40eee..b2f8790e9 100644 --- a/src/xenxs/xen_sxpr.h +++ b/src/xenxs/xen_sxpr.h @@ -36,53 +36,31 @@ int xenGetDomIdFromSxprString(const char *sexpr, int xendConfigVersion); int xenGetDomIdFromSxpr(const struct sexpr *root, int xendConfigVersion); -virDomainDefPtr -xenDaemonParseSxprString(const char *sexpr, - int xendConfigVersion, char *tty, int vncport); +virDomainDefPtr xenParseSxprString(const char *sexpr, int xendConfigVersion, + char *tty, int vncport); -virDomainDefPtr -xenDaemonParseSxpr(const struct sexpr *root, - int xendConfigVersion, - const char *cpus, char *tty, int vncport); +virDomainDefPtr xenParseSxpr(const struct sexpr *root, int xendConfigVersion, + const char *cpus, char *tty, int vncport); -int -xenDaemonParseSxprSound(virDomainDefPtr def, - const char *str); +int xenParseSxprSound(virDomainDefPtr def, const char *str); -virDomainChrDefPtr -xenDaemonParseSxprChar(const char *value, - const char *tty); +virDomainChrDefPtr xenParseSxprChar(const char *value, const char *tty); -int -xenDaemonFormatSxprDisk(virConnectPtr conn ATTRIBUTE_UNUSED, - virDomainDiskDefPtr def, - virBufferPtr buf, - int hvm, - int xendConfigVersion, - int isAttach); -int -xenDaemonFormatSxprNet(virConnectPtr conn ATTRIBUTE_UNUSED, - virDomainNetDefPtr def, - virBufferPtr buf, - int hvm, - int xendConfigVersion, - int isAttach); +int xenFormatSxprDisk(virConnectPtr conn ATTRIBUTE_UNUSED, + virDomainDiskDefPtr def, virBufferPtr buf, int hvm, + int xendConfigVersion, int isAttach); -int -xenDaemonFormatSxprOnePCI(virDomainHostdevDefPtr def, - virBufferPtr buf, - int detach); +int xenFormatSxprNet(virConnectPtr conn, + virDomainNetDefPtr def, virBufferPtr buf, int hvm, + int xendConfigVersion, int isAttach); -int -xenDaemonFormatSxprChr(virDomainChrDefPtr def, - virBufferPtr buf); -int -xenDaemonFormatSxprSound(virDomainDefPtr def, - virBufferPtr buf); +int xenFormatSxprOnePCI(virDomainHostdevDefPtr def, virBufferPtr buf, + int detach); -char * -xenDaemonFormatSxpr(virConnectPtr conn, - virDomainDefPtr def, - int xendConfigVersion); +int xenFormatSxprChr(virDomainChrDefPtr def, virBufferPtr buf); +int xenFormatSxprSound(virDomainDefPtr def, virBufferPtr buf); + +char * xenFormatSxpr(virConnectPtr conn, virDomainDefPtr def, + int xendConfigVersion); #endif /* __VIR_XEN_SXPR_H__ */ diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c index f01d767d9..ce590b949 100644 --- a/src/xenxs/xen_xm.c +++ b/src/xenxs/xen_xm.c @@ -196,7 +196,7 @@ static int xenXMConfigGetUUID(virConfPtr conf, const char *name, unsigned char * * domain, suitable for later feeding for virDomainCreateXML */ virDomainDefPtr -xenXMDomainConfigParse(virConfPtr conf, int xendConfigVersion, +xenParseXM(virConfPtr conf, int xendConfigVersion, virCapsPtr caps) { const char *str; int hvm = 0; @@ -951,7 +951,7 @@ xenXMDomainConfigParse(virConfPtr conf, int xendConfigVersion, if (xenXMConfigGetString(conf, "parallel", &str, NULL) < 0) goto cleanup; if (str && STRNEQ(str, "none") && - !(chr = xenDaemonParseSxprChar(str, NULL))) + !(chr = xenParseSxprChar(str, NULL))) goto cleanup; if (chr) { @@ -968,7 +968,7 @@ xenXMDomainConfigParse(virConfPtr conf, int xendConfigVersion, if (xenXMConfigGetString(conf, "serial", &str, NULL) < 0) goto cleanup; if (str && STRNEQ(str, "none") && - !(chr = xenDaemonParseSxprChar(str, NULL))) + !(chr = xenParseSxprChar(str, NULL))) goto cleanup; if (chr) { @@ -981,7 +981,7 @@ xenXMDomainConfigParse(virConfPtr conf, int xendConfigVersion, def->nserials++; } } else { - if (!(def->console = xenDaemonParseSxprChar("pty", NULL))) + if (!(def->console = xenParseSxprChar("pty", NULL))) goto cleanup; def->console->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE; def->console->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN; @@ -992,7 +992,7 @@ xenXMDomainConfigParse(virConfPtr conf, int xendConfigVersion, goto cleanup; if (str && - xenDaemonParseSxprSound(def, str) < 0) + xenParseSxprSound(def, str) < 0) goto cleanup; } @@ -1048,7 +1048,7 @@ int xenXMConfigSetString(virConfPtr conf, const char *setting, const char *str) } -static int xenXMDomainConfigFormatDisk(virConfValuePtr list, +static int xenFormatXMDisk(virConfValuePtr list, virDomainDiskDefPtr disk, int hvm, int xendConfigVersion) @@ -1120,7 +1120,7 @@ cleanup: return -1; } -static int xenXMDomainConfigFormatNet(virConnectPtr conn, +static int xenFormatXMNet(virConnectPtr conn, virConfValuePtr list, virDomainNetDefPtr net, int hvm, int xendConfigVersion) @@ -1232,7 +1232,7 @@ cleanup: static int -xenXMDomainConfigFormatPCI(virConfPtr conf, +xenFormatXMPCI(virConfPtr conf, virDomainDefPtr def) { @@ -1308,7 +1308,7 @@ error: either 32, or 64 on a platform where long is big enough. */ verify(MAX_VIRT_CPUS <= sizeof(1UL) * CHAR_BIT); -virConfPtr xenXMDomainConfigFormat(virConnectPtr conn, +virConfPtr xenFormatXM(virConnectPtr conn, virDomainDefPtr def, int xendConfigVersion) { virConfPtr conf = NULL; @@ -1626,8 +1626,8 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn, if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) continue; - if (xenXMDomainConfigFormatDisk(diskVal, def->disks[i], - hvm, xendConfigVersion) < 0) + if (xenFormatXMDisk(diskVal, def->disks[i], + hvm, xendConfigVersion) < 0) goto cleanup; } if (diskVal->list != NULL) { @@ -1644,9 +1644,8 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn, netVal->list = NULL; for (i = 0 ; i < def->nnets ; i++) { - if (xenXMDomainConfigFormatNet(conn, netVal, - def->nets[i], - hvm, xendConfigVersion) < 0) + if (xenFormatXMNet(conn, netVal,def->nets[i], + hvm, xendConfigVersion) < 0) goto cleanup; } if (netVal->list != NULL) { @@ -1657,7 +1656,7 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn, } VIR_FREE(netVal); - if (xenXMDomainConfigFormatPCI(conf, def) < 0) + if (xenFormatXMPCI(conf, def) < 0) goto cleanup; if (hvm) { @@ -1666,7 +1665,7 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn, char *str; int ret; - ret = xenDaemonFormatSxprChr(def->parallels[0], &buf); + ret = xenFormatSxprChr(def->parallels[0], &buf); str = virBufferContentAndReset(&buf); if (ret == 0) ret = xenXMConfigSetString(conf, "parallel", str); @@ -1683,7 +1682,7 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn, char *str; int ret; - ret = xenDaemonFormatSxprChr(def->serials[0], &buf); + ret = xenFormatSxprChr(def->serials[0], &buf); str = virBufferContentAndReset(&buf); if (ret == 0) ret = xenXMConfigSetString(conf, "serial", str); @@ -1699,7 +1698,7 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn, if (def->sounds) { virBuffer buf = VIR_BUFFER_INITIALIZER; char *str = NULL; - int ret = xenDaemonFormatSxprSound(def, &buf); + int ret = xenFormatSxprSound(def, &buf); str = virBufferContentAndReset(&buf); if (ret == 0) ret = xenXMConfigSetString(conf, "soundhw", str); diff --git a/src/xenxs/xen_xm.h b/src/xenxs/xen_xm.h index 1114ada80..7b53ab61b 100644 --- a/src/xenxs/xen_xm.h +++ b/src/xenxs/xen_xm.h @@ -30,10 +30,10 @@ # include "conf.h" # include "domain_conf.h" -virConfPtr xenXMDomainConfigFormat(virConnectPtr conn, virDomainDefPtr def, - int xendConfigVersion); +virConfPtr xenFormatXM(virConnectPtr conn, virDomainDefPtr def, + int xendConfigVersion); -virDomainDefPtr xenXMDomainConfigParse(virConfPtr conf, int xendConfigVersion, - virCapsPtr caps); +virDomainDefPtr xenParseXM(virConfPtr conf, int xendConfigVersion, + virCapsPtr caps); #endif /* __VIR_XEN_XM_H__ */ diff --git a/tests/sexpr2xmltest.c b/tests/sexpr2xmltest.c index cf3e5bcd3..9995ec4b0 100644 --- a/tests/sexpr2xmltest.c +++ b/tests/sexpr2xmltest.c @@ -58,8 +58,7 @@ static int testCompareFiles(const char *xml, const char *sexpr, vncport = xenStoreDomainGetVNCPort(conn, id); xenUnifiedUnlock(&priv); - if (!(def = xenDaemonParseSxprString(sexprData, xendConfigVersion, tty, - vncport))) + if (!(def = xenParseSxprString(sexprData, xendConfigVersion, tty, vncport))) goto fail; if (!(gotxml = virDomainDefFormat(def, 0))) diff --git a/tests/xmconfigtest.c b/tests/xmconfigtest.c index 9673e37b5..c4c301498 100644 --- a/tests/xmconfigtest.c +++ b/tests/xmconfigtest.c @@ -75,7 +75,7 @@ static int testCompareParseXML(const char *xmcfg, const char *xml, VIR_DOMAIN_XML_INACTIVE))) goto fail; - if (!(conf = xenXMDomainConfigFormat(conn, def, xendConfigVersion))) + if (!(conf = xenFormatXM(conn, def, xendConfigVersion))) goto fail; if (virConfWriteMem(gotxmcfgPtr, &wrote, conf) < 0) @@ -128,7 +128,7 @@ static int testCompareFormatXML(const char *xmcfg, const char *xml, if (!(conf = virConfReadMem(xmcfgPtr, strlen(xmcfgPtr), 0))) goto fail; - if (!(def = xenXMDomainConfigParse(conf, priv.xendConfigVersion, priv.caps))) + if (!(def = xenParseXM(conf, priv.xendConfigVersion, priv.caps))) goto fail; if (!(gotxml = virDomainDefFormat(def, VIR_DOMAIN_XML_SECURE))) diff --git a/tests/xml2sexprtest.c b/tests/xml2sexprtest.c index 05fc676e0..0b46faa2c 100644 --- a/tests/xml2sexprtest.c +++ b/tests/xml2sexprtest.c @@ -40,7 +40,7 @@ static int testCompareFiles(const char *xml, const char *sexpr, VIR_DOMAIN_XML_INACTIVE))) goto fail; - if (!(gotsexpr = xenDaemonFormatSxpr(NULL, def, xendConfigVersion))) + if (!(gotsexpr = xenFormatSxpr(NULL, def, xendConfigVersion))) goto fail; if (STRNEQ(sexprData, gotsexpr)) { |