[CRIU] [PATCH 1/3] tty: Rename tty_test_and_set_index to tty_test_and_set

Cyrill Gorcunov gorcunov at openvz.org
Tue Sep 18 08:34:54 EDT 2012


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: Cyrill Gorcunov <gorcunov at openvz.org>
---
 tty.c |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/tty.c b/tty.c
index e533fe7..6f23a1a 100644
--- a/tty.c
+++ b/tty.c
@@ -178,17 +178,15 @@ static int parse_index(u32 id, int lfd, int major)
 	return index;
 }
 
-static int tty_test_and_set_index(int index)
+static int tty_test_and_set(int bit, unsigned long *bitmap)
 {
 	int ret;
 
-	BUG_ON(index > (MAX_TTYS << 1));
+	BUG_ON(bit > (MAX_TTYS << 1));
 
-	/* FIXME Locking! */
-	ret = test_bit(index, tty_bitmap);
+	ret = test_bit(bit, bitmap);
 	if (!ret)
-		set_bit(index, tty_bitmap);
-
+		set_bit(bit, bitmap);
 	return ret;
 }
 
@@ -997,7 +995,7 @@ static int dump_one_pty(int lfd, u32 id, const struct fd_parms *p)
 	 */
 	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);
 
 	if (!ret)
-- 
1.7.7.6



More information about the CRIU mailing list