[Libvirt-cim] [PATCH 04 of 27] Fix uses of get_typed_*() in SystemDevice

Dan Smith danms at us.ibm.com
Mon Nov 19 18:25:56 UTC 2007


# HG changeset patch
# User Dan Smith <danms at us.ibm.com>
# Date 1195497544 28800
# Node ID 2baab0636245ee278bcddd63dfdd4dffbb8698ba
# Parent  430b7fab22f00f2d86ba9587e4e98af4b47881a3
Fix uses of get_typed_*() in SystemDevice

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

diff -r 430b7fab22f0 -r 2baab0636245 src/Virt_SystemDevice.c
--- a/src/Virt_SystemDevice.c	Mon Nov 19 10:33:50 2007 -0800
+++ b/src/Virt_SystemDevice.c	Mon Nov 19 10:39:04 2007 -0800
@@ -100,8 +100,7 @@ static int get_all_devices(const char *n
 }
 
 static CMPIInstance *host_instance(char *name,
-                                   const char *host_cn,
-                                   const char *ns)
+                                   const CMPIObjectPath *ref)
 {
         CMPIInstance *inst = NULL;
         virConnectPtr conn = NULL;
@@ -109,15 +108,16 @@ static CMPIInstance *host_instance(char 
         CMPIObjectPath *op;
         char *host_class;
 
-        host_class = get_typed_class("ComputerSystem");
+        host_class = get_typed_class(CLASSNAME(ref),
+                                     "ComputerSystem");
         if (host_class == NULL)
                 goto out;
 
-        op = CMNewObjectPath(_BROKER, ns, host_class, &s);
+        op = CMNewObjectPath(_BROKER, NAMESPACE(ref), host_class, &s);
         if ((s.rc != CMPI_RC_OK) || CMIsNullObject(op))
                 goto out;
 
-        conn = connect_by_classname(_BROKER, host_cn, &s);
+        conn = connect_by_classname(_BROKER, host_class, &s);
         if (conn == NULL)
                 goto out;
 
@@ -139,6 +139,7 @@ static CMPIInstance *make_ref(const CMPI
         CMPIInstance *refinst = NULL;
 
         refinst = get_typed_instance(_BROKER,
+                                     CLASSNAME(ref),
                                      "SystemDevice",
                                      NAMESPACE(ref));
 
@@ -227,9 +228,7 @@ static CMPIStatus dev_to_sys(const CMPIO
                 goto out;
         }
 
-        sys = host_instance(host,
-                            CLASSNAME(ref),
-                            NAMESPACE(ref));
+        sys = host_instance(host, ref);
 
         if (sys == NULL)
                 cu_statusf(_BROKER, &s,




More information about the Libvirt-cim mailing list