Changeset View
Changeset View
Standalone View
Standalone View
sys/sys/ttydevsw.h
| Show First 20 Lines • Show All 79 Lines • ▼ Show 20 Lines | struct ttydevsw { | ||||
| void *tsw_spare[3]; /* For future use. */ | void *tsw_spare[3]; /* For future use. */ | ||||
| }; | }; | ||||
| static __inline int | static __inline int | ||||
| ttydevsw_open(struct tty *tp) | ttydevsw_open(struct tty *tp) | ||||
| { | { | ||||
| tty_assert_locked(tp); | tty_assert_locked(tp); | ||||
| ttydisc_assert_locked(tp); | |||||
| MPASS(!tty_gone(tp)); | MPASS(!tty_gone(tp)); | ||||
| return (tp->t_devsw->tsw_open(tp)); | return (tp->t_devsw->tsw_open(tp)); | ||||
| } | } | ||||
| static __inline void | static __inline void | ||||
| ttydevsw_close(struct tty *tp) | ttydevsw_close(struct tty *tp) | ||||
| { | { | ||||
| tty_assert_locked(tp); | tty_assert_locked(tp); | ||||
| ttydisc_assert_locked(tp); | |||||
| MPASS(!tty_gone(tp)); | MPASS(!tty_gone(tp)); | ||||
| tp->t_devsw->tsw_close(tp); | tp->t_devsw->tsw_close(tp); | ||||
| } | } | ||||
| static __inline void | static __inline void | ||||
| ttydevsw_outwakeup(struct tty *tp) | ttydevsw_outwakeup(struct tty *tp) | ||||
| { | { | ||||
| tty_assert_locked(tp); | /* We may or may not have the tty lock. */ | ||||
| ttydisc_assert_locked(tp); | |||||
| MPASS(!tty_gone(tp)); | MPASS(!tty_gone(tp)); | ||||
| /* Prevent spurious wakeups. */ | /* Prevent spurious wakeups. */ | ||||
| if (ttydisc_getc_poll(tp) == 0) | if (ttydisc_getc_poll(tp) == 0) | ||||
| return; | return; | ||||
| tp->t_devsw->tsw_outwakeup(tp); | tp->t_devsw->tsw_outwakeup(tp); | ||||
| } | } | ||||
| static __inline void | static __inline void | ||||
| ttydevsw_inwakeup(struct tty *tp) | ttydevsw_inwakeup(struct tty *tp) | ||||
| { | { | ||||
| tty_assert_locked(tp); | /* We may or may not have the tty lock. */ | ||||
| ttydisc_assert_locked(tp); | |||||
| MPASS(!tty_gone(tp)); | MPASS(!tty_gone(tp)); | ||||
| /* Prevent spurious wakeups. */ | /* Prevent spurious wakeups. */ | ||||
| if (tp->t_flags & TF_HIWAT_IN) | if (tp->t_flags & TF_HIWAT_IN) | ||||
| return; | return; | ||||
| tp->t_devsw->tsw_inwakeup(tp); | tp->t_devsw->tsw_inwakeup(tp); | ||||
| } | } | ||||
| static __inline int | static __inline int | ||||
| ttydevsw_ioctl(struct tty *tp, u_long cmd, caddr_t data, struct thread *td) | ttydevsw_ioctl(struct tty *tp, u_long cmd, caddr_t data, struct thread *td) | ||||
| { | { | ||||
| tty_assert_locked(tp); | tty_assert_locked(tp); | ||||
| ttydisc_assert_locked(tp); | |||||
| MPASS(!tty_gone(tp)); | MPASS(!tty_gone(tp)); | ||||
| return (tp->t_devsw->tsw_ioctl(tp, cmd, data, td)); | return (tp->t_devsw->tsw_ioctl(tp, cmd, data, td)); | ||||
| } | } | ||||
| static __inline int | static __inline int | ||||
| ttydevsw_cioctl(struct tty *tp, int unit, u_long cmd, caddr_t data, | ttydevsw_cioctl(struct tty *tp, int unit, u_long cmd, caddr_t data, | ||||
| struct thread *td) | struct thread *td) | ||||
| { | { | ||||
| tty_assert_locked(tp); | tty_assert_locked(tp); | ||||
| MPASS(!tty_gone(tp)); | MPASS(!tty_gone(tp)); | ||||
| return (tp->t_devsw->tsw_cioctl(tp, unit, cmd, data, td)); | return (tp->t_devsw->tsw_cioctl(tp, unit, cmd, data, td)); | ||||
| } | } | ||||
| static __inline int | static __inline int | ||||
| ttydevsw_param(struct tty *tp, struct termios *t) | ttydevsw_param(struct tty *tp, struct termios *t) | ||||
| { | { | ||||
| tty_assert_locked(tp); | |||||
| ttydisc_assert_locked(tp); | |||||
| MPASS(!tty_gone(tp)); | MPASS(!tty_gone(tp)); | ||||
| return (tp->t_devsw->tsw_param(tp, t)); | return (tp->t_devsw->tsw_param(tp, t)); | ||||
| } | } | ||||
| static __inline int | static __inline int | ||||
| ttydevsw_modem(struct tty *tp, int sigon, int sigoff) | ttydevsw_modem(struct tty *tp, int sigon, int sigoff) | ||||
| { | { | ||||
| tty_assert_locked(tp); | |||||
| ttydisc_assert_locked(tp); | |||||
| MPASS(!tty_gone(tp)); | MPASS(!tty_gone(tp)); | ||||
| return (tp->t_devsw->tsw_modem(tp, sigon, sigoff)); | return (tp->t_devsw->tsw_modem(tp, sigon, sigoff)); | ||||
| } | } | ||||
| static __inline int | static __inline int | ||||
| ttydevsw_mmap(struct tty *tp, vm_ooffset_t offset, vm_paddr_t *paddr, | ttydevsw_mmap(struct tty *tp, vm_ooffset_t offset, vm_paddr_t *paddr, | ||||
| int nprot, vm_memattr_t *memattr) | int nprot, vm_memattr_t *memattr) | ||||
| { | { | ||||
| MPASS(!tty_gone(tp)); | MPASS(!tty_gone(tp)); | ||||
| return (tp->t_devsw->tsw_mmap(tp, offset, paddr, nprot, memattr)); | return (tp->t_devsw->tsw_mmap(tp, offset, paddr, nprot, memattr)); | ||||
| } | } | ||||
| static __inline void | static __inline void | ||||
| ttydevsw_pktnotify(struct tty *tp, char event) | ttydevsw_pktnotify(struct tty *tp, char event) | ||||
| { | { | ||||
| tty_assert_locked(tp); | ttydisc_assert_locked(tp); | ||||
| MPASS(!tty_gone(tp)); | MPASS(!tty_gone(tp)); | ||||
| tp->t_devsw->tsw_pktnotify(tp, event); | tp->t_devsw->tsw_pktnotify(tp, event); | ||||
| } | } | ||||
| static __inline void | static __inline void | ||||
| ttydevsw_free(struct tty *tp) | ttydevsw_free(struct tty *tp) | ||||
| { | { | ||||
| /* Locks are destroyed at this point. */ | |||||
| MPASS(tty_gone(tp)); | MPASS(tty_gone(tp)); | ||||
| tp->t_devsw->tsw_free(tty_softc(tp)); | tp->t_devsw->tsw_free(tty_softc(tp)); | ||||
| } | } | ||||
| static __inline bool | static __inline bool | ||||
| ttydevsw_busy(struct tty *tp) | ttydevsw_busy(struct tty *tp) | ||||
| { | { | ||||
| tty_assert_locked(tp); | /* We may or may not have the tty lock. */ | ||||
| ttydisc_assert_locked(tp); | |||||
| MPASS(!tty_gone(tp)); | MPASS(!tty_gone(tp)); | ||||
| return (tp->t_devsw->tsw_busy(tp)); | return (tp->t_devsw->tsw_busy(tp)); | ||||
| } | } | ||||
| #endif /* !_SYS_TTYDEVSW_H_ */ | #endif /* !_SYS_TTYDEVSW_H_ */ | ||||