[PATCH 0 of 3] #3 - Renamed device function for constistency with other providers

Renamed the device_type_by_classname() to res_type_by_device_classname() for consistency with other interfaces. Diff to patch set 1: - moved adoption of new resource types CIM_RES_TYPE_foo into separate patch set Diff to patch set 2: - Device patch was rejected because of patch set "#4 - Add configurable enum_devices() to Device provider and Adopt interface changes to SD & EAFP"

# HG changeset patch # User Heidi Eckhart <heidieck@linux.vnet.ibm.com> # Date 1205150870 -3600 # Node ID 8a864207add28f66b1b749aa0a01722aae8f88a4 # Parent 33213e77e6f58b3614ccc1ddb58db19e0112d034 Device: rename device_type_from_classname to res_type_from_device_classname for consistency with the other providers. Signed-off-by: Heidi Eckhart <heidieck@linux.vnet.ibm.com> diff -r 33213e77e6f5 -r 8a864207add2 src/Virt_Device.c --- a/src/Virt_Device.c Mon Mar 10 13:02:27 2008 +0100 +++ b/src/Virt_Device.c Mon Mar 10 13:07:50 2008 +0100 @@ -268,7 +268,7 @@ static CMPIInstance *device_instance(con return instance; } -uint16_t device_type_from_classname(const char *classname) +uint16_t res_type_from_device_classname(const char *classname) { if (strstr(classname, "NetworkPort")) return CIM_RES_TYPE_NET; @@ -410,7 +410,7 @@ static CMPIStatus return_enum_devices(co s = enum_devices(_BROKER, reference, NULL, - device_type_from_classname(CLASSNAME(reference)), + res_type_from_device_classname(CLASSNAME(reference)), &list); if (s.rc != CMPI_RC_OK) goto out; @@ -551,7 +551,7 @@ CMPIStatus get_device_by_ref(const CMPIB s = get_device_by_name(broker, reference, name, - device_type_from_classname(CLASSNAME(reference)), + res_type_from_device_classname(CLASSNAME(reference)), &inst); if (s.rc != CMPI_RC_OK) goto out; diff -r 33213e77e6f5 -r 8a864207add2 src/Virt_Device.h --- a/src/Virt_Device.h Mon Mar 10 13:02:27 2008 +0100 +++ b/src/Virt_Device.h Mon Mar 10 13:07:50 2008 +0100 @@ -69,7 +69,7 @@ CMPIStatus get_device_by_name(const CMPI const uint16_t type, CMPIInstance **_inst); -uint16_t device_type_from_classname(const char *classname); +uint16_t res_type_from_device_classname(const char *classname); #endif

# HG changeset patch # User Heidi Eckhart <heidieck@linux.vnet.ibm.com> # Date 1205150945 -3600 # Node ID 9a1a83db8e12f4c4881ad7818a669fc8b1394108 # Parent 8a864207add28f66b1b749aa0a01722aae8f88a4 SDS: adopt renamed Device function Signed-off-by: Heidi Eckhart <heidieck@linux.vnet.ibm.com> diff -r 8a864207add2 -r 9a1a83db8e12 src/Virt_SettingsDefineState.c --- a/src/Virt_SettingsDefineState.c Mon Mar 10 13:07:50 2008 +0100 +++ b/src/Virt_SettingsDefineState.c Mon Mar 10 13:09:05 2008 +0100 @@ -64,7 +64,7 @@ static CMPIStatus dev_to_rasd(const CMPI s = get_rasd_by_name(_BROKER, ref, name, - device_type_from_classname(CLASSNAME(ref)), + res_type_from_device_classname(CLASSNAME(ref)), NULL, &inst); if (s.rc != CMPI_RC_OK)

# HG changeset patch # User Heidi Eckhart <heidieck@linux.vnet.ibm.com> # Date 1205150954 -3600 # Node ID 1aaf26015bb83a1b2433073c2ec5886cf828d9e6 # Parent 9a1a83db8e12f4c4881ad7818a669fc8b1394108 EAFP: adopt renamed Device function Signed-off-by: Heidi Eckhart <heidieck@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,
participants (1)
-
Heidi Eckhart