]> Git Repo - linux.git/commitdiff
tty: move some internal tty lock enums and functions out of tty.h
authorGreg Kroah-Hartman <[email protected]>
Thu, 8 Apr 2021 12:51:30 +0000 (14:51 +0200)
committerGreg Kroah-Hartman <[email protected]>
Thu, 15 Apr 2021 08:26:58 +0000 (10:26 +0200)
Move the TTY_LOCK_* enums and tty_ldisc lock functions out of the global
tty.h into the local header file to clean things up.

Cc: Jiri Slaby <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/tty/tty.h
drivers/tty/tty_buffer.c
drivers/tty/tty_mutex.c
include/linux/tty.h

index 55003840cd689d65f7b130b9b3cd5193951a60b3..af997a4174c56d28e31a9c2c9a7f728367e242a3 100644 (file)
 #define tty_info_ratelimited(tty, f, ...) \
                tty_msg(pr_info_ratelimited, tty, f, ##__VA_ARGS__)
 
+/*
+ * 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.
+ * termios_rwsem - The stable lock order is tty_buffer lock->termios_rwsem.
+ *                Subclassing this lock enables the slave pty to hold its
+ *                termios_rwsem when claiming the master tty_buffer lock.
+ * tty_buffer lock - slave ptys can claim nested buffer lock when handling
+ *                  signal chars. The stable lock order is slave pty, then
+ *                  master.
+ */
+enum {
+       TTY_LOCK_NORMAL = 0,
+       TTY_LOCK_SLAVE,
+};
+
+int tty_ldisc_lock(struct tty_struct *tty, unsigned long timeout);
+void tty_ldisc_unlock(struct tty_struct *tty);
+
 /* tty_audit.c */
 #ifdef CONFIG_AUDIT
 void tty_audit_add_data(struct tty_struct *tty, const void *data, size_t size);
index 6d4995a5f3187cf083e22dfaa4aa58f856fbeacd..9733469a14b2ccacdbc2401ac6de5cf16529edb5 100644 (file)
@@ -17,7 +17,7 @@
 #include <linux/delay.h>
 #include <linux/module.h>
 #include <linux/ratelimit.h>
-
+#include "tty.h"
 
 #define MIN_TTYB_SIZE  256
 #define TTYB_ALIGN_MASK        255
index 2640635ee177d1ad027ee7bc3443bfb2880ae17c..393518a24cfe230e55e623697a5fe10dcd703665 100644 (file)
@@ -4,6 +4,7 @@
 #include <linux/kallsyms.h>
 #include <linux/semaphore.h>
 #include <linux/sched.h>
+#include "tty.h"
 
 /* Legacy tty mutex glue */
 
index 516c63c1bfe226680c148e1b856924822ba6609b..031e7e4b5c97aae30007567a556db1097b1066f2 100644 (file)
 #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.
- * termios_rwsem - The stable lock order is tty_buffer lock->termios_rwsem.
- *                Subclassing this lock enables the slave pty to hold its
- *                termios_rwsem when claiming the master tty_buffer lock.
- * tty_buffer lock - slave ptys can claim nested buffer lock when handling
- *                  signal chars. The stable lock order is slave pty, then
- *                  master.
- */
-
-enum {
-       TTY_LOCK_NORMAL = 0,
-       TTY_LOCK_SLAVE,
-};
-
 /*
  * (Note: the *_driver.minor_start values 1, 64, 128, 192 are
  * hardcoded at present.)
@@ -419,8 +395,6 @@ extern struct tty_struct *tty_kopen_exclusive(dev_t device);
 extern struct tty_struct *tty_kopen_shared(dev_t device);
 extern void tty_kclose(struct tty_struct *tty);
 extern int tty_dev_name_to_number(const char *name, dev_t *number);
-extern int tty_ldisc_lock(struct tty_struct *tty, unsigned long timeout);
-extern void tty_ldisc_unlock(struct tty_struct *tty);
 extern ssize_t redirected_tty_write(struct kiocb *, struct iov_iter *);
 extern struct file *tty_release_redirect(struct tty_struct *tty);
 #else
This page took 0.054433 seconds and 4 git commands to generate.