Commit dd783030 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

tty: Rename tty_test_and_set_index to tty_test_and_set

To trace paired ttys we will need one more bitmap
so rename tty_test_and_set_index to tty_test_and_set
because we will need this helper in another context.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Acked-by: 's avatarAndrew Vagin <avagin@parallels.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 850d74c4
...@@ -178,17 +178,15 @@ static int parse_index(u32 id, int lfd, int major) ...@@ -178,17 +178,15 @@ static int parse_index(u32 id, int lfd, int major)
return index; return index;
} }
static int tty_test_and_set_index(int index) static int tty_test_and_set(int bit, unsigned long *bitmap)
{ {
int ret; int ret;
BUG_ON(index > (MAX_TTYS << 1)); BUG_ON(bit > (MAX_TTYS << 1));
/* FIXME Locking! */ ret = test_bit(bit, bitmap);
ret = test_bit(index, tty_bitmap);
if (!ret) if (!ret)
set_bit(index, tty_bitmap); set_bit(bit, bitmap);
return ret; return ret;
} }
...@@ -997,7 +995,7 @@ static int dump_one_pty(int lfd, u32 id, const struct fd_parms *p) ...@@ -997,7 +995,7 @@ static int dump_one_pty(int lfd, u32 id, const struct fd_parms *p)
*/ */
ioctl(lfd, TCFLSH, TCIOFLUSH); ioctl(lfd, TCFLSH, TCIOFLUSH);
if (!tty_test_and_set_index(e.tty_info_id)) if (!tty_test_and_set(e.tty_info_id, tty_bitmap))
ret = dump_pty_info(lfd, e.tty_info_id, p, major, index); ret = dump_pty_info(lfd, e.tty_info_id, p, major, index);
if (!ret) if (!ret)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment