diff options
author | bmilekic <bmilekic@FreeBSD.org> | 2002-12-19 22:58:27 +0000 |
---|---|---|
committer | bmilekic <bmilekic@FreeBSD.org> | 2002-12-19 22:58:27 +0000 |
commit | 514c635ee6d3ff47b542ec91a037e7a241c1357c (patch) | |
tree | fb78678839efbdec9c58873ff5e7df1cf42aa7f5 /sys/netgraph | |
parent | 13bc2a4ca63803cb5287e5acd86ed9b2e3238689 (diff) | |
download | FreeBSD-src-514c635ee6d3ff47b542ec91a037e7a241c1357c.zip FreeBSD-src-514c635ee6d3ff47b542ec91a037e7a241c1357c.tar.gz |
o Untangle the confusion with the malloc flags {M_WAITOK, M_NOWAIT} and
the mbuf allocator flags {M_TRYWAIT, M_DONTWAIT}.
o Fix a bpf_compat issue where malloc() was defined to just call
bpf_alloc() and pass the 'canwait' flag(s) along. It's been changed
to call bpf_alloc() but pass the corresponding M_TRYWAIT or M_DONTWAIT
flag (and only one of those two).
Submitted by: Hiten Pandya <hiten@unixdaemons.com> (hiten->commit_count++)
Diffstat (limited to 'sys/netgraph')
-rw-r--r-- | sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c | 2 | ||||
-rw-r--r-- | sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c | 4 | ||||
-rw-r--r-- | sys/netgraph/ng_bridge.c | 2 | ||||
-rw-r--r-- | sys/netgraph/ng_l2tp.c | 10 | ||||
-rw-r--r-- | sys/netgraph/ng_one2many.c | 2 | ||||
-rw-r--r-- | sys/netgraph/ng_ppp.c | 4 | ||||
-rw-r--r-- | sys/netgraph/ng_pptpgre.c | 2 | ||||
-rw-r--r-- | sys/netgraph/ng_source.c | 2 | ||||
-rw-r--r-- | sys/netgraph/ng_tee.c | 2 |
9 files changed, 15 insertions, 15 deletions
diff --git a/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c b/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c index 69fcbf0..8fa8a08 100644 --- a/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c +++ b/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c @@ -1271,7 +1271,7 @@ ng_btsocket_hci_raw_send(struct socket *so, int flags, struct mbuf *m, sa = (struct sockaddr *) &pcb->addr; } - MGET(nam, M_WAITOK, MT_SONAME); + MGET(nam, M_TRYWAIT, MT_SONAME); if (nam == NULL) { error = ENOBUFS; goto drop; diff --git a/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c b/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c index 8360038..dec7a3c 100644 --- a/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c +++ b/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c @@ -1464,7 +1464,7 @@ ng_btsocket_l2cap_data_input(struct mbuf *m, hook_p hook) * it is a broadcast traffic after all */ - copy = m_dup(m, M_NOWAIT); + copy = m_dup(m, M_DONTWAIT); if (copy != NULL) { sbappendrecord(&pcb->so->so_rcv, copy); sorwakeup(pcb->so); @@ -2384,7 +2384,7 @@ ng_btsocket_l2cap_send2(ng_btsocket_l2cap_pcb_p pcb) if (pcb->so->so_snd.sb_cc == 0) return (EINVAL); /* XXX */ - m = m_dup(pcb->so->so_snd.sb_mb, M_NOWAIT); + m = m_dup(pcb->so->so_snd.sb_mb, M_DONTWAIT); if (m == NULL) return (ENOBUFS); diff --git a/sys/netgraph/ng_bridge.c b/sys/netgraph/ng_bridge.c index 1e1ff1c..f552a50 100644 --- a/sys/netgraph/ng_bridge.c +++ b/sys/netgraph/ng_bridge.c @@ -713,7 +713,7 @@ ng_bridge_rcvdata(hook_p hook, item_p item) * It's usable link but not the reserved (first) one. * Copy mbuf and meta info for sending. */ - m2 = m_dup(m, M_NOWAIT); /* XXX m_copypacket() */ + m2 = m_dup(m, M_DONTWAIT); /* XXX m_copypacket() */ if (m2 == NULL) { link->stats.memoryFailures++; NG_FREE_ITEM(item); diff --git a/sys/netgraph/ng_l2tp.c b/sys/netgraph/ng_l2tp.c index e467cb5..ebc6a41 100644 --- a/sys/netgraph/ng_l2tp.c +++ b/sys/netgraph/ng_l2tp.c @@ -55,6 +55,7 @@ #include <sys/mbuf.h> #include <sys/malloc.h> #include <sys/errno.h> +#include <sys/libkern.h> #include <netgraph/ng_message.h> #include <netgraph/netgraph.h> @@ -295,9 +296,8 @@ NETGRAPH_INIT(l2tp, &ng_l2tp_typestruct); #define L2TP_SEQ_CHECK(x) do { } while (0) #endif -/* mem*() macros */ +/* memmove macro */ #define memmove(d, s, l) ovbcopy(s, d, l) -#define memset(d, z, l) bzero(d, l) /* XXX */ /* Whether to use m_copypacket() or m_dup() */ #define L2TP_COPY_MBUF m_copypacket @@ -955,7 +955,7 @@ ng_l2tp_recv_ctrl(node_p node, item_p item) } /* Copy packet */ - if ((m = L2TP_COPY_MBUF(seq->xwin[i], M_NOWAIT)) == NULL) { + if ((m = L2TP_COPY_MBUF(seq->xwin[i], M_DONTWAIT)) == NULL) { priv->stats.memoryFailures++; return (ENOBUFS); } @@ -1219,7 +1219,7 @@ ng_l2tp_seq_recv_nr(priv_p priv, u_int16_t nr) */ while ((i = L2TP_SEQ_DIFF(seq->ns, seq->rack)) < seq->cwnd && seq->xwin[i] != NULL) { - if ((m = L2TP_COPY_MBUF(seq->xwin[i], M_NOWAIT)) == NULL) + if ((m = L2TP_COPY_MBUF(seq->xwin[i], M_DONTWAIT)) == NULL) priv->stats.memoryFailures++; else ng_l2tp_xmit_ctrl(priv, m, seq->ns); @@ -1361,7 +1361,7 @@ ng_l2tp_seq_rack_timeout(void *arg) seq->acks = 0; /* Retransmit oldest unack'd packet */ - if ((m = L2TP_COPY_MBUF(seq->xwin[0], M_NOWAIT)) == NULL) + if ((m = L2TP_COPY_MBUF(seq->xwin[0], M_DONTWAIT)) == NULL) priv->stats.memoryFailures++; else ng_l2tp_xmit_ctrl(priv, m, seq->rack); diff --git a/sys/netgraph/ng_one2many.c b/sys/netgraph/ng_one2many.c index 5332049..927bb77 100644 --- a/sys/netgraph/ng_one2many.c +++ b/sys/netgraph/ng_one2many.c @@ -427,7 +427,7 @@ ng_one2many_rcvdata(hook_p hook, item_p item) struct ng_one2many_link *mdst; mdst = &priv->many[priv->activeMany[i]]; - m2 = m_dup(m, M_NOWAIT); /* XXX m_copypacket() */ + m2 = m_dup(m, M_DONTWAIT); /* XXX m_copypacket() */ if (m2 == NULL) { mdst->stats.memoryFailures++; NG_FREE_ITEM(item); diff --git a/sys/netgraph/ng_ppp.c b/sys/netgraph/ng_ppp.c index 16373e3..6ffb082 100644 --- a/sys/netgraph/ng_ppp.c +++ b/sys/netgraph/ng_ppp.c @@ -1595,7 +1595,7 @@ deliver: /* Split off next fragment as "m2" */ m2 = m; if (!lastFragment) { - struct mbuf *n = m_split(m, len, M_NOWAIT); + struct mbuf *n = m_split(m, len, M_DONTWAIT); if (n == NULL) { NG_FREE_M(m); @@ -1916,7 +1916,7 @@ ng_ppp_addproto(struct mbuf *m, int proto, int compOK) static struct mbuf * ng_ppp_prepend(struct mbuf *m, const void *buf, int len) { - M_PREPEND(m, len, M_NOWAIT); + M_PREPEND(m, len, M_DONTWAIT); if (m == NULL || (m->m_len < len && (m = m_pullup(m, len)) == NULL)) return (NULL); bcopy(buf, mtod(m, u_char *), len); diff --git a/sys/netgraph/ng_pptpgre.c b/sys/netgraph/ng_pptpgre.c index f87e415..50811da 100644 --- a/sys/netgraph/ng_pptpgre.c +++ b/sys/netgraph/ng_pptpgre.c @@ -532,7 +532,7 @@ ng_pptpgre_xmit(node_p node, item_p item) m->m_len = m->m_pkthdr.len = grelen; m->m_pkthdr.rcvif = NULL; } else { - M_PREPEND(m, grelen, M_NOWAIT); + M_PREPEND(m, grelen, M_DONTWAIT); if (m == NULL || (m->m_len < grelen && (m = m_pullup(m, grelen)) == NULL)) { priv->stats.memoryFailures++; diff --git a/sys/netgraph/ng_source.c b/sys/netgraph/ng_source.c index 4932b3f..b2e976c 100644 --- a/sys/netgraph/ng_source.c +++ b/sys/netgraph/ng_source.c @@ -638,7 +638,7 @@ ng_source_send (sc_p sc, int tosend, int *sent_p) break; /* duplicate the packet */ - m2 = m_copypacket(m, M_NOWAIT); + m2 = m_copypacket(m, M_DONTWAIT); if (m2 == NULL) { s = splnet(); IF_PREPEND(&sc->snd_queue, m); diff --git a/sys/netgraph/ng_tee.c b/sys/netgraph/ng_tee.c index 877ef16..fbe80ba 100644 --- a/sys/netgraph/ng_tee.c +++ b/sys/netgraph/ng_tee.c @@ -334,7 +334,7 @@ ngt_rcvdata(hook_p hook, item_p item) meta_p meta2; /* Copy packet (failure will not stop the original)*/ - m2 = m_dup(m, M_NOWAIT); + m2 = m_dup(m, M_DONTWAIT); if (m2) { /* Copy meta info */ |