blob: 2002344ed36ad9de8c152b666eff10922ba930b8 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _LINUX_TTY_FLIP_H
2#define _LINUX_TTY_FLIP_H
3
Alan Cox33f0f882006-01-09 20:54:13 -08004extern int tty_buffer_request_room(struct tty_struct *tty, size_t size);
Thomas Koeller1aef8212006-03-25 03:07:03 -08005extern int tty_insert_flip_string_flags(struct tty_struct *tty, const unsigned char *chars, const char *flags, size_t size);
Alan Cox2832fc12010-02-18 16:43:54 +00006extern int tty_insert_flip_string_fixed_flag(struct tty_struct *tty, const unsigned char *chars, char flag, size_t size);
Alan Cox33f0f882006-01-09 20:54:13 -08007extern int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars, size_t size);
8extern int tty_prepare_flip_string_flags(struct tty_struct *tty, unsigned char **chars, char **flags, size_t size);
Andrew Mortone1a25092006-04-10 22:54:05 -07009void tty_schedule_flip(struct tty_struct *tty);
Alan Cox33f0f882006-01-09 20:54:13 -080010
Adrian Bunk41c28ff2006-03-23 03:00:56 -080011static inline int tty_insert_flip_char(struct tty_struct *tty,
Andrew Mortone1a25092006-04-10 22:54:05 -070012 unsigned char ch, char flag)
Linus Torvalds1da177e2005-04-16 15:20:36 -070013{
Jiri Slabyecbbfd42012-10-18 22:26:47 +020014 struct tty_buffer *tb = tty->port->buf.tail;
Paul Fulghum33b37a32006-06-28 04:26:49 -070015 if (tb && tb->used < tb->size) {
Alan Cox33f0f882006-01-09 20:54:13 -080016 tb->flag_buf_ptr[tb->used] = flag;
17 tb->char_buf_ptr[tb->used++] = ch;
18 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -070019 }
Alan Cox33f0f882006-01-09 20:54:13 -080020 return tty_insert_flip_string_flags(tty, &ch, &flag, 1);
Linus Torvalds1da177e2005-04-16 15:20:36 -070021}
22
Alan Cox2832fc12010-02-18 16:43:54 +000023static 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 Torvalds1da177e2005-04-16 15:20:36 -070028#endif /* _LINUX_TTY_FLIP_H */