Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Aug 2008 12:14:46 GMT
From:      Ed Schouten <ed@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 148791 for review
Message-ID:  <200808291214.m7TCEkdM011048@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=148791

Change 148791 by ed@ed_dull on 2008/08/29 12:14:14

	Add proper inline routine for ttyhook calls, just like ttydevsw.

Affected files ...

.. //depot/projects/mpsafetty/sys/kern/tty_ttydisc.c#17 edit
.. //depot/projects/mpsafetty/sys/sys/ttyhook.h#5 edit

Differences ...

==== //depot/projects/mpsafetty/sys/kern/tty_ttydisc.c#17 (text+ko) ====

@@ -1096,9 +1096,8 @@
 
 	len = ttyoutq_read(&tp->t_outq, buf, len);
 
-	/* Invoke TTY hooks. XXX: ttyhook_getc_capture()? */
 	if (ttyhook_hashook(tp, getc_capture))
-		tp->t_hook->th_getc_capture(tp, buf, len);
+		ttyhook_getc_capture(tp, buf, len);
 
 	ttydisc_wakeup_watermark(tp);
 	atomic_add_long(&tty_nout, len);

==== //depot/projects/mpsafetty/sys/sys/ttyhook.h#5 (text+ko) ====

@@ -52,4 +52,13 @@
 #define	ttyhook_hashook(tp,hook)	((tp)->t_hook != NULL && \
 					(tp)->t_hook->th_ ## hook != NULL)
 
+static __inline void
+ttyhook_getc_capture(struct tty *tp, const void *buf, size_t len)
+{
+	tty_lock_assert(tp, MA_OWNED);
+	MPASS(!tty_gone(tp));
+
+	tp->t_hook->th_getc_capture(tp, buf, len);
+}
+
 #endif /* !_SYS_TTYHOOK_H_ */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200808291214.m7TCEkdM011048>