[PATCH 0 of 4] Replace printfs with CU_DEBUG.

This patchset cleans up some extraneous printfs. They are replaced with CU_DEBUG statements.

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1199740240 28800 # Node ID 7281142059a1c419405addd2ba351c68fb719ff0 # Parent abcb596636c9530009756b1aa1e8900a2f01d10e Replace printf() with CU_DEBUG in EAFP. Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r abcb596636c9 -r 7281142059a1 src/Virt_ElementAllocatedFromPool.c --- a/src/Virt_ElementAllocatedFromPool.c Mon Jan 07 11:42:40 2008 -0800 +++ b/src/Virt_ElementAllocatedFromPool.c Mon Jan 07 13:10:40 2008 -0800 @@ -135,7 +135,7 @@ static int filter_by_pool(struct inst_li if ((dev_id == NULL) || (cn == NULL)) continue; - printf("Device %hhi:%s", type, dev_id); + CU_DEBUG("Device %hhi:%s", type, dev_id); poolid = pool_member_of(_BROKER, cn, type, dev_id); if (poolid && STREQ(poolid, _poolid)) @@ -162,11 +162,11 @@ static int devs_from_pool(uint16_t type, if (conn == NULL) return 0; - printf("Connected\n"); + CU_DEBUG("Connected"); count = get_domain_list(conn, &doms); - printf("Got %i domains\n", count); + CU_DEBUG("Got %i domains", count); for (i = 0; i < count; i++) { const char *name; @@ -179,11 +179,11 @@ static int devs_from_pool(uint16_t type, /* FIXME: Get VIRT_DEV_ type here */ dom_devices(_BROKER, doms[i], ns, type, &tmp); - printf("Got devices\n"); + CU_DEBUG("Got devices"); filter_by_pool(list, &tmp, type, poolid); - printf("Filtered\n"); + CU_DEBUG("Filtered"); inst_list_free(&tmp); virDomainFree(doms[i]);

KR> # HG changeset patch KR> # User Kaitlin Rupert <karupert@us.ibm.com> KR> # Date 1199740240 28800 KR> # Node ID 7281142059a1c419405addd2ba351c68fb719ff0 KR> # Parent abcb596636c9530009756b1aa1e8900a2f01d10e KR> Replace printf() with CU_DEBUG in EAFP. I'm all for cleanups of this fashion. However, KR> - printf("Device %hhi:%s", type, dev_id); KR> + CU_DEBUG("Device %hhi:%s", type, dev_id); This looks like crufty debug that uses a platform-dependent bit-width anyway. This and the rest in this file should probably be excised instead of formalized. What do you think? -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com

Dan Smith wrote:
KR> # HG changeset patch KR> # User Kaitlin Rupert <karupert@us.ibm.com> KR> # Date 1199740240 28800 KR> # Node ID 7281142059a1c419405addd2ba351c68fb719ff0 KR> # Parent abcb596636c9530009756b1aa1e8900a2f01d10e KR> Replace printf() with CU_DEBUG in EAFP.
I'm all for cleanups of this fashion. However,
KR> - printf("Device %hhi:%s", type, dev_id); KR> + CU_DEBUG("Device %hhi:%s", type, dev_id);
This looks like crufty debug that uses a platform-dependent bit-width anyway. This and the rest in this file should probably be excised instead of formalized. What do you think?
I can't really comment on the necessity of these particular statements, but is there a way for use to print that value in a platform-independent way? -- -Jay

JG> I can't really comment on the necessity of these particular JG> statements, but is there a way for use to print that value in a JG> platform-independent way? Yep, see inttypes.h. "%hhu" was intended to be a byte, so PRIu8 would be the appropriate selection here, used as follows: printf("Here is my byte: %" PRIu8 "\n", my_byte); -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com

Dan Smith wrote:
KR> # HG changeset patch KR> # User Kaitlin Rupert <karupert@us.ibm.com> KR> # Date 1199740240 28800 KR> # Node ID 7281142059a1c419405addd2ba351c68fb719ff0 KR> # Parent abcb596636c9530009756b1aa1e8900a2f01d10e KR> Replace printf() with CU_DEBUG in EAFP.
I'm all for cleanups of this fashion. However,
KR> - printf("Device %hhi:%s", type, dev_id); KR> + CU_DEBUG("Device %hhi:%s", type, dev_id);
This looks like crufty debug that uses a platform-dependent bit-width anyway. This and the rest in this file should probably be excised instead of formalized. What do you think?
This is a good point. I'll generate a new patch. -- Kaitlin Rupert IBM Linux Technology Center karupert@us.ibm.com

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1199740279 28800 # Node ID 87362d52572b34fd880d28b76bdfb021a507cbd6 # Parent 7281142059a1c419405addd2ba351c68fb719ff0 Replace printfs with CU_DEBUG in ComputerSystem. Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r 7281142059a1 -r 87362d52572b src/Virt_ComputerSystem.c --- a/src/Virt_ComputerSystem.c Mon Jan 07 13:10:40 2008 -0800 +++ b/src/Virt_ComputerSystem.c Mon Jan 07 13:11:19 2008 -0800 @@ -482,15 +482,15 @@ static CMPIStatus state_change_enable(vi switch (info->state) { case VIR_DOMAIN_SHUTOFF: - printf("Start domain\n"); + CU_DEBUG("Start domain"); ret = virDomainCreate(dom); break; case VIR_DOMAIN_PAUSED: - printf("Unpause domain\n"); + CU_DEBUG("Unpause domain"); ret = virDomainResume(dom); break; default: - printf("Cannot go to enabled state from %i\n", info->state); + CU_DEBUG("Cannot go to enabled state from %i", info->state); cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, "Invalid state transition"); @@ -511,11 +511,11 @@ static CMPIStatus state_change_disable(v switch (info->state) { case VIR_DOMAIN_RUNNING: - printf("Stop domain\n"); + CU_DEBUG("Stop domain"); ret = virDomainShutdown(dom); break; default: - printf("Cannot go to disabled state from %i\n", info->state); + CU_DEBUG("Cannot go to disabled state from %i", info->state); cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, "Invalid state transition"); @@ -536,7 +536,7 @@ static CMPIStatus state_change_pause(vir switch (info->state) { case VIR_DOMAIN_RUNNING: - printf("Pause domain\n"); + CU_DEBUG("Pause domain"); ret = virDomainSuspend(dom); break; default: @@ -560,7 +560,7 @@ static CMPIStatus state_change_reboot(vi switch (info->state) { case VIR_DOMAIN_RUNNING: - printf("Reboot domain\n"); + CU_DEBUG("Reboot domain"); ret = virDomainReboot(dom, 0); break; default: @@ -584,7 +584,7 @@ static CMPIStatus state_change_reset(vir switch (info->state) { case VIR_DOMAIN_RUNNING: - printf("Reset domain\n"); + CU_DEBUG("Reset domain"); ret = domain_reset(dom); break; default:

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1199740361 28800 # Node ID aecc7eb40e68ea06e9e5e3a5b80deac1c34af5eb # Parent 87362d52572b34fd880d28b76bdfb021a507cbd6 Replace printf() with CU_DEBUG in VSMgmtService. Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r 87362d52572b -r aecc7eb40e68 src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Mon Jan 07 13:11:19 2008 -0800 +++ b/src/Virt_VirtualSystemManagementService.c Mon Jan 07 13:12:41 2008 -0800 @@ -513,7 +513,7 @@ static CMPIStatus update_system_settings xml = system_to_xml(dominfo); if (xml != NULL) { - printf("New XML is:\n%s\n", xml); + CU_DEBUG("New XML is:\n%s", xml); connect_and_create(xml, ref, &s); } @@ -848,7 +848,7 @@ static CMPIStatus _update_resources_for( xml = system_to_xml(dominfo); if (xml != NULL) { - printf("New XML:\n%s\n", xml); + CU_DEBUG("New XML:\n%s", xml); connect_and_create(xml, ref, &s); } else { cu_statusf(_BROKER, &s,

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1199740491 28800 # Node ID d249e26d9d545455465e1f6fc2f03f160f3c8704 # Parent aecc7eb40e68ea06e9e5e3a5b80deac1c34af5eb Replace printf() with CU_DEBUG in ComputerSystemIndication. Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r aecc7eb40e68 -r d249e26d9d54 src/Virt_ComputerSystemIndication.c --- a/src/Virt_ComputerSystemIndication.c Mon Jan 07 13:12:41 2008 -0800 +++ b/src/Virt_ComputerSystemIndication.c Mon Jan 07 13:14:51 2008 -0800 @@ -76,20 +76,20 @@ static bool _lifecycle_indication(const type, NAMESPACE(newsystem)); if (ind == NULL) { - printf("Failed to create ind\n"); + CU_DEBUG("Failed to create ind"); return false; } ind_op = CMGetObjectPath(ind, &s); if (s.rc != CMPI_RC_OK) { - printf("Failed to get ind_op\n"); + CU_DEBUG("Failed to get ind_op"); return false; } CMSetProperty(ind, "AffectedSystem", (CMPIValue *)&newsystem, CMPI_ref); - printf("Delivering Indication: %s\n", + CU_DEBUG("Delivering Indication: %s", CMGetCharPtr(CMObjectPathToString(ind_op, NULL))); CBDeliverIndication(_BROKER, @@ -160,7 +160,7 @@ static bool async_ind(CMPIContext *conte op = CMNewObjectPath(_BROKER, ns, type_cn, &s); } else { - printf("Unknown event type: %i\n", type); + CU_DEBUG("Unknown event type: %i", type); return false; } @@ -189,7 +189,7 @@ static CMPI_THREAD_RETURN lifecycle_thre conn = lv_connect(_BROKER, &s); if (conn == NULL) { - printf("Failed to connect: %s\n", CMGetCharPtr(s.msg)); + CU_DEBUG("Failed to connect: %s", CMGetCharPtr(s.msg)); return NULL; } @@ -271,7 +271,7 @@ static _EI_RTYPE EnableIndications(CMPII lifecycle_enabled = true; pthread_mutex_unlock(&lifecycle_mutex); - printf("ComputerSystemIndication enabled\n"); + CU_DEBUG("ComputerSystemIndication enabled"); _EI_RET(); } @@ -283,7 +283,7 @@ static _EI_RTYPE DisableIndications(CMPI lifecycle_enabled = false; pthread_mutex_unlock(&lifecycle_mutex); - printf("ComputerSystemIndication disabled\n"); + CU_DEBUG("ComputerSystemIndication disabled"); _EI_RET(); }
participants (3)
-
Dan Smith
-
Jay Gagnon
-
Kaitlin Rupert