
# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1195662213 28800 # Node ID 140613919317633ad4b325b6321809849ecfbd41 # Parent 38cc6833481dd27b1d2d451b81e74aaf8f900944 Remove static from get_rasd_instance() Add get_rasd_instance() declaration to header file. Also add an additional broker argument so other providers can call this function. Fixed minor mem leak in GetInstance(). fixed whitespace issue in Virt_RASD.h Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r 38cc6833481d -r 140613919317 src/Virt_RASD.c --- a/src/Virt_RASD.c Mon Nov 26 10:32:08 2007 -0800 +++ b/src/Virt_RASD.c Wed Nov 21 08:23:33 2007 -0800 @@ -177,10 +177,11 @@ static CMPIInstance *rasd_from_vdev(cons return inst; } -static CMPIInstance *get_rasd_instance(const CMPIContext *context, - const CMPIObjectPath *ref, - const char *id, - const uint16_t type) +CMPIInstance *get_rasd_instance(const CMPIContext *context, + const CMPIObjectPath *ref, + const CMPIBroker *broker, + const char *id, + const uint16_t type) { CMPIInstance *inst = NULL; CMPIStatus s; @@ -194,13 +195,13 @@ static CMPIInstance *get_rasd_instance(c if (!ret) return NULL; - conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); + conn = connect_by_classname(broker, CLASSNAME(ref), &s); if (conn == NULL) goto out; dev = find_dev(conn, type, host, devid); if (dev) - inst = rasd_from_vdev(_BROKER, dev, host, ref); + inst = rasd_from_vdev(broker, dev, host, ref); out: virConnectClose(conn); @@ -264,7 +265,7 @@ static CMPIStatus GetInstance(CMPIInstan goto out; } - inst = get_rasd_instance(context, ref, id, type); + inst = get_rasd_instance(context, ref, _BROKER, id, type); if (inst != NULL) CMReturnInstance(results, inst); @@ -273,6 +274,8 @@ static CMPIStatus GetInstance(CMPIInstan CMPI_RC_ERR_FAILED, "Unknown instance"); out: + free(id); + return s; } diff -r 38cc6833481d -r 140613919317 src/Virt_RASD.h --- a/src/Virt_RASD.h Mon Nov 26 10:32:08 2007 -0800 +++ b/src/Virt_RASD.h Wed Nov 21 08:23:33 2007 -0800 @@ -41,6 +41,12 @@ int rasds_for_domain(const CMPIBroker *b CMPIrc rasd_type_from_classname(const char *cn, uint16_t *type); +CMPIInstance *get_rasd_instance(const CMPIContext *context, + const CMPIObjectPath *ref, + const CMPIBroker *broker, + const char *id, + const uint16_t type); + #endif /*