# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1198259651 28800
# Node ID 97c1cab36073319f7cf78cbec70eec9eaee01a4d
# Parent 84eb3549e19956d912684a09d58631211724a720
Cleanup device_type_from_poolid() in DevicePool.
Change return type to uint16_t to match the device type.
Change "Memory" and "Processor" to "MemoryPool" and
"ProcessorPool" so that it's more strict.
Replace strstr with STARTS_WITH() so that the check is more strict.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 84eb3549e199 -r 97c1cab36073 src/Virt_DevicePool.c
--- a/src/Virt_DevicePool.c Thu Dec 20 10:14:00 2007 -0800
+++ b/src/Virt_DevicePool.c Fri Dec 21 09:54:11 2007 -0800
@@ -268,15 +268,15 @@ char *pool_member_of(const CMPIBroker *b
return poolid;
}
-int device_type_from_poolid(const char *id)
-{
- if (strstr(id, "NetworkPool"))
+uint16_t device_type_from_poolid(const char *id)
+{
+ if (STARTS_WITH(id, "NetworkPool"))
return VIRT_DEV_NET;
- else if (strstr(id, "DiskPool"))
+ else if (STARTS_WITH(id, "DiskPool"))
return VIRT_DEV_DISK;
- else if (strstr(id, "Memory"))
+ else if (STARTS_WITH(id, "MemoryPool"))
return VIRT_DEV_MEM;
- else if (strstr(id, "Processor"))
+ else if (STARTS_WITH(id, "ProcessorPool"))
return VIRT_DEV_VCPU;
else
return VIRT_DEV_UNKNOWN;
diff -r 84eb3549e199 -r 97c1cab36073 src/Virt_DevicePool.h
--- a/src/Virt_DevicePool.h Thu Dec 20 10:14:00 2007 -0800
+++ b/src/Virt_DevicePool.h Fri Dec 21 09:54:11 2007 -0800
@@ -56,11 +56,11 @@ char *pool_member_of(const CMPIBroker *b
const char *id);
/**
- * * Get the device type of a given pool from the pool's InstanceID
- * *
- * * @param id The InstanceID of the pool
- * */
-int device_type_from_poolid(const char *id);
+ * Get the device type of a given pool from the pool's InstanceID
+ *
+ * @param id The InstanceID of the pool
+ */
+uint16_t device_type_from_poolid(const char *id);
/**
* Get all device pools on the system for the given connection