summaryrefslogtreecommitdiff
path: root/include/linux/tty.h
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2015-01-17 23:42:04 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-02-02 21:11:27 +0300
commit3abf87cd3e70009ed70a7f28c2914888a7e27332 (patch)
treec1c57a8caab29cd953b7373c5a19d0a4f0494a14 /include/linux/tty.h
parentfb5ef9e7da39968fec6d6f37f20a23d23740c75e (diff)
downloadlinux-3abf87cd3e70009ed70a7f28c2914888a7e27332.tar.xz
tty: Make lock subclasses available for other tty locks
Besides nested legacy_mutex locking which is required on pty pair teardown, other nested pty operations require lock subclassing. Move lock subclass definition to tty interface header, include/linux/tty.h, and document its use. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/tty.h')
-rw-r--r--include/linux/tty.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 7d66ae508e5c..849659908f23 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -14,6 +14,23 @@
#include <linux/llist.h>
+/*
+ * Lock subclasses for tty locks
+ *
+ * TTY_LOCK_NORMAL is for normal ttys and master ptys.
+ * TTY_LOCK_SLAVE is for slave ptys only.
+ *
+ * Lock subclasses are necessary for handling nested locking with pty pairs.
+ * tty locks which use nested locking:
+ *
+ * legacy_mutex - Nested tty locks are necessary for releasing pty pairs.
+ * The stable lock order is master pty first, then slave pty.
+ */
+
+enum {
+ TTY_LOCK_NORMAL = 0,
+ TTY_LOCK_SLAVE,
+};
/*
* (Note: the *_driver.minor_start values 1, 64, 128, 192 are