Changeset View
Changeset View
Standalone View
Standalone View
sys/sys/ttyhook.h
Show First 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | |||||
void ttyhook_unregister(struct tty *); | void ttyhook_unregister(struct tty *); | ||||
#define ttyhook_softc(tp) ((tp)->t_hooksoftc) | #define ttyhook_softc(tp) ((tp)->t_hooksoftc) | ||||
#define ttyhook_hashook(tp,hook) ((tp)->t_hook != NULL && \ | #define ttyhook_hashook(tp,hook) ((tp)->t_hook != NULL && \ | ||||
(tp)->t_hook->th_ ## hook != NULL) | (tp)->t_hook->th_ ## hook != NULL) | ||||
static __inline int | static __inline int | ||||
ttyhook_rint(struct tty *tp, char c, int flags) | ttyhook_rint(struct tty *tp, char c, int flags) | ||||
{ | { | ||||
tty_assert_locked(tp); | ttydisc_assert_locked(tp); | ||||
MPASS(!tty_gone(tp)); | MPASS(!tty_gone(tp)); | ||||
return tp->t_hook->th_rint(tp, c, flags); | return tp->t_hook->th_rint(tp, c, flags); | ||||
} | } | ||||
static __inline size_t | static __inline size_t | ||||
ttyhook_rint_bypass(struct tty *tp, const void *buf, size_t len) | ttyhook_rint_bypass(struct tty *tp, const void *buf, size_t len) | ||||
{ | { | ||||
tty_assert_locked(tp); | ttydisc_assert_locked(tp); | ||||
MPASS(!tty_gone(tp)); | MPASS(!tty_gone(tp)); | ||||
return tp->t_hook->th_rint_bypass(tp, buf, len); | return tp->t_hook->th_rint_bypass(tp, buf, len); | ||||
} | } | ||||
static __inline void | static __inline void | ||||
ttyhook_rint_done(struct tty *tp) | ttyhook_rint_done(struct tty *tp) | ||||
{ | { | ||||
tty_assert_locked(tp); | ttydisc_assert_locked(tp); | ||||
MPASS(!tty_gone(tp)); | MPASS(!tty_gone(tp)); | ||||
tp->t_hook->th_rint_done(tp); | tp->t_hook->th_rint_done(tp); | ||||
} | } | ||||
static __inline size_t | static __inline size_t | ||||
ttyhook_rint_poll(struct tty *tp) | ttyhook_rint_poll(struct tty *tp) | ||||
{ | { | ||||
tty_assert_locked(tp); | ttydisc_assert_locked(tp); | ||||
MPASS(!tty_gone(tp)); | MPASS(!tty_gone(tp)); | ||||
return tp->t_hook->th_rint_poll(tp); | return tp->t_hook->th_rint_poll(tp); | ||||
} | } | ||||
static __inline size_t | static __inline size_t | ||||
ttyhook_getc_inject(struct tty *tp, void *buf, size_t len) | ttyhook_getc_inject(struct tty *tp, void *buf, size_t len) | ||||
{ | { | ||||
tty_assert_locked(tp); | ttydisc_assert_locked(tp); | ||||
MPASS(!tty_gone(tp)); | MPASS(!tty_gone(tp)); | ||||
return tp->t_hook->th_getc_inject(tp, buf, len); | return tp->t_hook->th_getc_inject(tp, buf, len); | ||||
} | } | ||||
static __inline void | static __inline void | ||||
ttyhook_getc_capture(struct tty *tp, const void *buf, size_t len) | ttyhook_getc_capture(struct tty *tp, const void *buf, size_t len) | ||||
{ | { | ||||
tty_assert_locked(tp); | ttydisc_assert_locked(tp); | ||||
MPASS(!tty_gone(tp)); | MPASS(!tty_gone(tp)); | ||||
tp->t_hook->th_getc_capture(tp, buf, len); | tp->t_hook->th_getc_capture(tp, buf, len); | ||||
} | } | ||||
static __inline size_t | static __inline size_t | ||||
ttyhook_getc_poll(struct tty *tp) | ttyhook_getc_poll(struct tty *tp) | ||||
{ | { | ||||
tty_assert_locked(tp); | ttydisc_assert_locked(tp); | ||||
MPASS(!tty_gone(tp)); | MPASS(!tty_gone(tp)); | ||||
return tp->t_hook->th_getc_poll(tp); | return tp->t_hook->th_getc_poll(tp); | ||||
} | } | ||||
static __inline void | static __inline void | ||||
ttyhook_close(struct tty *tp) | ttyhook_close(struct tty *tp) | ||||
{ | { | ||||
tty_assert_locked(tp); | ttydisc_assert_locked(tp); | ||||
tp->t_hook->th_close(tp); | tp->t_hook->th_close(tp); | ||||
} | } | ||||
#endif /* !_SYS_TTYHOOK_H_ */ | #endif /* !_SYS_TTYHOOK_H_ */ |