svn commit: r186423 - projects/releng_7_xen/sys/xen/xenbus
Kip Macy
kmacy at FreeBSD.org
Mon Dec 22 21:10:05 PST 2008
Author: kmacy
Date: Tue Dec 23 05:10:05 2008
New Revision: 186423
URL: http://svn.freebsd.org/changeset/base/186423
Log:
turn off verbose debugging of xenbus by default
Modified:
projects/releng_7_xen/sys/xen/xenbus/xenbus_xs.c
Modified: projects/releng_7_xen/sys/xen/xenbus/xenbus_xs.c
==============================================================================
--- projects/releng_7_xen/sys/xen/xenbus/xenbus_xs.c Tue Dec 23 05:01:43 2008 (r186422)
+++ projects/releng_7_xen/sys/xen/xenbus/xenbus_xs.c Tue Dec 23 05:10:05 2008 (r186423)
@@ -72,6 +72,12 @@ static int xs_process_msg(enum xsd_sockm
int xenwatch_running = 0;
int xenbus_running = 0;
+#ifdef XENBUS_DEBUG
+#define DPRINTF printf
+#else
+#define DPRINTF(...)
+#endif
+
struct kvec {
const void *iov_base;
size_t iov_len;
@@ -150,9 +156,11 @@ static void *read_reply(enum xsd_sockmsg
struct xs_stored_msg *msg;
char *body;
int i, err;
+#ifdef XENBUS_DEBUG
enum xsd_sockmsg_type itype = *type;
-
- printf("read_reply ");
+#endif
+
+ DPRINTF("read_reply ");
if (xenbus_running == 0) {
/*
* Give other domain time to run :-/
@@ -168,7 +176,7 @@ static void *read_reply(enum xsd_sockmsg
}
if (list_empty(&xs_state.reply_list)) {
- printf("giving up and returning an error type=%d\n",
+ DPRINTF("giving up and returning an error type=%d\n",
*type);
kdb_backtrace();
return (ERR_PTR(-1));
@@ -192,7 +200,7 @@ static void *read_reply(enum xsd_sockmsg
mtx_unlock(&xs_state.reply_lock);
- printf("itype=%d htype=%d ", itype, msg->hdr.type);
+ DPRINTF("itype=%d htype=%d ", itype, msg->hdr.type);
*type = msg->hdr.type;
if (len)
*len = msg->hdr.len;
@@ -200,9 +208,9 @@ static void *read_reply(enum xsd_sockmsg
kfree(msg);
if (len)
- printf("len=%d\n", *len);
+ DPRINTF("len=%d\n", *len);
else
- printf("len=NULL\n");
+ DPRINTF("len=NULL\n");
return body;
}
@@ -274,14 +282,14 @@ static void *xs_talkv(struct xenbus_tran
for (i = 0; i < num_vecs; i++)
msg.len += iovec[i].iov_len;
- printf("xs_talkv ");
+ DPRINTF("xs_talkv ");
sx_xlock(&xs_state.request_mutex);
err = xb_write(&msg, sizeof(msg));
if (err) {
sx_xunlock(&xs_state.request_mutex);
- printf("xs_talkv failed %d\n", err);
+ DPRINTF("xs_talkv failed %d\n", err);
return ERR_PTR(err);
}
@@ -289,7 +297,7 @@ static void *xs_talkv(struct xenbus_tran
err = xb_write(iovec[i].iov_base, iovec[i].iov_len);;
if (err) {
sx_xunlock(&xs_state.request_mutex);
- printf("xs_talkv failed %d\n", err);
+ DPRINTF("xs_talkv failed %d\n", err);
return ERR_PTR(err);
}
}
@@ -314,13 +322,13 @@ static void *xs_talkv(struct xenbus_tran
struct xs_stored_msg *wmsg = TAILQ_FIRST(&watch_events);
list_del(&watch_events, wmsg);
- printf("handling %p ...", wmsg->u.watch.handle->callback);
+ DPRINTF("handling %p ...", wmsg->u.watch.handle->callback);
wmsg->u.watch.handle->callback(
wmsg->u.watch.handle,
(const char **)wmsg->u.watch.vec,
wmsg->u.watch.vec_size);
- printf("... %p done\n", wmsg->u.watch.handle->callback);
+ DPRINTF("... %p done\n", wmsg->u.watch.handle->callback);
kfree(wmsg->u.watch.vec);
kfree(wmsg);
}
@@ -339,7 +347,7 @@ static void *xs_single(struct xenbus_tra
{
struct kvec iovec;
- printf("xs_single %s ", string);
+ DPRINTF("xs_single %s ", string);
iovec.iov_base = (const void *)string;
iovec.iov_len = strlen(string) + 1;
return xs_talkv(t, type, &iovec, 1, len);
@@ -457,7 +465,7 @@ void *xenbus_read(struct xenbus_transact
if (IS_ERR(path))
return (void *)path;
- printf("xs_read ");
+ DPRINTF("xs_read ");
ret = xs_single(t, XS_READ, path, len);
kfree(path);
return ret;
@@ -483,7 +491,7 @@ int xenbus_write(struct xenbus_transacti
iovec[1].iov_base = string;
iovec[1].iov_len = strlen(string);
- printf("xenbus_write dir=%s val=%s ", dir, string);
+ DPRINTF("xenbus_write dir=%s val=%s ", dir, string);
ret = xs_error(xs_talkv(t, XS_WRITE, iovec, ARRAY_SIZE(iovec), NULL));
kfree(path);
return ret;
@@ -557,7 +565,7 @@ int xenbus_transaction_end(struct xenbus
else
strcpy(abortstr, "T");
- printf("xenbus_transaction_end ");
+ DPRINTF("xenbus_transaction_end ");
err = xs_error(xs_single(t, XS_TRANSACTION_END, abortstr, NULL));
sx_sunlock(&xs_state.suspend_mutex);
@@ -625,7 +633,7 @@ int xenbus_gather(struct xenbus_transact
for (i = 0; i < 10000; i++)
HYPERVISOR_yield();
- printf("gather ");
+ DPRINTF("gather ");
va_start(ap, dir);
while (ret == 0 && (name = va_arg(ap, char *)) != NULL) {
const char *fmt = va_arg(ap, char *);
@@ -637,7 +645,7 @@ int xenbus_gather(struct xenbus_transact
ret = PTR_ERR(p);
break;
}
- printf(" %s ", p);
+ DPRINTF(" %s ", p);
if (fmt) {
if (sscanf(p, fmt, result) == 0)
ret = -EINVAL;
@@ -646,7 +654,7 @@ int xenbus_gather(struct xenbus_transact
*(char **)result = p;
}
va_end(ap);
- printf("\n");
+ DPRINTF("\n");
return ret;
}
EXPORT_SYMBOL(xenbus_gather);
@@ -875,7 +883,7 @@ static int xs_process_msg(enum xsd_sockm
}
mtx_unlock(&watches_lock);
} else {
- printf("event=%d ", *type);
+ DPRINTF("event=%d ", *type);
msg->u.reply.body = body;
mtx_lock(&xs_state.reply_lock);
TAILQ_INSERT_TAIL(&xs_state.reply_list, msg, list);
@@ -883,7 +891,7 @@ static int xs_process_msg(enum xsd_sockm
mtx_unlock(&xs_state.reply_lock);
}
if (*type == XS_WATCH_EVENT)
- printf("\n");
+ DPRINTF("\n");
return 0;
}
More information about the svn-src-projects
mailing list