tty_flip.h 1.1 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3
#ifndef _LINUX_TTY_FLIP_H
#define _LINUX_TTY_FLIP_H

A
Alan Cox 已提交
4 5 6 7 8 9
extern int tty_buffer_request_room(struct tty_struct *tty, size_t size);
extern int tty_insert_flip_string(struct tty_struct *tty, unsigned char *chars, size_t size);
extern int tty_insert_flip_string_flags(struct tty_struct *tty, unsigned char *chars, char *flags, size_t size);
extern int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars, size_t size);
extern int tty_prepare_flip_string_flags(struct tty_struct *tty, unsigned char **chars, char **flags, size_t size);

L
Linus Torvalds 已提交
10 11 12 13 14 15
#ifdef INCLUDE_INLINE_FUNCS
#define _INLINE_ extern
#else
#define _INLINE_ static __inline__
#endif

A
Alan Cox 已提交
16
_INLINE_ int tty_insert_flip_char(struct tty_struct *tty,
L
Linus Torvalds 已提交
17 18
				   unsigned char ch, char flag)
{
A
Alan Cox 已提交
19 20 21 22 23
	struct tty_buffer *tb = tty->buf.tail;
	if (tb && tb->used < tb->size) {
		tb->flag_buf_ptr[tb->used] = flag;
		tb->char_buf_ptr[tb->used++] = ch;
		return 1;
L
Linus Torvalds 已提交
24
	}
A
Alan Cox 已提交
25
	return tty_insert_flip_string_flags(tty, &ch, &flag, 1);
L
Linus Torvalds 已提交
26 27 28 29
}

_INLINE_ void tty_schedule_flip(struct tty_struct *tty)
{
A
Alan Cox 已提交
30
	schedule_delayed_work(&tty->buf.work, 1);
L
Linus Torvalds 已提交
31 32 33 34 35 36 37 38 39 40 41 42 43
}

#undef _INLINE_


#endif /* _LINUX_TTY_FLIP_H */