]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/linux/tty.h
ocfs2: Better I/O error handling in heartbeat
[linux-2.6-omap-h63xx.git] / include / linux / tty.h
index 57449704a47be99355e1b467692ee7efe7cf2228..f13f49afe198cc0d59e998fe3a6e721d70fca6b4 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/tty_driver.h>
 #include <linux/tty_ldisc.h>
 #include <linux/screen_info.h>
+#include <linux/mutex.h>
 
 #include <asm/system.h>
 
  */
 #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;
+       int active;
+       int commit;
+       int read;
+       /* 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 */
+       spinlock_t lock;
+       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 +197,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;
@@ -220,8 +232,8 @@ struct tty_struct {
        int canon_data;
        unsigned long canon_head;
        unsigned int canon_column;
-       struct semaphore atomic_read;
-       struct semaphore atomic_write;
+       struct mutex atomic_read_lock;
+       struct mutex atomic_write_lock;
        unsigned char *write_buf;
        int write_cnt;
        spinlock_t read_lock;
@@ -308,8 +320,7 @@ extern void tty_ldisc_put(int);
 extern void tty_wakeup(struct tty_struct *tty);
 extern void tty_ldisc_flush(struct tty_struct *tty);
 
-struct semaphore;
-extern struct semaphore tty_sem;
+extern struct mutex tty_mutex;
 
 /* n_tty.c */
 extern struct tty_ldisc tty_ldisc_N_TTY;