diff options
Diffstat (limited to 'include/linux/tty.h')
-rw-r--r-- | include/linux/tty.h | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/include/linux/tty.h b/include/linux/tty.h index 7d66ae508e5c..358a337af598 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
@@ -14,6 +14,29 @@ | |||
14 | #include <linux/llist.h> | 14 | #include <linux/llist.h> |
15 | 15 | ||
16 | 16 | ||
17 | /* | ||
18 | * Lock subclasses for tty locks | ||
19 | * | ||
20 | * TTY_LOCK_NORMAL is for normal ttys and master ptys. | ||
21 | * TTY_LOCK_SLAVE is for slave ptys only. | ||
22 | * | ||
23 | * Lock subclasses are necessary for handling nested locking with pty pairs. | ||
24 | * tty locks which use nested locking: | ||
25 | * | ||
26 | * legacy_mutex - Nested tty locks are necessary for releasing pty pairs. | ||
27 | * The stable lock order is master pty first, then slave pty. | ||
28 | * termios_rwsem - The stable lock order is tty_buffer lock->termios_rwsem. | ||
29 | * Subclassing this lock enables the slave pty to hold its | ||
30 | * termios_rwsem when claiming the master tty_buffer lock. | ||
31 | * tty_buffer lock - slave ptys can claim nested buffer lock when handling | ||
32 | * signal chars. The stable lock order is slave pty, then | ||
33 | * master. | ||
34 | */ | ||
35 | |||
36 | enum { | ||
37 | TTY_LOCK_NORMAL = 0, | ||
38 | TTY_LOCK_SLAVE, | ||
39 | }; | ||
17 | 40 | ||
18 | /* | 41 | /* |
19 | * (Note: the *_driver.minor_start values 1, 64, 128, 192 are | 42 | * (Note: the *_driver.minor_start values 1, 64, 128, 192 are |
@@ -443,6 +466,7 @@ extern void tty_flush_to_ldisc(struct tty_struct *tty); | |||
443 | extern void tty_buffer_free_all(struct tty_port *port); | 466 | extern void tty_buffer_free_all(struct tty_port *port); |
444 | extern void tty_buffer_flush(struct tty_struct *tty, struct tty_ldisc *ld); | 467 | extern void tty_buffer_flush(struct tty_struct *tty, struct tty_ldisc *ld); |
445 | extern void tty_buffer_init(struct tty_port *port); | 468 | extern void tty_buffer_init(struct tty_port *port); |
469 | extern void tty_buffer_set_lock_subclass(struct tty_port *port); | ||
446 | extern speed_t tty_termios_baud_rate(struct ktermios *termios); | 470 | extern speed_t tty_termios_baud_rate(struct ktermios *termios); |
447 | extern speed_t tty_termios_input_baud_rate(struct ktermios *termios); | 471 | extern speed_t tty_termios_input_baud_rate(struct ktermios *termios); |
448 | extern void tty_termios_encode_baud_rate(struct ktermios *termios, | 472 | extern void tty_termios_encode_baud_rate(struct ktermios *termios, |
@@ -467,7 +491,6 @@ static inline speed_t tty_get_baud_rate(struct tty_struct *tty) | |||
467 | 491 | ||
468 | extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old); | 492 | extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old); |
469 | extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b); | 493 | extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b); |
470 | extern int tty_set_termios(struct tty_struct *tty, struct ktermios *kt); | ||
471 | 494 | ||
472 | extern struct tty_ldisc *tty_ldisc_ref(struct tty_struct *); | 495 | extern struct tty_ldisc *tty_ldisc_ref(struct tty_struct *); |
473 | extern void tty_ldisc_deref(struct tty_ldisc *); | 496 | extern void tty_ldisc_deref(struct tty_ldisc *); |