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
;
18 unsigned int lookahead
; /* Lazy update on recv, can become less than "read" */
21 /* Data points here */
22 u8 data
[] __aligned(sizeof(unsigned long));
25 static inline u8
*char_buf_ptr(struct tty_buffer
*b
, unsigned int ofs
)
30 static inline u8
*flag_buf_ptr(struct tty_buffer
*b
, unsigned int ofs
)
32 return char_buf_ptr(b
, ofs
) + b
->size
;
36 struct tty_buffer
*head
; /* Queue head */
37 struct work_struct work
;
40 struct tty_buffer sentinel
;
41 struct llist_head free
; /* Free queue head */
42 atomic_t mem_used
; /* In-use buffers excluding free list */
44 struct tty_buffer
*tail
; /* Active buffer */
48 * When a break, frame error, or parity error happens, these codes are
49 * stuffed into the flags buffer.