diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/kbd_kern.h | 2 | ||||
-rw-r--r-- | include/linux/tty.h | 25 | ||||
-rw-r--r-- | include/linux/tty_flip.h | 20 | ||||
-rw-r--r-- | include/linux/tty_ldisc.h | 9 |
4 files changed, 31 insertions, 25 deletions
diff --git a/include/linux/kbd_kern.h b/include/linux/kbd_kern.h index 7428198111eb..45f625d7d0b2 100644 --- a/include/linux/kbd_kern.h +++ b/include/linux/kbd_kern.h @@ -151,7 +151,7 @@ extern unsigned int keymap_count; static inline void con_schedule_flip(struct tty_struct *t) { - schedule_work(&t->flip.work); + schedule_work(&t->buf.work); } #endif diff --git a/include/linux/tty.h b/include/linux/tty.h index 57449704a47b..3787102e4b12 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -51,16 +51,22 @@ */ #define TTY_FLIPBUF_SIZE 512 -struct tty_flip_buffer { +struct tty_buffer { + struct tty_buffer *next; + char *char_buf_ptr; + unsigned char *flag_buf_ptr; + int used; + int size; + /* Data points here */ + unsigned long data[0]; +}; + +struct tty_bufhead { struct work_struct work; struct semaphore pty_sem; - char *char_buf_ptr; - unsigned char *flag_buf_ptr; - int count; - int buf_num; - unsigned char char_buf[2*TTY_FLIPBUF_SIZE]; - char flag_buf[2*TTY_FLIPBUF_SIZE]; - unsigned char slop[4]; /* N.B. bug overwrites buffer by 1 */ + struct tty_buffer *head; /* Queue head */ + struct tty_buffer *tail; /* Active buffer */ + struct tty_buffer *free; /* Free queue head */ }; /* * The pty uses char_buf and flag_buf as a contiguous buffer @@ -186,10 +192,11 @@ struct tty_struct { unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1; unsigned char low_latency:1, warned:1; unsigned char ctrl_status; + unsigned int receive_room; /* Bytes free for queue */ struct tty_struct *link; struct fasync_struct *fasync; - struct tty_flip_buffer flip; + struct tty_bufhead buf; int max_flip_cnt; int alt_speed; /* For magic substitution of 38400 bps */ wait_queue_head_t write_wait; diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h index abe9bfcf226c..be1400e82482 100644 --- a/include/linux/tty_flip.h +++ b/include/linux/tty_flip.h @@ -1,25 +1,33 @@ #ifndef _LINUX_TTY_FLIP_H #define _LINUX_TTY_FLIP_H +extern int tty_buffer_request_room(struct tty_struct *tty, size_t size); +extern int tty_insert_flip_string(struct tty_struct *tty, unsigned char *chars, size_t size); +extern int tty_insert_flip_string_flags(struct tty_struct *tty, unsigned char *chars, char *flags, size_t size); +extern int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars, size_t size); +extern int tty_prepare_flip_string_flags(struct tty_struct *tty, unsigned char **chars, char **flags, size_t size); + #ifdef INCLUDE_INLINE_FUNCS #define _INLINE_ extern #else #define _INLINE_ static __inline__ #endif -_INLINE_ void tty_insert_flip_char(struct tty_struct *tty, +_INLINE_ int tty_insert_flip_char(struct tty_struct *tty, unsigned char ch, char flag) { - if (tty->flip.count < TTY_FLIPBUF_SIZE) { - tty->flip.count++; - *tty->flip.flag_buf_ptr++ = flag; - *tty->flip.char_buf_ptr++ = ch; + struct tty_buffer *tb = tty->buf.tail; + if (tb && tb->used < tb->size) { + tb->flag_buf_ptr[tb->used] = flag; + tb->char_buf_ptr[tb->used++] = ch; + return 1; } + return tty_insert_flip_string_flags(tty, &ch, &flag, 1); } _INLINE_ void tty_schedule_flip(struct tty_struct *tty) { - schedule_delayed_work(&tty->flip.work, 1); + schedule_delayed_work(&tty->buf.work, 1); } #undef _INLINE_ diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h index 6066afde5ce4..83c6e6c10ebb 100644 --- a/include/linux/tty_ldisc.h +++ b/include/linux/tty_ldisc.h @@ -81,14 +81,6 @@ * pointer of flag bytes which indicate whether a character was * received with a parity error, etc. * - * int (*receive_room)(struct tty_struct *); - * - * This function is called by the low-level tty driver to - * determine how many characters the line discpline can accept. - * The low-level driver must not send more characters than was - * indicated by receive_room, or the line discpline may drop - * those characters. - * * void (*write_wakeup)(struct tty_struct *); * * This function is called by the low-level tty driver to signal @@ -136,7 +128,6 @@ struct tty_ldisc { */ void (*receive_buf)(struct tty_struct *, const unsigned char *cp, char *fp, int count); - int (*receive_room)(struct tty_struct *); void (*write_wakeup)(struct tty_struct *); struct module *owner; |