hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/include/linux/tty.h
....@@ -18,30 +18,6 @@
1818
1919
2020 /*
21
- * Lock subclasses for tty locks
22
- *
23
- * TTY_LOCK_NORMAL is for normal ttys and master ptys.
24
- * TTY_LOCK_SLAVE is for slave ptys only.
25
- *
26
- * Lock subclasses are necessary for handling nested locking with pty pairs.
27
- * tty locks which use nested locking:
28
- *
29
- * legacy_mutex - Nested tty locks are necessary for releasing pty pairs.
30
- * The stable lock order is master pty first, then slave pty.
31
- * termios_rwsem - The stable lock order is tty_buffer lock->termios_rwsem.
32
- * Subclassing this lock enables the slave pty to hold its
33
- * termios_rwsem when claiming the master tty_buffer lock.
34
- * tty_buffer lock - slave ptys can claim nested buffer lock when handling
35
- * signal chars. The stable lock order is slave pty, then
36
- * master.
37
- */
38
-
39
-enum {
40
- TTY_LOCK_NORMAL = 0,
41
- TTY_LOCK_SLAVE,
42
-};
43
-
44
-/*
4521 * (Note: the *_driver.minor_start values 1, 64, 128, 192 are
4622 * hardcoded at present.)
4723 */
....@@ -386,21 +362,6 @@
386362 #define TTY_LDISC_CHANGING 20 /* Change pending - non-block IO */
387363 #define TTY_LDISC_HALTED 22 /* Line discipline is halted */
388364
389
-/* Values for tty->flow_change */
390
-#define TTY_THROTTLE_SAFE 1
391
-#define TTY_UNTHROTTLE_SAFE 2
392
-
393
-static inline void __tty_set_flow_change(struct tty_struct *tty, int val)
394
-{
395
- tty->flow_change = val;
396
-}
397
-
398
-static inline void tty_set_flow_change(struct tty_struct *tty, int val)
399
-{
400
- tty->flow_change = val;
401
- smp_mb();
402
-}
403
-
404365 static inline bool tty_io_nonblock(struct tty_struct *tty, struct file *file)
405366 {
406367 return file->f_flags & O_NONBLOCK ||
....@@ -431,9 +392,6 @@
431392 extern struct tty_struct *tty_kopen(dev_t device);
432393 extern void tty_kclose(struct tty_struct *tty);
433394 extern int tty_dev_name_to_number(const char *name, dev_t *number);
434
-extern int tty_ldisc_lock(struct tty_struct *tty, unsigned long timeout);
435
-extern void tty_ldisc_unlock(struct tty_struct *tty);
436
-extern ssize_t redirected_tty_write(struct kiocb *, struct iov_iter *);
437395 #else
438396 static inline void tty_kref_put(struct tty_struct *tty)
439397 { }
....@@ -486,11 +444,7 @@
486444
487445 extern const char *tty_driver_name(const struct tty_struct *tty);
488446 extern void tty_wait_until_sent(struct tty_struct *tty, long timeout);
489
-extern int __tty_check_change(struct tty_struct *tty, int sig);
490
-extern int tty_check_change(struct tty_struct *tty);
491
-extern void __stop_tty(struct tty_struct *tty);
492447 extern void stop_tty(struct tty_struct *tty);
493
-extern void __start_tty(struct tty_struct *tty);
494448 extern void start_tty(struct tty_struct *tty);
495449 extern int tty_register_driver(struct tty_driver *driver);
496450 extern int tty_unregister_driver(struct tty_driver *driver);
....@@ -515,23 +469,11 @@
515469 extern int is_current_pgrp_orphaned(void);
516470 extern void tty_hangup(struct tty_struct *tty);
517471 extern void tty_vhangup(struct tty_struct *tty);
518
-extern void tty_vhangup_session(struct tty_struct *tty);
519472 extern int tty_hung_up_p(struct file *filp);
520473 extern void do_SAK(struct tty_struct *tty);
521474 extern void __do_SAK(struct tty_struct *tty);
522
-extern void tty_open_proc_set_tty(struct file *filp, struct tty_struct *tty);
523
-extern int tty_signal_session_leader(struct tty_struct *tty, int exit_session);
524
-extern void session_clear_tty(struct pid *session);
525475 extern void no_tty(void);
526
-extern void tty_buffer_free_all(struct tty_port *port);
527
-extern void tty_buffer_flush(struct tty_struct *tty, struct tty_ldisc *ld);
528
-extern void tty_buffer_init(struct tty_port *port);
529
-extern void tty_buffer_set_lock_subclass(struct tty_port *port);
530
-extern bool tty_buffer_restart_work(struct tty_port *port);
531
-extern bool tty_buffer_cancel_work(struct tty_port *port);
532
-extern void tty_buffer_flush_work(struct tty_port *port);
533476 extern speed_t tty_termios_baud_rate(struct ktermios *termios);
534
-extern speed_t tty_termios_input_baud_rate(struct ktermios *termios);
535477 extern void tty_termios_encode_baud_rate(struct ktermios *termios,
536478 speed_t ibaud, speed_t obaud);
537479 extern void tty_encode_baud_rate(struct tty_struct *tty,
....@@ -559,35 +501,22 @@
559501 extern struct tty_ldisc *tty_ldisc_ref(struct tty_struct *);
560502 extern void tty_ldisc_deref(struct tty_ldisc *);
561503 extern struct tty_ldisc *tty_ldisc_ref_wait(struct tty_struct *);
562
-extern void tty_ldisc_hangup(struct tty_struct *tty, bool reset);
563
-extern int tty_ldisc_reinit(struct tty_struct *tty, int disc);
564504 extern const struct seq_operations tty_ldiscs_seq_ops;
565505
566506 extern void tty_wakeup(struct tty_struct *tty);
567507 extern void tty_ldisc_flush(struct tty_struct *tty);
568508
569
-extern long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
570509 extern int tty_mode_ioctl(struct tty_struct *tty, struct file *file,
571510 unsigned int cmd, unsigned long arg);
572
-extern long tty_jobctrl_ioctl(struct tty_struct *tty, struct tty_struct *real_tty,
573
- struct file *file, unsigned int cmd, unsigned long arg);
574511 extern int tty_perform_flush(struct tty_struct *tty, unsigned long arg);
575
-extern void tty_default_fops(struct file_operations *fops);
576
-extern struct tty_struct *alloc_tty_struct(struct tty_driver *driver, int idx);
577
-extern int tty_alloc_file(struct file *file);
578
-extern void tty_add_file(struct tty_struct *tty, struct file *file);
579
-extern void tty_free_file(struct file *file);
580512 extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx);
581513 extern void tty_release_struct(struct tty_struct *tty, int idx);
582
-extern int tty_release(struct inode *inode, struct file *filp);
583514 extern void tty_init_termios(struct tty_struct *tty);
584515 extern void tty_save_termios(struct tty_struct *tty);
585516 extern int tty_standard_install(struct tty_driver *driver,
586517 struct tty_struct *tty);
587518
588519 extern struct mutex tty_mutex;
589
-
590
-#define tty_is_writelocked(tty) (mutex_is_locked(&tty->atomic_write_lock))
591520
592521 extern void tty_port_init(struct tty_port *port);
593522 extern void tty_port_link_device(struct tty_port *port,
....@@ -726,10 +655,6 @@
726655 extern int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc);
727656 extern int tty_unregister_ldisc(int disc);
728657 extern int tty_set_ldisc(struct tty_struct *tty, int disc);
729
-extern int tty_ldisc_setup(struct tty_struct *tty, struct tty_struct *o_tty);
730
-extern void tty_ldisc_release(struct tty_struct *tty);
731
-extern int __must_check tty_ldisc_init(struct tty_struct *tty);
732
-extern void tty_ldisc_deinit(struct tty_struct *tty);
733658 extern int tty_ldisc_receive_buf(struct tty_ldisc *ld, const unsigned char *p,
734659 char *f, int count);
735660
....@@ -743,20 +668,10 @@
743668
744669 /* tty_audit.c */
745670 #ifdef CONFIG_AUDIT
746
-extern void tty_audit_add_data(struct tty_struct *tty, const void *data,
747
- size_t size);
748671 extern void tty_audit_exit(void);
749672 extern void tty_audit_fork(struct signal_struct *sig);
750
-extern void tty_audit_tiocsti(struct tty_struct *tty, char ch);
751673 extern int tty_audit_push(void);
752674 #else
753
-static inline void tty_audit_add_data(struct tty_struct *tty, const void *data,
754
- size_t size)
755
-{
756
-}
757
-static inline void tty_audit_tiocsti(struct tty_struct *tty, char ch)
758
-{
759
-}
760675 static inline void tty_audit_exit(void)
761676 {
762677 }
....@@ -797,17 +712,5 @@
797712 static inline void proc_tty_register_driver(struct tty_driver *d) {}
798713 static inline void proc_tty_unregister_driver(struct tty_driver *d) {}
799714 #endif
800
-
801
-#define tty_msg(fn, tty, f, ...) \
802
- fn("%s %s: " f, tty_driver_name(tty), tty_name(tty), ##__VA_ARGS__)
803
-
804
-#define tty_debug(tty, f, ...) tty_msg(pr_debug, tty, f, ##__VA_ARGS__)
805
-#define tty_info(tty, f, ...) tty_msg(pr_info, tty, f, ##__VA_ARGS__)
806
-#define tty_notice(tty, f, ...) tty_msg(pr_notice, tty, f, ##__VA_ARGS__)
807
-#define tty_warn(tty, f, ...) tty_msg(pr_warn, tty, f, ##__VA_ARGS__)
808
-#define tty_err(tty, f, ...) tty_msg(pr_err, tty, f, ##__VA_ARGS__)
809
-
810
-#define tty_info_ratelimited(tty, f, ...) \
811
- tty_msg(pr_info_ratelimited, tty, f, ##__VA_ARGS__)
812715
813716 #endif