Signed-off-by: John Ferlan <jfer...@redhat.com> --- src/libvirt_private.syms | 2 ++ src/util/virobject.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++ src/util/virobject.h | 6 ++++++ 3 files changed, 59 insertions(+)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 74d4bf8..b18614b 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2236,6 +2236,8 @@ virObjectListFreeCount; virObjectLock; virObjectLockableNew; virObjectNew; +virObjectPoolableHashElementGetPrimaryKey; +virObjectPoolableHashElementGetSecondaryKey; virObjectPoolableHashElementNew; virObjectPoolableHashTableGetPrimary; virObjectPoolableHashTableGetSecondary; diff --git a/src/util/virobject.c b/src/util/virobject.c index c9e631c..87bf56a 100644 --- a/src/util/virobject.c +++ b/src/util/virobject.c @@ -700,3 +700,54 @@ virObjectPoolableHashTableGetSecondary(void *anyobj) return obj->objsSecondary; } + + +static virObjectPoolableHashElementPtr +virObjectGetPoolableHashElementObj(void *anyobj) +{ + if (virObjectIsClass(anyobj, virObjectPoolableHashElementClass)) + return anyobj; + + VIR_OBJECT_USAGE_PRINT_WARNING(anyobj, virObjectPoolableHashElementClass); + + return NULL; + +} + + +/** + * virObjectPoolableHashElementGetPrimaryKey + * @anyobj: Pointer to a PoolableHashElement object + * + * Returns: Pointer to the primaryKey or NULL on failure + */ +const char * +virObjectPoolableHashElementGetPrimaryKey(void *anyobj) +{ + virObjectPoolableHashElementPtr obj = + virObjectGetPoolableHashElementObj(anyobj); + + if (!obj) + return NULL; + + return obj->primaryKey; +} + + +/** + * virObjectPoolableHashElementGetSecondaryKey + * @anyobj: Pointer to a PoolableHashElement object + * + * Returns: Pointer to the secondaryKey which may be NULL + */ +const char * +virObjectPoolableHashElementGetSecondaryKey(void *anyobj) +{ + virObjectPoolableHashElementPtr obj = + virObjectGetPoolableHashElementObj(anyobj); + + if (!obj) + return NULL; + + return obj->secondaryKey; +} diff --git a/src/util/virobject.h b/src/util/virobject.h index 36fd842..c1e40da 100644 --- a/src/util/virobject.h +++ b/src/util/virobject.h @@ -190,4 +190,10 @@ virObjectPoolableHashTableGetPrimary(void *anyobj); virHashTablePtr virObjectPoolableHashTableGetSecondary(void *anyobj); +const char * +virObjectPoolableHashElementGetPrimaryKey(void *anyobj); + +const char * +virObjectPoolableHashElementGetSecondaryKey(void *anyobj); + #endif /* __VIR_OBJECT_H */ -- 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list