blob: e0f252633b4745940edef0c4539381de4bb129a5 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _LINUX_TTY_FLIP_H
2#define _LINUX_TTY_FLIP_H
3
Jiri Slaby227434f2013-01-03 15:53:01 +01004extern int tty_buffer_request_room(struct tty_port *port, size_t size);
Jiri Slaby2f693352013-01-03 15:53:02 +01005extern int tty_insert_flip_string_flags(struct tty_port *port,
6 const unsigned char *chars, const char *flags, size_t size);
7extern int tty_insert_flip_string_fixed_flag(struct tty_port *port,
8 const unsigned char *chars, char flag, size_t size);
9extern int tty_prepare_flip_string(struct tty_port *port,
10 unsigned char **chars, size_t size);
11extern int tty_prepare_flip_string_flags(struct tty_port *port,
12 unsigned char **chars, char **flags, size_t size);
Jiri Slaby2e124b42013-01-03 15:53:06 +010013extern void tty_flip_buffer_push(struct tty_port *port);
Jiri Slaby6732c8b2013-01-03 15:53:07 +010014void tty_schedule_flip(struct tty_port *port);
Alan Cox33f0f882006-01-09 20:54:13 -080015
Jiri Slaby92a19f92013-01-03 15:53:03 +010016static inline int tty_insert_flip_char(struct tty_port *port,
Andrew Mortone1a25092006-04-10 22:54:05 -070017 unsigned char ch, char flag)
Linus Torvalds1da177e2005-04-16 15:20:36 -070018{
Jiri Slaby92a19f92013-01-03 15:53:03 +010019 struct tty_buffer *tb = port->buf.tail;
Paul Fulghum33b37a32006-06-28 04:26:49 -070020 if (tb && tb->used < tb->size) {
Alan Cox33f0f882006-01-09 20:54:13 -080021 tb->flag_buf_ptr[tb->used] = flag;
22 tb->char_buf_ptr[tb->used++] = ch;
23 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -070024 }
Jiri Slaby92a19f92013-01-03 15:53:03 +010025 return tty_insert_flip_string_flags(port, &ch, &flag, 1);
Linus Torvalds1da177e2005-04-16 15:20:36 -070026}
27
Jiri Slaby05c7cd32013-01-03 15:53:04 +010028static inline int tty_insert_flip_string(struct tty_port *port,
29 const unsigned char *chars, size_t size)
Alan Cox2832fc12010-02-18 16:43:54 +000030{
Jiri Slaby05c7cd32013-01-03 15:53:04 +010031 return tty_insert_flip_string_fixed_flag(port, chars, TTY_NORMAL, size);
Alan Cox2832fc12010-02-18 16:43:54 +000032}
33
Linus Torvalds1da177e2005-04-16 15:20:36 -070034#endif /* _LINUX_TTY_FLIP_H */