ng_h4.c (107120) | ng_h4.c (109623) |
---|---|
1/* 2 * ng_h4.c 3 * 4 * Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com> 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 12 unchanged lines hidden (view full) --- 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * 28 * $Id: ng_h4.c,v 1.25 2002/11/03 02:17:31 max Exp $ | 1/* 2 * ng_h4.c 3 * 4 * Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com> 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 12 unchanged lines hidden (view full) --- 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * 28 * $Id: ng_h4.c,v 1.25 2002/11/03 02:17:31 max Exp $ |
29 * $FreeBSD: head/sys/netgraph/bluetooth/drivers/h4/ng_h4.c 107120 2002-11-20 23:01:59Z julian $ | 29 * $FreeBSD: head/sys/netgraph/bluetooth/drivers/h4/ng_h4.c 109623 2003-01-21 08:56:16Z alfred $ |
30 * 31 * Based on: 32 * --------- 33 * 34 * FreeBSD: src/sys/netgraph/ng_tty.c 35 * Author: Archie Cobbs <archie@freebsd.org> 36 * 37 */ --- 127 unchanged lines hidden (view full) --- 165 /* Already installed? */ 166 if (tp->t_line == H4DISC) { 167 sc = (ng_h4_info_p) tp->t_sc; 168 if (sc != NULL && sc->tp == tp) 169 goto out; 170 } 171 172 /* Initialize private struct */ | 30 * 31 * Based on: 32 * --------- 33 * 34 * FreeBSD: src/sys/netgraph/ng_tty.c 35 * Author: Archie Cobbs <archie@freebsd.org> 36 * 37 */ --- 127 unchanged lines hidden (view full) --- 165 /* Already installed? */ 166 if (tp->t_line == H4DISC) { 167 sc = (ng_h4_info_p) tp->t_sc; 168 if (sc != NULL && sc->tp == tp) 169 goto out; 170 } 171 172 /* Initialize private struct */ |
173 MALLOC(sc, ng_h4_info_p, sizeof(*sc), M_NETGRAPH_H4, M_WAITOK | M_ZERO); | 173 MALLOC(sc, ng_h4_info_p, sizeof(*sc), M_NETGRAPH_H4, M_ZERO); |
174 if (sc == NULL) { 175 error = ENOMEM; 176 goto out; 177 } 178 179 sc->tp = tp; 180 sc->debug = NG_H4_WARN_LEVEL; 181 --- 329 unchanged lines hidden (view full) --- 511 case NG_H4_W4_PKT_DATA: 512 NG_H4_INFO("%s: %s - got full packet, packet type=%#x, " \ 513 "packet size=%d\n", __func__, 514 NG_NODE_NAME(sc->node), sc->ibuf[0], sc->got); 515 516 if (sc->hook != NULL && NG_HOOK_IS_VALID(sc->hook)) { 517 struct mbuf *m = NULL; 518 | 174 if (sc == NULL) { 175 error = ENOMEM; 176 goto out; 177 } 178 179 sc->tp = tp; 180 sc->debug = NG_H4_WARN_LEVEL; 181 --- 329 unchanged lines hidden (view full) --- 511 case NG_H4_W4_PKT_DATA: 512 NG_H4_INFO("%s: %s - got full packet, packet type=%#x, " \ 513 "packet size=%d\n", __func__, 514 NG_NODE_NAME(sc->node), sc->ibuf[0], sc->got); 515 516 if (sc->hook != NULL && NG_HOOK_IS_VALID(sc->hook)) { 517 struct mbuf *m = NULL; 518 |
519 MGETHDR(m, M_DONTWAIT, MT_DATA); | 519 MGETHDR(m, M_NOWAIT, MT_DATA); |
520 if (m != NULL) { 521 m->m_pkthdr.len = 0; 522 523 /* XXX m_copyback() is stupid */ 524 m->m_len = min(MHLEN, sc->got); 525 526 m_copyback(m, 0, sc->got, sc->ibuf); 527 NG_SEND_DATA_ONLY(c, sc->hook, m); --- 532 unchanged lines hidden --- | 520 if (m != NULL) { 521 m->m_pkthdr.len = 0; 522 523 /* XXX m_copyback() is stupid */ 524 m->m_len = min(MHLEN, sc->got); 525 526 m_copyback(m, 0, sc->got, sc->ibuf); 527 NG_SEND_DATA_ONLY(c, sc->hook, m); --- 532 unchanged lines hidden --- |