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

Heidi Eckhart heidieck at linux.vnet.ibm.com
Mon Mar 10 12:09:39 UTC 2008


# HG changeset patch
# User Heidi Eckhart <heidieck at linux.vnet.ibm.com>
# Date 1205150954 -3600
# Node ID 1aaf26015bb83a1b2433073c2ec5886cf828d9e6
# Parent  9a1a83db8e12f4c4881ad7818a669fc8b1394108
EAFP: adopt renamed Device function
Signed-off-by: Heidi Eckhart <heidieck at linux.vnet.ibm.com>

diff -r 9a1a83db8e12 -r 1aaf26015bb8 src/Virt_ElementAllocatedFromPool.c
--- a/src/Virt_ElementAllocatedFromPool.c	Mon Mar 10 13:09:05 2008 +0100
+++ b/src/Virt_ElementAllocatedFromPool.c	Mon Mar 10 13:09:14 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