diff options
Diffstat (limited to 'include/linux/tty.h')
| -rw-r--r-- | include/linux/tty.h | 90 | 
1 files changed, 58 insertions, 32 deletions
diff --git a/include/linux/tty.h b/include/linux/tty.h index 9f47ab540f6..1509b86825d 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -43,6 +43,7 @@  #include <linux/tty_driver.h>  #include <linux/tty_ldisc.h>  #include <linux/mutex.h> +#include <linux/tty_flags.h> @@ -103,28 +104,28 @@ struct tty_bufhead {  #define TTY_PARITY	3  #define TTY_OVERRUN	4 -#define INTR_CHAR(tty) ((tty)->termios->c_cc[VINTR]) -#define QUIT_CHAR(tty) ((tty)->termios->c_cc[VQUIT]) -#define ERASE_CHAR(tty) ((tty)->termios->c_cc[VERASE]) -#define KILL_CHAR(tty) ((tty)->termios->c_cc[VKILL]) -#define EOF_CHAR(tty) ((tty)->termios->c_cc[VEOF]) -#define TIME_CHAR(tty) ((tty)->termios->c_cc[VTIME]) -#define MIN_CHAR(tty) ((tty)->termios->c_cc[VMIN]) -#define SWTC_CHAR(tty) ((tty)->termios->c_cc[VSWTC]) -#define START_CHAR(tty) ((tty)->termios->c_cc[VSTART]) -#define STOP_CHAR(tty) ((tty)->termios->c_cc[VSTOP]) -#define SUSP_CHAR(tty) ((tty)->termios->c_cc[VSUSP]) -#define EOL_CHAR(tty) ((tty)->termios->c_cc[VEOL]) -#define REPRINT_CHAR(tty) ((tty)->termios->c_cc[VREPRINT]) -#define DISCARD_CHAR(tty) ((tty)->termios->c_cc[VDISCARD]) -#define WERASE_CHAR(tty) ((tty)->termios->c_cc[VWERASE]) -#define LNEXT_CHAR(tty)	((tty)->termios->c_cc[VLNEXT]) -#define EOL2_CHAR(tty) ((tty)->termios->c_cc[VEOL2]) +#define INTR_CHAR(tty) ((tty)->termios.c_cc[VINTR]) +#define QUIT_CHAR(tty) ((tty)->termios.c_cc[VQUIT]) +#define ERASE_CHAR(tty) ((tty)->termios.c_cc[VERASE]) +#define KILL_CHAR(tty) ((tty)->termios.c_cc[VKILL]) +#define EOF_CHAR(tty) ((tty)->termios.c_cc[VEOF]) +#define TIME_CHAR(tty) ((tty)->termios.c_cc[VTIME]) +#define MIN_CHAR(tty) ((tty)->termios.c_cc[VMIN]) +#define SWTC_CHAR(tty) ((tty)->termios.c_cc[VSWTC]) +#define START_CHAR(tty) ((tty)->termios.c_cc[VSTART]) +#define STOP_CHAR(tty) ((tty)->termios.c_cc[VSTOP]) +#define SUSP_CHAR(tty) ((tty)->termios.c_cc[VSUSP]) +#define EOL_CHAR(tty) ((tty)->termios.c_cc[VEOL]) +#define REPRINT_CHAR(tty) ((tty)->termios.c_cc[VREPRINT]) +#define DISCARD_CHAR(tty) ((tty)->termios.c_cc[VDISCARD]) +#define WERASE_CHAR(tty) ((tty)->termios.c_cc[VWERASE]) +#define LNEXT_CHAR(tty)	((tty)->termios.c_cc[VLNEXT]) +#define EOL2_CHAR(tty) ((tty)->termios.c_cc[VEOL2]) -#define _I_FLAG(tty, f)	((tty)->termios->c_iflag & (f)) -#define _O_FLAG(tty, f)	((tty)->termios->c_oflag & (f)) -#define _C_FLAG(tty, f)	((tty)->termios->c_cflag & (f)) -#define _L_FLAG(tty, f)	((tty)->termios->c_lflag & (f)) +#define _I_FLAG(tty, f)	((tty)->termios.c_iflag & (f)) +#define _O_FLAG(tty, f)	((tty)->termios.c_oflag & (f)) +#define _C_FLAG(tty, f)	((tty)->termios.c_cflag & (f)) +#define _L_FLAG(tty, f)	((tty)->termios.c_lflag & (f))  #define I_IGNBRK(tty)	_I_FLAG((tty), IGNBRK)  #define I_BRKINT(tty)	_I_FLAG((tty), BRKINT) @@ -268,10 +269,11 @@ struct tty_struct {  	struct mutex ldisc_mutex;  	struct tty_ldisc *ldisc; +	struct mutex legacy_mutex;  	struct mutex termios_mutex;  	spinlock_t ctrl_lock;  	/* Termios values are protected by the termios mutex */ -	struct ktermios *termios, *termios_locked; +	struct ktermios termios, termios_locked;  	struct termiox *termiox;	/* May be NULL for unsupported */  	char name[64];  	struct pid *pgrp;		/* Protected by ctrl lock */ @@ -410,6 +412,10 @@ extern int tty_register_driver(struct tty_driver *driver);  extern int tty_unregister_driver(struct tty_driver *driver);  extern struct device *tty_register_device(struct tty_driver *driver,  					  unsigned index, struct device *dev); +extern struct device *tty_register_device_attr(struct tty_driver *driver, +				unsigned index, struct device *device, +				void *drvdata, +				const struct attribute_group **attr_grp);  extern void tty_unregister_device(struct tty_driver *driver, unsigned index);  extern int tty_read_raw_data(struct tty_struct *tty, unsigned char *bufp,  			     int buflen); @@ -423,7 +429,6 @@ extern void tty_unthrottle(struct tty_struct *tty);  extern int tty_do_resize(struct tty_struct *tty, struct winsize *ws);  extern void tty_driver_remove_tty(struct tty_driver *driver,  				  struct tty_struct *tty); -extern void tty_shutdown(struct tty_struct *tty);  extern void tty_free_termios(struct tty_struct *tty);  extern int is_current_pgrp_orphaned(void);  extern struct pid *tty_get_pgrp(struct tty_struct *tty); @@ -497,6 +502,15 @@ extern int tty_write_lock(struct tty_struct *tty, int ndelay);  #define tty_is_writelocked(tty)  (mutex_is_locked(&tty->atomic_write_lock))  extern void tty_port_init(struct tty_port *port); +extern void tty_port_link_device(struct tty_port *port, +		struct tty_driver *driver, unsigned index); +extern struct device *tty_port_register_device(struct tty_port *port, +		struct tty_driver *driver, unsigned index, +		struct device *device); +extern struct device *tty_port_register_device_attr(struct tty_port *port, +		struct tty_driver *driver, unsigned index, +		struct device *device, void *drvdata, +		const struct attribute_group **attr_grp);  extern int tty_port_alloc_xmit_buf(struct tty_port *port);  extern void tty_port_free_xmit_buf(struct tty_port *port);  extern void tty_port_put(struct tty_port *port); @@ -508,6 +522,12 @@ static inline struct tty_port *tty_port_get(struct tty_port *port)  	return port;  } +/* If the cts flow control is enabled, return true. */ +static inline bool tty_port_cts_enabled(struct tty_port *port) +{ +	return port->flags & ASYNC_CTS_FLOW; +} +  extern struct tty_struct *tty_port_tty_get(struct tty_port *port);  extern void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty);  extern int tty_port_carrier_raised(struct tty_port *port); @@ -521,6 +541,8 @@ extern int tty_port_close_start(struct tty_port *port,  extern void tty_port_close_end(struct tty_port *port, struct tty_struct *tty);  extern void tty_port_close(struct tty_port *port,  				struct tty_struct *tty, struct file *filp); +extern int tty_port_install(struct tty_port *port, struct tty_driver *driver, +				struct tty_struct *tty);  extern int tty_port_open(struct tty_port *port,  				struct tty_struct *tty, struct file *filp);  static inline int tty_port_users(struct tty_port *port) @@ -605,8 +627,12 @@ extern long vt_compat_ioctl(struct tty_struct *tty,  /* tty_mutex.c */  /* functions for preparation of BKL removal */ -extern void __lockfunc tty_lock(void) __acquires(tty_lock); -extern void __lockfunc tty_unlock(void) __releases(tty_lock); +extern void __lockfunc tty_lock(struct tty_struct *tty); +extern void __lockfunc tty_unlock(struct tty_struct *tty); +extern void __lockfunc tty_lock_pair(struct tty_struct *tty, +				struct tty_struct *tty2); +extern void __lockfunc tty_unlock_pair(struct tty_struct *tty, +				struct tty_struct *tty2);  /*   * this shall be called only from where BTM is held (like close) @@ -621,9 +647,9 @@ extern void __lockfunc tty_unlock(void) __releases(tty_lock);  static inline void tty_wait_until_sent_from_close(struct tty_struct *tty,  		long timeout)  { -	tty_unlock(); /* tty->ops->close holds the BTM, drop it while waiting */ +	tty_unlock(tty); /* tty->ops->close holds the BTM, drop it while waiting */  	tty_wait_until_sent(tty, timeout); -	tty_lock(); +	tty_lock(tty);  }  /* @@ -638,16 +664,16 @@ static inline void tty_wait_until_sent_from_close(struct tty_struct *tty,   *   * Do not use in new code.   */ -#define wait_event_interruptible_tty(wq, condition)			\ +#define wait_event_interruptible_tty(tty, wq, condition)		\  ({									\  	int __ret = 0;							\  	if (!(condition)) {						\ -		__wait_event_interruptible_tty(wq, condition, __ret);	\ +		__wait_event_interruptible_tty(tty, wq, condition, __ret);	\  	}								\  	__ret;								\  }) -#define __wait_event_interruptible_tty(wq, condition, ret)		\ +#define __wait_event_interruptible_tty(tty, wq, condition, ret)		\  do {									\  	DEFINE_WAIT(__wait);						\  									\ @@ -656,9 +682,9 @@ do {									\  		if (condition)						\  			break;						\  		if (!signal_pending(current)) {				\ -			tty_unlock();					\ +			tty_unlock(tty);					\  			schedule();					\ -			tty_lock();					\ +			tty_lock(tty);					\  			continue;					\  		}							\  		ret = -ERESTARTSYS;					\  |