[Libvirt-cim] [PATCH 02 of 18] Fixes to ComputerSystem for libcmpiutil API change

Dan Smith danms at us.ibm.com
Tue Nov 27 19:28:28 UTC 2007


# HG changeset patch
# User Dan Smith <danms at us.ibm.com>
# Date 1196194865 28800
# Node ID 620fadffdb9642fb379441d5341f89049c634ae7
# Parent  dce4d8a891849228a59d3f90b4b2d30dc098fc3a
Fixes to ComputerSystem for libcmpiutil API change

Signed-off-by: Dan Smith <danms at us.ibm.com>

diff -r dce4d8a89184 -r 620fadffdb96 src/Virt_ComputerSystem.c
--- a/src/Virt_ComputerSystem.c	Tue Nov 27 08:03:00 2007 -0800
+++ b/src/Virt_ComputerSystem.c	Tue Nov 27 12:21:05 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 dce4d8a89184 -r 620fadffdb96 src/Virt_ComputerSystem.h
--- a/src/Virt_ComputerSystem.h	Tue Nov 27 08:03:00 2007 -0800
+++ b/src/Virt_ComputerSystem.h	Tue Nov 27 12:21:05 2007 -0800
@@ -34,7 +34,7 @@
  */
 CMPIInstance *instance_from_name(const CMPIBroker *broker,
                                  virConnectPtr conn,
-                                 char *name,
+                                 const char *name,
                                  const CMPIObjectPath *ns);
 
 




More information about the Libvirt-cim mailing list