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.
Signed-off-by: Luyao Huang <lhuang(a)redhat.com>
---
src/conf/domain_conf.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
src/conf/domain_conf.h | 9 +++++++++
2 files changed, 53 insertions(+)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 91c114e..37c4569 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11956,6 +11956,50 @@ 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))
+ break;
+ }
+
+ if (i == vmdef->nrngs)
+ return NULL;
+
+ VIR_DELETE_ELEMENT(vmdef->rngs, i, vmdef->nrngs);
+ return ret;
+}
+
+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 c197095..cb87fad 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2600,6 +2600,15 @@ 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,
--
1.8.3.1