hc
2024-05-14 bedbef8ad3e75a304af6361af235302bcc61d06b
kernel/include/linux/tty.h
....@@ -14,31 +14,8 @@
1414 #include <uapi/linux/tty.h>
1515 #include <linux/rwsem.h>
1616 #include <linux/llist.h>
17
+#include <linux/android_kabi.h>
1718
18
-
19
-/*
20
- * Lock subclasses for tty locks
21
- *
22
- * TTY_LOCK_NORMAL is for normal ttys and master ptys.
23
- * TTY_LOCK_SLAVE is for slave ptys only.
24
- *
25
- * Lock subclasses are necessary for handling nested locking with pty pairs.
26
- * tty locks which use nested locking:
27
- *
28
- * legacy_mutex - Nested tty locks are necessary for releasing pty pairs.
29
- * The stable lock order is master pty first, then slave pty.
30
- * termios_rwsem - The stable lock order is tty_buffer lock->termios_rwsem.
31
- * Subclassing this lock enables the slave pty to hold its
32
- * termios_rwsem when claiming the master tty_buffer lock.
33
- * tty_buffer lock - slave ptys can claim nested buffer lock when handling
34
- * signal chars. The stable lock order is slave pty, then
35
- * master.
36
- */
37
-
38
-enum {
39
- TTY_LOCK_NORMAL = 0,
40
- TTY_LOCK_SLAVE,
41
-};
4219
4320 /*
4421 * (Note: the *_driver.minor_start values 1, 64, 128, 192 are
....@@ -218,6 +195,8 @@
218195 int (*activate)(struct tty_port *port, struct tty_struct *tty);
219196 /* Called on the final put of a port */
220197 void (*destruct)(struct tty_port *port);
198
+
199
+ ANDROID_KABI_RESERVE(1);
221200 };
222201
223202 struct tty_port_client_operations {
....@@ -252,6 +231,8 @@
252231 set to size of fifo */
253232 struct kref kref; /* Ref counter */
254233 void *client_data;
234
+
235
+ ANDROID_KABI_RESERVE(1);
255236 };
256237
257238 /* tty_port::iflags bits -- use atomic bit ops */
....@@ -303,7 +284,10 @@
303284 spinlock_t flow_lock;
304285 /* Termios values are protected by the termios rwsem */
305286 struct ktermios termios, termios_locked;
306
- struct termiox *termiox; /* May be NULL for unsupported */
287
+
288
+ /* termiox is estored only for ABI preservation, do not use */
289
+ struct termiox *termiox;
290
+
307291 char name[64];
308292 struct pid *pgrp; /* Protected by ctrl lock */
309293 /*
....@@ -342,6 +326,9 @@
342326 /* If the tty has a pending do_SAK, queue it here - akpm */
343327 struct work_struct SAK_work;
344328 struct tty_port *port;
329
+
330
+ ANDROID_KABI_RESERVE(1);
331
+ ANDROID_KABI_RESERVE(2);
345332 } __randomize_layout;
346333
347334 /* Each of a tty's open files has private_data pointing to tty_file_private */
....@@ -375,21 +362,6 @@
375362 #define TTY_LDISC_CHANGING 20 /* Change pending - non-block IO */
376363 #define TTY_LDISC_HALTED 22 /* Line discipline is halted */
377364
378
-/* Values for tty->flow_change */
379
-#define TTY_THROTTLE_SAFE 1
380
-#define TTY_UNTHROTTLE_SAFE 2
381
-
382
-static inline void __tty_set_flow_change(struct tty_struct *tty, int val)
383
-{
384
- tty->flow_change = val;
385
-}
386
-
387
-static inline void tty_set_flow_change(struct tty_struct *tty, int val)
388
-{
389
- tty->flow_change = val;
390
- smp_mb();
391
-}
392
-
393365 static inline bool tty_io_nonblock(struct tty_struct *tty, struct file *file)
394366 {
395367 return file->f_flags & O_NONBLOCK ||
....@@ -420,8 +392,6 @@
420392 extern struct tty_struct *tty_kopen(dev_t device);
421393 extern void tty_kclose(struct tty_struct *tty);
422394 extern int tty_dev_name_to_number(const char *name, dev_t *number);
423
-extern int tty_ldisc_lock(struct tty_struct *tty, unsigned long timeout);
424
-extern void tty_ldisc_unlock(struct tty_struct *tty);
425395 #else
426396 static inline void tty_kref_put(struct tty_struct *tty)
427397 { }
....@@ -474,11 +444,7 @@
474444
475445 extern const char *tty_driver_name(const struct tty_struct *tty);
476446 extern void tty_wait_until_sent(struct tty_struct *tty, long timeout);
477
-extern int __tty_check_change(struct tty_struct *tty, int sig);
478
-extern int tty_check_change(struct tty_struct *tty);
479
-extern void __stop_tty(struct tty_struct *tty);
480447 extern void stop_tty(struct tty_struct *tty);
481
-extern void __start_tty(struct tty_struct *tty);
482448 extern void start_tty(struct tty_struct *tty);
483449 extern int tty_register_driver(struct tty_driver *driver);
484450 extern int tty_unregister_driver(struct tty_driver *driver);
....@@ -503,23 +469,11 @@
503469 extern int is_current_pgrp_orphaned(void);
504470 extern void tty_hangup(struct tty_struct *tty);
505471 extern void tty_vhangup(struct tty_struct *tty);
506
-extern void tty_vhangup_session(struct tty_struct *tty);
507472 extern int tty_hung_up_p(struct file *filp);
508473 extern void do_SAK(struct tty_struct *tty);
509474 extern void __do_SAK(struct tty_struct *tty);
510
-extern void tty_open_proc_set_tty(struct file *filp, struct tty_struct *tty);
511
-extern int tty_signal_session_leader(struct tty_struct *tty, int exit_session);
512
-extern void session_clear_tty(struct pid *session);
513475 extern void no_tty(void);
514
-extern void tty_buffer_free_all(struct tty_port *port);
515
-extern void tty_buffer_flush(struct tty_struct *tty, struct tty_ldisc *ld);
516
-extern void tty_buffer_init(struct tty_port *port);
517
-extern void tty_buffer_set_lock_subclass(struct tty_port *port);
518
-extern bool tty_buffer_restart_work(struct tty_port *port);
519
-extern bool tty_buffer_cancel_work(struct tty_port *port);
520
-extern void tty_buffer_flush_work(struct tty_port *port);
521476 extern speed_t tty_termios_baud_rate(struct ktermios *termios);
522
-extern speed_t tty_termios_input_baud_rate(struct ktermios *termios);
523477 extern void tty_termios_encode_baud_rate(struct ktermios *termios,
524478 speed_t ibaud, speed_t obaud);
525479 extern void tty_encode_baud_rate(struct tty_struct *tty,
....@@ -547,35 +501,22 @@
547501 extern struct tty_ldisc *tty_ldisc_ref(struct tty_struct *);
548502 extern void tty_ldisc_deref(struct tty_ldisc *);
549503 extern struct tty_ldisc *tty_ldisc_ref_wait(struct tty_struct *);
550
-extern void tty_ldisc_hangup(struct tty_struct *tty, bool reset);
551
-extern int tty_ldisc_reinit(struct tty_struct *tty, int disc);
552504 extern const struct seq_operations tty_ldiscs_seq_ops;
553505
554506 extern void tty_wakeup(struct tty_struct *tty);
555507 extern void tty_ldisc_flush(struct tty_struct *tty);
556508
557
-extern long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
558509 extern int tty_mode_ioctl(struct tty_struct *tty, struct file *file,
559510 unsigned int cmd, unsigned long arg);
560
-extern long tty_jobctrl_ioctl(struct tty_struct *tty, struct tty_struct *real_tty,
561
- struct file *file, unsigned int cmd, unsigned long arg);
562511 extern int tty_perform_flush(struct tty_struct *tty, unsigned long arg);
563
-extern void tty_default_fops(struct file_operations *fops);
564
-extern struct tty_struct *alloc_tty_struct(struct tty_driver *driver, int idx);
565
-extern int tty_alloc_file(struct file *file);
566
-extern void tty_add_file(struct tty_struct *tty, struct file *file);
567
-extern void tty_free_file(struct file *file);
568512 extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx);
569513 extern void tty_release_struct(struct tty_struct *tty, int idx);
570
-extern int tty_release(struct inode *inode, struct file *filp);
571514 extern void tty_init_termios(struct tty_struct *tty);
572515 extern void tty_save_termios(struct tty_struct *tty);
573516 extern int tty_standard_install(struct tty_driver *driver,
574517 struct tty_struct *tty);
575518
576519 extern struct mutex tty_mutex;
577
-
578
-#define tty_is_writelocked(tty) (mutex_is_locked(&tty->atomic_write_lock))
579520
580521 extern void tty_port_init(struct tty_port *port);
581522 extern void tty_port_link_device(struct tty_port *port,
....@@ -714,10 +655,6 @@
714655 extern int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc);
715656 extern int tty_unregister_ldisc(int disc);
716657 extern int tty_set_ldisc(struct tty_struct *tty, int disc);
717
-extern int tty_ldisc_setup(struct tty_struct *tty, struct tty_struct *o_tty);
718
-extern void tty_ldisc_release(struct tty_struct *tty);
719
-extern int __must_check tty_ldisc_init(struct tty_struct *tty);
720
-extern void tty_ldisc_deinit(struct tty_struct *tty);
721658 extern int tty_ldisc_receive_buf(struct tty_ldisc *ld, const unsigned char *p,
722659 char *f, int count);
723660
....@@ -731,20 +668,10 @@
731668
732669 /* tty_audit.c */
733670 #ifdef CONFIG_AUDIT
734
-extern void tty_audit_add_data(struct tty_struct *tty, const void *data,
735
- size_t size);
736671 extern void tty_audit_exit(void);
737672 extern void tty_audit_fork(struct signal_struct *sig);
738
-extern void tty_audit_tiocsti(struct tty_struct *tty, char ch);
739673 extern int tty_audit_push(void);
740674 #else
741
-static inline void tty_audit_add_data(struct tty_struct *tty, const void *data,
742
- size_t size)
743
-{
744
-}
745
-static inline void tty_audit_tiocsti(struct tty_struct *tty, char ch)
746
-{
747
-}
748675 static inline void tty_audit_exit(void)
749676 {
750677 }
....@@ -759,8 +686,6 @@
759686
760687 /* tty_ioctl.c */
761688 extern int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file,
762
- unsigned int cmd, unsigned long arg);
763
-extern long n_tty_compat_ioctl_helper(struct tty_struct *tty, struct file *file,
764689 unsigned int cmd, unsigned long arg);
765690
766691 /* vt.c */
....@@ -787,17 +712,5 @@
787712 static inline void proc_tty_register_driver(struct tty_driver *d) {}
788713 static inline void proc_tty_unregister_driver(struct tty_driver *d) {}
789714 #endif
790
-
791
-#define tty_msg(fn, tty, f, ...) \
792
- fn("%s %s: " f, tty_driver_name(tty), tty_name(tty), ##__VA_ARGS__)
793
-
794
-#define tty_debug(tty, f, ...) tty_msg(pr_debug, tty, f, ##__VA_ARGS__)
795
-#define tty_info(tty, f, ...) tty_msg(pr_info, tty, f, ##__VA_ARGS__)
796
-#define tty_notice(tty, f, ...) tty_msg(pr_notice, tty, f, ##__VA_ARGS__)
797
-#define tty_warn(tty, f, ...) tty_msg(pr_warn, tty, f, ##__VA_ARGS__)
798
-#define tty_err(tty, f, ...) tty_msg(pr_err, tty, f, ##__VA_ARGS__)
799
-
800
-#define tty_info_ratelimited(tty, f, ...) \
801
- tty_msg(pr_info_ratelimited, tty, f, ##__VA_ARGS__)
802715
803716 #endif