[Libvirt-cim] [PATCH 4 of 5] Fix rpcs_instance() call so other providers can call it

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Thu Nov 8 23:48:50 UTC 2007


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1194558008 28800
# Node ID 34e8e0d331e42f42545342dd765d35ee66aabd56
# Parent  151bc006918bfcce761944dbe2397191a535a2dc
Fix rpcs_instance() call so other providers can call it.

Remove static from rpcs_instance(), add support for a broker from another provider, and add the function declartion
 to a header file.  This will allow other providers to call this function as needed.

Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>

diff -r 151bc006918b -r 34e8e0d331e4 src/Virt_ResourcePoolConfigurationService.c
--- a/src/Virt_ResourcePoolConfigurationService.c	Thu Nov 08 12:55:39 2007 -0800
+++ b/src/Virt_ResourcePoolConfigurationService.c	Thu Nov 08 13:40:08 2007 -0800
@@ -28,6 +28,7 @@
 #include "misc_util.h"
 
 #include "Virt_HostSystem.h"
+#include "Virt_ResourcePoolConfigurationService.h"
 
 const static CMPIBroker *_BROKER;
 
@@ -89,23 +90,24 @@ DEFAULT_EQ();
 DEFAULT_EQ();
 DEFAULT_INST_CLEANUP();
 
-static CMPIStatus rpcs_instance(const CMPIObjectPath *reference,
-                                CMPIInstance **_inst)
+CMPIStatus rpcs_instance(const CMPIObjectPath *reference,
+                         CMPIInstance **_inst,
+                         const CMPIBroker *broker)
 {
         CMPIInstance *inst;
         CMPIInstance *host;
         CMPIStatus s;
         CMPIData prop;
 
-        s = get_host_cs(_BROKER, reference, &host);
+        s = get_host_cs(broker, reference, &host);
         if (s.rc != CMPI_RC_OK)
                 goto out;
 
-        inst = get_typed_instance(_BROKER,
+        inst = get_typed_instance(broker,
                                   "ResourcePoolConfigurationService",
                                   NAMESPACE(reference));
         if (inst == NULL) {
-                cu_statusf(_BROKER, &s,
+                cu_statusf(broker, &s,
                            CMPI_RC_ERR_FAILED,
                            "Unable to get "
                            "ResourcePoolConfigurationService instance");
@@ -117,7 +119,7 @@ static CMPIStatus rpcs_instance(const CM
 
         prop = CMGetProperty(host, "CreationClassName", &s);
         if (s.rc != CMPI_RC_OK) {
-                cu_statusf(_BROKER, &s,
+                cu_statusf(broker, &s,
                            CMPI_RC_ERR_FAILED,
                            "Unable to get CreationClassName from HostSystem");
                 goto out;
@@ -128,7 +130,7 @@ static CMPIStatus rpcs_instance(const CM
 
         prop = CMGetProperty(host, "Name", NULL);
         if (s.rc != CMPI_RC_OK) {
-                cu_statusf(_BROKER, &s,
+                cu_statusf(broker, &s,
                            CMPI_RC_ERR_FAILED,
                            "Unable to get Name from HostSystem");
                 goto out;
@@ -152,7 +154,7 @@ static CMPIStatus GetInstance(CMPIInstan
         CMPIStatus s;
         const char *prop = NULL;
 
-        s = rpcs_instance(reference, &inst);
+        s = rpcs_instance(reference, &inst, _BROKER);
         if (s.rc != CMPI_RC_OK)
                 return s;
 
@@ -176,7 +178,7 @@ static CMPIStatus EnumInstanceNames(CMPI
         CMPIInstance *inst;
         CMPIStatus s;
 
-        s = rpcs_instance(reference, &inst);
+        s = rpcs_instance(reference, &inst, _BROKER);
         if (s.rc == CMPI_RC_OK)
                 cu_return_instance_name(results, inst);
 
@@ -193,7 +195,7 @@ static CMPIStatus EnumInstances(CMPIInst
         CMPIInstance *inst;
         CMPIStatus s;
 
-        s = rpcs_instance(reference, &inst);
+        s = rpcs_instance(reference, &inst, _BROKER);
         if (s.rc == CMPI_RC_OK)
                 CMReturnInstance(results, inst);
 
diff -r 151bc006918b -r 34e8e0d331e4 src/Virt_ResourcePoolConfigurationService.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Virt_ResourcePoolConfigurationService.h	Thu Nov 08 13:40:08 2007 -0800
@@ -0,0 +1,24 @@
+/*
+ * Copyright IBM Corp. 2007
+ *
+ * Authors:
+ *  Kaitlin Rupert <karupert at us.ibm.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+CMPIStatus rpcs_instance(const CMPIObjectPath *reference,
+                         CMPIInstance **_inst,
+                         const CMPIBroker *broker);




More information about the Libvirt-cim mailing list