aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/ttydevsw.h
diff options
context:
space:
mode:
authorEd Schouten <ed@FreeBSD.org>2011-07-02 13:54:20 +0000
committerEd Schouten <ed@FreeBSD.org>2011-07-02 13:54:20 +0000
commit18f5477167e87cec9ad05b00e43683db880b39eb (patch)
treef0a768511da18b5ea3cab54069bd41a6768f120c /sys/sys/ttydevsw.h
parentdf41287464a65426380bfae6078994751947305b (diff)
downloadsrc-18f5477167e87cec9ad05b00e43683db880b39eb.tar.gz
src-18f5477167e87cec9ad05b00e43683db880b39eb.zip
Reintroduce the cioctl() hook in the TTY layer for digi(4).
The cioctl() hook can be used by drivers to add ioctls to the *.init and *.lock devices. This commit breaks the ttydevsw ABI, since this structure didn't provide any padding. To prevent ABI breakage in the future, add a tsw_spare. Submitted by: Peter Jeremy <peter jeremy alcatel lucent com> Obtained from: kern/152254 (slightly modified)
Notes
Notes: svn path=/head/; revision=223722
Diffstat (limited to 'sys/sys/ttydevsw.h')
-rw-r--r--sys/sys/ttydevsw.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/sys/sys/ttydevsw.h b/sys/sys/ttydevsw.h
index 4506919832f9..748ae0bee8e1 100644
--- a/sys/sys/ttydevsw.h
+++ b/sys/sys/ttydevsw.h
@@ -46,6 +46,8 @@ typedef void tsw_outwakeup_t(struct tty *tp);
typedef void tsw_inwakeup_t(struct tty *tp);
typedef int tsw_ioctl_t(struct tty *tp, u_long cmd, caddr_t data,
struct thread *td);
+typedef int tsw_cioctl_t(struct tty *tp, int unit, u_long cmd, caddr_t data,
+ struct thread *td);
typedef int tsw_param_t(struct tty *tp, struct termios *t);
typedef int tsw_modem_t(struct tty *tp, int sigon, int sigoff);
typedef int tsw_mmap_t(struct tty *tp, vm_ooffset_t offset,
@@ -63,6 +65,7 @@ struct ttydevsw {
tsw_inwakeup_t *tsw_inwakeup; /* Input can be stored again. */
tsw_ioctl_t *tsw_ioctl; /* ioctl() hooks. */
+ tsw_cioctl_t *tsw_cioctl; /* ioctl() on control devices. */
tsw_param_t *tsw_param; /* TIOCSETA device parameter setting. */
tsw_modem_t *tsw_modem; /* Modem sigon/sigoff. */
@@ -70,6 +73,8 @@ struct ttydevsw {
tsw_pktnotify_t *tsw_pktnotify; /* TIOCPKT events. */
tsw_free_t *tsw_free; /* Destructor. */
+
+ void *tsw_spare[4]; /* For future use. */
};
static __inline int
@@ -126,6 +131,15 @@ ttydevsw_ioctl(struct tty *tp, u_long cmd, caddr_t data, struct thread *td)
}
static __inline int
+ttydevsw_cioctl(struct tty *tp, int unit, u_long cmd, caddr_t data, struct thread *td)
+{
+ tty_lock_assert(tp, MA_OWNED);
+ MPASS(!tty_gone(tp));
+
+ return tp->t_devsw->tsw_cioctl(tp, unit, cmd, data, td);
+}
+
+static __inline int
ttydevsw_param(struct tty *tp, struct termios *t)
{
MPASS(!tty_gone(tp));