[Cluster-devel] cluster/fence/agents/xvm debug.c fence_xvm.c f ...
lhh at sourceware.org
lhh at sourceware.org
Wed Oct 17 18:27:28 UTC 2007
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: lhh at sourceware.org 2007-10-17 18:27:27
Modified files:
fence/agents/xvm: debug.c fence_xvm.c fence_xvmd.c ip_lookup.c
mcast.c simple_auth.c tcp.c xml.c xvm.h
Log message:
Make fence_xvmd read options from ccs like it should; merge dbg_printf patch from RHEL5 branch
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/xvm/debug.c.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/xvm/fence_xvm.c.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/xvm/fence_xvmd.c.diff?cvsroot=cluster&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/xvm/ip_lookup.c.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/xvm/mcast.c.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/xvm/simple_auth.c.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/xvm/tcp.c.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/xvm/xml.c.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/xvm/xvm.h.diff?cvsroot=cluster&r1=1.2&r2=1.3
--- cluster/fence/agents/xvm/debug.c 2006/11/13 16:13:50 1.1
+++ cluster/fence/agents/xvm/debug.c 2007/10/17 18:27:27 1.2
@@ -16,7 +16,8 @@
Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
MA 02139, USA.
*/
-#include "xvm.h"
+#include <stdio.h>
+#include "debug.h"
static int _debug = 0;
@@ -24,7 +25,7 @@
dset(int threshold)
{
_debug = threshold;
- dprintf(3, "Debugging threshold is now %d\n", threshold);
+ dbg_printf(3, "Debugging threshold is now %d\n", threshold);
}
inline int
--- cluster/fence/agents/xvm/fence_xvm.c 2007/08/22 08:58:41 1.6
+++ cluster/fence/agents/xvm/fence_xvm.c 2007/10/17 18:27:27 1.7
@@ -53,6 +53,7 @@
#include "options.h"
#include "tcp.h"
#include "mcast.h"
+#include "debug.h"
int
@@ -63,7 +64,7 @@
int n;
struct timeval tv;
- dprintf(3, "Waiting for connection from XVM host daemon.\n");
+ dbg_printf(3, "Waiting for connection from XVM host daemon.\n");
FD_ZERO(&rfds);
FD_SET(lfd, &rfds);
tv.tv_sec = retry_tenths / 10;
@@ -94,7 +95,7 @@
struct timeval tv;
/* Ok, we're connected */
- dprintf(3, "Issuing TCP challenge\n");
+ dbg_printf(3, "Issuing TCP challenge\n");
if (tcp_challenge(fd, auth, key, key_len, timeout) <= 0) {
/* Challenge failed */
printf("Invalid response to challenge\n");
@@ -102,13 +103,13 @@
}
/* Now they'll send us one, so we need to respond here */
- dprintf(3, "Responding to TCP challenge\n");
+ dbg_printf(3, "Responding to TCP challenge\n");
if (tcp_response(fd, auth, key, key_len, timeout) <= 0) {
printf("Invalid response to challenge\n");
return 0;
}
- dprintf(2, "TCP Exchange + Authentication done... \n");
+ dbg_printf(2, "TCP Exchange + Authentication done... \n");
FD_ZERO(&rfds);
FD_SET(fd, &rfds);
@@ -116,7 +117,7 @@
tv.tv_usec = 0;
ret = 1;
- dprintf(3, "Waiting for return value from XVM host\n");
+ dbg_printf(3, "Waiting for return value from XVM host\n");
if (select(fd + 1, &rfds, NULL, NULL, &tv) <= 0)
return -1;
@@ -146,7 +147,7 @@
for (ipa = ipl->tqh_first; ipa; ipa = ipa->ipa_entries.tqe_next) {
if (ipa->ipa_family != args->family) {
- dprintf(2, "Ignoring %s: wrong family\n", ipa->ipa_address);
+ dbg_printf(2, "Ignoring %s: wrong family\n", ipa->ipa_address);
continue;
}
@@ -166,7 +167,7 @@
tgt = (struct sockaddr *)&tgt6;
tgt_len = sizeof(tgt6);
} else {
- dprintf(2, "Unsupported family %d\n", args->family);
+ dbg_printf(2, "Unsupported family %d\n", args->family);
return -1;
}
@@ -198,7 +199,7 @@
sign_request(&freq, key, key_len);
- dprintf(3, "Sending to %s via %s\n", args->addr,
+ dbg_printf(3, "Sending to %s via %s\n", args->addr,
ipa->ipa_address);
sendto(mc_sock, &freq, sizeof(freq), 0,
--- cluster/fence/agents/xvm/fence_xvmd.c 2007/09/11 13:44:49 1.11
+++ cluster/fence/agents/xvm/fence_xvmd.c 2007/10/17 18:27:27 1.12
@@ -52,6 +52,7 @@
#include "tcp.h"
#include "virt.h"
#include "libcman.h"
+#include "debug.h"
static int running = 1;
@@ -188,7 +189,7 @@
sleep(1);
vdp = get_domain(req, vp);
if (!vdp) {
- dprintf(2, "Domain no longer exists\n");
+ dbg_printf(2, "Domain no longer exists\n");
response = 0;
break;
}
@@ -198,12 +199,12 @@
virDomainFree(vdp);
if (di.state == VIR_DOMAIN_SHUTOFF) {
- dprintf(2, "Domain has been shut off\n");
+ dbg_printf(2, "Domain has been shut off\n");
response = 0;
break;
}
- dprintf(4, "Domain still exists (state %d) after %d seconds\n",
+ dbg_printf(4, "Domain still exists (state %d) after %d seconds\n",
di.state, tries);
if (++tries >= timeout)
@@ -227,13 +228,13 @@
size_t sz;
if (!(vdp = get_domain(req, vp))) {
- dprintf(2, "Could not find domain: %s\n", req->domain);
+ dbg_printf(2, "Could not find domain: %s\n", req->domain);
goto out;
}
fd = connect_tcp(req, auth, key, key_len);
if (fd < 0) {
- dprintf(2, "Could call back for fence request: %s\n",
+ dbg_printf(2, "Could call back for fence request: %s\n",
strerror(errno));
goto out;
}
@@ -246,7 +247,7 @@
case FENCE_OFF:
printf("Destroying domain %s...\n", (char *)req->domain);
- dprintf(2, "[OFF] Calling virDomainDestroy\n");
+ dbg_printf(2, "[OFF] Calling virDomainDestroy\n");
ret = virDomainDestroy(vdp);
if (ret < 0) {
printf("virDomainDestroy() failed: %d\n", ret);
@@ -265,8 +266,8 @@
domain_desc = virDomainGetXMLDesc(vdp, 0);
if (domain_desc) {
- dprintf(3, "[[ XML Domain Info ]]\n");
- dprintf(3, "%s\n[[ XML END ]]\n", domain_desc);
+ dbg_printf(3, "[[ XML Domain Info ]]\n");
+ dbg_printf(3, "%s\n[[ XML END ]]\n", domain_desc);
sz = 0;
if (cleanup_xml(domain_desc,
@@ -275,14 +276,14 @@
domain_desc = domain_desc_sanitized;
}
- dprintf(3, "[[ XML Domain Info (modified) ]]\n");
- dprintf(3, "%s\n[[ XML END ]]\n", domain_desc);
+ dbg_printf(3, "[[ XML Domain Info (modified) ]]\n");
+ dbg_printf(3, "%s\n[[ XML END ]]\n", domain_desc);
} else {
printf("Failed getting domain description from "
"libvirt\n");
}
- dprintf(2, "[REBOOT] Calling virDomainDestroy\n");
+ dbg_printf(2, "[REBOOT] Calling virDomainDestroy\n");
ret = virDomainDestroy(vdp);
if (ret < 0) {
printf("virDomainDestroy() failed: %d\n", ret);
@@ -298,14 +299,14 @@
} else if (domain_desc) {
/* Recreate the domain if possible */
/* Success */
- dprintf(2, "Calling virDomainCreateLinux()...\n");
+ dbg_printf(2, "Calling virDomainCreateLinux()...\n");
virDomainCreateLinux(vp, domain_desc, 0);
free(domain_desc);
}
break;
}
- dprintf(3, "Sending response to caller...\n");
+ dbg_printf(3, "Sending response to caller...\n");
if (write(fd, &response, 1) < 0) {
perror("write");
}
@@ -669,6 +670,16 @@
}
+void
+sigint_handler(int sig)
+{
+ running = 0;
+}
+
+
+void malloc_dump_table(void);
+
+
int
main(int argc, char **argv)
{
@@ -772,7 +783,13 @@
return 1;
}
+
+ signal(SIGINT, sigint_handler);
+ signal(SIGTERM, sigint_handler);
+ signal(SIGQUIT, sigint_handler);
xvmd_loop(ch, h, mc_sock, &args, key, key_len);
+ //malloc_dump_table();
+
return 0;
}
--- cluster/fence/agents/xvm/ip_lookup.c 2006/11/13 16:13:50 1.3
+++ cluster/fence/agents/xvm/ip_lookup.c 2007/10/17 18:27:27 1.4
@@ -38,6 +38,7 @@
/* Local includes */
#include "ip_lookup.h"
+#include "debug.h"
static int
send_addr_dump(int fd, int family)
@@ -85,7 +86,7 @@
return -1;
}
- dprintf(4, "Adding IP %s to list (family %d)\n", ipaddr, family);
+ dbg_printf(4, "Adding IP %s to list (family %d)\n", ipaddr, family);
ipa = malloc(sizeof(*ipa));
memset(ipa, 0, sizeof(*ipa));
@@ -110,25 +111,25 @@
char outbuf[256];
int x, fd, len;
- dprintf(5, "Connecting to Netlink...\n");
+ dbg_printf(5, "Connecting to Netlink...\n");
fd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE);
if (fd < 0) {
perror("socket");
exit(1);
}
- dprintf(5, "Sending address dump request\n");
+ dbg_printf(5, "Sending address dump request\n");
send_addr_dump(fd, family);
memset(buf, 0, sizeof(buf));
- dprintf(5, "Waiting for response\n");
+ dbg_printf(5, "Waiting for response\n");
x = recvfrom(fd, buf, sizeof(buf), 0, NULL, 0);
if (x < 0) {
perror("recvfrom");
return -1;
}
- dprintf(5, "Received %d bytes\n", x);
+ dbg_printf(5, "Received %d bytes\n", x);
nh = (struct nlmsghdr *)buf;
while (NLMSG_OK(nh, x)) {
@@ -173,7 +174,7 @@
do {
/* Make sure we've got a valid rtaddr field */
if (!RTA_OK(rta, len)) {
- dprintf(5, "!RTA_OK(rta, len)\n");
+ dbg_printf(5, "!RTA_OK(rta, len)\n");
break;
}
@@ -184,7 +185,7 @@
}
if (rta->rta_type == IFA_LABEL) {
- dprintf(5, "Skipping label: %s\n",
+ dbg_printf(5, "Skipping label: %s\n",
(char *)RTA_DATA(rta));
}
@@ -199,7 +200,7 @@
nh = NLMSG_NEXT(nh, x);
}
- dprintf(5, "Closing Netlink connection\n");
+ dbg_printf(5, "Closing Netlink connection\n");
close(fd);
return 0;
}
@@ -210,15 +211,15 @@
{
ip_addr_t *ipa;
- dprintf(5, "Looking for IP address %s in IP list %p...", ip_name, ipl);
+ dbg_printf(5, "Looking for IP address %s in IP list %p...", ip_name, ipl);
ipa = ipl->tqh_first;
for (ipa = ipl->tqh_first; ipa; ipa = ipa->ipa_entries.tqe_next) {
if (!strcmp(ip_name, ipa->ipa_address)) {
- dprintf(4,"Found\n");
+ dbg_printf(4,"Found\n");
return 0;
}
}
- dprintf(5, "Not found\n");
+ dbg_printf(5, "Not found\n");
return 1;
}
@@ -228,7 +229,7 @@
{
ip_addr_t *ipa;
- dprintf(5, "Tearing down IP list @ %p\n", ipl);
+ dbg_printf(5, "Tearing down IP list @ %p\n", ipl);
while ((ipa = ipl->tqh_first)) {
TAILQ_REMOVE(ipl, ipa, ipa_entries);
free(ipa->ipa_address);
@@ -241,7 +242,7 @@
int
ip_build_list(ip_list_t *ipl)
{
- dprintf(5, "Build IP address list\n");
+ dbg_printf(5, "Build IP address list\n");
TAILQ_INIT(ipl);
if (add_ip_addresses(PF_INET6, ipl) < 0) {
ip_free_list(ipl);
@@ -275,7 +276,7 @@
ip_list_t ipl;
int ret = -1;
- dprintf(5, "Looking for IP matching %s\n", nodename);
+ dbg_printf(5, "Looking for IP matching %s\n", nodename);
/* Build list of IP addresses configured locally */
if (ip_build_list(&ipl) < 0)
return -1;
--- cluster/fence/agents/xvm/mcast.c 2006/11/13 16:13:50 1.2
+++ cluster/fence/agents/xvm/mcast.c 2007/10/17 18:27:27 1.3
@@ -41,6 +41,7 @@
/* Local includes */
#include "mcast.h"
+#include "debug.h"
/**
Sets up a multicast receive socket
@@ -62,7 +63,7 @@
/********************************
* SET UP MULTICAST RECV SOCKET *
********************************/
- dprintf(4, "Setting up ipv4 multicast receive (%s:%d)\n", addr, port);
+ dbg_printf(4, "Setting up ipv4 multicast receive (%s:%d)\n", addr, port);
sock = socket(PF_INET, SOCK_DGRAM, 0);
if (sock < 0) {
printf("socket: %s\n", strerror(errno));
@@ -90,7 +91,7 @@
*/
/* mreq.imr_multiaddr.s_addr is set above */
mreq.imr_interface.s_addr = htonl(INADDR_ANY);
- dprintf(4, "Joining multicast group\n");
+ dbg_printf(4, "Joining multicast group\n");
if (setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP,
&mreq, sizeof(mreq)) == -1) {
printf("Failed to bind multicast receive socket to "
@@ -100,7 +101,7 @@
return -1;
}
- dprintf(4, "%s: success, fd = %d\n", __FUNCTION__, sock);
+ dbg_printf(4, "%s: success, fd = %d\n", __FUNCTION__, sock);
return sock;
}
@@ -147,7 +148,7 @@
/*************************
* SET UP MULTICAST SEND *
*************************/
- dprintf(4, "Setting up ipv4 multicast send (%s:%d)\n", addr, port);
+ dbg_printf(4, "Setting up ipv4 multicast send (%s:%d)\n", addr, port);
sock = socket(PF_INET, SOCK_DGRAM, 0);
if (sock < 0) {
perror("socket");
@@ -157,7 +158,7 @@
/*
* Join Multicast group.
*/
- dprintf(4, "Joining IP Multicast group (pass 1)\n");
+ dbg_printf(4, "Joining IP Multicast group (pass 1)\n");
if (setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq,
sizeof(mreq)) == -1) {
printf("Failed to add multicast membership to transmit "
@@ -169,7 +170,7 @@
/*
* Join Multicast group.
*/
- dprintf(4, "Joining IP Multicast group (pass 2)\n");
+ dbg_printf(4, "Joining IP Multicast group (pass 2)\n");
if (setsockopt(sock, IPPROTO_IP, IP_MULTICAST_IF, &src.sin_addr,
sizeof(src.sin_addr)) == -1) {
printf("Failed to bind multicast transmit socket to "
@@ -181,7 +182,7 @@
/*
* set time to live to 2 hops.
*/
- dprintf(4, "Setting TTL to 2 for fd%d\n", sock);
+ dbg_printf(4, "Setting TTL to 2 for fd%d\n", sock);
val = 2;
if (setsockopt(sock, SOL_IP, IP_MULTICAST_TTL, &val,
sizeof(val)))
@@ -189,7 +190,7 @@
memcpy((struct sockaddr_in *)tgt, &mcast, sizeof(struct sockaddr_in));
- dprintf(4, "%s: success, fd = %d\n", __FUNCTION__, sock);
+ dbg_printf(4, "%s: success, fd = %d\n", __FUNCTION__, sock);
return sock;
}
@@ -222,7 +223,7 @@
/********************************
* SET UP MULTICAST RECV SOCKET *
********************************/
- dprintf(4, "Setting up ipv6 multicast receive (%s:%d)\n", addr, port);
+ dbg_printf(4, "Setting up ipv6 multicast receive (%s:%d)\n", addr, port);
sock = socket(PF_INET6, SOCK_DGRAM, IPPROTO_UDP);
if (sock < 0) {
printf("socket: %s\n", strerror(errno));
@@ -246,7 +247,7 @@
return -1;
}
- dprintf(4, "Disabling IP Multicast loopback\n");
+ dbg_printf(4, "Disabling IP Multicast loopback\n");
val = 1;
if (setsockopt(sock, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, &val,
sizeof(val)) != 0) {
@@ -258,7 +259,7 @@
/*
* Join multicast group
*/
- dprintf(4, "Joining IP Multicast group\n");
+ dbg_printf(4, "Joining IP Multicast group\n");
if (setsockopt(sock, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, &mreq,
sizeof(mreq)) == -1) {
printf("Failed to add multicast to socket %s: %s\n",
@@ -267,7 +268,7 @@
return -1;
}
- dprintf(4, "%s: success, fd = %d\n", __FUNCTION__, sock);
+ dbg_printf(4, "%s: success, fd = %d\n", __FUNCTION__, sock);
return sock;
}
@@ -316,14 +317,14 @@
/*************************
* SET UP MULTICAST SEND *
*************************/
- dprintf(4, "Setting up ipv6 multicast send (%s:%d)\n", addr, port);
+ dbg_printf(4, "Setting up ipv6 multicast send (%s:%d)\n", addr, port);
sock = socket(PF_INET6, SOCK_DGRAM, 0);
if (sock < 0) {
perror("socket");
return -1;
}
- dprintf(4, "Disabling IP Multicast loopback\n");
+ dbg_printf(4, "Disabling IP Multicast loopback\n");
val = 1;
if (setsockopt(sock, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, &val,
sizeof(val)) != 0) {
@@ -335,7 +336,7 @@
/*
* Join Multicast group.
*/
- dprintf(4, "Joining IP Multicast group\n");
+ dbg_printf(4, "Joining IP Multicast group\n");
if (setsockopt(sock, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, &mreq,
sizeof(mreq)) == -1) {
printf("Failed to add multicast membership to transmit "
@@ -367,6 +368,6 @@
memcpy((struct sockaddr_in *)tgt, &mcast, sizeof(struct sockaddr_in6));
- dprintf(4, "%s: success, fd = %d\n", __FUNCTION__, sock);
+ dbg_printf(4, "%s: success, fd = %d\n", __FUNCTION__, sock);
return sock;
}
--- cluster/fence/agents/xvm/simple_auth.c 2007/03/06 23:08:31 1.6
+++ cluster/fence/agents/xvm/simple_auth.c 2007/10/17 18:27:27 1.7
@@ -29,6 +29,7 @@
/* Local includes */
#include "xvm.h"
#include "simple_auth.h"
+#include "debug.h"
void
@@ -64,7 +65,7 @@
return;
}
- dprintf(4, "Opening /dev/urandom\n");
+ dbg_printf(4, "Opening /dev/urandom\n");
devrand = open("/dev/urandom", O_RDONLY);
if (devrand >= 0) {
if (read(devrand, req->random, sizeof(req->random)) < 0) {
@@ -109,7 +110,7 @@
ht = HASH_AlgSHA512;
break;
default:
- dprintf(3, "%s: no-op (HASH_NONE)\n", __FUNCTION__);
+ dbg_printf(3, "%s: no-op (HASH_NONE)\n", __FUNCTION__);
return 0;
}
@@ -148,7 +149,7 @@
memset(req->hash, 0, sizeof(req->hash));
switch(req->hashtype) {
case HASH_NONE:
- dprintf(3, "%s: no-op (HASH_NONE)\n", __FUNCTION__);
+ dbg_printf(3, "%s: no-op (HASH_NONE)\n", __FUNCTION__);
return 0;
case HASH_SHA1:
case HASH_SHA256:
@@ -305,7 +306,7 @@
ht = HASH_AlgSHA512;
break;
default:
- dprintf(3, "%s: no-op (AUTH_NONE)\n", __FUNCTION__);
+ dbg_printf(3, "%s: no-op (AUTH_NONE)\n", __FUNCTION__);
return 0;
}
@@ -335,7 +336,7 @@
{
switch(auth) {
case AUTH_NONE:
- dprintf(3, "%s: no-op (AUTH_NONE)\n", __FUNCTION__);
+ dbg_printf(3, "%s: no-op (AUTH_NONE)\n", __FUNCTION__);
return 1;
case AUTH_SHA1:
case AUTH_SHA256:
@@ -354,7 +355,7 @@
{
switch(auth) {
case AUTH_NONE:
- dprintf(3, "%s: no-op (AUTH_NONE)\n", __FUNCTION__);
+ dbg_printf(3, "%s: no-op (AUTH_NONE)\n", __FUNCTION__);
return 1;
case AUTH_SHA1:
case AUTH_SHA256:
@@ -374,11 +375,11 @@
int nread, remain = max_len;
char *p;
- dprintf(3, "Reading in key file %s into %p (%d max size)\n",
+ dbg_printf(3, "Reading in key file %s into %p (%d max size)\n",
file, key, (int)max_len);
fd = open(file, O_RDONLY);
if (fd < 0) {
- dprintf(2, "Error opening key file: %s\n", strerror(errno));
+ dbg_printf(2, "Error opening key file: %s\n", strerror(errno));
return -1;
}
@@ -389,13 +390,13 @@
while (remain) {
nread = read(fd, p, remain);
if (nread < 0) {
- dprintf(2, "Error from read: %s\n", strerror(errno));
+ dbg_printf(2, "Error from read: %s\n", strerror(errno));
close(fd);
return -1;
}
if (nread == 0) {
- dprintf(3, "Stopped reading @ %d bytes",
+ dbg_printf(3, "Stopped reading @ %d bytes",
(int)max_len-remain);
break;
}
@@ -405,7 +406,7 @@
}
close(fd);
- dprintf(3, "Actual key length = %d bytes", (int)max_len-remain);
+ dbg_printf(3, "Actual key length = %d bytes", (int)max_len-remain);
return (int)(max_len - remain);
}
--- cluster/fence/agents/xvm/tcp.c 2006/11/13 16:13:50 1.2
+++ cluster/fence/agents/xvm/tcp.c 2007/10/17 18:27:27 1.3
@@ -33,6 +33,8 @@
#include <sys/types.h>
#include <arpa/inet.h>
+#include "debug.h"
+
static int connect_nb(int fd, struct sockaddr *dest, socklen_t len, int timeout);
/**
@@ -65,7 +67,7 @@
struct sockaddr_in6 _sin6;
int fd, ret;
- dprintf(4, "%s: Setting up ipv6 listen socket\n", __FUNCTION__);
+ dbg_printf(4, "%s: Setting up ipv6 listen socket\n", __FUNCTION__);
fd = socket(PF_INET6, SOCK_STREAM, 0);
if (fd < 0)
return -1;
@@ -96,7 +98,7 @@
return -1;
}
- dprintf(4, "%s: Success; fd = %d\n", __FUNCTION__, fd);
+ dbg_printf(4, "%s: Success; fd = %d\n", __FUNCTION__, fd);
return fd;
}
@@ -115,7 +117,7 @@
struct sockaddr_in _sin;
int fd, ret;
- dprintf(4, "%s: Setting up ipv4 listen socket\n", __FUNCTION__);
+ dbg_printf(4, "%s: Setting up ipv4 listen socket\n", __FUNCTION__);
fd = socket(PF_INET, SOCK_STREAM, 0);
if (fd < 0)
return -1;
@@ -144,7 +146,7 @@
return -1;
}
- dprintf(4, "%s: Success; fd = %d\n", __FUNCTION__, fd);
+ dbg_printf(4, "%s: Success; fd = %d\n", __FUNCTION__, fd);
return fd;
}
@@ -166,7 +168,7 @@
struct sockaddr_in6 _sin6;
int fd, ret;
- dprintf(4, "%s: Connecting to client\n", __FUNCTION__);
+ dbg_printf(4, "%s: Connecting to client\n", __FUNCTION__);
fd = socket(PF_INET6, SOCK_STREAM, 0);
if (fd < 0)
return -1;
@@ -182,7 +184,7 @@
close(fd);
return -1;
}
- dprintf(4, "%s: Success; fd = %d\n", __FUNCTION__, fd);
+ dbg_printf(4, "%s: Success; fd = %d\n", __FUNCTION__, fd);
return fd;
}
@@ -203,7 +205,7 @@
struct sockaddr_in _sin;
int fd, ret;
- dprintf(4, "%s: Connecting to client\n", __FUNCTION__);
+ dbg_printf(4, "%s: Connecting to client\n", __FUNCTION__);
fd = socket(PF_INET, SOCK_STREAM, 0);
if (fd < 0)
return -1;
@@ -218,7 +220,7 @@
return -1;
}
- dprintf(4, "%s: Success; fd = %d\n", __FUNCTION__, fd);
+ dbg_printf(4, "%s: Success; fd = %d\n", __FUNCTION__, fd);
return fd;
}
--- cluster/fence/agents/xvm/xml.c 2007/06/26 17:31:32 1.3
+++ cluster/fence/agents/xvm/xml.c 2007/10/17 18:27:27 1.4
@@ -10,9 +10,9 @@
#ifdef STANDALONE
-#define dprintf(x, fmt, args...) printf("<%d> " fmt, x, ##args)
+#define dbg_printf(x, fmt, args...) printf("<%d> " fmt, x, ##args)
#else
-#include "xvm.h"
+#include "debug.h"
#endif
xmlNodePtr
@@ -58,7 +58,7 @@
}
if (xmlGetProp(curr, (xmlChar *)"port")) {
- dprintf(5,"Zapping the graphics port\n");
+ dbg_printf(5,"Zapping the graphics port\n");
xmlSetProp(curr, (xmlChar *)"port", (xmlChar *)"-1");
}
@@ -75,7 +75,7 @@
curr = xmlDocGetRootElement(doc);
if (xmlStrcmp(curr->name, (xmlChar *)"domain")) {
- dprintf(1, "Invalid XML\n");
+ dbg_printf(1, "Invalid XML\n");
return -1;
}
@@ -90,7 +90,7 @@
curr = curr->next;
}
if (!curr) {
- dprintf(1, "Unable to determine the domain type\n");
+ dbg_printf(1, "Unable to determine the domain type\n");
return -1;
}
@@ -99,15 +99,15 @@
if (!strcasecmp(val, "hvm")) {
type = 1;
- dprintf(2, "Virtual machine is HVM\n");
+ dbg_printf(2, "Virtual machine is HVM\n");
} else if (!strcasecmp(val, "linux")) {
type = 2;
- dprintf(2, "Virtual machine is Linux\n");
+ dbg_printf(2, "Virtual machine is Linux\n");
}
/* Node is still pointing to the <os> block */
if (type == 2) {
- dprintf(3, "Unlinkiking %s block\n", (char *)os_node->name);
+ dbg_printf(3, "Unlinkiking %s block\n", (char *)os_node->name);
xmlUnlinkNode(os_node);
xmlFreeNode(os_node);
}
@@ -150,12 +150,12 @@
*xtreep = xmlParseMemory(buffer, size);
if (!*xtreep) {
- dprintf(1, "parse failure %p %d\n", buffer, (int)size);
+ dbg_printf(1, "parse failure %p %d\n", buffer, (int)size);
return -1;
}
if (!((cur = xmlDocGetRootElement(*xtreep)))) {
- dprintf(1, "root element failure\n");
+ dbg_printf(1, "root element failure\n");
xmlFreeDoc(*xtreep);
*xtreep = NULL;
return -1;
--- cluster/fence/agents/xvm/xvm.h 2006/11/13 16:13:50 1.2
+++ cluster/fence/agents/xvm/xvm.h 2007/10/17 18:27:27 1.3
@@ -73,14 +73,4 @@
} fence_req_t;
-inline void dset(int);
-inline int dget(void);
-
-#define dprintf(level, fmt, args...) \
-do { \
- if (dget()>=level) \
- printf(fmt, ##args); \
-} while(0)
-
-
#endif
More information about the Cluster-devel
mailing list