From mboxrd@z Thu Jan 1 00:00:00 1970 From: lhh@sourceware.org Date: 26 Jun 2007 17:30:26 -0000 Subject: [Cluster-devel] cluster/fence/agents/xvm Makefile xml.c Message-ID: <20070626173026.2609.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit CVSROOT: /cvs/cluster Module name: cluster Branch: RHEL5 Changes by: lhh at sourceware.org 2007-06-26 17:30:26 Modified files: fence/agents/xvm: Makefile xml.c Log message: Ancillary patch to fix debug output Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/xvm/Makefile.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.3.2.3&r2=1.3.2.4 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/xvm/xml.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.2.1&r2=1.1.2.2 --- cluster/fence/agents/xvm/Makefile 2007/06/26 17:17:40 1.3.2.3 +++ cluster/fence/agents/xvm/Makefile 2007/06/26 17:30:26 1.3.2.4 @@ -45,7 +45,7 @@ gcc $(CFLAGS) -c -o $@ $^ $(INCLUDES) clean: - rm -f $(TARGETS) *~ *.o + rm -f $(TARGETS) *~ *.o testprog testprog: gcc -o testprog xml.c -I/usr/include/libxml2 -lxml2 \ --- cluster/fence/agents/xvm/xml.c 2007/06/26 17:17:40 1.1.2.1 +++ cluster/fence/agents/xvm/xml.c 2007/06/26 17:30:26 1.1.2.2 @@ -9,6 +9,12 @@ #include +#ifdef STANDALONE +#define dprintf(x, fmt, args...) printf("<%d> " fmt, x, ##args) +#else +#include "xvm.h" +#endif + xmlNodePtr get_os_node(xmlDocPtr doc) { @@ -52,7 +58,7 @@ } if (xmlGetProp(curr, (xmlChar *)"port")) { - printf("Zapping the port spec\n"); + dprintf(5,"Zapping the graphics port\n"); xmlSetProp(curr, (xmlChar *)"port", (xmlChar *)"-1"); } @@ -69,7 +75,7 @@ curr = xmlDocGetRootElement(doc); if (xmlStrcmp(curr->name, (xmlChar *)"domain")) { - printf("Invalid XML\n"); + dprintf(1, "Invalid XML\n"); return -1; } @@ -84,7 +90,7 @@ curr = curr->next; } if (!curr) { - printf("Unable to determine the domain type\n"); + dprintf(1, "Unable to determine the domain type\n"); return -1; } @@ -93,15 +99,15 @@ if (!strcasecmp(val, "hvm")) { type = 1; - printf("Virtual machine is HVM\n"); + dprintf(2, "Virtual machine is HVM\n"); } else if (!strcasecmp(val, "linux")) { type = 2; - printf("Virtual machine is Linux\n"); + dprintf(2, "Virtual machine is Linux\n"); } /* Node is still pointing to the block */ if (type == 2) { - printf("Unlinkiking %s block\n", (char *)os_node->name); + dprintf(3, "Unlinkiking %s block\n", (char *)os_node->name); xmlUnlinkNode(os_node); xmlFreeNode(os_node); } @@ -144,12 +150,12 @@ *xtreep = xmlParseMemory(buffer, size); if (!*xtreep) { - printf("parse failure %p %d\n", buffer, (int)size); + dprintf(1, "parse failure %p %d\n", buffer, (int)size); return -1; } if (!((cur = xmlDocGetRootElement(*xtreep)))) { - printf("root element failure\n"); + dprintf(1, "root element failure\n"); xmlFreeDoc(*xtreep); *xtreep = NULL; return -1;