[Libvirt-cim] [PATCH 3 of 3] EAFP: adopt renamed Device function

Heidi Eckhart heidieck at linux.vnet.ibm.com
Fri Mar 7 12:29:57 UTC 2008


# HG changeset patch
# User Heidi Eckhart <heidieck at linux.vnet.ibm.com>
# Date 1204892347 -3600
# Node ID 83f78e06e6495634dd8e5a02cda2755e27cf654c
# Parent  e0dc4edf60115ef41e5c093b4dc65c6ff0ac1faa
EAFP: adopt renamed Device function
Signed-off-by: Heidi Eckhart <heidieck at linux.vnet.ibm.com>

diff -r e0dc4edf6011 -r 83f78e06e649 src/Virt_ElementAllocatedFromPool.c
--- a/src/Virt_ElementAllocatedFromPool.c	Fri Mar 07 13:19:07 2008 +0100
+++ b/src/Virt_ElementAllocatedFromPool.c	Fri Mar 07 13:19:07 2008 +0100
@@ -40,24 +40,6 @@
 
 const static CMPIBroker *_BROKER;
 
-static uint16_t class_to_type(const CMPIObjectPath *ref)
-{
-        uint16_t type;
-
-        if (CMClassPathIsA(_BROKER, ref, "CIM_LogicalDisk", NULL))
-                type = CIM_RES_TYPE_DISK;
-        else if (CMClassPathIsA(_BROKER, ref, "CIM_NetworkPort", NULL))
-                type = CIM_RES_TYPE_NET;
-        else if (CMClassPathIsA(_BROKER, ref, "CIM_Memory", NULL))
-                type = CIM_RES_TYPE_MEM;
-        else if (CMClassPathIsA(_BROKER, ref, "CIM_Processor", NULL))
-                type = CIM_RES_TYPE_PROC;
-        else
-                type = 0;
-
-        return type;
-}
-
 static CMPIStatus vdev_to_pool(const CMPIObjectPath *ref,
                                struct std_assoc_info *info,
                                struct inst_list *list)
@@ -76,7 +58,7 @@ static CMPIStatus vdev_to_pool(const CMP
         if (s.rc != CMPI_RC_OK)
                 goto out;
 
-        type = class_to_type(ref);
+        type = res_type_from_device_classname(CLASSNAME(ref));
         if (type == CIM_RES_TYPE_UNKNOWN) {
                 cu_statusf(_BROKER, &s,
                            CMPI_RC_ERR_FAILED,




More information about the Libvirt-cim mailing list