aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/tty.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/tty.h')
-rw-r--r--include/linux/tty.h44
1 files changed, 10 insertions, 34 deletions
diff --git a/include/linux/tty.h b/include/linux/tty.h
index f0b4eb47297c..d7ff88fb8967 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -188,7 +188,9 @@ struct tty_port_operations {
188}; 188};
189 189
190struct tty_port { 190struct tty_port {
191 struct tty_bufhead buf; /* Locked internally */
191 struct tty_struct *tty; /* Back pointer */ 192 struct tty_struct *tty; /* Back pointer */
193 struct tty_struct *itty; /* internal back ptr */
192 const struct tty_port_operations *ops; /* Port operations */ 194 const struct tty_port_operations *ops; /* Port operations */
193 spinlock_t lock; /* Lock protecting tty field */ 195 spinlock_t lock; /* Lock protecting tty field */
194 int blocked_open; /* Waiting to open */ 196 int blocked_open; /* Waiting to open */
@@ -197,6 +199,9 @@ struct tty_port {
197 wait_queue_head_t close_wait; /* Close waiters */ 199 wait_queue_head_t close_wait; /* Close waiters */
198 wait_queue_head_t delta_msr_wait; /* Modem status change */ 200 wait_queue_head_t delta_msr_wait; /* Modem status change */
199 unsigned long flags; /* TTY flags ASY_*/ 201 unsigned long flags; /* TTY flags ASY_*/
202 unsigned long iflags; /* TTYP_ internal flags */
203#define TTYP_FLUSHING 1 /* Flushing to ldisc in progress */
204#define TTYP_FLUSHPENDING 2 /* Queued buffer flush pending */
200 unsigned char console:1; /* port is a console */ 205 unsigned char console:1; /* port is a console */
201 struct mutex mutex; /* Locking */ 206 struct mutex mutex; /* Locking */
202 struct mutex buf_mutex; /* Buffer alloc lock */ 207 struct mutex buf_mutex; /* Buffer alloc lock */
@@ -235,6 +240,7 @@ struct tty_struct {
235 struct mutex ldisc_mutex; 240 struct mutex ldisc_mutex;
236 struct tty_ldisc *ldisc; 241 struct tty_ldisc *ldisc;
237 242
243 struct mutex atomic_write_lock;
238 struct mutex legacy_mutex; 244 struct mutex legacy_mutex;
239 struct mutex termios_mutex; 245 struct mutex termios_mutex;
240 spinlock_t ctrl_lock; 246 spinlock_t ctrl_lock;
@@ -254,7 +260,6 @@ struct tty_struct {
254 260
255 struct tty_struct *link; 261 struct tty_struct *link;
256 struct fasync_struct *fasync; 262 struct fasync_struct *fasync;
257 struct tty_bufhead buf; /* Locked internally */
258 int alt_speed; /* For magic substitution of 38400 bps */ 263 int alt_speed; /* For magic substitution of 38400 bps */
259 wait_queue_head_t write_wait; 264 wait_queue_head_t write_wait;
260 wait_queue_head_t read_wait; 265 wait_queue_head_t read_wait;
@@ -265,37 +270,10 @@ struct tty_struct {
265 270
266#define N_TTY_BUF_SIZE 4096 271#define N_TTY_BUF_SIZE 4096
267 272
268 /*
269 * The following is data for the N_TTY line discipline. For
270 * historical reasons, this is included in the tty structure.
271 * Mostly locked by the BKL.
272 */
273 unsigned int column;
274 unsigned char lnext:1, erasing:1, raw:1, real_raw:1, icanon:1;
275 unsigned char closing:1; 273 unsigned char closing:1;
276 unsigned char echo_overrun:1;
277 unsigned short minimum_to_wake; 274 unsigned short minimum_to_wake;
278 unsigned long overrun_time;
279 int num_overrun;
280 unsigned long process_char_map[256/(8*sizeof(unsigned long))];
281 char *read_buf;
282 int read_head;
283 int read_tail;
284 int read_cnt;
285 unsigned long read_flags[N_TTY_BUF_SIZE/(8*sizeof(unsigned long))];
286 unsigned char *echo_buf;
287 unsigned int echo_pos;
288 unsigned int echo_cnt;
289 int canon_data;
290 unsigned long canon_head;
291 unsigned int canon_column;
292 struct mutex atomic_read_lock;
293 struct mutex atomic_write_lock;
294 struct mutex output_lock;
295 struct mutex echo_lock;
296 unsigned char *write_buf; 275 unsigned char *write_buf;
297 int write_cnt; 276 int write_cnt;
298 spinlock_t read_lock;
299 /* If the tty has a pending do_SAK, queue it here - akpm */ 277 /* If the tty has a pending do_SAK, queue it here - akpm */
300 struct work_struct SAK_work; 278 struct work_struct SAK_work;
301 struct tty_port *port; 279 struct tty_port *port;
@@ -335,8 +313,6 @@ struct tty_file_private {
335#define TTY_PTY_LOCK 16 /* pty private */ 313#define TTY_PTY_LOCK 16 /* pty private */
336#define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */ 314#define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */
337#define TTY_HUPPED 18 /* Post driver->hangup() */ 315#define TTY_HUPPED 18 /* Post driver->hangup() */
338#define TTY_FLUSHING 19 /* Flushing to ldisc in progress */
339#define TTY_FLUSHPENDING 20 /* Queued buffer flush pending */
340#define TTY_HUPPING 21 /* ->hangup() in progress */ 316#define TTY_HUPPING 21 /* ->hangup() in progress */
341 317
342#define TTY_WRITE_FLUSH(tty) tty_write_flush((tty)) 318#define TTY_WRITE_FLUSH(tty) tty_write_flush((tty))
@@ -412,9 +388,9 @@ extern void disassociate_ctty(int priv);
412extern void no_tty(void); 388extern void no_tty(void);
413extern void tty_flip_buffer_push(struct tty_struct *tty); 389extern void tty_flip_buffer_push(struct tty_struct *tty);
414extern void tty_flush_to_ldisc(struct tty_struct *tty); 390extern void tty_flush_to_ldisc(struct tty_struct *tty);
415extern void tty_buffer_free_all(struct tty_struct *tty); 391extern void tty_buffer_free_all(struct tty_port *port);
416extern void tty_buffer_flush(struct tty_struct *tty); 392extern void tty_buffer_flush(struct tty_struct *tty);
417extern void tty_buffer_init(struct tty_struct *tty); 393extern void tty_buffer_init(struct tty_port *port);
418extern speed_t tty_get_baud_rate(struct tty_struct *tty); 394extern speed_t tty_get_baud_rate(struct tty_struct *tty);
419extern speed_t tty_termios_baud_rate(struct ktermios *termios); 395extern speed_t tty_termios_baud_rate(struct ktermios *termios);
420extern speed_t tty_termios_input_baud_rate(struct ktermios *termios); 396extern speed_t tty_termios_input_baud_rate(struct ktermios *termios);
@@ -535,7 +511,7 @@ extern void n_tty_inherit_ops(struct tty_ldisc_ops *ops);
535/* tty_audit.c */ 511/* tty_audit.c */
536#ifdef CONFIG_AUDIT 512#ifdef CONFIG_AUDIT
537extern void tty_audit_add_data(struct tty_struct *tty, unsigned char *data, 513extern void tty_audit_add_data(struct tty_struct *tty, unsigned char *data,
538 size_t size); 514 size_t size, unsigned icanon);
539extern void tty_audit_exit(void); 515extern void tty_audit_exit(void);
540extern void tty_audit_fork(struct signal_struct *sig); 516extern void tty_audit_fork(struct signal_struct *sig);
541extern void tty_audit_tiocsti(struct tty_struct *tty, char ch); 517extern void tty_audit_tiocsti(struct tty_struct *tty, char ch);
@@ -544,7 +520,7 @@ extern int tty_audit_push_task(struct task_struct *tsk,
544 kuid_t loginuid, u32 sessionid); 520 kuid_t loginuid, u32 sessionid);
545#else 521#else
546static inline void tty_audit_add_data(struct tty_struct *tty, 522static inline void tty_audit_add_data(struct tty_struct *tty,
547 unsigned char *data, size_t size) 523 unsigned char *data, size_t size, unsigned icanon)
548{ 524{
549} 525}
550static inline void tty_audit_tiocsti(struct tty_struct *tty, char ch) 526static inline void tty_audit_tiocsti(struct tty_struct *tty, char ch)