# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1196272229 28800
# Node ID 6d9aed8314c6a9c00ee506d724695859c623e396
# Parent cc0d80e1229bbd45e62c409336ce6020fbdebdbf
Fixes to ComputerSystem for libcmpiutil API change
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r cc0d80e1229b -r 6d9aed8314c6 src/Virt_ComputerSystem.c
--- a/src/Virt_ComputerSystem.c Wed Nov 28 09:50:29 2007 -0800
+++ b/src/Virt_ComputerSystem.c Wed Nov 28 09:50:29 2007 -0800
@@ -277,7 +277,7 @@ static int instance_from_dom(const CMPIB
/* Given a hypervisor connection and a domain name, return an instance */
CMPIInstance *instance_from_name(const CMPIBroker *broker,
virConnectPtr conn,
- char *name,
+ const char *name,
const CMPIObjectPath *op)
{
virDomainPtr dom;
@@ -376,7 +376,7 @@ static CMPIStatus return_enum_domains(co
static CMPIStatus get_domain(const CMPIObjectPath *reference,
const CMPIResult *results,
- char *name)
+ const char *name)
{
CMPIInstance *inst;
CMPIStatus s;
@@ -440,10 +440,9 @@ static CMPIStatus GetInstance(CMPIInstan
const CMPIObjectPath *reference,
const char **properties)
{
- char *name;
-
- name = cu_get_str_path(reference, "Name");
- if (name == NULL) {
+ const char *name;
+
+ if (cu_get_str_path(reference, "Name", &name) != CMPI_RC_OK) {
CMPIStatus s;
CMSetStatusWithChars(_BROKER, &s,
@@ -602,7 +601,7 @@ static CMPIStatus state_change_reset(vir
return s;
}
-static CMPIStatus __state_change(char *name,
+static CMPIStatus __state_change(const char *name,
uint16_t state,
const CMPIObjectPath *ref)
{
@@ -660,7 +659,7 @@ static CMPIStatus state_change(CMPIMetho
CMPIStatus s;
uint16_t state;
int ret;
- char *name = NULL;
+ const char *name = NULL;
ret = cu_get_u16_arg(argsin, "RequestedState", &state);
if (!ret) {
@@ -668,8 +667,7 @@ static CMPIStatus state_change(CMPIMetho
goto out;
}
- name = cu_get_str_path(reference, "Name");
- if (name == NULL) {
+ if (cu_get_str_path(reference, "Name", &name) != CMPI_RC_OK) {
CMSetStatusWithChars(_BROKER, &s,
CMPI_RC_ERR_FAILED,
"Name key not specified");
@@ -679,8 +677,6 @@ static CMPIStatus state_change(CMPIMetho
s = __state_change(name, state, reference);
out:
- free(name);
-
return s;
}
diff -r cc0d80e1229b -r 6d9aed8314c6 src/Virt_ComputerSystem.h
--- a/src/Virt_ComputerSystem.h Wed Nov 28 09:50:29 2007 -0800
+++ b/src/Virt_ComputerSystem.h Wed Nov 28 09:50:29 2007 -0800
@@ -34,7 +34,7 @@
*/
CMPIInstance *instance_from_name(const CMPIBroker *broker,
virConnectPtr conn,
- char *name,
+ const char *name,
const CMPIObjectPath *ns);