the 3 functions are:
virDomainRNGInsert: Insert a RNG device to vm->def.
virDomainRNGRemove: remove a RNG device in vm->def.
virDomainRNGFind: find a RNG device in vm->def.
And export this 3 functions.
Signed-off-by: Luyao Huang <lhuang(a)redhat.com>
---
src/conf/domain_conf.c | 42 ++++++++++++++++++++++++++++++++++++++++++
src/conf/domain_conf.h | 6 ++++++
src/libvirt_private.syms | 3 +++
3 files changed, 51 insertions(+)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 9afef72..8f963a8 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -12170,6 +12170,48 @@ virDomainRNGEquals(virDomainRNGDefPtr src,
return false;
}
+int
+virDomainRNGInsert(virDomainDefPtr vmdef,
+ virDomainRNGDefPtr rng)
+{
+ return VIR_APPEND_ELEMENT(vmdef->rngs, vmdef->nrngs, rng);
+}
+
+virDomainRNGDefPtr
+virDomainRNGRemove(virDomainDefPtr vmdef,
+ virDomainRNGDefPtr rng)
+{
+ virDomainRNGDefPtr ret;
+ size_t i;
+
+ for (i = 0; i < vmdef->nrngs; i++) {
+ ret = vmdef->rngs[i];
+
+ if (virDomainRNGEquals(ret, rng)) {
+ VIR_DELETE_ELEMENT(vmdef->rngs, i, vmdef->nrngs);
+ return ret;
+ }
+ }
+
+ return NULL;
+}
+
+virDomainRNGDefPtr
+virDomainRNGFind(virDomainDefPtr vmdef,
+ virDomainRNGDefPtr rng)
+{
+ virDomainRNGDefPtr ret;
+ size_t i;
+
+ for (i = 0; i < vmdef->nrngs; i++) {
+ ret = vmdef->rngs[i];
+
+ if (virDomainRNGEquals(ret, rng))
+ return ret;
+ }
+ return NULL;
+}
+
char *
virDomainDefGetDefaultEmulator(virDomainDefPtr def,
virCapsPtr caps)
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index e4a8b29..7d8faf2 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2625,6 +2625,12 @@ virDomainChrRemove(virDomainDefPtr vmdef,
bool virDomainRNGEquals(virDomainRNGDefPtr src,
virDomainRNGDefPtr tgt);
+int virDomainRNGInsert(virDomainDefPtr vmdef,
+ virDomainRNGDefPtr rng);
+virDomainRNGDefPtr virDomainRNGRemove(virDomainDefPtr vmdef,
+ virDomainRNGDefPtr rng);
+virDomainRNGDefPtr virDomainRNGFind(virDomainDefPtr vmdef,
+ virDomainRNGDefPtr rng);
int virDomainSaveXML(const char *configDir,
virDomainDefPtr def,
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 6390566..c07728e 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -377,7 +377,10 @@ virDomainRedirdevBusTypeFromString;
virDomainRedirdevBusTypeToString;
virDomainRNGBackendTypeToString;
virDomainRNGEquals;
+virDomainRNGFind;
+virDomainRNGInsert;
virDomainRNGModelTypeToString;
+virDomainRNGRemove;
virDomainRunningReasonTypeFromString;
virDomainRunningReasonTypeToString;
virDomainSaveConfig;
--
1.8.3.1