[PATCH v2 tty-next 8/8] n_tty: Trace echo output with separate trace configuration

From: Peter Hurley
Date: Mon Dec 02 2013 - 14:26:07 EST


Add trace support for echo output but leave it separately selectable/
buildable from the base trace support.

Signed-off-by: Peter Hurley <peter@xxxxxxxxxxxxxxxxxx>
---
drivers/tty/n_tty.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 26ae9d7..bd01d97 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -94,6 +94,13 @@
# define n_tty_trace(tty, f, args...) do { } while (0)
#endif

+#undef N_TTY_TRACE_ECHOES
+#ifdef N_TTY_TRACE_ECHOES
+# define n_tty_trace_echoes(tty, f, args...) _n_tty_trace(tty, f, args)
+#else
+# define n_tty_trace_echoes(tty, f, args...) do { } while (0)
+#endif
+
struct n_tty_data {
/* producer-published */
size_t read_head;
@@ -791,13 +798,18 @@ static size_t __process_echoes(struct tty_struct *tty)
}
}

+ n_tty_trace_echoes(tty, "echoes:%zu,%zu commit:%zu head:%zu\n",
+ ldata->echo_tail, tail, ldata->echo_commit,
+ ldata->echo_head);
+
/* If the echo buffer is nearly full (so that the possibility exists
* of echo overrun before the next commit), then discard enough
* data at the tail to prevent a subsequent overrun */
while (ldata->echo_commit - tail >= ECHO_DISCARD_WATERMARK) {

- n_tty_trace(tty, "discard echoes (%zu - %zu > %d)\n",
- ldata->echo_commit, tail, ECHO_DISCARD_WATERMARK);
+ n_tty_trace_echoes(tty, "discard echoes (%zu - %zu > %d)\n",
+ ldata->echo_commit, tail,
+ ECHO_DISCARD_WATERMARK);

if (echo_buf(ldata, tail) == ECHO_OP_START) {
if (echo_buf(ldata, tail + 1) == ECHO_OP_ERASE_TAB)
--
1.8.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/