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@xxxxxxxxxx> --- 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 81e4030..659864c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -12095,6 +12095,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 b3843e8..10cb09b 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2655,6 +2655,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 653655f..a635652 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -378,7 +378,10 @@ virDomainRedirdevBusTypeFromString; virDomainRedirdevBusTypeToString; virDomainRNGBackendTypeToString; virDomainRNGEquals; +virDomainRNGFind; +virDomainRNGInsert; virDomainRNGModelTypeToString; +virDomainRNGRemove; virDomainRunningReasonTypeFromString; virDomainRunningReasonTypeToString; virDomainSaveConfig; -- 1.8.3.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list