Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _LINUX_TTY_FLIP_H |
| 2 | #define _LINUX_TTY_FLIP_H |
| 3 | |
Alan Cox | 33f0f88 | 2006-01-09 20:54:13 -0800 | [diff] [blame] | 4 | extern int tty_buffer_request_room(struct tty_struct *tty, size_t size); |
Thomas Koeller | 1aef821 | 2006-03-25 03:07:03 -0800 | [diff] [blame] | 5 | extern int tty_insert_flip_string_flags(struct tty_struct *tty, const unsigned char *chars, const char *flags, size_t size); |
Alan Cox | 2832fc1 | 2010-02-18 16:43:54 +0000 | [diff] [blame] | 6 | extern int tty_insert_flip_string_fixed_flag(struct tty_struct *tty, const unsigned char *chars, char flag, size_t size); |
Alan Cox | 33f0f88 | 2006-01-09 20:54:13 -0800 | [diff] [blame] | 7 | extern int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars, size_t size); |
| 8 | extern int tty_prepare_flip_string_flags(struct tty_struct *tty, unsigned char **chars, char **flags, size_t size); |
Andrew Morton | e1a2509 | 2006-04-10 22:54:05 -0700 | [diff] [blame] | 9 | void tty_schedule_flip(struct tty_struct *tty); |
Alan Cox | 33f0f88 | 2006-01-09 20:54:13 -0800 | [diff] [blame] | 10 | |
Adrian Bunk | 41c28ff | 2006-03-23 03:00:56 -0800 | [diff] [blame] | 11 | static inline int tty_insert_flip_char(struct tty_struct *tty, |
Andrew Morton | e1a2509 | 2006-04-10 22:54:05 -0700 | [diff] [blame] | 12 | unsigned char ch, char flag) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | { |
Jiri Slaby | ecbbfd4 | 2012-10-18 22:26:47 +0200 | [diff] [blame] | 14 | struct tty_buffer *tb = tty->port->buf.tail; |
Paul Fulghum | 33b37a3 | 2006-06-28 04:26:49 -0700 | [diff] [blame] | 15 | if (tb && tb->used < tb->size) { |
Alan Cox | 33f0f88 | 2006-01-09 20:54:13 -0800 | [diff] [blame] | 16 | tb->flag_buf_ptr[tb->used] = flag; |
| 17 | tb->char_buf_ptr[tb->used++] = ch; |
| 18 | return 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | } |
Alan Cox | 33f0f88 | 2006-01-09 20:54:13 -0800 | [diff] [blame] | 20 | return tty_insert_flip_string_flags(tty, &ch, &flag, 1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | } |
| 22 | |
Alan Cox | 2832fc1 | 2010-02-18 16:43:54 +0000 | [diff] [blame] | 23 | static inline int tty_insert_flip_string(struct tty_struct *tty, const unsigned char *chars, size_t size) |
| 24 | { |
| 25 | return tty_insert_flip_string_fixed_flag(tty, chars, TTY_NORMAL, size); |
| 26 | } |
| 27 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | #endif /* _LINUX_TTY_FLIP_H */ |