diff options
author | ed <ed@FreeBSD.org> | 2008-09-22 19:25:14 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2008-09-22 19:25:14 +0000 |
commit | 1475e942ed4a544d79230d9b2774b0e79f9189cd (patch) | |
tree | b0edacd4932fd8b74d222a3adf26ec514131733e /sys/sys/ttydisc.h | |
parent | d1f0654ba47a78005fb632d88f7f7e1f2715a850 (diff) | |
download | FreeBSD-src-1475e942ed4a544d79230d9b2774b0e79f9189cd.zip FreeBSD-src-1475e942ed4a544d79230d9b2774b0e79f9189cd.tar.gz |
Introduce a hooks layer for the MPSAFE TTY layer.
One of the features that prevented us from fixing some of the TTY
consumers to work once again, was an interface that allowed consumers to
do the following:
- `Sniff' incoming data, which is used by the snp(4) driver.
- Take direct control of the input and output paths of a TTY, which is
used by ng_tty(4), ppp(4), sl(4), etc.
There's no practical advantage in committing a hooks layer without
having any consumers. In P4 there is a preliminary port of snp(4) and
thompsa@ is busy porting ng_tty(4) to this interface. I already want to
have it in the tree, because this may stimulate others to work on the
remaining modules.
Discussed with: thompsa
Obtained from: //depot/projects/mpsafetty/...
Diffstat (limited to 'sys/sys/ttydisc.h')
-rw-r--r-- | sys/sys/ttydisc.h | 34 |
1 files changed, 2 insertions, 32 deletions
diff --git a/sys/sys/ttydisc.h b/sys/sys/ttydisc.h index aeaabc6..2ea5466 100644 --- a/sys/sys/ttydisc.h +++ b/sys/sys/ttydisc.h @@ -54,8 +54,10 @@ void ttydisc_modem(struct tty *tp, int open); int ttydisc_rint(struct tty *tp, char c, int flags); size_t ttydisc_rint_bypass(struct tty *tp, const void *buf, size_t len); void ttydisc_rint_done(struct tty *tp); +size_t ttydisc_rint_poll(struct tty *tp); size_t ttydisc_getc(struct tty *tp, void *buf, size_t len); int ttydisc_getc_uio(struct tty *tp, struct uio *uio); +size_t ttydisc_getc_poll(struct tty *tp); /* Error codes for ttydisc_rint(). */ #define TRE_FRAMING 0x01 @@ -81,36 +83,4 @@ ttydisc_write_poll(struct tty *tp) return ttyoutq_bytesleft(&tp->t_outq); } -static __inline size_t -ttydisc_rint_poll(struct tty *tp) -{ - size_t l; - - tty_lock_assert(tp, MA_OWNED); - - /* - * XXX: Still allow character input when there's no space in the - * buffers, but we haven't entered the high watermark. This is - * to allow backspace characters to be inserted when in - * canonical mode. - */ - l = ttyinq_bytesleft(&tp->t_inq); - if (l == 0 && (tp->t_flags & TF_HIWAT_IN) == 0) - return (1); - - return (l); -} - -static __inline size_t -ttydisc_getc_poll(struct tty *tp) -{ - - tty_lock_assert(tp, MA_OWNED); - - if (tp->t_flags & TF_STOPPED) - return (0); - - return ttyoutq_bytesused(&tp->t_outq); -} - #endif /* !_SYS_TTYDISC_H_ */ |