mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 20:15:17 +00:00
xml: namespaces: use uri instead of href
Store the namespace URI as const char*, instead of in a function. Suggested-by: Jiri Denemark <jdenemar@redhat.com> Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
6f2819ef20
commit
6602551031
@ -31,8 +31,6 @@
|
||||
|
||||
VIR_LOG_INIT("bhyve.bhyve_domain");
|
||||
|
||||
#define BHYVE_NAMESPACE_HREF "http://libvirt.org/schemas/domain/bhyve/1.0"
|
||||
|
||||
static void *
|
||||
bhyveDomainObjPrivateAlloc(void *opaque ATTRIBUTE_UNUSED)
|
||||
{
|
||||
@ -258,16 +256,11 @@ bhyveDomainDefNamespaceFormatXML(virBufferPtr buf,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char *
|
||||
bhyveDomainDefNamespaceHref(void)
|
||||
{
|
||||
return BHYVE_NAMESPACE_HREF;
|
||||
}
|
||||
|
||||
virXMLNamespace virBhyveDriverDomainXMLNamespace = {
|
||||
.parse = bhyveDomainDefNamespaceParse,
|
||||
.free = bhyveDomainDefNamespaceFree,
|
||||
.format = bhyveDomainDefNamespaceFormatXML,
|
||||
.prefix = "bhyve",
|
||||
.href = bhyveDomainDefNamespaceHref,
|
||||
.uri = "http://libvirt.org/schemas/domain/bhyve/1.0",
|
||||
|
||||
};
|
||||
|
@ -34,7 +34,6 @@
|
||||
#include "virinitctl.h"
|
||||
|
||||
#define VIR_FROM_THIS VIR_FROM_LXC
|
||||
#define LXC_NAMESPACE_HREF "http://libvirt.org/schemas/domain/lxc/1.0"
|
||||
|
||||
VIR_ENUM_IMPL(virLXCDomainJob,
|
||||
LXC_JOB_LAST,
|
||||
@ -302,19 +301,13 @@ lxcDomainDefNamespaceFormatXML(virBufferPtr buf,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char *
|
||||
lxcDomainDefNamespaceHref(void)
|
||||
{
|
||||
return LXC_NAMESPACE_HREF;
|
||||
}
|
||||
|
||||
|
||||
virXMLNamespace virLXCDriverDomainXMLNamespace = {
|
||||
.parse = lxcDomainDefNamespaceParse,
|
||||
.free = lxcDomainDefNamespaceFree,
|
||||
.format = lxcDomainDefNamespaceFormatXML,
|
||||
.prefix = "lxc",
|
||||
.href = lxcDomainDefNamespaceHref,
|
||||
.uri = "http://libvirt.org/schemas/domain/lxc/1.0",
|
||||
};
|
||||
|
||||
|
||||
|
@ -83,8 +83,6 @@
|
||||
|
||||
VIR_LOG_INIT("network.bridge_driver");
|
||||
|
||||
#define DNSMASQ_NAMESPACE_HREF "http://libvirt.org/schemas/network/dnsmasq/1.0"
|
||||
|
||||
static virNetworkDriverStatePtr network_driver;
|
||||
|
||||
|
||||
@ -231,19 +229,12 @@ networkDnsmasqDefNamespaceFormatXML(virBufferPtr buf,
|
||||
}
|
||||
|
||||
|
||||
static const char *
|
||||
networkDnsmasqDefNamespaceHref(void)
|
||||
{
|
||||
return DNSMASQ_NAMESPACE_HREF;
|
||||
}
|
||||
|
||||
|
||||
virXMLNamespace networkDnsmasqXMLNamespace = {
|
||||
.parse = networkDnsmasqDefNamespaceParse,
|
||||
.free = networkDnsmasqDefNamespaceFree,
|
||||
.format = networkDnsmasqDefNamespaceFormatXML,
|
||||
.prefix = "dnsmasq",
|
||||
.href = networkDnsmasqDefNamespaceHref,
|
||||
.uri = "http://libvirt.org/schemas/network/dnsmasq/1.0",
|
||||
};
|
||||
|
||||
|
||||
|
@ -81,8 +81,6 @@
|
||||
|
||||
VIR_LOG_INIT("qemu.qemu_domain");
|
||||
|
||||
#define QEMU_NAMESPACE_HREF "http://libvirt.org/schemas/domain/qemu/1.0"
|
||||
|
||||
VIR_ENUM_IMPL(qemuDomainJob,
|
||||
QEMU_JOB_LAST,
|
||||
"none",
|
||||
@ -3713,19 +3711,13 @@ qemuDomainDefNamespaceFormatXML(virBufferPtr buf,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char *
|
||||
qemuDomainDefNamespaceHref(void)
|
||||
{
|
||||
return QEMU_NAMESPACE_HREF;
|
||||
}
|
||||
|
||||
|
||||
virXMLNamespace virQEMUDriverDomainXMLNamespace = {
|
||||
.parse = qemuDomainDefNamespaceParse,
|
||||
.free = qemuDomainDefNamespaceFree,
|
||||
.format = qemuDomainDefNamespaceFormatXML,
|
||||
.prefix = "qemu",
|
||||
.href = qemuDomainDefNamespaceHref,
|
||||
.uri = "http://libvirt.org/schemas/domain/qemu/1.0",
|
||||
};
|
||||
|
||||
|
||||
|
@ -528,7 +528,6 @@ virStorageBackendFileSystemBuild(virStoragePoolObjPtr pool,
|
||||
|
||||
#if WITH_STORAGE_FS
|
||||
|
||||
# define STORAGE_POOL_FS_NAMESPACE_HREF "http://libvirt.org/schemas/storagepool/fs/1.0"
|
||||
|
||||
/* Backend XML Namespace handling for fs or netfs specific mount options to
|
||||
* be added to the mount -o {options_list} command line that are not otherwise
|
||||
@ -624,12 +623,6 @@ virStoragePoolDefFSNamespaceFormatXML(virBufferPtr buf,
|
||||
}
|
||||
|
||||
|
||||
static const char *
|
||||
virStoragePoolDefFSNamespaceHref(void)
|
||||
{
|
||||
return STORAGE_POOL_FS_NAMESPACE_HREF;
|
||||
}
|
||||
|
||||
#endif /* WITH_STORAGE_FS */
|
||||
|
||||
|
||||
@ -697,7 +690,7 @@ static virXMLNamespace virStoragePoolFSXMLNamespace = {
|
||||
.free = virStoragePoolDefFSNamespaceFree,
|
||||
.format = virStoragePoolDefFSNamespaceFormatXML,
|
||||
.prefix = "fs",
|
||||
.href = virStoragePoolDefFSNamespaceHref,
|
||||
.uri = "http://libvirt.org/schemas/storagepool/fs/1.0",
|
||||
};
|
||||
#endif /* WITH_STORAGE_FS */
|
||||
|
||||
|
@ -58,8 +58,6 @@ struct _virStoragePoolRBDConfigOptionsDef {
|
||||
char **values;
|
||||
};
|
||||
|
||||
#define STORAGE_POOL_RBD_NAMESPACE_HREF "http://libvirt.org/schemas/storagepool/rbd/1.0"
|
||||
|
||||
static void
|
||||
virStoragePoolDefRBDNamespaceFree(void *nsdata)
|
||||
{
|
||||
@ -166,13 +164,6 @@ virStoragePoolDefRBDNamespaceFormatXML(virBufferPtr buf,
|
||||
}
|
||||
|
||||
|
||||
static const char *
|
||||
virStoragePoolDefRBDNamespaceHref(void)
|
||||
{
|
||||
return STORAGE_POOL_RBD_NAMESPACE_HREF;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
virStorageBackendRBDRADOSConfSet(rados_t cluster,
|
||||
const char *option,
|
||||
@ -1538,7 +1529,7 @@ static virXMLNamespace virStoragePoolRBDXMLNamespace = {
|
||||
.free = virStoragePoolDefRBDNamespaceFree,
|
||||
.format = virStoragePoolDefRBDNamespaceFormatXML,
|
||||
.prefix = "rbd",
|
||||
.href = virStoragePoolDefRBDNamespaceHref,
|
||||
.uri = "http://libvirt.org/schemas/storagepool/rbd/1.0",
|
||||
};
|
||||
|
||||
|
||||
|
@ -167,8 +167,6 @@ testDriverDispose(void *obj)
|
||||
virObjectUnref(driver->eventState);
|
||||
}
|
||||
|
||||
#define TEST_NAMESPACE_HREF "http://libvirt.org/schemas/domain/test/1.0"
|
||||
|
||||
typedef struct _testDomainNamespaceDef testDomainNamespaceDef;
|
||||
typedef testDomainNamespaceDef *testDomainNamespaceDefPtr;
|
||||
struct _testDomainNamespaceDef {
|
||||
@ -180,12 +178,6 @@ struct _testDomainNamespaceDef {
|
||||
xmlNodePtr *snap_nodes;
|
||||
};
|
||||
|
||||
static const char*
|
||||
testDomainDefNamespaceHref(void)
|
||||
{
|
||||
return TEST_NAMESPACE_HREF;
|
||||
}
|
||||
|
||||
static void
|
||||
testDomainDefNamespaceFree(void *data)
|
||||
{
|
||||
@ -427,7 +419,7 @@ testDriverNew(void)
|
||||
.parse = testDomainDefNamespaceParse,
|
||||
.free = testDomainDefNamespaceFree,
|
||||
.prefix = "test",
|
||||
.href = testDomainDefNamespaceHref,
|
||||
.uri = "http://libvirt.org/schemas/domain/test/1.0",
|
||||
};
|
||||
virDomainDefParserConfig config = {
|
||||
.features = VIR_DOMAIN_DEF_FEATURE_MEMORY_HOTPLUG |
|
||||
|
@ -1416,7 +1416,7 @@ void
|
||||
virXMLNamespaceFormatNS(virBufferPtr buf,
|
||||
virXMLNamespace const *ns)
|
||||
{
|
||||
virBufferAsprintf(buf, " xmlns:%s='%s'", ns->prefix, ns->href());
|
||||
virBufferAsprintf(buf, " xmlns:%s='%s'", ns->prefix, ns->uri);
|
||||
}
|
||||
|
||||
|
||||
@ -1426,10 +1426,10 @@ virXMLNamespaceRegister(xmlXPathContextPtr ctxt,
|
||||
{
|
||||
if (xmlXPathRegisterNs(ctxt,
|
||||
BAD_CAST ns->prefix,
|
||||
BAD_CAST ns->href()) < 0) {
|
||||
BAD_CAST ns->uri) < 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Failed to register xml namespace '%s'"),
|
||||
ns->href());
|
||||
ns->uri);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -257,7 +257,7 @@ struct _virXMLNamespace {
|
||||
virXMLNamespaceFree free;
|
||||
virXMLNamespaceFormat format;
|
||||
const char *prefix;
|
||||
virXMLNamespaceHref href;
|
||||
const char *uri;
|
||||
};
|
||||
typedef struct _virXMLNamespace virXMLNamespace;
|
||||
typedef virXMLNamespace *virXMLNamespacePtr;
|
||||
|
@ -597,18 +597,12 @@ virVMXDomainDefNamespaceFormatXML(virBufferPtr buf, void *nsdata)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char *
|
||||
virVMXDomainDefNamespaceHref(void)
|
||||
{
|
||||
return "http://libvirt.org/schemas/domain/vmware/1.0";
|
||||
}
|
||||
|
||||
static virXMLNamespace virVMXDomainXMLNamespace = {
|
||||
.parse = NULL,
|
||||
.free = virVMXDomainDefNamespaceFree,
|
||||
.format = virVMXDomainDefNamespaceFormatXML,
|
||||
.prefix = "vmware",
|
||||
.href = virVMXDomainDefNamespaceHref,
|
||||
.uri = "http://libvirt.org/schemas/domain/vmware/1.0",
|
||||
};
|
||||
|
||||
virDomainXMLOptionPtr
|
||||
|
Loading…
x
Reference in New Issue
Block a user