Deleted Added
full compact
ng_tty.c (93593) ng_tty.c (109623)
1
2/*
3 * ng_tty.c
4 *
5 * Copyright (c) 1996-1999 Whistle Communications, Inc.
6 * All rights reserved.
7 *
8 * Subject to the following obligations and disclaimer of warranty, use and

--- 22 unchanged lines hidden (view full) ---

31 * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34 * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
35 * OF SUCH DAMAGE.
36 *
37 * Author: Archie Cobbs <archie@freebsd.org>
38 *
1
2/*
3 * ng_tty.c
4 *
5 * Copyright (c) 1996-1999 Whistle Communications, Inc.
6 * All rights reserved.
7 *
8 * Subject to the following obligations and disclaimer of warranty, use and

--- 22 unchanged lines hidden (view full) ---

31 * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34 * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
35 * OF SUCH DAMAGE.
36 *
37 * Author: Archie Cobbs <archie@freebsd.org>
38 *
39 * $FreeBSD: head/sys/netgraph/ng_tty.c 93593 2002-04-01 21:31:13Z jhb $
39 * $FreeBSD: head/sys/netgraph/ng_tty.c 109623 2003-01-21 08:56:16Z alfred $
40 * $Whistle: ng_tty.c,v 1.21 1999/11/01 09:24:52 julian Exp $
41 */
42
43/*
44 * This file implements a terminal line discipline that is also a
45 * netgraph node. Installing this line discipline on a terminal device
46 * instantiates a new netgraph node of this type, which allows access
47 * to the device via the "hook" hook of the node.

--- 150 unchanged lines hidden (view full) ---

198 /* Already installed? */
199 if (tp->t_line == NETGRAPHDISC) {
200 sc = (sc_p) tp->t_sc;
201 if (sc != NULL && sc->tp == tp)
202 goto done;
203 }
204
205 /* Initialize private struct */
40 * $Whistle: ng_tty.c,v 1.21 1999/11/01 09:24:52 julian Exp $
41 */
42
43/*
44 * This file implements a terminal line discipline that is also a
45 * netgraph node. Installing this line discipline on a terminal device
46 * instantiates a new netgraph node of this type, which allows access
47 * to the device via the "hook" hook of the node.

--- 150 unchanged lines hidden (view full) ---

198 /* Already installed? */
199 if (tp->t_line == NETGRAPHDISC) {
200 sc = (sc_p) tp->t_sc;
201 if (sc != NULL && sc->tp == tp)
202 goto done;
203 }
204
205 /* Initialize private struct */
206 MALLOC(sc, sc_p, sizeof(*sc), M_NETGRAPH, M_WAITOK | M_ZERO);
206 MALLOC(sc, sc_p, sizeof(*sc), M_NETGRAPH, M_ZERO);
207 if (sc == NULL) {
208 error = ENOMEM;
209 goto done;
210 }
211 sc->tp = tp;
212 sc->hotchar = NG_TTY_DFL_HOTCHAR;
213 sc->qtail = &sc->qhead;
214 QUEUECHECK(sc);

--- 148 unchanged lines hidden (view full) ---

363 log(LOG_DEBUG, "%s: line error %x\n",
364 NG_NODE_NAME(node), c & TTY_ERRORMASK);
365 ERROUT(0);
366 }
367 c &= TTY_CHARMASK;
368
369 /* Get a new header mbuf if we need one */
370 if (!(m = sc->m)) {
207 if (sc == NULL) {
208 error = ENOMEM;
209 goto done;
210 }
211 sc->tp = tp;
212 sc->hotchar = NG_TTY_DFL_HOTCHAR;
213 sc->qtail = &sc->qhead;
214 QUEUECHECK(sc);

--- 148 unchanged lines hidden (view full) ---

363 log(LOG_DEBUG, "%s: line error %x\n",
364 NG_NODE_NAME(node), c & TTY_ERRORMASK);
365 ERROUT(0);
366 }
367 c &= TTY_CHARMASK;
368
369 /* Get a new header mbuf if we need one */
370 if (!(m = sc->m)) {
371 MGETHDR(m, M_DONTWAIT, MT_DATA);
371 MGETHDR(m, M_NOWAIT, MT_DATA);
372 if (!m) {
373 if (sc->flags & FLG_DEBUG)
374 log(LOG_ERR,
375 "%s: can't get mbuf\n", NG_NODE_NAME(node));
376 ERROUT(ENOBUFS);
377 }
378 m->m_len = m->m_pkthdr.len = 0;
379 m->m_pkthdr.rcvif = NULL;

--- 308 unchanged lines hidden ---
372 if (!m) {
373 if (sc->flags & FLG_DEBUG)
374 log(LOG_ERR,
375 "%s: can't get mbuf\n", NG_NODE_NAME(node));
376 ERROUT(ENOBUFS);
377 }
378 m->m_len = m->m_pkthdr.len = 0;
379 m->m_pkthdr.rcvif = NULL;

--- 308 unchanged lines hidden ---