1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_TTY_BUFFER_H
3 #define _LINUX_TTY_BUFFER_H
5 #include <linux/atomic.h>
6 #include <linux/llist.h>
7 #include <linux/mutex.h>
8 #include <linux/workqueue.h>
12 struct tty_buffer *next;
13 struct llist_node free;
20 /* Data points here */
24 /* Values for .flags field of tty_buffer */
25 #define TTYB_NORMAL 1 /* buffer has no flags buffer */
27 static inline unsigned char *char_buf_ptr(struct tty_buffer *b, int ofs)
29 return ((unsigned char *)b->data) + ofs;
32 static inline char *flag_buf_ptr(struct tty_buffer *b, int ofs)
34 return (char *)char_buf_ptr(b, ofs) + b->size;
38 struct tty_buffer *head; /* Queue head */
39 struct work_struct work;
42 struct tty_buffer sentinel;
43 struct llist_head free; /* Free queue head */
44 atomic_t mem_used; /* In-use buffers excluding free list */
46 struct tty_buffer *tail; /* Active buffer */
50 * When a break, frame error, or parity error happens, these codes are
51 * stuffed into the flags buffer.