From af274e5bd4593fa79c0489e0b6105f4bd23310c8 Mon Sep 17 00:00:00 2001 From: David Smith Date: Wed, 3 Jun 2009 15:20:46 -0500 Subject: [PATCH] Make sure all DEBUG_TRANS output uses printk. * runtime/transport/control.c (_stp_ctl_write_cmd): Calls dbug_trans2 instead of _dbug (so that printk is used instead of the transport itself). (_stp_ctl_write_dbug): Ditto. * runtime/debug.h (dbug_trans2): New macro. --- runtime/debug.h | 6 ++++++ runtime/transport/control.c | 28 +++++++++++++++------------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/runtime/debug.h b/runtime/debug.h index ce0c39439..5c9cca748 100644 --- a/runtime/debug.h +++ b/runtime/debug.h @@ -38,8 +38,14 @@ printk(args); \ } \ } while (0) + +#define dbug_trans2(args...) do { \ + printk("%s:%d ",__FUNCTION__, __LINE__); \ + printk(args); \ + } while (0) #else #define dbug_trans(level, args...) ; +#define dbug_trans2(args...) ; #endif #ifdef DEBUG_UNWIND /* stack unwinder */ diff --git a/runtime/transport/control.c b/runtime/transport/control.c index 11338eb29..35130f0f0 100644 --- a/runtime/transport/control.c +++ b/runtime/transport/control.c @@ -37,7 +37,8 @@ static ssize_t _stp_ctl_write_cmd(struct file *file, const char __user *buf, siz #ifdef DEBUG_TRANS if (type < STP_MAX_CMD) - _dbug("Got %s. len=%d\n", _stp_command_name[type], (int)count); + dbug_trans2("Got %s. len=%d\n", _stp_command_name[type], + (int)count); #endif switch (type) { @@ -84,45 +85,46 @@ static void _stp_ctl_write_dbug(int type, void *data, int len) char buf[64]; switch (type) { case STP_START: - _dbug("sending STP_START\n"); + dbug_trans2("sending STP_START\n"); break; case STP_EXIT: - _dbug("sending STP_EXIT\n"); + dbug_trans2("sending STP_EXIT\n"); break; case STP_OOB_DATA: snprintf(buf, sizeof(buf), "%s", (char *)data); - _dbug("sending %d bytes of STP_OOB_DATA: %s\n", len, buf); + dbug_trans2("sending %d bytes of STP_OOB_DATA: %s\n", len, + buf); break; case STP_SYSTEM: snprintf(buf, sizeof(buf), "%s", (char *)data); - _dbug("sending STP_SYSTEM: %s\n", buf); + dbug_trans2("sending STP_SYSTEM: %s\n", buf); break; case STP_TRANSPORT: - _dbug("sending STP_TRANSPORT\n"); + dbug_trans2("sending STP_TRANSPORT\n"); break; case STP_CONNECT: - _dbug("sending STP_CONNECT\n"); + dbug_trans2("sending STP_CONNECT\n"); break; case STP_DISCONNECT: - _dbug("sending STP_DISCONNECT\n"); + dbug_trans2("sending STP_DISCONNECT\n"); break; case STP_BULK: - _dbug("sending STP_BULK\n"); + dbug_trans2("sending STP_BULK\n"); break; case STP_READY: case STP_RELOCATION: case STP_BUF_INFO: case STP_SUBBUFS_CONSUMED: - _dbug("sending old message\n"); + dbug_trans2("sending old message\n"); break; case STP_REALTIME_DATA: - _dbug("sending %d bytes of STP_REALTIME_DATA\n", len); + dbug_trans2("sending %d bytes of STP_REALTIME_DATA\n", len); break; case STP_REQUEST_EXIT: - _dbug("sending STP_REQUEST_EXIT\n"); + dbug_trans2("sending STP_REQUEST_EXIT\n"); break; default: - _dbug("ERROR: unknown message type: %d\n", type); + dbug_trans2("ERROR: unknown message type: %d\n", type); break; } } -- 2.43.5