
# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1208195852 25200 # Node ID b342662208d69fb8f3c7189b1f227e3dff04fd59 # Parent 9518a04a73bef32166da24e795f0d5c8c6665981 Add function to parse out pool name from InstanceID Signed-off-by: Dan Smith <danms@us.ibm.com> diff -r 9518a04a73be -r b342662208d6 src/Virt_DevicePool.c --- a/src/Virt_DevicePool.c Mon Apr 14 10:57:32 2008 -0700 +++ b/src/Virt_DevicePool.c Mon Apr 14 10:57:32 2008 -0700 @@ -500,6 +500,17 @@ uint16_t res_type_from_pool_id(const cha return CIM_RES_TYPE_UNKNOWN; } +char *name_from_pool_id(const char *id) +{ + char *s; + + s = strchr(id, '/'); + if (s == NULL) + return NULL; + + return strdup((char *)s+1); +} + static bool mempool_set_total(CMPIInstance *inst, virConnectPtr conn) { virNodeInfo info; diff -r 9518a04a73be -r b342662208d6 src/Virt_DevicePool.h --- a/src/Virt_DevicePool.h Mon Apr 14 10:57:32 2008 -0700 +++ b/src/Virt_DevicePool.h Mon Apr 14 10:57:32 2008 -0700 @@ -58,6 +58,14 @@ uint16_t res_type_from_pool_id(const cha uint16_t res_type_from_pool_id(const char *id); /** + * Get the pool name from a given pool's InstanceID + * + * @param id The InstanceID of the pool + * @returns the name (must be free'd by the caller) + */ +char *name_from_pool_id(const char *id); + +/** * Get all device pools on the system for the given type * *