n_tty: Use separate head and tail indices for echo_buf
authorPeter Hurley <peter@hurleysoftware.com>
Sat, 15 Jun 2013 14:04:22 +0000 (10:04 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Jul 2013 00:02:21 +0000 (17:02 -0700)
commitaddaebccf63a8c9f7c7a62ce1ceb9da4307c5a1c
treedfce21ff8b94fab6fbe53da5046d4c56ca072f32
parentae56f3304107f70e26a389d845db76d6b949c114
n_tty: Use separate head and tail indices for echo_buf

Instead of using a single index to track the current echo_buf position,
use a head index when adding to the buffer and a tail index when
consuming from the buffer. Allow these head and tail indices to wrap
at max representable value; perform modulo reduction via helper
functions when accessing the buffer.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/n_tty.c