From 5a975a3dcb66c383a644f58dd3a9a43c6ba43ac9 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Thu, 26 Jun 2008 23:05:40 +0000 Subject: [PATCH] Netgraph port from FreeBSD - initial porting work * Use relative #include's as appropriate so the code doesn't dig into the original netgraph/ directory. * Move FBSDID's and add DragonFly ids. * Fix improper uses of M_NOWAIT. * Fix uses of M_NOWAIT which should be MB_DONTWAIT and vise-versa (also forward to Julian). * Add a dragonfly.h compatibility header. * NOTE: m_tag_alloc() in DFly takes MB_ flags. --- sys/netgraph7/atm/ccatm/ng_ccatm.c | 77 ++++++++------- sys/netgraph7/atm/ccatm/ng_ccatm_cust.h | 14 +-- sys/netgraph7/atm/ng_atm.c | 70 +++++++------- sys/netgraph7/atm/ng_atm.h | 1 + sys/netgraph7/atm/ng_ccatm.h | 1 + sys/netgraph7/atm/ng_sscfu.h | 1 + sys/netgraph7/atm/ng_sscop.h | 1 + sys/netgraph7/atm/ng_uni.h | 1 + sys/netgraph7/atm/ngatmbase.c | 37 ++++---- sys/netgraph7/atm/ngatmbase.h | 1 + sys/netgraph7/atm/sscfu/ng_sscfu.c | 41 ++++---- sys/netgraph7/atm/sscfu/ng_sscfu_cust.h | 12 ++- sys/netgraph7/atm/sscop/ng_sscop.c | 44 ++++----- sys/netgraph7/atm/sscop/ng_sscop_cust.h | 32 ++++--- sys/netgraph7/atm/uni/ng_uni.c | 46 ++++----- sys/netgraph7/atm/uni/ng_uni_cust.h | 8 +- sys/netgraph7/bluetooth/common/ng_bluetooth.c | 4 +- .../bluetooth/drivers/bt3c/ng_bt3c_pccard.c | 30 +++--- .../bluetooth/drivers/bt3c/ng_bt3c_var.h | 1 + sys/netgraph7/bluetooth/drivers/h4/ng_h4.c | 32 ++++--- .../bluetooth/drivers/h4/ng_h4_prse.h | 1 + .../bluetooth/drivers/h4/ng_h4_var.h | 1 + sys/netgraph7/bluetooth/drivers/ubt/ng_ubt.c | 45 ++++----- .../bluetooth/drivers/ubt/ng_ubt_var.h | 1 + .../bluetooth/drivers/ubtbcmfw/ubtbcmfw.c | 1 + sys/netgraph7/bluetooth/hci/ng_hci_cmds.c | 21 ++-- sys/netgraph7/bluetooth/hci/ng_hci_cmds.h | 1 + sys/netgraph7/bluetooth/hci/ng_hci_evnt.c | 23 ++--- sys/netgraph7/bluetooth/hci/ng_hci_evnt.h | 1 + sys/netgraph7/bluetooth/hci/ng_hci_main.c | 49 +++++----- sys/netgraph7/bluetooth/hci/ng_hci_misc.c | 27 +++--- sys/netgraph7/bluetooth/hci/ng_hci_misc.h | 1 + sys/netgraph7/bluetooth/hci/ng_hci_prse.h | 1 + sys/netgraph7/bluetooth/hci/ng_hci_ulpi.c | 49 +++++----- sys/netgraph7/bluetooth/hci/ng_hci_ulpi.h | 1 + sys/netgraph7/bluetooth/hci/ng_hci_var.h | 1 + .../bluetooth/include/ng_bluetooth.h | 1 + sys/netgraph7/bluetooth/include/ng_bt3c.h | 1 + sys/netgraph7/bluetooth/include/ng_btsocket.h | 1 + .../bluetooth/include/ng_btsocket_hci_raw.h | 1 + .../bluetooth/include/ng_btsocket_l2cap.h | 1 + .../bluetooth/include/ng_btsocket_rfcomm.h | 1 + sys/netgraph7/bluetooth/include/ng_h4.h | 1 + sys/netgraph7/bluetooth/include/ng_hci.h | 1 + sys/netgraph7/bluetooth/include/ng_l2cap.h | 1 + sys/netgraph7/bluetooth/include/ng_ubt.h | 1 + sys/netgraph7/bluetooth/l2cap/ng_l2cap_cmds.c | 23 ++--- sys/netgraph7/bluetooth/l2cap/ng_l2cap_cmds.h | 23 ++--- sys/netgraph7/bluetooth/l2cap/ng_l2cap_evnt.c | 25 ++--- sys/netgraph7/bluetooth/l2cap/ng_l2cap_evnt.h | 1 + sys/netgraph7/bluetooth/l2cap/ng_l2cap_llpi.c | 33 +++---- sys/netgraph7/bluetooth/l2cap/ng_l2cap_llpi.h | 1 + sys/netgraph7/bluetooth/l2cap/ng_l2cap_main.c | 41 ++++---- sys/netgraph7/bluetooth/l2cap/ng_l2cap_misc.c | 33 +++---- sys/netgraph7/bluetooth/l2cap/ng_l2cap_misc.h | 1 + sys/netgraph7/bluetooth/l2cap/ng_l2cap_prse.h | 1 + sys/netgraph7/bluetooth/l2cap/ng_l2cap_ulpi.c | 47 ++++----- sys/netgraph7/bluetooth/l2cap/ng_l2cap_ulpi.h | 1 + sys/netgraph7/bluetooth/l2cap/ng_l2cap_var.h | 1 + sys/netgraph7/bluetooth/socket/ng_btsocket.c | 19 ++-- .../bluetooth/socket/ng_btsocket_hci_raw.c | 37 ++++---- .../bluetooth/socket/ng_btsocket_l2cap.c | 39 ++++---- .../bluetooth/socket/ng_btsocket_l2cap_raw.c | 35 +++---- .../bluetooth/socket/ng_btsocket_rfcomm.c | 39 ++++---- sys/netgraph7/dragonfly.h | 73 ++++++++++++++ sys/netgraph7/netflow/netflow.c | 21 ++-- sys/netgraph7/netflow/ng_netflow.c | 23 +++-- sys/netgraph7/netgraph.h | 4 +- sys/netgraph7/ng_UI.c | 11 ++- sys/netgraph7/ng_UI.h | 1 + sys/netgraph7/ng_async.c | 23 ++--- sys/netgraph7/ng_async.h | 1 + sys/netgraph7/ng_atmllc.c | 13 +-- sys/netgraph7/ng_atmllc.h | 1 + sys/netgraph7/ng_base.c | 25 ++--- sys/netgraph7/ng_bpf.c | 15 +-- sys/netgraph7/ng_bpf.h | 1 + sys/netgraph7/ng_bridge.c | 25 ++--- sys/netgraph7/ng_bridge.h | 1 + sys/netgraph7/ng_car.c | 17 ++-- sys/netgraph7/ng_car.h | 1 + sys/netgraph7/ng_cisco.c | 25 ++--- sys/netgraph7/ng_cisco.h | 1 + sys/netgraph7/ng_deflate.c | 21 ++-- sys/netgraph7/ng_deflate.h | 1 + sys/netgraph7/ng_device.c | 15 +-- sys/netgraph7/ng_device.h | 1 + sys/netgraph7/ng_echo.c | 7 +- sys/netgraph7/ng_echo.h | 1 + sys/netgraph7/ng_eiface.c | 17 ++-- sys/netgraph7/ng_eiface.h | 1 + sys/netgraph7/ng_etf.c | 17 ++-- sys/netgraph7/ng_etf.h | 1 + sys/netgraph7/ng_ether.c | 23 ++--- sys/netgraph7/ng_ether.h | 1 + sys/netgraph7/ng_fec.c | 19 ++-- sys/netgraph7/ng_fec.h | 1 + sys/netgraph7/ng_frame_relay.c | 11 ++- sys/netgraph7/ng_frame_relay.h | 1 + sys/netgraph7/ng_gif.c | 17 ++-- sys/netgraph7/ng_gif.h | 1 + sys/netgraph7/ng_gif_demux.c | 13 +-- sys/netgraph7/ng_gif_demux.h | 1 + sys/netgraph7/ng_hole.c | 13 +-- sys/netgraph7/ng_hole.h | 1 + sys/netgraph7/ng_hub.c | 9 +- sys/netgraph7/ng_hub.h | 1 + sys/netgraph7/ng_iface.c | 21 ++-- sys/netgraph7/ng_iface.h | 1 + sys/netgraph7/ng_ip_input.c | 7 +- sys/netgraph7/ng_ip_input.h | 1 + sys/netgraph7/ng_ipfw.c | 15 +-- sys/netgraph7/ng_ipfw.h | 1 + sys/netgraph7/ng_ksocket.c | 25 ++--- sys/netgraph7/ng_ksocket.h | 1 + sys/netgraph7/ng_l2tp.c | 37 ++++---- sys/netgraph7/ng_l2tp.h | 1 + sys/netgraph7/ng_lmi.c | 17 ++-- sys/netgraph7/ng_lmi.h | 1 + sys/netgraph7/ng_message.h | 1 + sys/netgraph7/ng_mppc.c | 95 ++++++++++--------- sys/netgraph7/ng_mppc.h | 1 + sys/netgraph7/ng_nat.c | 31 +++--- sys/netgraph7/ng_nat.h | 1 + sys/netgraph7/ng_one2many.c | 19 ++-- sys/netgraph7/ng_one2many.h | 1 + sys/netgraph7/ng_parse.c | 15 +-- sys/netgraph7/ng_parse.h | 1 + sys/netgraph7/ng_ppp.c | 27 +++--- sys/netgraph7/ng_ppp.h | 1 + sys/netgraph7/ng_pppoe.c | 63 ++++++------ sys/netgraph7/ng_pppoe.h | 1 + sys/netgraph7/ng_pptpgre.c | 23 ++--- sys/netgraph7/ng_pptpgre.h | 1 + sys/netgraph7/ng_pred1.c | 17 ++-- sys/netgraph7/ng_pred1.h | 1 + sys/netgraph7/ng_rfc1490.c | 23 ++--- sys/netgraph7/ng_rfc1490.h | 1 + sys/netgraph7/ng_sample.c | 13 +-- sys/netgraph7/ng_sample.h | 1 + sys/netgraph7/ng_socket.c | 37 ++++---- sys/netgraph7/ng_socket.h | 1 + sys/netgraph7/ng_socketvar.h | 1 + sys/netgraph7/ng_source.c | 34 +++---- sys/netgraph7/ng_source.h | 1 + sys/netgraph7/ng_split.c | 9 +- sys/netgraph7/ng_split.h | 1 + sys/netgraph7/ng_sppp.c | 19 ++-- sys/netgraph7/ng_sppp.h | 1 + sys/netgraph7/ng_tag.c | 11 ++- sys/netgraph7/ng_tag.h | 1 + sys/netgraph7/ng_tcpmss.c | 13 +-- sys/netgraph7/ng_tcpmss.h | 1 + sys/netgraph7/ng_tee.c | 15 +-- sys/netgraph7/ng_tee.h | 1 + sys/netgraph7/ng_tty.c | 11 ++- sys/netgraph7/ng_tty.h | 1 + sys/netgraph7/ng_vjc.c | 19 ++-- sys/netgraph7/ng_vjc.h | 1 + sys/netgraph7/ng_vlan.c | 19 ++-- sys/netgraph7/ng_vlan.h | 1 + 161 files changed, 1229 insertions(+), 998 deletions(-) create mode 100644 sys/netgraph7/dragonfly.h diff --git a/sys/netgraph7/atm/ccatm/ng_ccatm.c b/sys/netgraph7/atm/ccatm/ng_ccatm.c index 404f54e7c8..c583a2e326 100644 --- a/sys/netgraph7/atm/ccatm/ng_ccatm.c +++ b/sys/netgraph7/atm/ccatm/ng_ccatm.c @@ -31,13 +31,12 @@ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/netgraph/atm/ccatm/ng_ccatm.c,v 1.3 2006/09/30 12:37:43 netchild Exp $ + * $DragonFly: src/sys/netgraph7/atm/ccatm/ng_ccatm.c,v 1.2 2008/06/26 23:05:39 dillon Exp $ + * $DragonFly: src/sys/netgraph7/atm/ccatm/ng_ccatm.c,v 1.2 2008/06/26 23:05:39 dillon Exp $ * * ATM call control and API */ -#include -__FBSDID("$FreeBSD: src/sys/netgraph/atm/ccatm/ng_ccatm.c,v 1.3 2006/09/30 12:37:43 netchild Exp $"); - #include #include #include @@ -49,17 +48,17 @@ __FBSDID("$FreeBSD: src/sys/netgraph/atm/ccatm/ng_ccatm.c,v 1.3 2006/09/30 12:37 #include #include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_parse.h" #include #include #include #include -#include -#include +#include "atm/ngatmbase.h" +#include "atm/ng_uni.h" #include -#include +#include "atm/ng_ccatm.h" #include MODULE_DEPEND(ng_ccatm, ngatmbase, 1, 1, 1); @@ -348,14 +347,14 @@ ng_ccatm_constructor(node_p node) { struct ccnode *priv; - priv = malloc(sizeof(*priv), M_NG_CCATM, M_NOWAIT | M_ZERO); + priv = kmalloc(sizeof(*priv), M_NG_CCATM, M_WAITOK | M_NULLOK | M_ZERO); if (priv == NULL) return (ENOMEM); priv->node = node; priv->data = cc_create(&cc_funcs); if (priv->data == NULL) { - free(priv, M_NG_CCATM); + kfree(priv, M_NG_CCATM); return (ENOMEM); } @@ -377,7 +376,7 @@ ng_ccatm_shutdown(node_p node) cc_destroy(priv->data); - free(priv, M_NG_CCATM); + kfree(priv, M_NG_CCATM); NG_NODE_SET_PRIVATE(node, NULL); NG_NODE_UNREF(node); @@ -406,10 +405,10 @@ ng_ccatm_get_addresses(node_p node, uint32_t portno, struct ng_mesg *msg, return (err); len = sizeof(*list) + count * sizeof(list->addr[0]); - NG_MKRESPONSE(*resp, msg, len, M_NOWAIT); + NG_MKRESPONSE(*resp, msg, len, M_WAITOK | M_NULLOK); if (*resp == NULL) { - free(addrs, M_NG_CCATM); - free(ports, M_NG_CCATM); + kfree(addrs, M_NG_CCATM); + kfree(ports, M_NG_CCATM); return (ENOMEM); } list = (struct ngm_ccatm_get_addresses *)(*resp)->data; @@ -420,8 +419,8 @@ ng_ccatm_get_addresses(node_p node, uint32_t portno, struct ng_mesg *msg, list->addr[i].addr = addrs[i]; } - free(addrs, M_NG_CCATM); - free(ports, M_NG_CCATM); + kfree(addrs, M_NG_CCATM); + kfree(ports, M_NG_CCATM); return (0); } @@ -436,13 +435,13 @@ send_dump(struct ccdata *data, void *uarg, const char *buf) struct ccnode *priv = uarg; if (priv->dump == NULL) { - m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + m = m_getcl(MB_DONTWAIT, MT_DATA, M_PKTHDR); if (m == NULL) return (ENOBUFS); priv->dump_first = priv->dump_last = m; m->m_pkthdr.len = 0; } else { - m = m_getcl(M_DONTWAIT, MT_DATA, 0); + m = m_getcl(MB_DONTWAIT, MT_DATA, 0); if (m == 0) { m_freem(priv->dump_first); return (ENOBUFS); @@ -545,7 +544,7 @@ ng_ccatm_rcvmsg(node_p node, item_p item, hook_p lasthook) &state); if (error == 0) { NG_MKRESPONSE(resp, msg, sizeof(uint32_t), - M_NOWAIT); + M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -620,7 +619,7 @@ ng_ccatm_rcvmsg(node_p node, item_p item, hook_p lasthook) } arg = (struct ngm_ccatm_port *)msg->data; NG_MKRESPONSE(resp, msg, sizeof(struct atm_port_info), - M_NOWAIT); + M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -628,7 +627,7 @@ ng_ccatm_rcvmsg(node_p node, item_p item, hook_p lasthook) error = cc_port_get_param(priv->data, arg->port, (struct atm_port_info *)resp->data); if (error != 0) { - free(resp, M_NETGRAPH_MSG); + kfree(resp, M_NETGRAPH_MSG); resp = NULL; } break; @@ -661,9 +660,9 @@ ng_ccatm_rcvmsg(node_p node, item_p item, hook_p lasthook) break; NG_MKRESPONSE(resp, msg, sizeof(*arg) + - n * sizeof(arg->ports[0]), M_NOWAIT); + n * sizeof(arg->ports[0]), M_WAITOK | M_NULLOK); if (resp == NULL) { - free(ports, M_NG_CCATM); + kfree(ports, M_NG_CCATM); error = ENOMEM; break; } @@ -672,7 +671,7 @@ ng_ccatm_rcvmsg(node_p node, item_p item, hook_p lasthook) arg->nports = 0; for (arg->nports = 0; arg->nports < n; arg->nports++) arg->ports[arg->nports] = ports[arg->nports]; - free(ports, M_NG_CCATM); + kfree(ports, M_NG_CCATM); break; } @@ -689,7 +688,7 @@ ng_ccatm_rcvmsg(node_p node, item_p item, hook_p lasthook) cc_set_log(priv->data, *(uint32_t *)msg->data); } - NG_MKRESPONSE(resp, msg, sizeof(uint32_t), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(uint32_t), M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; if (msg->header.arglen != 0) @@ -736,7 +735,7 @@ ng_ccatm_rcvmsg(node_p node, item_p item, hook_p lasthook) s.nconns * sizeof(*conns) + s.nparties * sizeof(*parties); - NG_MKRESPONSE(resp, msg, offs, M_NOWAIT); + NG_MKRESPONSE(resp, msg, offs, M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -761,10 +760,10 @@ ng_ccatm_rcvmsg(node_p node, item_p item, hook_p lasthook) sizeof(*parties) * s.nparties); offs += sizeof(*parties) * s.nparties; - free(eps, M_NG_CCATM); - free(ports, M_NG_CCATM); - free(conns, M_NG_CCATM); - free(parties, M_NG_CCATM); + kfree(eps, M_NG_CCATM); + kfree(ports, M_NG_CCATM); + kfree(conns, M_NG_CCATM); + kfree(parties, M_NG_CCATM); break; } @@ -810,7 +809,7 @@ ng_ccatm_newhook(node_p node, hook_p hook, const char *name) if (*end != '\0' || lport == 0 || lport > 0xffffffff) return (EINVAL); - hd = malloc(sizeof(*hd), M_NG_CCATM, M_NOWAIT); + hd = kmalloc(sizeof(*hd), M_NG_CCATM, M_WAITOK | M_NULLOK); if (hd == NULL) return (ENOMEM); hd->is_uni = 1; @@ -819,7 +818,7 @@ ng_ccatm_newhook(node_p node, hook_p hook, const char *name) port = cc_port_create(priv->data, hd, (u_int)lport); if (port == NULL) { - free(hd, M_NG_CCATM); + kfree(hd, M_NG_CCATM); return (ENOMEM); } hd->inst = port; @@ -848,7 +847,7 @@ ng_ccatm_newhook(node_p node, hook_p hook, const char *name) /* * User hook */ - hd = malloc(sizeof(*hd), M_NG_CCATM, M_NOWAIT); + hd = kmalloc(sizeof(*hd), M_NG_CCATM, M_WAITOK | M_NULLOK); if (hd == NULL) return (ENOMEM); hd->is_uni = 0; @@ -857,7 +856,7 @@ ng_ccatm_newhook(node_p node, hook_p hook, const char *name) user = cc_user_create(priv->data, hd, NG_HOOK_NAME(hook)); if (user == NULL) { - free(hd, M_NG_CCATM); + kfree(hd, M_NG_CCATM); return (ENOMEM); } @@ -896,7 +895,7 @@ ng_ccatm_disconnect(hook_p hook) cc = hd->node->data; - free(hd, M_NG_CCATM); + kfree(hd, M_NG_CCATM); NG_HOOK_SET_PRIVATE(hook, NULL); priv->hook_cnt--; @@ -960,7 +959,7 @@ pack_buf(void *h, size_t hlen, void *t, size_t tlen) size_t n; /* header should fit into a normal mbuf */ - MGETHDR(m0, M_NOWAIT, MT_DATA); + MGETHDR(m0, MB_DONTWAIT, MT_DATA); if (m0 == NULL) return NULL; @@ -973,11 +972,11 @@ pack_buf(void *h, size_t hlen, void *t, size_t tlen) last = m0; while ((n = tlen) != 0) { if (n > MLEN) { - m = m_getcl(M_NOWAIT, MT_DATA, 0); + m = m_getcl(MB_DONTWAIT, MT_DATA, 0); if (n > MCLBYTES) n = MCLBYTES; } else - MGET(m, M_NOWAIT, MT_DATA); + MGET(m, MB_DONTWAIT, MT_DATA); if(m == NULL) goto drop; diff --git a/sys/netgraph7/atm/ccatm/ng_ccatm_cust.h b/sys/netgraph7/atm/ccatm/ng_ccatm_cust.h index 0749a94998..90596e1912 100644 --- a/sys/netgraph7/atm/ccatm/ng_ccatm_cust.h +++ b/sys/netgraph7/atm/ccatm/ng_ccatm_cust.h @@ -29,6 +29,8 @@ * Customisation of call control source to the NG environment. * * $FreeBSD: src/sys/netgraph/atm/ccatm/ng_ccatm_cust.h,v 1.2 2005/01/07 01:45:41 imp Exp $ + * $DragonFly: src/sys/netgraph7/atm/ccatm/ng_ccatm_cust.h,v 1.2 2008/06/26 23:05:39 dillon Exp $ + * $DragonFly: src/sys/netgraph7/atm/ccatm/ng_ccatm_cust.h,v 1.2 2008/06/26 23:05:39 dillon Exp $ */ #include @@ -39,16 +41,16 @@ #include #include #include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "atm/ngatmbase.h" #define CCASSERT(E, M) KASSERT(E, M) MALLOC_DECLARE(M_NG_CCATM); -#define CCMALLOC(S) (malloc((S), M_NG_CCATM, M_NOWAIT)) -#define CCZALLOC(S) (malloc((S), M_NG_CCATM, M_NOWAIT | M_ZERO)) -#define CCFREE(P) do { free((P), M_NG_CCATM); } while (0) +#define CCMALLOC(S) (kmalloc((S), M_NG_CCATM, M_WAITOK | M_NULLOK)) +#define CCZALLOC(S) (kmalloc((S), M_NG_CCATM, M_WAITOK | M_NULLOK | M_ZERO)) +#define CCFREE(P) do { kfree((P), M_NG_CCATM); } while (0) #define CCGETERRNO() (ENOMEM) diff --git a/sys/netgraph7/atm/ng_atm.c b/sys/netgraph7/atm/ng_atm.c index 9528ac54ba..53009c5220 100644 --- a/sys/netgraph7/atm/ng_atm.c +++ b/sys/netgraph7/atm/ng_atm.c @@ -25,15 +25,15 @@ * SUCH DAMAGE. * * Author: Hartmut Brandt + * + * $FreeBSD: src/sys/netgraph/atm/ng_atm.c,v 1.15 2005/08/10 06:25:40 obrien Exp $ + * $DragonFly: src/sys/netgraph7/atm/ng_atm.c,v 1.2 2008/06/26 23:05:37 dillon Exp $ + * $DragonFly: src/sys/netgraph7/atm/ng_atm.c,v 1.2 2008/06/26 23:05:37 dillon Exp $ */ /* * Netgraph module to connect NATM interfaces to netgraph. */ - -#include -__FBSDID("$FreeBSD: src/sys/netgraph/atm/ng_atm.c,v 1.15 2005/08/10 06:25:40 obrien Exp $"); - #include #include #include @@ -54,10 +54,10 @@ __FBSDID("$FreeBSD: src/sys/netgraph/atm/ng_atm.c,v 1.15 2005/08/10 06:25:40 obr #include #include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_parse.h" +#include "atm/ng_atm.h" /* * Hooks in the NATM code @@ -382,7 +382,7 @@ ng_atm_input(struct ifnet *ifp, struct mbuf **mp, /* * Prepend the atm_pseudoheader. */ - M_PREPEND(*mp, sizeof(*ah), M_DONTWAIT); + M_PREPEND(*mp, sizeof(*ah), MB_DONTWAIT); if (*mp == NULL) return; memcpy(mtod(*mp, struct atm_pseudohdr *), ah, sizeof(*ah)); @@ -460,7 +460,7 @@ ng_atm_input_orphans(struct ifnet *ifp, struct mbuf *m, /* * Prepend the atm_pseudoheader. */ - M_PREPEND(m, sizeof(*ah), M_DONTWAIT); + M_PREPEND(m, sizeof(*ah), MB_DONTWAIT); if (m == NULL) return; memcpy(mtod(m, struct atm_pseudohdr *), ah, sizeof(*ah)); @@ -500,7 +500,7 @@ ng_atm_rcvdata(hook_p hook, item_p item) /* * Prepend pseudo-hdr. Drivers don't care about the flags. */ - M_PREPEND(m, sizeof(*aph), M_DONTWAIT); + M_PREPEND(m, sizeof(*aph), MB_DONTWAIT); if (m == NULL) { NG_FREE_M(m); return (ENOMEM); @@ -554,7 +554,7 @@ ng_atm_event_func(node_p node, hook_p hook, void *arg, int event) /* convert into a flow control message */ NG_MKMESSAGE(mesg, NGM_FLOW_COOKIE, ev->busy ? NGM_HIGH_WATER_PASSED : NGM_LOW_WATER_PASSED, - sizeof(struct ngm_queue_state), M_NOWAIT); + sizeof(struct ngm_queue_state), M_WAITOK | M_NULLOK); if (mesg == NULL) break; qstate = (struct ngm_queue_state *)mesg->data; @@ -573,7 +573,7 @@ ng_atm_event_func(node_p node, hook_p hook, void *arg, int event) if (priv->manage == NULL) break; NG_MKMESSAGE(mesg, NGM_ATM_COOKIE, NGM_ATM_VCC_CHANGE, - sizeof(struct ngm_atm_vcc_change), M_NOWAIT); + sizeof(struct ngm_atm_vcc_change), M_WAITOK | M_NULLOK); if (mesg == NULL) break; chg = (struct ngm_atm_vcc_change *)mesg->data; @@ -593,7 +593,7 @@ ng_atm_event_func(node_p node, hook_p hook, void *arg, int event) if (priv->manage == NULL) break; NG_MKMESSAGE(mesg, NGM_ATM_COOKIE, NGM_ATM_IF_CHANGE, - sizeof(struct ngm_atm_if_change), M_NOWAIT); + sizeof(struct ngm_atm_if_change), M_WAITOK | M_NULLOK); if (mesg == NULL) break; chg = (struct ngm_atm_if_change *)mesg->data; @@ -618,7 +618,7 @@ ng_atm_event_func(node_p node, hook_p hook, void *arg, int event) /* convert into a flow control message */ NG_MKMESSAGE(mesg, NGM_ATM_COOKIE, NGM_ATM_ACR_CHANGE, - sizeof(struct ngm_atm_acr_change), M_NOWAIT); + sizeof(struct ngm_atm_acr_change), M_WAITOK | M_NULLOK); if (mesg == NULL) break; acr = (struct ngm_atm_acr_change *)mesg->data; @@ -916,7 +916,7 @@ ng_atm_rcvmsg(node_p node, item_p item, hook_p lasthook) switch (msg->header.cmd) { case NGM_TEXT_STATUS: - NG_MKRESPONSE(resp, msg, NG_TEXTRESPONSE, M_NOWAIT); + NG_MKRESPONSE(resp, msg, NG_TEXTRESPONSE, M_WAITOK | M_NULLOK); if(resp == NULL) { error = ENOMEM; break; @@ -936,7 +936,7 @@ ng_atm_rcvmsg(node_p node, item_p item, hook_p lasthook) switch (msg->header.cmd) { case NGM_ATM_GET_IFNAME: - NG_MKRESPONSE(resp, msg, IFNAMSIZ, M_NOWAIT); + NG_MKRESPONSE(resp, msg, IFNAMSIZ, M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -948,7 +948,7 @@ ng_atm_rcvmsg(node_p node, item_p item, hook_p lasthook) { struct ngm_atm_config *config; - NG_MKRESPONSE(resp, msg, sizeof(*config), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(*config), M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -978,15 +978,15 @@ ng_atm_rcvmsg(node_p node, item_p item, hook_p lasthook) len = sizeof(*vccs) + vccs->count * sizeof(vccs->vccs[0]); - NG_MKRESPONSE(resp, msg, len, M_NOWAIT); + NG_MKRESPONSE(resp, msg, len, M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; - free(vccs, M_DEVBUF); + kfree(vccs, M_DEVBUF); break; } (void)memcpy(resp->data, vccs, len); - free(vccs, M_DEVBUF); + kfree(vccs, M_DEVBUF); break; } @@ -1026,20 +1026,20 @@ ng_atm_rcvmsg(node_p node, item_p item, hook_p lasthook) break; if (i == vccs->count) { error = ENOTCONN; - free(vccs, M_DEVBUF); + kfree(vccs, M_DEVBUF); break; } NG_MKRESPONSE(resp, msg, sizeof(vccs->vccs[0]), - M_NOWAIT); + M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; - free(vccs, M_DEVBUF); + kfree(vccs, M_DEVBUF); break; } *(struct atmio_vcc *)resp->data = vccs->vccs[i]; - free(vccs, M_DEVBUF); + kfree(vccs, M_DEVBUF); break; } @@ -1070,20 +1070,20 @@ ng_atm_rcvmsg(node_p node, item_p item, hook_p lasthook) break; if (i == vccs->count) { error = ENOTCONN; - free(vccs, M_DEVBUF); + kfree(vccs, M_DEVBUF); break; } NG_MKRESPONSE(resp, msg, sizeof(vccs->vccs[0]), - M_NOWAIT); + M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; - free(vccs, M_DEVBUF); + kfree(vccs, M_DEVBUF); break; } *(struct atmio_vcc *)resp->data = vccs->vccs[i]; - free(vccs, M_DEVBUF); + kfree(vccs, M_DEVBUF); break; } @@ -1115,7 +1115,7 @@ ng_atm_rcvmsg(node_p node, item_p item, hook_p lasthook) error = EINVAL; break; } - NG_MKRESPONSE(resp, msg, sizeof(*p), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(*p), M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -1180,7 +1180,7 @@ ng_atm_newhook(node_p node, hook_p hook, const char *name) /* * Allocate a new entry */ - vcc = malloc(sizeof(*vcc), M_NETGRAPH, M_NOWAIT | M_ZERO); + vcc = kmalloc(sizeof(*vcc), M_NETGRAPH, M_WAITOK | M_NULLOK | M_ZERO); if (vcc == NULL) return (ENOMEM); @@ -1240,7 +1240,7 @@ ng_atm_disconnect(hook_p hook) NG_HOOK_SET_PRIVATE(hook, NULL); LIST_REMOVE(vcc, link); - free(vcc, M_NETGRAPH); + kfree(vcc, M_NETGRAPH); if (hook == priv->manage) priv->manage = NULL; @@ -1270,7 +1270,7 @@ ng_atm_attach(struct ifnet *ifp) return; } - priv = malloc(sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); + priv = kmalloc(sizeof(*priv), M_NETGRAPH, M_WAITOK | M_NULLOK | M_ZERO); if (priv == NULL) { log(LOG_ERR, "%s: can't allocate memory for %s\n", __func__, ifp->if_xname); @@ -1324,7 +1324,7 @@ ng_atm_shutdown(node_p node) * already handled in the detach routine. */ NG_NODE_SET_PRIVATE(node, NULL); - free(priv, M_NETGRAPH); + kfree(priv, M_NETGRAPH); NG_NODE_UNREF(node); return (0); @@ -1336,7 +1336,7 @@ ng_atm_shutdown(node_p node) else { IFP2NG_SET(priv->ifp, NULL); NG_NODE_SET_PRIVATE(node, NULL); - free(priv, M_NETGRAPH); + kfree(priv, M_NETGRAPH); NG_NODE_UNREF(node); } #else diff --git a/sys/netgraph7/atm/ng_atm.h b/sys/netgraph7/atm/ng_atm.h index 4b40657ada..16e286504e 100644 --- a/sys/netgraph7/atm/ng_atm.h +++ b/sys/netgraph7/atm/ng_atm.h @@ -31,6 +31,7 @@ * Netgraph module to connect NATM interfaces to netgraph. * * $FreeBSD: src/sys/netgraph/atm/ng_atm.h,v 1.5 2005/01/07 01:45:40 imp Exp $ + * $DragonFly: src/sys/netgraph7/atm/ng_atm.h,v 1.2 2008/06/26 23:05:37 dillon Exp $ */ #ifndef _NETGRAPH_ATM_NG_ATM_H_ #define _NETGRAPH_ATM_NG_ATM_H_ diff --git a/sys/netgraph7/atm/ng_ccatm.h b/sys/netgraph7/atm/ng_ccatm.h index b0ab97a59f..ecaecf5e15 100644 --- a/sys/netgraph7/atm/ng_ccatm.h +++ b/sys/netgraph7/atm/ng_ccatm.h @@ -31,6 +31,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netgraph/atm/ng_ccatm.h,v 1.2 2005/01/07 01:45:40 imp Exp $ + * $DragonFly: src/sys/netgraph7/atm/ng_ccatm.h,v 1.2 2008/06/26 23:05:37 dillon Exp $ */ /* diff --git a/sys/netgraph7/atm/ng_sscfu.h b/sys/netgraph7/atm/ng_sscfu.h index 5a8950a70d..666c280a33 100644 --- a/sys/netgraph7/atm/ng_sscfu.h +++ b/sys/netgraph7/atm/ng_sscfu.h @@ -27,6 +27,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netgraph/atm/ng_sscfu.h,v 1.2 2005/01/07 01:45:40 imp Exp $ + * $DragonFly: src/sys/netgraph7/atm/ng_sscfu.h,v 1.2 2008/06/26 23:05:37 dillon Exp $ * * Netgraph module for ITU-T Q.2120 UNI SSCF. */ diff --git a/sys/netgraph7/atm/ng_sscop.h b/sys/netgraph7/atm/ng_sscop.h index b4b2b3e6ad..b15ab93c01 100644 --- a/sys/netgraph7/atm/ng_sscop.h +++ b/sys/netgraph7/atm/ng_sscop.h @@ -27,6 +27,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netgraph/atm/ng_sscop.h,v 1.3 2005/01/07 01:45:40 imp Exp $ + * $DragonFly: src/sys/netgraph7/atm/ng_sscop.h,v 1.2 2008/06/26 23:05:37 dillon Exp $ * * Netgraph module for Q.2110 SSCOP */ diff --git a/sys/netgraph7/atm/ng_uni.h b/sys/netgraph7/atm/ng_uni.h index b2dc2c5c33..b0edea5377 100644 --- a/sys/netgraph7/atm/ng_uni.h +++ b/sys/netgraph7/atm/ng_uni.h @@ -27,6 +27,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netgraph/atm/ng_uni.h,v 1.2 2005/01/07 01:45:40 imp Exp $ + * $DragonFly: src/sys/netgraph7/atm/ng_uni.h,v 1.2 2008/06/26 23:05:37 dillon Exp $ * * Netgraph module for UNI 4.0 */ diff --git a/sys/netgraph7/atm/ngatmbase.c b/sys/netgraph7/atm/ngatmbase.c index 47fa5bf71f..dd630a5a4a 100644 --- a/sys/netgraph7/atm/ngatmbase.c +++ b/sys/netgraph7/atm/ngatmbase.c @@ -27,11 +27,12 @@ * SUCH DAMAGE. * * In-kernel UNI stack message functions. + * + * $FreeBSD: src/sys/netgraph/atm/ngatmbase.c,v 1.3 2005/01/07 01:45:40 imp Exp $ + * $DragonFly: src/sys/netgraph7/atm/ngatmbase.c,v 1.2 2008/06/26 23:05:37 dillon Exp $ + * $DragonFly: src/sys/netgraph7/atm/ngatmbase.c,v 1.2 2008/06/26 23:05:37 dillon Exp $ */ -#include -__FBSDID("$FreeBSD: src/sys/netgraph/atm/ngatmbase.c,v 1.3 2005/01/07 01:45:40 imp Exp $"); - #include #include #include @@ -42,7 +43,7 @@ __FBSDID("$FreeBSD: src/sys/netgraph/atm/ngatmbase.c,v 1.3 2005/01/07 01:45:40 i #include #include #include -#include +#include "atm/ngatmbase.h" #define NGATMBASE_VERSION 1 @@ -94,13 +95,13 @@ uni_msg_extend(struct uni_msg *m, size_t s) lead = uni_msg_leading(m); len = uni_msg_len(m); s += lead + len + EXTRA; - if ((b = malloc(s, M_UNIMSG, M_NOWAIT)) == NULL) { + if ((b = kmalloc(s, M_UNIMSG, MB_DONTWAIT)) == NULL) { uni_msg_destroy(m); return (ENOMEM); } bcopy(m->b_rptr, b + lead, len); - free(m->b_buf, M_UNIMSG); + kfree(m->b_buf, M_UNIMSG); m->b_buf = b; m->b_rptr = m->b_buf + lead; @@ -138,7 +139,7 @@ uni_msg_pack_mbuf(struct uni_msg *msg, void *hdr, size_t hdrlen) struct mbuf *m, *m0, *last; size_t n; - MGETHDR(m0, M_NOWAIT, MT_DATA); + MGETHDR(m0, MB_DONTWAIT, MT_DATA); if (m0 == NULL) return (NULL); @@ -151,7 +152,7 @@ uni_msg_pack_mbuf(struct uni_msg *msg, void *hdr, size_t hdrlen) } else { if ((n = uni_msg_len(msg)) > MHLEN) { - MCLGET(m0, M_NOWAIT); + MCLGET(m0, MB_DONTWAIT); if (!(m0->m_flags & M_EXT)) goto drop; if (n > MCLBYTES) @@ -166,14 +167,14 @@ uni_msg_pack_mbuf(struct uni_msg *msg, void *hdr, size_t hdrlen) last = m0; while (msg != NULL && (n = uni_msg_len(msg)) != 0) { - MGET(m, M_NOWAIT, MT_DATA); + MGET(m, MB_DONTWAIT, MT_DATA); if (m == NULL) goto drop; last->m_next = m; last = m; if (n > MLEN) { - MCLGET(m, M_NOWAIT); + MCLGET(m, MB_DONTWAIT); if (!(m->m_flags & M_EXT)) goto drop; if (n > MCLBYTES) @@ -224,7 +225,7 @@ uni_msg_fini(void) /* free all free message headers */ while ((h = LIST_FIRST(&ngatm_freeuni)) != NULL) { LIST_REMOVE(h, link); - free(h, M_UNIMSGHDR); + kfree(h, M_UNIMSGHDR); } /* forget about still used messages */ @@ -249,11 +250,11 @@ _uni_msg_alloc(size_t s, const char *file, int line) mtx_unlock(&ngatm_unilist_mtx); if (m == NULL && - (m = malloc(sizeof(*m), M_UNIMSGHDR, M_NOWAIT)) == NULL) + (m = kmalloc(sizeof(*m), M_UNIMSGHDR, M_WAITOK | M_NULLOK)) == NULL) return (NULL); s += EXTRA; - if((m->msg.b_buf = malloc(s, M_UNIMSG, M_NOWAIT | M_ZERO)) == NULL) { + if((m->msg.b_buf = kmalloc(s, M_UNIMSG, M_WAITOK | M_NULLOK | M_ZERO)) == NULL) { mtx_lock(&ngatm_unilist_mtx); LIST_INSERT_HEAD(&ngatm_freeuni, m, link); mtx_unlock(&ngatm_unilist_mtx); @@ -302,7 +303,7 @@ _uni_msg_destroy(struct uni_msg *m, const char *file, int line) "found in %s:%u\n", m, h->file, h->line, file, line); } else { - free(m->b_buf, M_UNIMSG); + kfree(m->b_buf, M_UNIMSG); LIST_REMOVE(d, link); LIST_INSERT_HEAD(&ngatm_freeuni, d, link); @@ -339,7 +340,7 @@ uni_msg_fini(void) /* free all free message headers */ while ((h = LIST_FIRST(&ngatm_freeuni)) != NULL) { LIST_REMOVE(h, link); - free(h, M_UNIMSGHDR); + kfree(h, M_UNIMSGHDR); } mtx_destroy(&ngatm_unilist_mtx); @@ -360,14 +361,14 @@ uni_msg_alloc(size_t s) mtx_unlock(&ngatm_unilist_mtx); if (a == NULL) { - if ((m = malloc(sizeof(*m), M_UNIMSGHDR, M_NOWAIT)) == NULL) + if ((m = kmalloc(sizeof(*m), M_UNIMSGHDR, M_WAITOK | M_NULLOK)) == NULL) return (NULL); a = (struct ngatm_msg *)m; } else m = (struct uni_msg *)a; s += EXTRA; - if((m->b_buf = malloc(s, M_UNIMSG, M_NOWAIT | M_ZERO)) == NULL) { + if((m->b_buf = kmalloc(s, M_UNIMSG, M_WAITOK | M_NULLOK | M_ZERO)) == NULL) { mtx_lock(&ngatm_unilist_mtx); LIST_INSERT_HEAD(&ngatm_freeuni, a, link); mtx_unlock(&ngatm_unilist_mtx); @@ -390,7 +391,7 @@ uni_msg_destroy(struct uni_msg *m) a = (struct ngatm_msg *)m; - free(m->b_buf, M_UNIMSG); + kfree(m->b_buf, M_UNIMSG); mtx_lock(&ngatm_unilist_mtx); LIST_INSERT_HEAD(&ngatm_freeuni, a, link); diff --git a/sys/netgraph7/atm/ngatmbase.h b/sys/netgraph7/atm/ngatmbase.h index 126cb0b0ec..8539a25346 100644 --- a/sys/netgraph7/atm/ngatmbase.h +++ b/sys/netgraph7/atm/ngatmbase.h @@ -28,6 +28,7 @@ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/netgraph/atm/ngatmbase.h,v 1.3 2005/01/07 01:45:40 imp Exp $ + * $DragonFly: src/sys/netgraph7/atm/ngatmbase.h,v 1.2 2008/06/26 23:05:37 dillon Exp $ * * In-kernel UNI stack message functions. */ diff --git a/sys/netgraph7/atm/sscfu/ng_sscfu.c b/sys/netgraph7/atm/sscfu/ng_sscfu.c index 1cf1f5d51b..d433bdf39d 100644 --- a/sys/netgraph7/atm/sscfu/ng_sscfu.c +++ b/sys/netgraph7/atm/sscfu/ng_sscfu.c @@ -27,11 +27,12 @@ * Author: Hartmut Brandt * * Netgraph module for ITU-T Q.2120 UNI SSCF. + * + * $FreeBSD: src/sys/netgraph/atm/sscfu/ng_sscfu.c,v 1.4 2005/01/07 01:45:41 imp Exp $ + * $DragonFly: src/sys/netgraph7/atm/sscfu/ng_sscfu.c,v 1.2 2008/06/26 23:05:39 dillon Exp $ + * $DragonFly: src/sys/netgraph7/atm/sscfu/ng_sscfu.c,v 1.2 2008/06/26 23:05:39 dillon Exp $ */ -#include -__FBSDID("$FreeBSD: src/sys/netgraph/atm/sscfu/ng_sscfu.c,v 1.4 2005/01/07 01:45:41 imp Exp $"); - #include #include #include @@ -44,14 +45,14 @@ __FBSDID("$FreeBSD: src/sys/netgraph/atm/sscfu/ng_sscfu.c,v 1.4 2005/01/07 01:45 #include #include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_parse.h" #include #include -#include -#include -#include +#include "atm/ng_sscop.h" +#include "atm/ng_sscfu.h" +#include "atm/sscfu/ng_sscfu_cust.h" #include MALLOC_DEFINE(M_NG_SSCFU, "netgraph_sscfu", "netgraph uni sscf node"); @@ -227,7 +228,7 @@ ng_sscfu_rcvmsg(node_p node, item_p item, hook_p lasthook) switch (msg->header.cmd) { case NGM_TEXT_STATUS: - NG_MKRESPONSE(resp, msg, NG_TEXTRESPONSE, M_NOWAIT); + NG_MKRESPONSE(resp, msg, NG_TEXTRESPONSE, M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -253,7 +254,7 @@ ng_sscfu_rcvmsg(node_p node, item_p item, hook_p lasthook) error = EINVAL; break; } - NG_MKRESPONSE(resp, msg, sizeof(*p), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(*p), M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -293,7 +294,7 @@ ng_sscfu_rcvmsg(node_p node, item_p item, hook_p lasthook) error = EINVAL; break; } - NG_MKRESPONSE(resp, msg, sizeof(uint32_t), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(uint32_t), M_WAITOK | M_NULLOK); if(resp == NULL) { error = ENOMEM; break; @@ -308,7 +309,7 @@ ng_sscfu_rcvmsg(node_p node, item_p item, hook_p lasthook) error = EINVAL; break; } - NG_MKRESPONSE(resp, msg, sizeof(uint32_t), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(uint32_t), M_WAITOK | M_NULLOK); if(resp == NULL) { error = ENOMEM; break; @@ -438,13 +439,13 @@ sscfu_send_upper(struct sscfu *sscf, void *p, enum saal_sig sig, struct mbuf *m) return; } if (m == NULL) { - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, MB_DONTWAIT, MT_DATA); if (m == NULL) return; m->m_len = sizeof(struct sscfu_arg); m->m_pkthdr.len = m->m_len; } else { - M_PREPEND(m, sizeof(struct sscfu_arg), M_NOWAIT); + M_PREPEND(m, sizeof(struct sscfu_arg), MB_DONTWAIT); if (m == NULL) return; } @@ -504,13 +505,13 @@ sscfu_send_lower(struct sscfu *sscf, void *p, enum sscop_aasig sig, return; } if (m == NULL) { - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, MB_DONTWAIT, MT_DATA); if (m == NULL) return; m->m_len = sizeof(struct sscop_arg); m->m_pkthdr.len = m->m_len; } else { - M_PREPEND(m, sizeof(struct sscop_arg), M_NOWAIT); + M_PREPEND(m, sizeof(struct sscop_arg), MB_DONTWAIT); if (m == NULL) return; } @@ -538,11 +539,11 @@ ng_sscfu_constructor(node_p node) { struct priv *priv; - if ((priv = malloc(sizeof(*priv), M_NG_SSCFU, M_NOWAIT|M_ZERO)) == NULL) + if ((priv = kmalloc(sizeof(*priv), M_NG_SSCFU, M_WAITOK | M_NULLOK | M_ZERO)) == NULL) return (ENOMEM); if ((priv->sscf = sscfu_create(node, &sscfu_funcs)) == NULL) { - free(priv, M_NG_SSCFU); + kfree(priv, M_NG_SSCFU); return (ENOMEM); } @@ -558,7 +559,7 @@ ng_sscfu_shutdown(node_p node) sscfu_destroy(priv->sscf); - free(priv, M_NG_SSCFU); + kfree(priv, M_NG_SSCFU); NG_NODE_SET_PRIVATE(node, NULL); NG_NODE_UNREF(node); diff --git a/sys/netgraph7/atm/sscfu/ng_sscfu_cust.h b/sys/netgraph7/atm/sscfu/ng_sscfu_cust.h index 4605ad53f3..942fb28b8b 100644 --- a/sys/netgraph7/atm/sscfu/ng_sscfu_cust.h +++ b/sys/netgraph7/atm/sscfu/ng_sscfu_cust.h @@ -29,6 +29,8 @@ * Customisation of the SSCFU code to ng_sscfu. * * $FreeBSD: src/sys/netgraph/atm/sscfu/ng_sscfu_cust.h,v 1.2 2005/01/07 01:45:41 imp Exp $ + * $DragonFly: src/sys/netgraph7/atm/sscfu/ng_sscfu_cust.h,v 1.2 2008/06/26 23:05:39 dillon Exp $ + * $DragonFly: src/sys/netgraph7/atm/sscfu/ng_sscfu_cust.h,v 1.2 2008/06/26 23:05:39 dillon Exp $ */ #include #include @@ -51,9 +53,9 @@ DECL_SIGQ_GET #define MEMZALLOC(PTR, CAST, SIZE) \ - ((PTR) = (CAST)malloc((SIZE), M_NG_SSCFU, M_NOWAIT | M_ZERO)) + ((PTR) = (CAST)kmalloc((SIZE), M_NG_SSCFU, M_WAITOK | M_NULLOK | M_ZERO)) #define MEMFREE(PTR) \ - free(PTR, M_NG_SSCFU) + kfree(PTR, M_NG_SSCFU) #define SIG_ALLOC(PTR) \ MEMZALLOC(PTR, struct sscfu_sig *, sizeof(struct sscfu_sig)) @@ -68,13 +70,13 @@ DECL_SIGQ_GET #define MEMZALLOC(PTR, CAST, SIZE) \ - ((PTR) = (CAST)malloc((SIZE), M_NG_SSCFU_INS, M_NOWAIT | M_ZERO)) + ((PTR) = (CAST)kmalloc((SIZE), M_NG_SSCFU_INS, M_WAITOK | M_NULLOK | M_ZERO)) #define MEMFREE(PTR) \ FREE(PTR, M_NG_SSCFU_INS) #define SIG_ALLOC(PTR) \ - ((PTR) = malloc(sizeof(struct sscfu_sig), \ - M_NG_SSCFU_SIG, M_NOWAIT | M_ZERO)) + ((PTR) = kmalloc(sizeof(struct sscfu_sig), \ + M_NG_SSCFU_SIG, M_WAITOK | M_NULLOK | M_ZERO)) #define SIG_FREE(PTR) \ FREE(PTR, M_NG_SSCFU_SIG) diff --git a/sys/netgraph7/atm/sscop/ng_sscop.c b/sys/netgraph7/atm/sscop/ng_sscop.c index 3b7e1c86bf..fd995deb75 100644 --- a/sys/netgraph7/atm/sscop/ng_sscop.c +++ b/sys/netgraph7/atm/sscop/ng_sscop.c @@ -28,11 +28,11 @@ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * Netgraph module for ITU-T Q.2110 SSCOP. + * + * $FreeBSD: src/sys/netgraph/atm/sscop/ng_sscop.c,v 1.4 2005/08/10 06:25:40 obrien Exp $ + * $DragonFly: src/sys/netgraph7/atm/sscop/ng_sscop.c,v 1.2 2008/06/26 23:05:39 dillon Exp $ + * $DragonFly: src/sys/netgraph7/atm/sscop/ng_sscop.c,v 1.2 2008/06/26 23:05:39 dillon Exp $ */ - -#include -__FBSDID("$FreeBSD: src/sys/netgraph/atm/sscop/ng_sscop.c,v 1.4 2005/08/10 06:25:40 obrien Exp $"); - #include #include #include @@ -47,12 +47,12 @@ __FBSDID("$FreeBSD: src/sys/netgraph/atm/sscop/ng_sscop.c,v 1.4 2005/08/10 06:25 #include #include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_parse.h" #include -#include -#include +#include "atm/ng_sscop.h" +#include "atm/sscop/ng_sscop_cust.h" #include #define DDD printf("%s: %d\n", __func__, __LINE__) @@ -246,11 +246,11 @@ ng_sscop_constructor(node_p node) { struct priv *p; - if ((p = malloc(sizeof(*p), M_NG_SSCOP, M_NOWAIT | M_ZERO)) == NULL) + if ((p = kmalloc(sizeof(*p), M_NG_SSCOP, M_WAITOK | M_NULLOK | M_ZERO)) == NULL) return (ENOMEM); if ((p->sscop = sscop_create(node, &sscop_funcs)) == NULL) { - free(p, M_NG_SSCOP); + kfree(p, M_NG_SSCOP); return (ENOMEM); } NG_NODE_SET_PRIVATE(node, p); @@ -268,7 +268,7 @@ ng_sscop_shutdown(node_p node) sscop_destroy(priv->sscop); - free(priv, M_NG_SSCOP); + kfree(priv, M_NG_SSCOP); NG_NODE_SET_PRIVATE(node, NULL); NG_NODE_UNREF(node); @@ -456,7 +456,7 @@ ng_sscop_rcvmsg(node_p node, item_p item, hook_p lasthook) switch (msg->header.cmd) { case NGM_TEXT_STATUS: - NG_MKRESPONSE(resp, msg, NG_TEXTRESPONSE, M_NOWAIT); + NG_MKRESPONSE(resp, msg, NG_TEXTRESPONSE, M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -488,7 +488,7 @@ ng_sscop_rcvmsg(node_p node, item_p item, hook_p lasthook) { struct sscop_param *p; - NG_MKRESPONSE(resp, msg, sizeof(*p), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(*p), M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -512,7 +512,7 @@ ng_sscop_rcvmsg(node_p node, item_p item, hook_p lasthook) break; } arg = (struct ng_sscop_setparam *)msg->data; - NG_MKRESPONSE(resp, msg, sizeof(*p), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(*p), M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -556,7 +556,7 @@ ng_sscop_rcvmsg(node_p node, item_p item, hook_p lasthook) error = EINVAL; break; } - NG_MKRESPONSE(resp, msg, sizeof(u_int32_t), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(u_int32_t), M_WAITOK | M_NULLOK); if(resp == NULL) { error = ENOMEM; break; @@ -577,7 +577,7 @@ ng_sscop_rcvmsg(node_p node, item_p item, hook_p lasthook) error = EINVAL; break; } - NG_MKRESPONSE(resp, msg, sizeof(u_int32_t), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(u_int32_t), M_WAITOK | M_NULLOK); if(resp == NULL) { error = ENOMEM; break; @@ -762,13 +762,13 @@ sscop_send_upper(struct sscop *sscop, void *p, enum sscop_aasig sig, priv->stats.data_delivered++; if (m == NULL) { - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, MB_DONTWAIT, MT_DATA); if (m == NULL) return; m->m_len = sizeof(struct sscop_arg); m->m_pkthdr.len = m->m_len; } else { - M_PREPEND(m, sizeof(struct sscop_arg), M_NOWAIT); + M_PREPEND(m, sizeof(struct sscop_arg), MB_DONTWAIT); if (m == NULL) return; } @@ -820,7 +820,7 @@ sscop_send_manage(struct sscop *sscop, void *p, enum sscop_maasig sig, } if (sig == SSCOP_MERROR_indication) { - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, MB_DONTWAIT, MT_DATA); if (m == NULL) return; m->m_len = sizeof(*e); @@ -831,7 +831,7 @@ sscop_send_manage(struct sscop *sscop, void *p, enum sscop_maasig sig, e->cnt = cnt; priv->stats.errors++; } else if (m == NULL) { - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, MB_DONTWAIT, MT_DATA); if (m == NULL) return; m->m_len = sizeof(*a); @@ -840,7 +840,7 @@ sscop_send_manage(struct sscop *sscop, void *p, enum sscop_maasig sig, a->sig = sig; priv->stats.maa_signals++; } else { - M_PREPEND(m, sizeof(*a), M_NOWAIT); + M_PREPEND(m, sizeof(*a), MB_DONTWAIT); if (m == NULL) return; a = mtod(m, struct sscop_marg *); diff --git a/sys/netgraph7/atm/sscop/ng_sscop_cust.h b/sys/netgraph7/atm/sscop/ng_sscop_cust.h index d8f073b41d..bf95be8647 100644 --- a/sys/netgraph7/atm/sscop/ng_sscop_cust.h +++ b/sys/netgraph7/atm/sscop/ng_sscop_cust.h @@ -27,6 +27,8 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netgraph/atm/sscop/ng_sscop_cust.h,v 1.5 2005/01/07 01:45:41 imp Exp $ + * $DragonFly: src/sys/netgraph7/atm/sscop/ng_sscop_cust.h,v 1.2 2008/06/26 23:05:39 dillon Exp $ + * $DragonFly: src/sys/netgraph7/atm/sscop/ng_sscop_cust.h,v 1.2 2008/06/26 23:05:39 dillon Exp $ * * Customisation of the SSCOP code to ng_sscop. */ @@ -40,9 +42,9 @@ #include #include #include -#include -#include #include +#include "ng_message.h" +#include "netgraph.h" #include @@ -59,9 +61,9 @@ DECL_MBUF_ALLOC #define MEMZALLOC(PTR, CAST, SIZE) \ - ((PTR) = (CAST)malloc((SIZE), M_NG_SSCOP, M_NOWAIT | M_ZERO)) + ((PTR) = (CAST)kmalloc((SIZE), M_NG_SSCOP, M_WAITOK | M_NULLOK | M_ZERO)) #define MEMFREE(PTR) \ - free((PTR), M_NG_SSCOP) + kfree((PTR), M_NG_SSCOP) #define MSG_ALLOC(PTR) \ MEMZALLOC(PTR, struct sscop_msg *, sizeof(struct sscop_msg)) @@ -84,21 +86,21 @@ DECL_MBUF_ALLOC #define MEMZALLOC(PTR, CAST, SIZE) \ - ((PTR) = (CAST)malloc((SIZE), M_NG_SSCOP_INS, M_NOWAIT | M_ZERO)) + ((PTR) = (CAST)kmalloc((SIZE), M_NG_SSCOP_INS, M_WAITOK | M_NULLOK | M_ZERO)) #define MEMFREE(PTR) \ - free((PTR), M_NG_SSCOP_INS) + kfree((PTR), M_NG_SSCOP_INS) #define MSG_ALLOC(PTR) \ - ((PTR) = malloc(sizeof(struct sscop_msg), \ - M_NG_SSCOP_MSG, M_NOWAIT | M_ZERO)) + ((PTR) = kmalloc(sizeof(struct sscop_msg), \ + M_NG_SSCOP_MSG, M_WAITOK | M_NULLOK | M_ZERO)) #define MSG_FREE(PTR) \ - free((PTR), M_NG_SSCOP_MSG) + kfree((PTR), M_NG_SSCOP_MSG) #define SIG_ALLOC(PTR) \ - ((PTR) = malloc(sizeof(struct sscop_sig), \ - M_NG_SSCOP_SIG, M_NOWAIT | M_ZERO)) + ((PTR) = kmalloc(sizeof(struct sscop_sig), \ + M_NG_SSCOP_SIG, M_WAITOK | M_NULLOK | M_ZERO)) #define SIG_FREE(PTR) \ - free((PTR), M_NG_SSCOP_SIG) + kfree((PTR), M_NG_SSCOP_SIG) #endif @@ -234,7 +236,7 @@ ng_sscop_sigq_get(struct sscop_sigq *q) \ * Message buffers */ #define MBUF_FREE(M) do { if ((M)) m_freem((M)); } while(0) -#define MBUF_DUP(M) m_copypacket((M), M_NOWAIT) +#define MBUF_DUP(M) m_copypacket((M), MB_DONTWAIT) #define MBUF_LEN(M) ((size_t)(M)->m_pkthdr.len) /* @@ -322,12 +324,12 @@ ng_sscop_mbuf_alloc(size_t n) \ { \ struct mbuf *m; \ \ - MGETHDR(m, M_NOWAIT, MT_DATA); \ + MGETHDR(m, MB_DONTWAIT, MT_DATA); \ if (m != NULL) { \ m->m_len = 0; \ m->m_pkthdr.len = 0; \ if (n > MHLEN) { \ - MCLGET(m, M_NOWAIT); \ + MCLGET(m, MB_DONTWAIT); \ if (!(m->m_flags & M_EXT)){ \ m_free(m); \ m = NULL; \ diff --git a/sys/netgraph7/atm/uni/ng_uni.c b/sys/netgraph7/atm/uni/ng_uni.c index 3eb0584ce1..f8ee24d7d5 100644 --- a/sys/netgraph7/atm/uni/ng_uni.c +++ b/sys/netgraph7/atm/uni/ng_uni.c @@ -27,11 +27,11 @@ * SUCH DAMAGE. * * Netgraph module for ATM-Forum UNI 4.0 signalling + * + * $FreeBSD: src/sys/netgraph/atm/uni/ng_uni.c,v 1.6 2005/10/31 15:41:26 rwatson Exp $ + * $DragonFly: src/sys/netgraph7/atm/uni/ng_uni.c,v 1.2 2008/06/26 23:05:39 dillon Exp $ + * $DragonFly: src/sys/netgraph7/atm/uni/ng_uni.c,v 1.2 2008/06/26 23:05:39 dillon Exp $ */ - -#include -__FBSDID("$FreeBSD: src/sys/netgraph/atm/uni/ng_uni.c,v 1.6 2005/10/31 15:41:26 rwatson Exp $"); - #include #include #include @@ -45,20 +45,20 @@ __FBSDID("$FreeBSD: src/sys/netgraph/atm/uni/ng_uni.c,v 1.6 2005/10/31 15:41:26 #include #include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_parse.h" #include #include -#include +#include "netgraph/atm/ngatmbase.h" #include #include -#include +#include "netgraph/atm/uni/ng_uni_cust.h" #include #include -#include -#include -#include +#include "atm/ng_sscop.h" +#include "atm/ng_sscfu.h" +#include "atm/ng_uni.h" MALLOC_DEFINE(M_NG_UNI, "netgraph_uni_node", "netgraph uni node"); MALLOC_DEFINE(M_UNI, "netgraph_uni_data", "uni protocol data"); @@ -223,11 +223,11 @@ ng_uni_constructor(node_p node) { struct priv *priv; - if ((priv = malloc(sizeof(*priv), M_NG_UNI, M_NOWAIT | M_ZERO)) == NULL) + if ((priv = kmalloc(sizeof(*priv), M_NG_UNI, M_WAITOK | M_NULLOK | M_ZERO)) == NULL) return (ENOMEM); if ((priv->uni = uni_create(node, &uni_funcs)) == NULL) { - free(priv, M_NG_UNI); + kfree(priv, M_NG_UNI); return (ENOMEM); } @@ -244,7 +244,7 @@ ng_uni_shutdown(node_p node) uni_destroy(priv->uni); - free(priv, M_NG_UNI); + kfree(priv, M_NG_UNI); NG_NODE_SET_PRIVATE(node, NULL); NG_NODE_UNREF(node); @@ -319,7 +319,7 @@ ng_uni_rcvmsg(node_p node, item_p item, hook_p lasthook) switch (msg->header.cmd) { case NGM_TEXT_STATUS: - NG_MKRESPONSE(resp, msg, NG_TEXTRESPONSE, M_NOWAIT); + NG_MKRESPONSE(resp, msg, NG_TEXTRESPONSE, M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -356,7 +356,7 @@ ng_uni_rcvmsg(node_p node, item_p item, hook_p lasthook) { struct ngm_uni_debug *arg; - NG_MKRESPONSE(resp, msg, sizeof(*arg), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(*arg), M_WAITOK | M_NULLOK); if(resp == NULL) { error = ENOMEM; break; @@ -375,7 +375,7 @@ ng_uni_rcvmsg(node_p node, item_p item, hook_p lasthook) error = EINVAL; break; } - NG_MKRESPONSE(resp, msg, sizeof(*config), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(*config), M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -397,7 +397,7 @@ ng_uni_rcvmsg(node_p node, item_p item, hook_p lasthook) } arg = (struct ngm_uni_set_config *)msg->data; - NG_MKRESPONSE(resp, msg, sizeof(*mask), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(*mask), M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -442,7 +442,7 @@ ng_uni_rcvmsg(node_p node, item_p item, hook_p lasthook) error = EINVAL; break; } - NG_MKRESPONSE(resp, msg, sizeof(u_int32_t), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(u_int32_t), M_WAITOK | M_NULLOK); if(resp == NULL) { error = ENOMEM; break; @@ -811,7 +811,7 @@ uni_fini(void) for (type = 0; type < UNIMEM_TYPES; type++) { while ((h = LIST_FIRST(&nguni_freemem[type])) != NULL) { LIST_REMOVE(h, link); - free(h, M_UNI); + kfree(h, M_UNI); } while ((h = LIST_FIRST(&nguni_usedmem[type])) != NULL) { @@ -819,7 +819,7 @@ uni_fini(void) printf("ng_uni: %s in use: %p (%s,%u)\n", unimem_names[type], (caddr_t)h->data, h->file, h->lno); - free(h, M_UNI); + kfree(h, M_UNI); } } @@ -848,7 +848,7 @@ ng_uni_malloc(enum unimem type, const char *file, u_int lno) * allocate */ full = unimem_sizes[type] + offsetof(struct unimem_debug, data); - if ((d = malloc(full, M_UNI, M_NOWAIT | M_ZERO)) == NULL) + if ((d = kmalloc(full, M_UNI, M_WAITOK | M_NULLOK | M_ZERO)) == NULL) return (NULL); } else { bzero(d->data, unimem_sizes[type]); diff --git a/sys/netgraph7/atm/uni/ng_uni_cust.h b/sys/netgraph7/atm/uni/ng_uni_cust.h index 603c419bf7..6c02d2247a 100644 --- a/sys/netgraph7/atm/uni/ng_uni_cust.h +++ b/sys/netgraph7/atm/uni/ng_uni_cust.h @@ -29,6 +29,8 @@ * Customisation of signalling source to the NG environment. * * $FreeBSD: src/sys/netgraph/atm/uni/ng_uni_cust.h,v 1.6 2006/06/02 09:08:51 dds Exp $ + * $DragonFly: src/sys/netgraph7/atm/uni/ng_uni_cust.h,v 1.2 2008/06/26 23:05:39 dillon Exp $ + * $DragonFly: src/sys/netgraph7/atm/uni/ng_uni_cust.h,v 1.2 2008/06/26 23:05:39 dillon Exp $ */ #include @@ -39,9 +41,9 @@ #include #include #include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "atm/ngatmbase.h" #define ASSERT(E, M) KASSERT(E,M) diff --git a/sys/netgraph7/bluetooth/common/ng_bluetooth.c b/sys/netgraph7/bluetooth/common/ng_bluetooth.c index aa1bad379a..309c2b8614 100644 --- a/sys/netgraph7/bluetooth/common/ng_bluetooth.c +++ b/sys/netgraph7/bluetooth/common/ng_bluetooth.c @@ -29,6 +29,8 @@ * * $Id: ng_bluetooth.c,v 1.3 2003/04/26 22:37:31 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/common/ng_bluetooth.c,v 1.7 2007/06/04 18:25:07 dwmalone Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/common/ng_bluetooth.c,v 1.2 2008/06/26 23:05:39 dillon Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/common/ng_bluetooth.c,v 1.2 2008/06/26 23:05:39 dillon Exp $ */ #include @@ -38,7 +40,7 @@ #include #include -#include +#include "bluetooth/include/ng_bluetooth.h" /* * Bluetooth stack sysctl globals diff --git a/sys/netgraph7/bluetooth/drivers/bt3c/ng_bt3c_pccard.c b/sys/netgraph7/bluetooth/drivers/bt3c/ng_bt3c_pccard.c index a9b971661f..08b42e3ea3 100644 --- a/sys/netgraph7/bluetooth/drivers/bt3c/ng_bt3c_pccard.c +++ b/sys/netgraph7/bluetooth/drivers/bt3c/ng_bt3c_pccard.c @@ -29,6 +29,8 @@ * * $Id: ng_bt3c_pccard.c,v 1.5 2003/04/01 18:15:21 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c,v 1.20 2007/02/23 12:19:02 piso Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/drivers/bt3c/ng_bt3c_pccard.c,v 1.2 2008/06/26 23:05:40 dillon Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/drivers/bt3c/ng_bt3c_pccard.c,v 1.2 2008/06/26 23:05:40 dillon Exp $ * * XXX XXX XX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX * @@ -63,13 +65,13 @@ #include #include "pccarddevs.h" -#include -#include -#include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_parse.h" +#include "bluetooth/include/ng_bluetooth.h" +#include "bluetooth/include/ng_hci.h" +#include "bluetooth/include/ng_bt3c.h" +#include "bluetooth/drivers/bt3c/ng_bt3c_var.h" /* Netgraph methods */ static ng_constructor_t ng_bt3c_constructor; @@ -376,7 +378,7 @@ ng_bt3c_rcvmsg(node_p node, item_p item, hook_p lasthook) case NGM_GENERIC_COOKIE: switch (msg->header.cmd) { case NGM_TEXT_STATUS: - NG_MKRESPONSE(rsp, msg, NG_TEXTRESPONSE, M_NOWAIT); + NG_MKRESPONSE(rsp, msg, NG_TEXTRESPONSE, M_WAITOK | M_NULLOK); if (rsp == NULL) error = ENOMEM; else @@ -408,7 +410,7 @@ ng_bt3c_rcvmsg(node_p node, item_p item, hook_p lasthook) switch (msg->header.cmd) { case NGM_BT3C_NODE_GET_STATE: NG_MKRESPONSE(rsp, msg, sizeof(ng_bt3c_node_state_ep), - M_NOWAIT); + M_WAITOK | M_NULLOK); if (rsp == NULL) error = ENOMEM; else @@ -426,7 +428,7 @@ ng_bt3c_rcvmsg(node_p node, item_p item, hook_p lasthook) case NGM_BT3C_NODE_GET_DEBUG: NG_MKRESPONSE(rsp, msg, sizeof(ng_bt3c_node_debug_ep), - M_NOWAIT); + M_WAITOK | M_NULLOK); if (rsp == NULL) error = ENOMEM; else @@ -436,7 +438,7 @@ ng_bt3c_rcvmsg(node_p node, item_p item, hook_p lasthook) case NGM_BT3C_NODE_GET_QLEN: NG_MKRESPONSE(rsp, msg, sizeof(ng_bt3c_node_qlen_ep), - M_NOWAIT); + M_WAITOK | M_NULLOK); if (rsp == NULL) { error = ENOMEM; break; @@ -494,7 +496,7 @@ ng_bt3c_rcvmsg(node_p node, item_p item, hook_p lasthook) case NGM_BT3C_NODE_GET_STAT: NG_MKRESPONSE(rsp, msg, sizeof(ng_bt3c_node_stat_ep), - M_NOWAIT); + M_WAITOK | M_NULLOK); if (rsp == NULL) error = ENOMEM; else @@ -807,7 +809,7 @@ bt3c_receive(bt3c_softc_p sc) sc->state = NG_BT3C_W4_PKT_IND; sc->want = 1; - MGETHDR(sc->m, M_DONTWAIT, MT_DATA); + MGETHDR(sc->m, MB_DONTWAIT, MT_DATA); if (sc->m == NULL) { NG_BT3C_ERR(sc->dev, "Could not get mbuf\n"); NG_BT3C_STAT_IERROR(sc->stat); @@ -815,7 +817,7 @@ bt3c_receive(bt3c_softc_p sc) break; /* XXX lost of sync */ } - MCLGET(sc->m, M_DONTWAIT); + MCLGET(sc->m, MB_DONTWAIT); if (!(sc->m->m_flags & M_EXT)) { NG_FREE_M(sc->m); diff --git a/sys/netgraph7/bluetooth/drivers/bt3c/ng_bt3c_var.h b/sys/netgraph7/bluetooth/drivers/bt3c/ng_bt3c_var.h index a3bca3cabf..348bfd7601 100644 --- a/sys/netgraph7/bluetooth/drivers/bt3c/ng_bt3c_var.h +++ b/sys/netgraph7/bluetooth/drivers/bt3c/ng_bt3c_var.h @@ -29,6 +29,7 @@ * * $Id: ng_bt3c_var.h,v 1.1 2002/11/24 19:46:54 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_var.h,v 1.4 2006/07/05 17:18:47 emax Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/drivers/bt3c/ng_bt3c_var.h,v 1.2 2008/06/26 23:05:40 dillon Exp $ * * XXX XXX XX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX * diff --git a/sys/netgraph7/bluetooth/drivers/h4/ng_h4.c b/sys/netgraph7/bluetooth/drivers/h4/ng_h4.c index a6c8316b75..96568ab7ac 100644 --- a/sys/netgraph7/bluetooth/drivers/h4/ng_h4.c +++ b/sys/netgraph7/bluetooth/drivers/h4/ng_h4.c @@ -29,6 +29,8 @@ * * $Id: ng_h4.c,v 1.10 2005/10/31 17:57:43 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/drivers/h4/ng_h4.c,v 1.17 2007/08/13 17:19:28 emax Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/drivers/h4/ng_h4.c,v 1.2 2008/06/26 23:05:40 dillon Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/drivers/h4/ng_h4.c,v 1.2 2008/06/26 23:05:40 dillon Exp $ * * Based on: * --------- @@ -54,14 +56,14 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_parse.h" +#include "bluetooth/include/ng_bluetooth.h" +#include "bluetooth/include/ng_hci.h" +#include "bluetooth/include/ng_h4.h" +#include "bluetooth/drivers/h4/ng_h4_var.h" +#include "bluetooth/drivers/h4/ng_h4_prse.h" /***************************************************************************** ***************************************************************************** @@ -161,7 +163,7 @@ ng_h4_open(struct cdev *dev, struct tty *tp) return (error); /* Initialize private struct */ - MALLOC(sc, ng_h4_info_p, sizeof(*sc), M_NETGRAPH_H4, M_NOWAIT|M_ZERO); + MALLOC(sc, ng_h4_info_p, sizeof(*sc), M_NETGRAPH_H4, M_WAITOK | M_NULLOK | M_ZERO); if (sc == NULL) return (ENOMEM); @@ -525,7 +527,7 @@ ng_h4_input(int c, struct tty *tp) if (sc->hook != NULL && NG_HOOK_IS_VALID(sc->hook)) { struct mbuf *m = NULL; - MGETHDR(m, M_DONTWAIT, MT_DATA); + MGETHDR(m, MB_DONTWAIT, MT_DATA); if (m != NULL) { m->m_pkthdr.len = 0; @@ -849,7 +851,7 @@ ng_h4_rcvmsg(node_p node, item_p item, hook_p lasthook) case NGM_GENERIC_COOKIE: switch (msg->header.cmd) { case NGM_TEXT_STATUS: - NG_MKRESPONSE(resp, msg, NG_TEXTRESPONSE, M_NOWAIT); + NG_MKRESPONSE(resp, msg, NG_TEXTRESPONSE, M_WAITOK | M_NULLOK); if (resp == NULL) error = ENOMEM; else @@ -885,7 +887,7 @@ ng_h4_rcvmsg(node_p node, item_p item, hook_p lasthook) case NGM_H4_NODE_GET_STATE: NG_MKRESPONSE(resp, msg, sizeof(ng_h4_node_state_ep), - M_NOWAIT); + M_WAITOK | M_NULLOK); if (resp == NULL) error = ENOMEM; else @@ -895,7 +897,7 @@ ng_h4_rcvmsg(node_p node, item_p item, hook_p lasthook) case NGM_H4_NODE_GET_DEBUG: NG_MKRESPONSE(resp, msg, sizeof(ng_h4_node_debug_ep), - M_NOWAIT); + M_WAITOK | M_NULLOK); if (resp == NULL) error = ENOMEM; else @@ -913,7 +915,7 @@ ng_h4_rcvmsg(node_p node, item_p item, hook_p lasthook) case NGM_H4_NODE_GET_QLEN: NG_MKRESPONSE(resp, msg, sizeof(ng_h4_node_qlen_ep), - M_NOWAIT); + M_WAITOK | M_NULLOK); if (resp == NULL) error = ENOMEM; else @@ -933,7 +935,7 @@ ng_h4_rcvmsg(node_p node, item_p item, hook_p lasthook) case NGM_H4_NODE_GET_STAT: NG_MKRESPONSE(resp, msg, sizeof(ng_h4_node_stat_ep), - M_NOWAIT); + M_WAITOK | M_NULLOK); if (resp == NULL) error = ENOMEM; else diff --git a/sys/netgraph7/bluetooth/drivers/h4/ng_h4_prse.h b/sys/netgraph7/bluetooth/drivers/h4/ng_h4_prse.h index fbf39310e7..cc19414585 100644 --- a/sys/netgraph7/bluetooth/drivers/h4/ng_h4_prse.h +++ b/sys/netgraph7/bluetooth/drivers/h4/ng_h4_prse.h @@ -29,6 +29,7 @@ * * $Id: ng_h4_prse.h,v 1.4 2005/10/31 17:57:43 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/drivers/h4/ng_h4_prse.h,v 1.5 2007/08/13 17:19:28 emax Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/drivers/h4/ng_h4_prse.h,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ /*************************************************************************** diff --git a/sys/netgraph7/bluetooth/drivers/h4/ng_h4_var.h b/sys/netgraph7/bluetooth/drivers/h4/ng_h4_var.h index e79c3b2402..e87c7563dd 100644 --- a/sys/netgraph7/bluetooth/drivers/h4/ng_h4_var.h +++ b/sys/netgraph7/bluetooth/drivers/h4/ng_h4_var.h @@ -29,6 +29,7 @@ * * $Id: ng_h4_var.h,v 1.5 2005/10/31 17:57:43 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/drivers/h4/ng_h4_var.h,v 1.6 2007/08/13 17:19:28 emax Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/drivers/h4/ng_h4_var.h,v 1.2 2008/06/26 23:05:40 dillon Exp $ * * Based on: * --------- diff --git a/sys/netgraph7/bluetooth/drivers/ubt/ng_ubt.c b/sys/netgraph7/bluetooth/drivers/ubt/ng_ubt.c index b8f17be83b..f1dd20f79c 100644 --- a/sys/netgraph7/bluetooth/drivers/ubt/ng_ubt.c +++ b/sys/netgraph7/bluetooth/drivers/ubt/ng_ubt.c @@ -29,6 +29,7 @@ * * $Id: ng_ubt.c,v 1.16 2003/10/10 19:15:06 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c,v 1.33 2007/06/23 04:34:38 imp Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/drivers/ubt/ng_ubt.c,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ #include @@ -51,13 +52,13 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_parse.h" +#include "bluetooth/include/ng_bluetooth.h" +#include "bluetooth/include/ng_hci.h" +#include "bluetooth/include/ng_ubt.h" +#include "bluetooth/drivers/ubt/ng_ubt_var.h" #include "usbdevs.h" @@ -655,8 +656,8 @@ ubt_attach(device_t self) device_get_nameunit(sc->sc_dev)); goto bad; } - sc->sc_isoc_in_frlen = malloc(sizeof(u_int16_t) * sc->sc_isoc_nframes, - M_USBDEV, M_NOWAIT); + sc->sc_isoc_in_frlen = kmalloc(sizeof(u_int16_t) * sc->sc_isoc_nframes, + M_USBDEV, M_WAITOK | M_NULLOK); if (sc->sc_isoc_in_frlen == NULL) { printf("%s: Could not allocate isoc-in frame sizes buffer\n", device_get_nameunit(sc->sc_dev)); @@ -676,8 +677,8 @@ ubt_attach(device_t self) device_get_nameunit(sc->sc_dev)); goto bad; } - sc->sc_isoc_out_frlen = malloc(sizeof(u_int16_t) * sc->sc_isoc_nframes, - M_USBDEV, M_NOWAIT); + sc->sc_isoc_out_frlen = kmalloc(sizeof(u_int16_t) * sc->sc_isoc_nframes, + M_USBDEV, M_WAITOK | M_NULLOK); if (sc->sc_isoc_out_frlen == NULL) { printf("%s: Could not allocate isoc-out frame sizes buffer\n", device_get_nameunit(sc->sc_dev)); @@ -851,11 +852,11 @@ ubt_detach(device_t self) /* Destroy isoc. frame size buffers */ if (sc->sc_isoc_in_frlen != NULL) { - free(sc->sc_isoc_in_frlen, M_USBDEV); + kfree(sc->sc_isoc_in_frlen, M_USBDEV); sc->sc_isoc_in_frlen = NULL; } if (sc->sc_isoc_out_frlen != NULL) { - free(sc->sc_isoc_out_frlen, M_USBDEV); + kfree(sc->sc_isoc_out_frlen, M_USBDEV); sc->sc_isoc_out_frlen = NULL; } @@ -1026,11 +1027,11 @@ ubt_intr_start(ubt_softc_p sc) __func__, device_get_nameunit(sc->sc_dev))); /* Allocate new mbuf cluster */ - MGETHDR(m, M_DONTWAIT, MT_DATA); + MGETHDR(m, MB_DONTWAIT, MT_DATA); if (m == NULL) return (USBD_NOMEM); - MCLGET(m, M_DONTWAIT); + MCLGET(m, MB_DONTWAIT); if (!(m->m_flags & M_EXT)) { NG_FREE_M(m); return (USBD_NOMEM); @@ -1192,11 +1193,11 @@ ubt_bulk_in_start(ubt_softc_p sc) __func__, device_get_nameunit(sc->sc_dev))); /* Allocate new mbuf cluster */ - MGETHDR(m, M_DONTWAIT, MT_DATA); + MGETHDR(m, MB_DONTWAIT, MT_DATA); if (m == NULL) return (USBD_NOMEM); - MCLGET(m, M_DONTWAIT); + MCLGET(m, MB_DONTWAIT); if (!(m->m_flags & M_EXT)) { NG_FREE_M(m); return (USBD_NOMEM); @@ -1585,7 +1586,7 @@ ubt_isoc_in_complete2(node_p node, hook_p hook, void *arg1, int arg2) __func__, device_get_nameunit(sc->sc_dev), h->actlen); /* Copy SCO data frame to mbuf */ - MGETHDR(m, M_DONTWAIT, MT_DATA); + MGETHDR(m, MB_DONTWAIT, MT_DATA); if (m == NULL) { NG_UBT_ALERT( "%s: %s - Could not allocate mbuf\n", @@ -1990,7 +1991,7 @@ ng_ubt_rcvmsg(node_p node, item_p item, hook_p lasthook) case NGM_GENERIC_COOKIE: switch (msg->header.cmd) { case NGM_TEXT_STATUS: - NG_MKRESPONSE(rsp, msg, NG_TEXTRESPONSE, M_NOWAIT); + NG_MKRESPONSE(rsp, msg, NG_TEXTRESPONSE, M_WAITOK | M_NULLOK); if (rsp == NULL) error = ENOMEM; else @@ -2030,7 +2031,7 @@ ng_ubt_rcvmsg(node_p node, item_p item, hook_p lasthook) case NGM_UBT_NODE_GET_DEBUG: NG_MKRESPONSE(rsp, msg, sizeof(ng_ubt_node_debug_ep), - M_NOWAIT); + M_WAITOK | M_NULLOK); if (rsp == NULL) error = ENOMEM; else @@ -2104,7 +2105,7 @@ ng_ubt_rcvmsg(node_p node, item_p item, hook_p lasthook) if (q != NULL) { NG_MKRESPONSE(rsp, msg, - sizeof(ng_ubt_node_qlen_ep), M_NOWAIT); + sizeof(ng_ubt_node_qlen_ep), M_WAITOK | M_NULLOK); if (rsp == NULL) { error = ENOMEM; break; @@ -2119,7 +2120,7 @@ ng_ubt_rcvmsg(node_p node, item_p item, hook_p lasthook) case NGM_UBT_NODE_GET_STAT: NG_MKRESPONSE(rsp, msg, sizeof(ng_ubt_node_stat_ep), - M_NOWAIT); + M_WAITOK | M_NULLOK); if (rsp == NULL) error = ENOMEM; else diff --git a/sys/netgraph7/bluetooth/drivers/ubt/ng_ubt_var.h b/sys/netgraph7/bluetooth/drivers/ubt/ng_ubt_var.h index ec8f15d9c1..413d774ce9 100644 --- a/sys/netgraph7/bluetooth/drivers/ubt/ng_ubt_var.h +++ b/sys/netgraph7/bluetooth/drivers/ubt/ng_ubt_var.h @@ -29,6 +29,7 @@ * * $Id: ng_ubt_var.h,v 1.2 2003/03/22 23:44:36 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_var.h,v 1.7 2006/09/07 23:38:09 emax Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/drivers/ubt/ng_ubt_var.h,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ #ifndef _NG_UBT_VAR_H_ diff --git a/sys/netgraph7/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c b/sys/netgraph7/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c index a85b6ebeec..8c4ee8c239 100644 --- a/sys/netgraph7/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c +++ b/sys/netgraph7/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c @@ -29,6 +29,7 @@ * * $Id: ubtbcmfw.c,v 1.3 2003/10/10 19:15:08 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c,v 1.18 2007/06/23 04:34:38 imp Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ #include diff --git a/sys/netgraph7/bluetooth/hci/ng_hci_cmds.c b/sys/netgraph7/bluetooth/hci/ng_hci_cmds.c index aa31c007fa..289e01f0eb 100644 --- a/sys/netgraph7/bluetooth/hci/ng_hci_cmds.c +++ b/sys/netgraph7/bluetooth/hci/ng_hci_cmds.c @@ -29,6 +29,7 @@ * * $Id: ng_hci_cmds.c,v 1.4 2003/09/08 18:57:51 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/hci/ng_hci_cmds.c,v 1.7 2005/01/07 01:45:43 imp Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/hci/ng_hci_cmds.c,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ #include @@ -38,15 +39,15 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "bluetooth/include/ng_bluetooth.h" +#include "bluetooth/include/ng_hci.h" +#include "bluetooth/hci/ng_hci_var.h" +#include "bluetooth/hci/ng_hci_cmds.h" +#include "bluetooth/hci/ng_hci_evnt.h" +#include "bluetooth/hci/ng_hci_ulpi.h" +#include "bluetooth/hci/ng_hci_misc.h" /****************************************************************************** ****************************************************************************** @@ -118,7 +119,7 @@ ng_hci_send_command(ng_hci_unit_p unit) ng_hci_mtap(unit, m0); - m = m_dup(m0, M_DONTWAIT); + m = m_dup(m0, MB_DONTWAIT); if (m != NULL) NG_SEND_DATA_ONLY(error, unit->drv, m); else diff --git a/sys/netgraph7/bluetooth/hci/ng_hci_cmds.h b/sys/netgraph7/bluetooth/hci/ng_hci_cmds.h index f802aaca2a..f77cde223c 100644 --- a/sys/netgraph7/bluetooth/hci/ng_hci_cmds.h +++ b/sys/netgraph7/bluetooth/hci/ng_hci_cmds.h @@ -29,6 +29,7 @@ * * $Id: ng_hci_cmds.h,v 1.1 2002/11/24 19:46:58 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/hci/ng_hci_cmds.h,v 1.4 2005/01/07 01:45:43 imp Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/hci/ng_hci_cmds.h,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ #ifndef _NETGRAPH_HCI_CMDS_H_ diff --git a/sys/netgraph7/bluetooth/hci/ng_hci_evnt.c b/sys/netgraph7/bluetooth/hci/ng_hci_evnt.c index 6cab3eaf73..8642863033 100644 --- a/sys/netgraph7/bluetooth/hci/ng_hci_evnt.c +++ b/sys/netgraph7/bluetooth/hci/ng_hci_evnt.c @@ -29,6 +29,7 @@ * * $Id: ng_hci_evnt.c,v 1.6 2003/09/08 18:57:51 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/hci/ng_hci_evnt.c,v 1.8 2005/01/07 01:45:43 imp Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/hci/ng_hci_evnt.c,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ #include @@ -38,15 +39,15 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "bluetooth/include/ng_bluetooth.h" +#include "bluetooth/include/ng_hci.h" +#include "bluetooth/hci/ng_hci_var.h" +#include "bluetooth/hci/ng_hci_cmds.h" +#include "bluetooth/hci/ng_hci_evnt.h" +#include "bluetooth/hci/ng_hci_ulpi.h" +#include "bluetooth/hci/ng_hci_misc.h" /****************************************************************************** ****************************************************************************** @@ -351,7 +352,7 @@ sync_con_queue(ng_hci_unit_p unit, ng_hci_unit_con_p con, int completed) return (ENOTCONN); NG_MKMESSAGE(msg, NGM_HCI_COOKIE, NGM_HCI_SYNC_CON_QUEUE, - sizeof(*state), M_NOWAIT); + sizeof(*state), M_WAITOK | M_NULLOK); if (msg == NULL) return (ENOMEM); @@ -511,7 +512,7 @@ con_compl(ng_hci_unit_p unit, struct mbuf *event) } __attribute__ ((packed)) *lp; struct mbuf *m; - MGETHDR(m, M_DONTWAIT, MT_DATA); + MGETHDR(m, MB_DONTWAIT, MT_DATA); if (m != NULL) { m->m_pkthdr.len = m->m_len = sizeof(*lp); lp = mtod(m, struct __link_policy *); diff --git a/sys/netgraph7/bluetooth/hci/ng_hci_evnt.h b/sys/netgraph7/bluetooth/hci/ng_hci_evnt.h index e6949f6ea1..58544214f9 100644 --- a/sys/netgraph7/bluetooth/hci/ng_hci_evnt.h +++ b/sys/netgraph7/bluetooth/hci/ng_hci_evnt.h @@ -29,6 +29,7 @@ * * $Id: ng_hci_evnt.h,v 1.1 2002/11/24 19:46:58 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/hci/ng_hci_evnt.h,v 1.4 2005/01/07 01:45:43 imp Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/hci/ng_hci_evnt.h,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ #ifndef _NETGRAPH_HCI_EVNT_H_ diff --git a/sys/netgraph7/bluetooth/hci/ng_hci_main.c b/sys/netgraph7/bluetooth/hci/ng_hci_main.c index c7eb336a1c..a29515ca4b 100644 --- a/sys/netgraph7/bluetooth/hci/ng_hci_main.c +++ b/sys/netgraph7/bluetooth/hci/ng_hci_main.c @@ -29,6 +29,7 @@ * * $Id: ng_hci_main.c,v 1.2 2003/03/18 00:09:36 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/hci/ng_hci_main.c,v 1.6 2005/01/07 01:45:43 imp Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/hci/ng_hci_main.c,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ #include @@ -38,17 +39,17 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_parse.h" +#include "bluetooth/include/ng_bluetooth.h" +#include "bluetooth/include/ng_hci.h" +#include "bluetooth/hci/ng_hci_var.h" +#include "bluetooth/hci/ng_hci_prse.h" +#include "bluetooth/hci/ng_hci_cmds.h" +#include "bluetooth/hci/ng_hci_evnt.h" +#include "bluetooth/hci/ng_hci_ulpi.h" +#include "bluetooth/hci/ng_hci_misc.h" /****************************************************************************** ****************************************************************************** @@ -110,7 +111,7 @@ ng_hci_constructor(node_p node) ng_hci_unit_p unit = NULL; MALLOC(unit, ng_hci_unit_p, sizeof(*unit), M_NETGRAPH_HCI, - M_NOWAIT | M_ZERO); + M_WAITOK | M_NULLOK | M_ZERO); if (unit == NULL) return (ENOMEM); @@ -291,7 +292,7 @@ ng_hci_default_rcvmsg(node_p node, item_p item, hook_p lasthook) acl_total, acl_avail, acl_size, sco_total, sco_avail, sco_size; - NG_MKRESPONSE(rsp, msg, NG_TEXTRESPONSE, M_NOWAIT); + NG_MKRESPONSE(rsp, msg, NG_TEXTRESPONSE, M_WAITOK | M_NULLOK); if (rsp == NULL) { error = ENOMEM; break; @@ -337,7 +338,7 @@ ng_hci_default_rcvmsg(node_p node, item_p item, hook_p lasthook) switch (msg->header.cmd) { /* Get current node state */ case NGM_HCI_NODE_GET_STATE: - NG_MKRESPONSE(rsp, msg, sizeof(unit->state), M_NOWAIT); + NG_MKRESPONSE(rsp, msg, sizeof(unit->state), M_WAITOK | M_NULLOK); if (rsp == NULL) { error = ENOMEM; break; @@ -362,7 +363,7 @@ ng_hci_default_rcvmsg(node_p node, item_p item, hook_p lasthook) /* Get node debug level */ case NGM_HCI_NODE_GET_DEBUG: - NG_MKRESPONSE(rsp, msg, sizeof(unit->debug), M_NOWAIT); + NG_MKRESPONSE(rsp, msg, sizeof(unit->debug), M_WAITOK | M_NULLOK); if (rsp == NULL) { error = ENOMEM; break; @@ -386,7 +387,7 @@ ng_hci_default_rcvmsg(node_p node, item_p item, hook_p lasthook) ng_hci_node_buffer_ep *ep = NULL; NG_MKRESPONSE(rsp, msg, sizeof(ng_hci_node_buffer_ep), - M_NOWAIT); + M_WAITOK | M_NULLOK); if (rsp == NULL) { error = ENOMEM; break; @@ -405,7 +406,7 @@ ng_hci_default_rcvmsg(node_p node, item_p item, hook_p lasthook) /* Get BDADDR */ case NGM_HCI_NODE_GET_BDADDR: - NG_MKRESPONSE(rsp, msg, sizeof(bdaddr_t), M_NOWAIT); + NG_MKRESPONSE(rsp, msg, sizeof(bdaddr_t), M_WAITOK | M_NULLOK); if (rsp == NULL) { error = ENOMEM; break; @@ -416,7 +417,7 @@ ng_hci_default_rcvmsg(node_p node, item_p item, hook_p lasthook) /* Get features */ case NGM_HCI_NODE_GET_FEATURES: - NG_MKRESPONSE(rsp,msg,sizeof(unit->features),M_NOWAIT); + NG_MKRESPONSE(rsp,msg,sizeof(unit->features),M_WAITOK | M_NULLOK); if (rsp == NULL) { error = ENOMEM; break; @@ -427,7 +428,7 @@ ng_hci_default_rcvmsg(node_p node, item_p item, hook_p lasthook) /* Get stat */ case NGM_HCI_NODE_GET_STAT: - NG_MKRESPONSE(rsp, msg, sizeof(unit->stat), M_NOWAIT); + NG_MKRESPONSE(rsp, msg, sizeof(unit->stat), M_WAITOK | M_NULLOK); if (rsp == NULL) { error = ENOMEM; break; @@ -469,7 +470,7 @@ ng_hci_default_rcvmsg(node_p node, item_p item, hook_p lasthook) /* Prepare response */ NG_MKRESPONSE(rsp, msg, sizeof(*e1) + s * sizeof(*e2), - M_NOWAIT); + M_WAITOK | M_NULLOK); if (rsp == NULL) { error = ENOMEM; break; @@ -510,7 +511,7 @@ ng_hci_default_rcvmsg(node_p node, item_p item, hook_p lasthook) /* Prepare response */ NG_MKRESPONSE(rsp, msg, sizeof(*e1) + s * sizeof(*e2), - M_NOWAIT); + M_WAITOK | M_NULLOK); if (rsp == NULL) { error = ENOMEM; break; @@ -545,7 +546,7 @@ ng_hci_default_rcvmsg(node_p node, item_p item, hook_p lasthook) /* Get link policy settings mask */ case NGM_HCI_NODE_GET_LINK_POLICY_SETTINGS_MASK: NG_MKRESPONSE(rsp, msg, sizeof(unit->link_policy_mask), - M_NOWAIT); + M_WAITOK | M_NULLOK); if (rsp == NULL) { error = ENOMEM; break; @@ -571,7 +572,7 @@ ng_hci_default_rcvmsg(node_p node, item_p item, hook_p lasthook) /* Get packet mask */ case NGM_HCI_NODE_GET_PACKET_MASK: NG_MKRESPONSE(rsp, msg, sizeof(unit->packet_mask), - M_NOWAIT); + M_WAITOK | M_NULLOK); if (rsp == NULL) { error = ENOMEM; break; @@ -596,7 +597,7 @@ ng_hci_default_rcvmsg(node_p node, item_p item, hook_p lasthook) /* Get role switch */ case NGM_HCI_NODE_GET_ROLE_SWITCH: NG_MKRESPONSE(rsp, msg, sizeof(unit->role_switch), - M_NOWAIT); + M_WAITOK | M_NULLOK); if (rsp == NULL) { error = ENOMEM; break; diff --git a/sys/netgraph7/bluetooth/hci/ng_hci_misc.c b/sys/netgraph7/bluetooth/hci/ng_hci_misc.c index c4b6caf70b..b356429b17 100644 --- a/sys/netgraph7/bluetooth/hci/ng_hci_misc.c +++ b/sys/netgraph7/bluetooth/hci/ng_hci_misc.c @@ -29,6 +29,7 @@ * * $Id: ng_hci_misc.c,v 1.5 2003/09/08 18:57:51 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/hci/ng_hci_misc.c,v 1.10 2005/01/07 01:45:43 imp Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/hci/ng_hci_misc.c,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ #include @@ -37,15 +38,15 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "bluetooth/include/ng_bluetooth.h" +#include "bluetooth/include/ng_hci.h" +#include "bluetooth/hci/ng_hci_var.h" +#include "bluetooth/hci/ng_hci_cmds.h" +#include "bluetooth/hci/ng_hci_evnt.h" +#include "bluetooth/hci/ng_hci_ulpi.h" +#include "bluetooth/hci/ng_hci_misc.h" /****************************************************************************** ****************************************************************************** @@ -65,7 +66,7 @@ ng_hci_mtap(ng_hci_unit_p unit, struct mbuf *m0) int error = 0; if (unit->raw != NULL && NG_HOOK_IS_VALID(unit->raw)) { - m = m_dup(m0, M_DONTWAIT); + m = m_dup(m0, MB_DONTWAIT); if (m != NULL) NG_SEND_DATA_ONLY(error, unit->raw, m); @@ -99,7 +100,7 @@ ng_hci_node_is_up(node_p node, hook_p hook, void *arg1, int arg2) if (hook != unit->acl && hook != unit->sco) return; - NG_MKMESSAGE(msg,NGM_HCI_COOKIE,NGM_HCI_NODE_UP,sizeof(*ep),M_NOWAIT); + NG_MKMESSAGE(msg,NGM_HCI_COOKIE,NGM_HCI_NODE_UP,sizeof(*ep),M_WAITOK | M_NULLOK); if (msg != NULL) { ep = (ng_hci_node_up_ep *)(msg->data); @@ -177,7 +178,7 @@ ng_hci_new_neighbor(ng_hci_unit_p unit) ng_hci_neighbor_p n = NULL; MALLOC(n, ng_hci_neighbor_p, sizeof(*n), M_NETGRAPH_HCI, - M_NOWAIT | M_ZERO); + M_WAITOK | M_NULLOK | M_ZERO); if (n != NULL) { getmicrotime(&n->updated); LIST_INSERT_HEAD(&unit->neighbors, n, next); @@ -259,7 +260,7 @@ ng_hci_new_con(ng_hci_unit_p unit, int link_type) static int fake_con_handle = 0x0f00; MALLOC(con, ng_hci_unit_con_p, sizeof(*con), M_NETGRAPH_HCI, - M_NOWAIT | M_ZERO); + M_WAITOK | M_NULLOK | M_ZERO); if (con != NULL) { con->unit = unit; con->state = NG_HCI_CON_CLOSED; diff --git a/sys/netgraph7/bluetooth/hci/ng_hci_misc.h b/sys/netgraph7/bluetooth/hci/ng_hci_misc.h index 7861b915fe..074fa3ba91 100644 --- a/sys/netgraph7/bluetooth/hci/ng_hci_misc.h +++ b/sys/netgraph7/bluetooth/hci/ng_hci_misc.h @@ -29,6 +29,7 @@ * * $Id: ng_hci_misc.h,v 1.3 2003/09/08 18:57:51 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/hci/ng_hci_misc.h,v 1.5 2005/01/07 01:45:43 imp Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/hci/ng_hci_misc.h,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ #ifndef _NETGRAPH_HCI_MISC_H_ diff --git a/sys/netgraph7/bluetooth/hci/ng_hci_prse.h b/sys/netgraph7/bluetooth/hci/ng_hci_prse.h index 5856f171e4..10fa348c56 100644 --- a/sys/netgraph7/bluetooth/hci/ng_hci_prse.h +++ b/sys/netgraph7/bluetooth/hci/ng_hci_prse.h @@ -29,6 +29,7 @@ * * $Id: ng_hci_prse.h,v 1.2 2003/03/18 00:09:36 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/hci/ng_hci_prse.h,v 1.4 2005/01/07 01:45:43 imp Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/hci/ng_hci_prse.h,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ /*************************************************************************** diff --git a/sys/netgraph7/bluetooth/hci/ng_hci_ulpi.c b/sys/netgraph7/bluetooth/hci/ng_hci_ulpi.c index 1da18d4f6a..ec6ed461da 100644 --- a/sys/netgraph7/bluetooth/hci/ng_hci_ulpi.c +++ b/sys/netgraph7/bluetooth/hci/ng_hci_ulpi.c @@ -29,6 +29,7 @@ * * $Id: ng_hci_ulpi.c,v 1.7 2003/09/08 18:57:51 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/hci/ng_hci_ulpi.c,v 1.8 2005/01/07 01:45:43 imp Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/hci/ng_hci_ulpi.c,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ #include @@ -38,15 +39,15 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "bluetooth/include/ng_bluetooth.h" +#include "bluetooth/include/ng_hci.h" +#include "bluetooth/hci/ng_hci_var.h" +#include "bluetooth/hci/ng_hci_cmds.h" +#include "bluetooth/hci/ng_hci_evnt.h" +#include "bluetooth/hci/ng_hci_ulpi.h" +#include "bluetooth/hci/ng_hci_misc.h" /****************************************************************************** ****************************************************************************** @@ -171,7 +172,7 @@ ng_hci_lp_acl_con_req(ng_hci_unit_p unit, item_p item, hook_p hook) NG_MKMESSAGE(msg, NGM_HCI_COOKIE, NGM_HCI_LP_CON_CFM, sizeof(*cfm), - M_NOWAIT); + M_WAITOK | M_NULLOK); if (msg != NULL) { cfm = (ng_hci_lp_con_cfm_ep *)msg->data; cfm->status = 0; @@ -224,7 +225,7 @@ ng_hci_lp_acl_con_req(ng_hci_unit_p unit, item_p item, hook_p hook) * Create HCI command */ - MGETHDR(m, M_DONTWAIT, MT_DATA); + MGETHDR(m, MB_DONTWAIT, MT_DATA); if (m == NULL) { ng_hci_free_con(con); error = ENOBUFS; @@ -417,7 +418,7 @@ ng_hci_lp_sco_con_req(ng_hci_unit_p unit, item_p item, hook_p hook) * Create HCI command */ - MGETHDR(m, M_DONTWAIT, MT_DATA); + MGETHDR(m, MB_DONTWAIT, MT_DATA); if (m == NULL) { ng_hci_free_con(sco_con); error = ENOBUFS; @@ -531,7 +532,7 @@ ng_hci_lp_discon_req(ng_hci_unit_p unit, item_p item, hook_p hook) * Create HCI command */ - MGETHDR(m, M_DONTWAIT, MT_DATA); + MGETHDR(m, MB_DONTWAIT, MT_DATA); if (m == NULL) { error = ENOBUFS; goto out; @@ -582,7 +583,7 @@ ng_hci_lp_con_cfm(ng_hci_unit_con_p con, int status) con->flags & NG_HCI_CON_NOTIFY_ACL) { if (unit->acl != NULL && NG_HOOK_IS_VALID(unit->acl)) { NG_MKMESSAGE(msg, NGM_HCI_COOKIE, NGM_HCI_LP_CON_CFM, - sizeof(*ep), M_NOWAIT); + sizeof(*ep), M_WAITOK | M_NULLOK); if (msg != NULL) { ep = (ng_hci_lp_con_cfm_ep *) msg->data; ep->status = status; @@ -605,7 +606,7 @@ ng_hci_lp_con_cfm(ng_hci_unit_con_p con, int status) if (con->flags & NG_HCI_CON_NOTIFY_SCO) { if (unit->sco != NULL && NG_HOOK_IS_VALID(unit->sco)) { NG_MKMESSAGE(msg, NGM_HCI_COOKIE, NGM_HCI_LP_CON_CFM, - sizeof(*ep), M_NOWAIT); + sizeof(*ep), M_WAITOK | M_NULLOK); if (msg != NULL) { ep = (ng_hci_lp_con_cfm_ep *) msg->data; ep->status = status; @@ -653,7 +654,7 @@ ng_hci_lp_con_ind(ng_hci_unit_con_p con, u_int8_t *uclass) if (hook != NULL && NG_HOOK_IS_VALID(hook)) { NG_MKMESSAGE(msg, NGM_HCI_COOKIE, NGM_HCI_LP_CON_IND, - sizeof(*ep), M_NOWAIT); + sizeof(*ep), M_WAITOK | M_NULLOK); if (msg == NULL) return (ENOMEM); @@ -776,7 +777,7 @@ ng_hci_lp_con_rsp(ng_hci_unit_p unit, item_p item, hook_p hook) * Create HCI command */ - MGETHDR(m, M_DONTWAIT, MT_DATA); + MGETHDR(m, MB_DONTWAIT, MT_DATA); if (m == NULL) { error = ENOBUFS; goto out; @@ -890,7 +891,7 @@ ng_hci_lp_discon_ind(ng_hci_unit_con_p con, int reason) if (con->link_type == NG_HCI_LINK_ACL) { if (unit->acl != NULL && NG_HOOK_IS_VALID(unit->acl)) { NG_MKMESSAGE(msg, NGM_HCI_COOKIE, - NGM_HCI_LP_DISCON_IND, sizeof(*ep), M_NOWAIT); + NGM_HCI_LP_DISCON_IND, sizeof(*ep), M_WAITOK | M_NULLOK); if (msg == NULL) return (ENOMEM); @@ -908,7 +909,7 @@ ng_hci_lp_discon_ind(ng_hci_unit_con_p con, int reason) if (unit->sco != NULL && NG_HOOK_IS_VALID(unit->sco)) { NG_MKMESSAGE(msg, NGM_HCI_COOKIE, NGM_HCI_LP_DISCON_IND, - sizeof(*ep), M_NOWAIT); + sizeof(*ep), M_WAITOK | M_NULLOK); if (msg == NULL) return (ENOMEM); @@ -996,7 +997,7 @@ ng_hci_lp_qos_req(ng_hci_unit_p unit, item_p item, hook_p hook) * Create HCI command */ - MGETHDR(m, M_DONTWAIT, MT_DATA); + MGETHDR(m, MB_DONTWAIT, MT_DATA); if (m == NULL) { error = ENOBUFS; goto out; @@ -1054,7 +1055,7 @@ ng_hci_lp_qos_cfm(ng_hci_unit_con_p con, int status) if (con->flags & NG_HCI_CON_NOTIFY_ACL) { if (unit->acl != NULL && NG_HOOK_IS_VALID(unit->acl)) { NG_MKMESSAGE(msg, NGM_HCI_COOKIE, NGM_HCI_LP_QOS_CFM, - sizeof(*ep), M_NOWAIT); + sizeof(*ep), M_WAITOK | M_NULLOK); if (msg != NULL) { ep = (ng_hci_lp_qos_cfm_ep *) msg->data; ep->status = status; @@ -1074,7 +1075,7 @@ ng_hci_lp_qos_cfm(ng_hci_unit_con_p con, int status) if (con->flags & NG_HCI_CON_NOTIFY_SCO) { if (unit->sco != NULL && NG_HOOK_IS_VALID(unit->sco)) { NG_MKMESSAGE(msg, NGM_HCI_COOKIE, NGM_HCI_LP_QOS_CFM, - sizeof(*ep), M_NOWAIT); + sizeof(*ep), M_WAITOK | M_NULLOK); if (msg != NULL) { ep = (ng_hci_lp_qos_cfm_ep *) msg->data; ep->status = status; @@ -1113,7 +1114,7 @@ ng_hci_lp_qos_ind(ng_hci_unit_con_p con) if (unit->acl != NULL && NG_HOOK_IS_VALID(unit->acl)) { NG_MKMESSAGE(msg, NGM_HCI_COOKIE, NGM_HCI_LP_QOS_IND, - sizeof(*ep), M_NOWAIT); + sizeof(*ep), M_WAITOK | M_NULLOK); if (msg == NULL) return (ENOMEM); @@ -1128,7 +1129,7 @@ ng_hci_lp_qos_ind(ng_hci_unit_con_p con) if (unit->sco != NULL && NG_HOOK_IS_VALID(unit->sco)) { NG_MKMESSAGE(msg, NGM_HCI_COOKIE, NGM_HCI_LP_QOS_IND, - sizeof(*ep), M_NOWAIT); + sizeof(*ep), M_WAITOK | M_NULLOK); if (msg == NULL) return (ENOMEM); diff --git a/sys/netgraph7/bluetooth/hci/ng_hci_ulpi.h b/sys/netgraph7/bluetooth/hci/ng_hci_ulpi.h index e3bfb4481b..33be008026 100644 --- a/sys/netgraph7/bluetooth/hci/ng_hci_ulpi.h +++ b/sys/netgraph7/bluetooth/hci/ng_hci_ulpi.h @@ -29,6 +29,7 @@ * * $Id: ng_hci_ulpi.h,v 1.2 2003/04/26 22:35:21 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/hci/ng_hci_ulpi.h,v 1.3 2005/01/07 01:45:43 imp Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/hci/ng_hci_ulpi.h,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ #ifndef _NETGRAPH_HCI_ULPI_H_ diff --git a/sys/netgraph7/bluetooth/hci/ng_hci_var.h b/sys/netgraph7/bluetooth/hci/ng_hci_var.h index 8df13a8cd8..6129b5db57 100644 --- a/sys/netgraph7/bluetooth/hci/ng_hci_var.h +++ b/sys/netgraph7/bluetooth/hci/ng_hci_var.h @@ -29,6 +29,7 @@ * * $Id: ng_hci_var.h,v 1.3 2003/04/26 22:35:21 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/hci/ng_hci_var.h,v 1.6 2005/01/07 01:45:43 imp Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/hci/ng_hci_var.h,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ #ifndef _NETGRAPH_HCI_VAR_H_ diff --git a/sys/netgraph7/bluetooth/include/ng_bluetooth.h b/sys/netgraph7/bluetooth/include/ng_bluetooth.h index c59812b9bf..d7ffb612cc 100644 --- a/sys/netgraph7/bluetooth/include/ng_bluetooth.h +++ b/sys/netgraph7/bluetooth/include/ng_bluetooth.h @@ -29,6 +29,7 @@ * * $Id: ng_bluetooth.h,v 1.4 2003/04/26 22:32:34 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/include/ng_bluetooth.h,v 1.5 2008/04/15 21:15:32 mav Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/include/ng_bluetooth.h,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ #ifndef _NETGRAPH_BLUETOOTH_H_ diff --git a/sys/netgraph7/bluetooth/include/ng_bt3c.h b/sys/netgraph7/bluetooth/include/ng_bt3c.h index 0cf5d5d9b0..8da7ff7230 100644 --- a/sys/netgraph7/bluetooth/include/ng_bt3c.h +++ b/sys/netgraph7/bluetooth/include/ng_bt3c.h @@ -29,6 +29,7 @@ * * $Id: ng_bt3c.h,v 1.1 2002/11/24 19:47:05 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/include/ng_bt3c.h,v 1.4 2005/01/07 01:45:43 imp Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/include/ng_bt3c.h,v 1.2 2008/06/26 23:05:40 dillon Exp $ * * XXX XXX XX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX * diff --git a/sys/netgraph7/bluetooth/include/ng_btsocket.h b/sys/netgraph7/bluetooth/include/ng_btsocket.h index 111d283460..965758b5c1 100644 --- a/sys/netgraph7/bluetooth/include/ng_btsocket.h +++ b/sys/netgraph7/bluetooth/include/ng_btsocket.h @@ -29,6 +29,7 @@ * * $Id: ng_btsocket.h,v 1.8 2003/04/26 22:32:10 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/include/ng_btsocket.h,v 1.8 2006/05/17 00:13:06 emax Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/include/ng_btsocket.h,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ #ifndef _NETGRAPH_BTSOCKET_H_ diff --git a/sys/netgraph7/bluetooth/include/ng_btsocket_hci_raw.h b/sys/netgraph7/bluetooth/include/ng_btsocket_hci_raw.h index 359a990b8a..283077251e 100644 --- a/sys/netgraph7/bluetooth/include/ng_btsocket_hci_raw.h +++ b/sys/netgraph7/bluetooth/include/ng_btsocket_hci_raw.h @@ -29,6 +29,7 @@ * * $Id: ng_btsocket_hci_raw.h,v 1.3 2003/03/25 23:53:32 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/include/ng_btsocket_hci_raw.h,v 1.7 2006/07/21 17:11:13 rwatson Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/include/ng_btsocket_hci_raw.h,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ #ifndef _NETGRAPH_BTSOCKET_HCI_RAW_H_ diff --git a/sys/netgraph7/bluetooth/include/ng_btsocket_l2cap.h b/sys/netgraph7/bluetooth/include/ng_btsocket_l2cap.h index 1597650a68..0415b0c9eb 100644 --- a/sys/netgraph7/bluetooth/include/ng_btsocket_l2cap.h +++ b/sys/netgraph7/bluetooth/include/ng_btsocket_l2cap.h @@ -29,6 +29,7 @@ * * $Id: ng_btsocket_l2cap.h,v 1.4 2003/03/25 23:53:33 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/include/ng_btsocket_l2cap.h,v 1.8 2006/07/21 17:11:13 rwatson Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/include/ng_btsocket_l2cap.h,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ #ifndef _NETGRAPH_BTSOCKET_L2CAP_H_ diff --git a/sys/netgraph7/bluetooth/include/ng_btsocket_rfcomm.h b/sys/netgraph7/bluetooth/include/ng_btsocket_rfcomm.h index 6e20bfdcfa..51caff4c49 100644 --- a/sys/netgraph7/bluetooth/include/ng_btsocket_rfcomm.h +++ b/sys/netgraph7/bluetooth/include/ng_btsocket_rfcomm.h @@ -29,6 +29,7 @@ * * $Id: ng_btsocket_rfcomm.h,v 1.10 2003/03/29 22:27:42 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/include/ng_btsocket_rfcomm.h,v 1.8 2006/07/21 17:11:13 rwatson Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/include/ng_btsocket_rfcomm.h,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ #ifndef _NETGRAPH_BTSOCKET_RFCOMM_H_ diff --git a/sys/netgraph7/bluetooth/include/ng_h4.h b/sys/netgraph7/bluetooth/include/ng_h4.h index a8a8fdcdb8..091d0a4312 100644 --- a/sys/netgraph7/bluetooth/include/ng_h4.h +++ b/sys/netgraph7/bluetooth/include/ng_h4.h @@ -29,6 +29,7 @@ * * $Id: ng_h4.h,v 1.1 2002/11/24 19:47:05 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/include/ng_h4.h,v 1.5 2005/01/07 01:45:43 imp Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/include/ng_h4.h,v 1.2 2008/06/26 23:05:40 dillon Exp $ * * Based on: * --------- diff --git a/sys/netgraph7/bluetooth/include/ng_hci.h b/sys/netgraph7/bluetooth/include/ng_hci.h index da475551ab..7d7e1d49c2 100644 --- a/sys/netgraph7/bluetooth/include/ng_hci.h +++ b/sys/netgraph7/bluetooth/include/ng_hci.h @@ -29,6 +29,7 @@ * * $Id: ng_hci.h,v 1.2 2003/03/18 00:09:37 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/include/ng_hci.h,v 1.7 2006/05/17 00:13:06 emax Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/include/ng_hci.h,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ /* diff --git a/sys/netgraph7/bluetooth/include/ng_l2cap.h b/sys/netgraph7/bluetooth/include/ng_l2cap.h index 3be95d94aa..f45574302a 100644 --- a/sys/netgraph7/bluetooth/include/ng_l2cap.h +++ b/sys/netgraph7/bluetooth/include/ng_l2cap.h @@ -29,6 +29,7 @@ * * $Id: ng_l2cap.h,v 1.2 2003/04/27 00:52:26 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/include/ng_l2cap.h,v 1.4 2005/08/31 18:13:23 emax Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/include/ng_l2cap.h,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ /* diff --git a/sys/netgraph7/bluetooth/include/ng_ubt.h b/sys/netgraph7/bluetooth/include/ng_ubt.h index 0233f08587..d8f5ffd06a 100644 --- a/sys/netgraph7/bluetooth/include/ng_ubt.h +++ b/sys/netgraph7/bluetooth/include/ng_ubt.h @@ -29,6 +29,7 @@ * * $Id: ng_ubt.h,v 1.6 2003/04/13 21:34:42 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/include/ng_ubt.h,v 1.3 2005/01/07 01:45:43 imp Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/include/ng_ubt.h,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ #ifndef _NG_UBT_H_ diff --git a/sys/netgraph7/bluetooth/l2cap/ng_l2cap_cmds.c b/sys/netgraph7/bluetooth/l2cap/ng_l2cap_cmds.c index 44a037216e..2068f35672 100644 --- a/sys/netgraph7/bluetooth/l2cap/ng_l2cap_cmds.c +++ b/sys/netgraph7/bluetooth/l2cap/ng_l2cap_cmds.c @@ -29,6 +29,7 @@ * * $Id: ng_l2cap_cmds.c,v 1.2 2003/09/08 19:11:45 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/l2cap/ng_l2cap_cmds.c,v 1.7 2007/03/28 21:25:56 emax Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/l2cap/ng_l2cap_cmds.c,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ #include @@ -38,17 +39,17 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "bluetooth/include/ng_bluetooth.h" +#include "bluetooth/include/ng_hci.h" +#include "bluetooth/include/ng_l2cap.h" +#include "bluetooth/l2cap/ng_l2cap_var.h" +#include "bluetooth/l2cap/ng_l2cap_cmds.h" +#include "bluetooth/l2cap/ng_l2cap_evnt.h" +#include "bluetooth/l2cap/ng_l2cap_llpi.h" +#include "bluetooth/l2cap/ng_l2cap_ulpi.h" +#include "bluetooth/l2cap/ng_l2cap_misc.h" /****************************************************************************** ****************************************************************************** diff --git a/sys/netgraph7/bluetooth/l2cap/ng_l2cap_cmds.h b/sys/netgraph7/bluetooth/l2cap/ng_l2cap_cmds.h index 5c4f126d09..39e6f8e63b 100644 --- a/sys/netgraph7/bluetooth/l2cap/ng_l2cap_cmds.h +++ b/sys/netgraph7/bluetooth/l2cap/ng_l2cap_cmds.h @@ -29,6 +29,7 @@ * * $Id: ng_l2cap_cmds.h,v 1.4 2003/04/01 18:15:26 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/l2cap/ng_l2cap_cmds.h,v 1.5 2005/01/07 01:45:43 imp Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/l2cap/ng_l2cap_cmds.h,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ #ifndef _NETGRAPH_L2CAP_CMDS_H_ @@ -56,7 +57,7 @@ do { \ ng_l2cap_cmd_rej_data_t data; \ } __attribute__ ((packed)) *c = NULL; \ \ - MGETHDR((_m), M_DONTWAIT, MT_DATA); \ + MGETHDR((_m), MB_DONTWAIT, MT_DATA); \ if ((_m) == NULL) \ break; \ \ @@ -90,7 +91,7 @@ do { \ ng_l2cap_con_req_cp param; \ } __attribute__ ((packed)) *c = NULL; \ \ - MGETHDR((_m), M_DONTWAIT, MT_DATA); \ + MGETHDR((_m), MB_DONTWAIT, MT_DATA); \ if ((_m) == NULL) \ break; \ \ @@ -113,7 +114,7 @@ do { \ ng_l2cap_con_rsp_cp param; \ } __attribute__ ((packed)) *c = NULL; \ \ - MGETHDR((_m), M_DONTWAIT, MT_DATA); \ + MGETHDR((_m), MB_DONTWAIT, MT_DATA); \ if ((_m) == NULL) \ break; \ \ @@ -138,7 +139,7 @@ do { \ ng_l2cap_cfg_req_cp param; \ } __attribute__ ((packed)) *c = NULL; \ \ - MGETHDR((_m), M_DONTWAIT, MT_DATA); \ + MGETHDR((_m), MB_DONTWAIT, MT_DATA); \ if ((_m) == NULL) { \ NG_FREE_M((_data)); \ break; \ @@ -172,7 +173,7 @@ do { \ ng_l2cap_cfg_rsp_cp param; \ } __attribute__ ((packed)) *c = NULL; \ \ - MGETHDR((_m), M_DONTWAIT, MT_DATA); \ + MGETHDR((_m), MB_DONTWAIT, MT_DATA); \ if ((_m) == NULL) { \ NG_FREE_M((_data)); \ break; \ @@ -204,7 +205,7 @@ do { \ do { \ u_int8_t *p = NULL; \ \ - MGETHDR((_m), M_DONTWAIT, MT_DATA); \ + MGETHDR((_m), MB_DONTWAIT, MT_DATA); \ if ((_m) == NULL) \ break; \ \ @@ -281,7 +282,7 @@ do { \ ng_l2cap_discon_req_cp param; \ } __attribute__ ((packed)) *c = NULL; \ \ - MGETHDR((_m), M_DONTWAIT, MT_DATA); \ + MGETHDR((_m), MB_DONTWAIT, MT_DATA); \ if ((_m) == NULL) \ break; \ \ @@ -304,7 +305,7 @@ do { \ ng_l2cap_discon_rsp_cp param; \ } __attribute__ ((packed)) *c = NULL; \ \ - MGETHDR((_m), M_DONTWAIT, MT_DATA); \ + MGETHDR((_m), MB_DONTWAIT, MT_DATA); \ if ((_m) == NULL) \ break; \ \ @@ -324,7 +325,7 @@ do { \ do { \ ng_l2cap_cmd_hdr_t *c = NULL; \ \ - MGETHDR((_m), M_DONTWAIT, MT_DATA); \ + MGETHDR((_m), MB_DONTWAIT, MT_DATA); \ if ((_m) == NULL) \ break; \ \ @@ -351,7 +352,7 @@ do { \ ng_l2cap_info_req_cp param; \ } __attribute__ ((packed)) *c = NULL; \ \ - MGETHDR((_m), M_DONTWAIT, MT_DATA); \ + MGETHDR((_m), MB_DONTWAIT, MT_DATA); \ if ((_m) == NULL) \ break; \ \ @@ -374,7 +375,7 @@ do { \ ng_l2cap_info_rsp_data_t data; \ } __attribute__ ((packed)) *c = NULL; \ \ - MGETHDR((_m), M_DONTWAIT, MT_DATA); \ + MGETHDR((_m), MB_DONTWAIT, MT_DATA); \ if ((_m) == NULL) \ break; \ \ diff --git a/sys/netgraph7/bluetooth/l2cap/ng_l2cap_evnt.c b/sys/netgraph7/bluetooth/l2cap/ng_l2cap_evnt.c index 2a79976fbc..904f777758 100644 --- a/sys/netgraph7/bluetooth/l2cap/ng_l2cap_evnt.c +++ b/sys/netgraph7/bluetooth/l2cap/ng_l2cap_evnt.c @@ -29,6 +29,7 @@ * * $Id: ng_l2cap_evnt.c,v 1.5 2003/09/08 19:11:45 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/l2cap/ng_l2cap_evnt.c,v 1.8 2005/01/07 01:45:43 imp Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/l2cap/ng_l2cap_evnt.c,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ #include @@ -38,17 +39,17 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "bluetooth/include/ng_bluetooth.h" +#include "bluetooth/include/ng_hci.h" +#include "bluetooth/include/ng_l2cap.h" +#include "bluetooth/l2cap/ng_l2cap_var.h" +#include "bluetooth/l2cap/ng_l2cap_cmds.h" +#include "bluetooth/l2cap/ng_l2cap_evnt.h" +#include "bluetooth/l2cap/ng_l2cap_llpi.h" +#include "bluetooth/l2cap/ng_l2cap_ulpi.h" +#include "bluetooth/l2cap/ng_l2cap_misc.h" /****************************************************************************** ****************************************************************************** @@ -192,7 +193,7 @@ ng_l2cap_process_signal_cmd(ng_l2cap_con_p con) /* Get the command, save the rest (if any) */ if (con->rx_pkt->m_pkthdr.len > hdr->length) - m = m_split(con->rx_pkt, hdr->length, M_DONTWAIT); + m = m_split(con->rx_pkt, hdr->length, MB_DONTWAIT); else m = NULL; diff --git a/sys/netgraph7/bluetooth/l2cap/ng_l2cap_evnt.h b/sys/netgraph7/bluetooth/l2cap/ng_l2cap_evnt.h index d4cd0c93e9..151d4f5be7 100644 --- a/sys/netgraph7/bluetooth/l2cap/ng_l2cap_evnt.h +++ b/sys/netgraph7/bluetooth/l2cap/ng_l2cap_evnt.h @@ -29,6 +29,7 @@ * * $Id: ng_l2cap_evnt.h,v 1.1 2002/11/24 19:47:06 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/l2cap/ng_l2cap_evnt.h,v 1.3 2005/01/07 01:45:43 imp Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/l2cap/ng_l2cap_evnt.h,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ #ifndef _NETGRAPH_L2CAP_EVNT_H_ diff --git a/sys/netgraph7/bluetooth/l2cap/ng_l2cap_llpi.c b/sys/netgraph7/bluetooth/l2cap/ng_l2cap_llpi.c index d97e4e933d..6d898b6c50 100644 --- a/sys/netgraph7/bluetooth/l2cap/ng_l2cap_llpi.c +++ b/sys/netgraph7/bluetooth/l2cap/ng_l2cap_llpi.c @@ -29,6 +29,7 @@ * * $Id: ng_l2cap_llpi.c,v 1.5 2003/09/08 19:11:45 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/l2cap/ng_l2cap_llpi.c,v 1.9 2005/07/29 14:44:17 emax Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/l2cap/ng_l2cap_llpi.c,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ #include @@ -38,17 +39,17 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "bluetooth/include/ng_bluetooth.h" +#include "bluetooth/include/ng_hci.h" +#include "bluetooth/include/ng_l2cap.h" +#include "bluetooth/l2cap/ng_l2cap_var.h" +#include "bluetooth/l2cap/ng_l2cap_cmds.h" +#include "bluetooth/l2cap/ng_l2cap_evnt.h" +#include "bluetooth/l2cap/ng_l2cap_llpi.h" +#include "bluetooth/l2cap/ng_l2cap_ulpi.h" +#include "bluetooth/l2cap/ng_l2cap_misc.h" /****************************************************************************** ****************************************************************************** @@ -99,7 +100,7 @@ ng_l2cap_lp_con_req(ng_l2cap_p l2cap, bdaddr_p bdaddr) /* Create and send LP_ConnectReq event */ NG_MKMESSAGE(msg, NGM_HCI_COOKIE, NGM_HCI_LP_CON_REQ, - sizeof(*ep), M_NOWAIT); + sizeof(*ep), M_WAITOK | M_NULLOK); if (msg == NULL) { ng_l2cap_free_con(con); @@ -249,7 +250,7 @@ ng_l2cap_lp_con_ind(ng_l2cap_p l2cap, struct ng_mesg *msg) /* Create and send LP_ConnectRsp event */ NG_MKMESSAGE(rsp, NGM_HCI_COOKIE, NGM_HCI_LP_CON_RSP, - sizeof(*rp), M_NOWAIT); + sizeof(*rp), M_WAITOK | M_NULLOK); if (rsp == NULL) { ng_l2cap_free_con(con); error = ENOMEM; @@ -382,7 +383,7 @@ ng_l2cap_lp_qos_req(ng_l2cap_p l2cap, u_int16_t con_handle, /* Create and send LP_QoSSetupReq event */ NG_MKMESSAGE(msg, NGM_HCI_COOKIE, NGM_HCI_LP_QOS_REQ, - sizeof(*ep), M_NOWAIT); + sizeof(*ep), M_WAITOK | M_NULLOK); if (msg == NULL) return (ENOMEM); @@ -522,7 +523,7 @@ ng_l2cap_lp_send(ng_l2cap_con_p con, u_int16_t dcid, struct mbuf *m0) /* Check length of the packet against HCI MTU */ len = m0->m_pkthdr.len; if (len > l2cap->pkt_size) { - m = m_split(m0, l2cap->pkt_size, M_DONTWAIT); + m = m_split(m0, l2cap->pkt_size, MB_DONTWAIT); if (m == NULL) { NG_L2CAP_ALERT( "%s: %s - m_split(%d) failed\n", __func__, NG_NODE_NAME(l2cap->node), @@ -893,7 +894,7 @@ ng_l2cap_process_discon_timeout(node_p node, hook_p hook, void *arg1, int con_ha /* Create and send LP_DisconReq event */ NG_MKMESSAGE(msg, NGM_HCI_COOKIE, NGM_HCI_LP_DISCON_REQ, - sizeof(*ep), M_NOWAIT); + sizeof(*ep), M_WAITOK | M_NULLOK); if (msg == NULL) return; diff --git a/sys/netgraph7/bluetooth/l2cap/ng_l2cap_llpi.h b/sys/netgraph7/bluetooth/l2cap/ng_l2cap_llpi.h index a630bd4193..0c7847a1ea 100644 --- a/sys/netgraph7/bluetooth/l2cap/ng_l2cap_llpi.h +++ b/sys/netgraph7/bluetooth/l2cap/ng_l2cap_llpi.h @@ -29,6 +29,7 @@ * * $Id: ng_l2cap_llpi.h,v 1.2 2003/04/28 21:44:59 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/l2cap/ng_l2cap_llpi.h,v 1.3 2005/01/07 01:45:43 imp Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/l2cap/ng_l2cap_llpi.h,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ #ifndef _NETGRAPH_L2CAP_LLPI_H_ diff --git a/sys/netgraph7/bluetooth/l2cap/ng_l2cap_main.c b/sys/netgraph7/bluetooth/l2cap/ng_l2cap_main.c index 47905a8c3e..a18e13fc45 100644 --- a/sys/netgraph7/bluetooth/l2cap/ng_l2cap_main.c +++ b/sys/netgraph7/bluetooth/l2cap/ng_l2cap_main.c @@ -29,6 +29,7 @@ * * $Id: ng_l2cap_main.c,v 1.2 2003/04/28 21:44:59 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/l2cap/ng_l2cap_main.c,v 1.5 2005/01/07 01:45:43 imp Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/l2cap/ng_l2cap_main.c,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ #include @@ -37,19 +38,19 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_parse.h" +#include "bluetooth/include/ng_bluetooth.h" +#include "bluetooth/include/ng_hci.h" +#include "bluetooth/include/ng_l2cap.h" +#include "bluetooth/l2cap/ng_l2cap_var.h" +#include "bluetooth/l2cap/ng_l2cap_cmds.h" +#include "bluetooth/l2cap/ng_l2cap_evnt.h" +#include "bluetooth/l2cap/ng_l2cap_llpi.h" +#include "bluetooth/l2cap/ng_l2cap_ulpi.h" +#include "bluetooth/l2cap/ng_l2cap_misc.h" +#include "bluetooth/l2cap/ng_l2cap_prse.h" /****************************************************************************** ****************************************************************************** @@ -114,7 +115,7 @@ ng_l2cap_constructor(node_p node) /* Create new L2CAP node */ MALLOC(l2cap, ng_l2cap_p, sizeof(*l2cap), - M_NETGRAPH_L2CAP, M_NOWAIT|M_ZERO); + M_NETGRAPH_L2CAP, M_WAITOK | M_NULLOK | M_ZERO); if (l2cap == NULL) return (ENOMEM); @@ -483,7 +484,7 @@ ng_l2cap_default_rcvmsg(node_p node, item_p item, hook_p lasthook) case NGM_GENERIC_COOKIE: switch (msg->header.cmd) { case NGM_TEXT_STATUS: - NG_MKRESPONSE(rsp, msg, NG_TEXTRESPONSE, M_NOWAIT); + NG_MKRESPONSE(rsp, msg, NG_TEXTRESPONSE, M_WAITOK | M_NULLOK); if (rsp == NULL) error = ENOMEM; else @@ -517,7 +518,7 @@ ng_l2cap_default_rcvmsg(node_p node, item_p item, hook_p lasthook) /* Get node flags */ case NGM_L2CAP_NODE_GET_FLAGS: NG_MKRESPONSE(rsp, msg, sizeof(ng_l2cap_node_flags_ep), - M_NOWAIT); + M_WAITOK | M_NULLOK); if (rsp == NULL) error = ENOMEM; else @@ -528,7 +529,7 @@ ng_l2cap_default_rcvmsg(node_p node, item_p item, hook_p lasthook) /* Get node debug */ case NGM_L2CAP_NODE_GET_DEBUG: NG_MKRESPONSE(rsp, msg, sizeof(ng_l2cap_node_debug_ep), - M_NOWAIT); + M_WAITOK | M_NULLOK); if (rsp == NULL) error = ENOMEM; else @@ -561,7 +562,7 @@ ng_l2cap_default_rcvmsg(node_p node, item_p item, hook_p lasthook) /* Prepare response */ NG_MKRESPONSE(rsp, msg, - sizeof(*e1) + n * sizeof(*e2), M_NOWAIT); + sizeof(*e1) + n * sizeof(*e2), M_WAITOK | M_NULLOK); if (rsp == NULL) { error = ENOMEM; break; @@ -609,7 +610,7 @@ ng_l2cap_default_rcvmsg(node_p node, item_p item, hook_p lasthook) /* Prepare response */ NG_MKRESPONSE(rsp, msg, sizeof(ng_l2cap_node_chan_list_ep) + - n * sizeof(ng_l2cap_node_chan_ep), M_NOWAIT); + n * sizeof(ng_l2cap_node_chan_ep), M_WAITOK | M_NULLOK); if (rsp == NULL) { error = ENOMEM; break; @@ -641,7 +642,7 @@ ng_l2cap_default_rcvmsg(node_p node, item_p item, hook_p lasthook) case NGM_L2CAP_NODE_GET_AUTO_DISCON_TIMO: NG_MKRESPONSE(rsp, msg, - sizeof(ng_l2cap_node_auto_discon_ep), M_NOWAIT); + sizeof(ng_l2cap_node_auto_discon_ep), M_WAITOK | M_NULLOK); if (rsp == NULL) error = ENOMEM; else diff --git a/sys/netgraph7/bluetooth/l2cap/ng_l2cap_misc.c b/sys/netgraph7/bluetooth/l2cap/ng_l2cap_misc.c index 8f69b4a603..56cce16934 100644 --- a/sys/netgraph7/bluetooth/l2cap/ng_l2cap_misc.c +++ b/sys/netgraph7/bluetooth/l2cap/ng_l2cap_misc.c @@ -29,6 +29,7 @@ * * $Id: ng_l2cap_misc.c,v 1.5 2003/09/08 19:11:45 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.c,v 1.12 2005/08/31 18:13:23 emax Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/l2cap/ng_l2cap_misc.c,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ #include @@ -37,17 +38,17 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "bluetooth/include/ng_bluetooth.h" +#include "bluetooth/include/ng_hci.h" +#include "bluetooth/include/ng_l2cap.h" +#include "bluetooth/l2cap/ng_l2cap_var.h" +#include "bluetooth/l2cap/ng_l2cap_cmds.h" +#include "bluetooth/l2cap/ng_l2cap_evnt.h" +#include "bluetooth/l2cap/ng_l2cap_llpi.h" +#include "bluetooth/l2cap/ng_l2cap_ulpi.h" +#include "bluetooth/l2cap/ng_l2cap_misc.h" static u_int16_t ng_l2cap_get_cid (ng_l2cap_p); @@ -78,7 +79,7 @@ ng_l2cap_send_hook_info(node_p node, hook_p hook, void *arg1, int arg2) return; NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_NODE_HOOK_INFO, - sizeof(bdaddr_t), M_NOWAIT); + sizeof(bdaddr_t), M_WAITOK | M_NULLOK); if (msg != NULL) { bcopy(&l2cap->bdaddr, msg->data, sizeof(bdaddr_t)); NG_SEND_MSG_HOOK(error, node, msg, hook, 0); @@ -105,7 +106,7 @@ ng_l2cap_new_con(ng_l2cap_p l2cap, bdaddr_p bdaddr) /* Create new connection descriptor */ MALLOC(con, ng_l2cap_con_p, sizeof(*con), M_NETGRAPH_L2CAP, - M_NOWAIT|M_ZERO); + M_WAITOK | M_NULLOK | M_ZERO); if (con == NULL) return (NULL); @@ -330,7 +331,7 @@ ng_l2cap_new_chan(ng_l2cap_p l2cap, ng_l2cap_con_p con, u_int16_t psm) ng_l2cap_chan_p ch = NULL; MALLOC(ch, ng_l2cap_chan_p, sizeof(*ch), M_NETGRAPH_L2CAP, - M_NOWAIT|M_ZERO); + M_WAITOK | M_NULLOK | M_ZERO); if (ch == NULL) return (NULL); @@ -426,7 +427,7 @@ ng_l2cap_new_cmd(ng_l2cap_con_p con, ng_l2cap_chan_p ch, u_int8_t ident, __func__, NG_NODE_NAME(con->l2cap->node))); MALLOC(cmd, ng_l2cap_cmd_p, sizeof(*cmd), M_NETGRAPH_L2CAP, - M_NOWAIT|M_ZERO); + M_WAITOK | M_NULLOK | M_ZERO); if (cmd == NULL) return (NULL); @@ -558,7 +559,7 @@ ng_l2cap_command_untimeout(ng_l2cap_cmd_p cmd) struct mbuf * ng_l2cap_prepend(struct mbuf *m, int size) { - M_PREPEND(m, size, M_DONTWAIT); + M_PREPEND(m, size, MB_DONTWAIT); if (m == NULL || (m->m_len < size && (m = m_pullup(m, size)) == NULL)) return (NULL); diff --git a/sys/netgraph7/bluetooth/l2cap/ng_l2cap_misc.h b/sys/netgraph7/bluetooth/l2cap/ng_l2cap_misc.h index e2da0e6935..87a1d870b7 100644 --- a/sys/netgraph7/bluetooth/l2cap/ng_l2cap_misc.h +++ b/sys/netgraph7/bluetooth/l2cap/ng_l2cap_misc.h @@ -29,6 +29,7 @@ * * $Id: ng_l2cap_misc.h,v 1.3 2003/09/08 19:11:45 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.h,v 1.6 2005/08/21 19:15:14 pjd Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/l2cap/ng_l2cap_misc.h,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ #ifndef _NETGRAPH_L2CAP_MISC_H_ diff --git a/sys/netgraph7/bluetooth/l2cap/ng_l2cap_prse.h b/sys/netgraph7/bluetooth/l2cap/ng_l2cap_prse.h index bc2dba3666..2e17c74cab 100644 --- a/sys/netgraph7/bluetooth/l2cap/ng_l2cap_prse.h +++ b/sys/netgraph7/bluetooth/l2cap/ng_l2cap_prse.h @@ -29,6 +29,7 @@ * * $Id: ng_l2cap_prse.h,v 1.2 2003/04/28 21:44:59 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/l2cap/ng_l2cap_prse.h,v 1.4 2005/01/07 01:45:43 imp Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/l2cap/ng_l2cap_prse.h,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ /*************************************************************************** diff --git a/sys/netgraph7/bluetooth/l2cap/ng_l2cap_ulpi.c b/sys/netgraph7/bluetooth/l2cap/ng_l2cap_ulpi.c index ce2d93c6ef..ef3e8fadb9 100644 --- a/sys/netgraph7/bluetooth/l2cap/ng_l2cap_ulpi.c +++ b/sys/netgraph7/bluetooth/l2cap/ng_l2cap_ulpi.c @@ -29,6 +29,7 @@ * * $Id: ng_l2cap_ulpi.c,v 1.1 2002/11/24 19:47:06 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/l2cap/ng_l2cap_ulpi.c,v 1.5 2005/01/07 01:45:43 imp Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/l2cap/ng_l2cap_ulpi.c,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ #include @@ -38,16 +39,16 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "bluetooth/include/ng_hci.h" +#include "bluetooth/include/ng_l2cap.h" +#include "bluetooth/l2cap/ng_l2cap_var.h" +#include "bluetooth/l2cap/ng_l2cap_cmds.h" +#include "bluetooth/l2cap/ng_l2cap_evnt.h" +#include "bluetooth/l2cap/ng_l2cap_llpi.h" +#include "bluetooth/l2cap/ng_l2cap_ulpi.h" +#include "bluetooth/l2cap/ng_l2cap_misc.h" /****************************************************************************** ****************************************************************************** @@ -168,7 +169,7 @@ ng_l2cap_l2ca_con_rsp(ng_l2cap_chan_p ch, u_int32_t token, u_int16_t result, /* Create and send L2CA_Connect response message */ NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_L2CA_CON, - sizeof(*op), M_NOWAIT); + sizeof(*op), M_WAITOK | M_NULLOK); if (msg == NULL) error = ENOMEM; else { @@ -325,7 +326,7 @@ ng_l2cap_l2ca_con_rsp_rsp(ng_l2cap_chan_p ch, u_int32_t token, u_int16_t result) /* Create and send L2CA_ConnectRsp response message */ NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_L2CA_CON_RSP, - sizeof(*op), M_NOWAIT); + sizeof(*op), M_WAITOK | M_NULLOK); if (msg == NULL) error = ENOMEM; else { @@ -365,7 +366,7 @@ ng_l2cap_l2ca_con_ind(ng_l2cap_chan_p ch) /* Create and send L2CA_ConnectInd message */ NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_L2CA_CON_IND, - sizeof(*ip), M_NOWAIT); + sizeof(*ip), M_WAITOK | M_NULLOK); if (msg == NULL) error = ENOMEM; else { @@ -513,7 +514,7 @@ ng_l2cap_l2ca_cfg_rsp(ng_l2cap_chan_p ch, u_int32_t token, u_int16_t result) /* Create and send L2CA_Config response message */ NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_L2CA_CFG, - sizeof(*op), M_NOWAIT); + sizeof(*op), M_WAITOK | M_NULLOK); if (msg == NULL) error = ENOMEM; else { @@ -672,7 +673,7 @@ ng_l2cap_l2ca_cfg_rsp_rsp(ng_l2cap_chan_p ch, u_int32_t token, u_int16_t result) /* Create and send L2CA_ConfigRsp response message */ NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_L2CA_CFG_RSP, - sizeof(*op), M_NOWAIT); + sizeof(*op), M_WAITOK | M_NULLOK); if (msg == NULL) error = ENOMEM; else { @@ -725,7 +726,7 @@ ng_l2cap_l2ca_cfg_ind(ng_l2cap_chan_p ch) /* Create and send L2CA_ConnectInd message */ NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_L2CA_CFG_IND, - sizeof(*ip), M_NOWAIT); + sizeof(*ip), M_WAITOK | M_NULLOK); if (msg == NULL) error = ENOMEM; else { @@ -855,7 +856,7 @@ ng_l2cap_l2ca_write_rsp(ng_l2cap_chan_p ch, u_int32_t token, u_int16_t result, /* Create and send L2CA_WriteRsp message */ NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_L2CA_WRITE, - sizeof(*op), M_NOWAIT); + sizeof(*op), M_WAITOK | M_NULLOK); if (msg == NULL) error = ENOMEM; else { @@ -1055,7 +1056,7 @@ ng_l2cap_l2ca_qos_ind(ng_l2cap_chan_p ch) /* Create and send L2CA_QoSViolationInd message */ NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_L2CA_QOS_IND, - sizeof(*ip), M_NOWAIT); + sizeof(*ip), M_WAITOK | M_NULLOK); if (msg == NULL) error = ENOMEM; else { @@ -1171,7 +1172,7 @@ ng_l2cap_l2ca_discon_rsp(ng_l2cap_chan_p ch, u_int32_t token, u_int16_t result) /* Create and send L2CA_Disconnect response message */ NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_L2CA_DISCON, - sizeof(*op), M_NOWAIT); + sizeof(*op), M_WAITOK | M_NULLOK); if (msg == NULL) error = ENOMEM; else { @@ -1211,7 +1212,7 @@ ng_l2cap_l2ca_discon_ind(ng_l2cap_chan_p ch) /* Create and send L2CA_DisconnectInd message */ NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_L2CA_DISCON_IND, - sizeof(*ip), M_NOWAIT); + sizeof(*ip), M_WAITOK | M_NULLOK); if (msg == NULL) error = ENOMEM; else { @@ -1396,7 +1397,7 @@ ng_l2cap_l2ca_ping_rsp(ng_l2cap_con_p con, u_int32_t token, u_int16_t result, /* Create and send L2CA_Ping response message */ NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_L2CA_PING, - sizeof(*op) + size, M_NOWAIT); + sizeof(*op) + size, M_WAITOK | M_NULLOK); if (msg == NULL) error = ENOMEM; else { @@ -1517,7 +1518,7 @@ ng_l2cap_l2ca_get_info_rsp(ng_l2cap_con_p con, u_int32_t token, /* Create and send L2CA_GetInfo response message */ NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_L2CA_GET_INFO, - sizeof(*op) + size, M_NOWAIT); + sizeof(*op) + size, M_WAITOK | M_NULLOK); if (msg == NULL) error = ENOMEM; else { @@ -1621,7 +1622,7 @@ ng_l2cap_l2ca_enable_clt(ng_l2cap_p l2cap, struct ng_mesg *msg) * token = msg->header.token; * NG_FREE_MSG(msg); * NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_L2CA_ENABLE_CLT, - * sizeof(*op), M_NOWAIT); + * sizeof(*op), M_WAITOK | M_NULLOK); * if (msg == NULL) * error = ENOMEM; * else { diff --git a/sys/netgraph7/bluetooth/l2cap/ng_l2cap_ulpi.h b/sys/netgraph7/bluetooth/l2cap/ng_l2cap_ulpi.h index 4e9380c650..f7cb0a8a38 100644 --- a/sys/netgraph7/bluetooth/l2cap/ng_l2cap_ulpi.h +++ b/sys/netgraph7/bluetooth/l2cap/ng_l2cap_ulpi.h @@ -29,6 +29,7 @@ * * $Id: ng_l2cap_ulpi.h,v 1.1 2002/11/24 19:47:06 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/l2cap/ng_l2cap_ulpi.h,v 1.3 2005/01/07 01:45:43 imp Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/l2cap/ng_l2cap_ulpi.h,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ #ifndef _NETGRAPH_L2CAP_ULPI_H_ diff --git a/sys/netgraph7/bluetooth/l2cap/ng_l2cap_var.h b/sys/netgraph7/bluetooth/l2cap/ng_l2cap_var.h index 2a93b9adc5..9a83c847b4 100644 --- a/sys/netgraph7/bluetooth/l2cap/ng_l2cap_var.h +++ b/sys/netgraph7/bluetooth/l2cap/ng_l2cap_var.h @@ -29,6 +29,7 @@ * * $Id: ng_l2cap_var.h,v 1.2 2003/04/28 21:44:59 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/l2cap/ng_l2cap_var.h,v 1.6 2005/01/07 01:45:43 imp Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/l2cap/ng_l2cap_var.h,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ #ifndef _NETGRAPH_L2CAP_VAR_H_ diff --git a/sys/netgraph7/bluetooth/socket/ng_btsocket.c b/sys/netgraph7/bluetooth/socket/ng_btsocket.c index 1bbccd69c2..3e2d10ada1 100644 --- a/sys/netgraph7/bluetooth/socket/ng_btsocket.c +++ b/sys/netgraph7/bluetooth/socket/ng_btsocket.c @@ -29,6 +29,7 @@ * * $Id: ng_btsocket.c,v 1.4 2003/09/14 23:29:06 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/socket/ng_btsocket.c,v 1.13 2006/07/21 17:11:13 rwatson Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/socket/ng_btsocket.c,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ #include @@ -45,15 +46,15 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "bluetooth/include/ng_bluetooth.h" +#include "bluetooth/include/ng_hci.h" +#include "bluetooth/include/ng_l2cap.h" +#include "bluetooth/include/ng_btsocket.h" +#include "bluetooth/include/ng_btsocket_hci_raw.h" +#include "bluetooth/include/ng_btsocket_l2cap.h" +#include "bluetooth/include/ng_btsocket_rfcomm.h" static int ng_btsocket_modevent (module_t, int, void *); extern struct domain ng_btsocket_domain; diff --git a/sys/netgraph7/bluetooth/socket/ng_btsocket_hci_raw.c b/sys/netgraph7/bluetooth/socket/ng_btsocket_hci_raw.c index 9f4a038917..cc8bc699e4 100644 --- a/sys/netgraph7/bluetooth/socket/ng_btsocket_hci_raw.c +++ b/sys/netgraph7/bluetooth/socket/ng_btsocket_hci_raw.c @@ -29,6 +29,7 @@ * * $Id: ng_btsocket_hci_raw.c,v 1.14 2003/09/14 23:29:06 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c,v 1.23 2006/11/06 13:42:04 rwatson Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/socket/ng_btsocket_hci_raw.c,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ #include @@ -51,13 +52,13 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "bluetooth/include/ng_bluetooth.h" +#include "bluetooth/include/ng_hci.h" +#include "bluetooth/include/ng_l2cap.h" +#include "bluetooth/include/ng_btsocket.h" +#include "bluetooth/include/ng_btsocket_hci_raw.h" /* MALLOC define */ #ifdef NG_SEPARATE_MALLOC @@ -305,7 +306,7 @@ ng_btsocket_hci_raw_node_rcvdata(hook_p hook, item_p item) * for now */ - MGET(nam, M_DONTWAIT, MT_SONAME); + MGET(nam, MB_DONTWAIT, MT_SONAME); if (nam != NULL) { struct sockaddr_hci *sa = mtod(nam, struct sockaddr_hci *); @@ -378,7 +379,7 @@ ng_btsocket_hci_raw_send_ngmsg(char *path, int cmd, void *arg, int arglen) struct ng_mesg *msg = NULL; int error = 0; - NG_MKMESSAGE(msg, NGM_HCI_COOKIE, cmd, arglen, M_NOWAIT); + NG_MKMESSAGE(msg, NGM_HCI_COOKIE, cmd, arglen, M_WAITOK | M_NULLOK); if (msg == NULL) return (ENOMEM); @@ -403,7 +404,7 @@ ng_btsocket_hci_raw_send_sync_ngmsg(ng_btsocket_hci_raw_pcb_p pcb, char *path, mtx_assert(&pcb->pcb_mtx, MA_OWNED); - NG_MKMESSAGE(msg, NGM_HCI_COOKIE, cmd, 0, M_NOWAIT); + NG_MKMESSAGE(msg, NGM_HCI_COOKIE, cmd, 0, M_WAITOK | M_NULLOK); if (msg == NULL) return (ENOMEM); @@ -514,7 +515,7 @@ ng_btsocket_hci_raw_data_input(struct mbuf *nam) * will check if socket has enough buffer space. */ - m = m_dup(m0, M_DONTWAIT); + m = m_dup(m0, MB_DONTWAIT); if (m != NULL) { struct mbuf *ctl = NULL; @@ -786,7 +787,7 @@ ng_btsocket_hci_raw_init(void) MALLOC(ng_btsocket_hci_raw_sec_filter, struct ng_btsocket_hci_raw_sec_filter *, sizeof(struct ng_btsocket_hci_raw_sec_filter), - M_NETGRAPH_BTSOCKET_HCI_RAW, M_NOWAIT|M_ZERO); + M_NETGRAPH_BTSOCKET_HCI_RAW, M_WAITOK | M_NULLOK | M_ZERO); if (ng_btsocket_hci_raw_sec_filter == NULL) { printf("%s: Could not allocate security filter!\n", __func__); return; @@ -910,7 +911,7 @@ ng_btsocket_hci_raw_attach(struct socket *so, int proto, struct thread *td) return (error); MALLOC(pcb, ng_btsocket_hci_raw_pcb_p, sizeof(*pcb), - M_NETGRAPH_BTSOCKET_HCI_RAW, M_NOWAIT|M_ZERO); + M_NETGRAPH_BTSOCKET_HCI_RAW, M_WAITOK | M_NULLOK | M_ZERO); if (pcb == NULL) return (ENOMEM); @@ -1148,7 +1149,7 @@ ng_btsocket_hci_raw_control(struct socket *so, u_long cmd, caddr_t data, } NG_MKMESSAGE(msg, NGM_HCI_COOKIE, - NGM_HCI_NODE_GET_NEIGHBOR_CACHE, 0, M_NOWAIT); + NGM_HCI_NODE_GET_NEIGHBOR_CACHE, 0, M_WAITOK | M_NULLOK); if (msg == NULL) { error = ENOMEM; break; @@ -1204,7 +1205,7 @@ ng_btsocket_hci_raw_control(struct socket *so, u_long cmd, caddr_t data, } NG_MKMESSAGE(msg, NGM_HCI_COOKIE, NGM_HCI_NODE_GET_CON_LIST, - 0, M_NOWAIT); + 0, M_WAITOK | M_NULLOK); if (msg == NULL) { error = ENOMEM; break; @@ -1324,7 +1325,7 @@ ng_btsocket_hci_raw_control(struct socket *so, u_long cmd, caddr_t data, } NG_MKMESSAGE(msg, NGM_GENERIC_COOKIE, NGM_LISTNAMES, - 0, M_NOWAIT); + 0, M_WAITOK | M_NULLOK); if (msg == NULL) { error = ENOMEM; break; @@ -1584,7 +1585,7 @@ ng_btsocket_hci_raw_send(struct socket *so, int flags, struct mbuf *m, sa = (struct sockaddr *) &pcb->addr; } - MGET(nam, M_DONTWAIT, MT_SONAME); + MGET(nam, MB_DONTWAIT, MT_SONAME); if (nam == NULL) { mtx_unlock(&pcb->pcb_mtx); error = ENOBUFS; @@ -1632,7 +1633,7 @@ ng_btsocket_hci_raw_sockaddr(struct socket *so, struct sockaddr **nam) strlcpy(sa.hci_node, pcb->addr.hci_node, sizeof(sa.hci_node)); mtx_unlock(&pcb->pcb_mtx); - *nam = sodupsockaddr((struct sockaddr *) &sa, M_NOWAIT); + *nam = sodupsockaddr((struct sockaddr *) &sa, M_WAITOK | M_NULLOK); return ((*nam == NULL)? ENOMEM : 0); } /* ng_btsocket_hci_raw_sockaddr */ diff --git a/sys/netgraph7/bluetooth/socket/ng_btsocket_l2cap.c b/sys/netgraph7/bluetooth/socket/ng_btsocket_l2cap.c index 82544be25c..874a9ed8e4 100644 --- a/sys/netgraph7/bluetooth/socket/ng_btsocket_l2cap.c +++ b/sys/netgraph7/bluetooth/socket/ng_btsocket_l2cap.c @@ -29,6 +29,7 @@ * * $Id: ng_btsocket_l2cap.c,v 1.16 2003/09/14 23:29:06 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c,v 1.25 2007/10/31 16:17:20 emax Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/socket/ng_btsocket_l2cap.c,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ #include @@ -50,13 +51,13 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "bluetooth/include/ng_bluetooth.h" +#include "bluetooth/include/ng_hci.h" +#include "bluetooth/include/ng_l2cap.h" +#include "bluetooth/include/ng_btsocket.h" +#include "bluetooth/include/ng_btsocket_l2cap.h" /* MALLOC define */ #ifdef NG_SEPARATE_MALLOC @@ -1156,7 +1157,7 @@ ng_btsocket_l2cap_send_l2ca_con_req(ng_btsocket_l2cap_pcb_p pcb) return (ENETDOWN); NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_L2CA_CON, - sizeof(*ip), M_NOWAIT); + sizeof(*ip), M_WAITOK | M_NULLOK); if (msg == NULL) return (ENOMEM); @@ -1188,7 +1189,7 @@ ng_btsocket_l2cap_send_l2ca_con_rsp_req(u_int32_t token, return (ENETDOWN); NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_L2CA_CON_RSP, - sizeof(*ip), M_NOWAIT); + sizeof(*ip), M_WAITOK | M_NULLOK); if (msg == NULL) return (ENOMEM); @@ -1224,7 +1225,7 @@ ng_btsocket_l2cap_send_l2ca_cfg_req(ng_btsocket_l2cap_pcb_p pcb) return (ENETDOWN); NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_L2CA_CFG, - sizeof(*ip), M_NOWAIT); + sizeof(*ip), M_WAITOK | M_NULLOK); if (msg == NULL) return (ENOMEM); @@ -1260,7 +1261,7 @@ ng_btsocket_l2cap_send_l2ca_cfg_rsp(ng_btsocket_l2cap_pcb_p pcb) return (ENETDOWN); NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_L2CA_CFG_RSP, - sizeof(*ip), M_NOWAIT); + sizeof(*ip), M_WAITOK | M_NULLOK); if (msg == NULL) return (ENOMEM); @@ -1295,7 +1296,7 @@ ng_btsocket_l2cap_send_l2ca_discon_req(u_int32_t token, return (ENETDOWN); NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_L2CA_DISCON, - sizeof(*ip), M_NOWAIT); + sizeof(*ip), M_WAITOK | M_NULLOK); if (msg == NULL) return (ENOMEM); @@ -1521,7 +1522,7 @@ ng_btsocket_l2cap_data_input(struct mbuf *m, hook_p hook) * it is a broadcast traffic after all */ - copy = m_dup(m, M_DONTWAIT); + copy = m_dup(m, MB_DONTWAIT); if (copy != NULL) { sbappendrecord(&pcb->so->so_rcv, copy); sorwakeup(pcb->so); @@ -1558,7 +1559,7 @@ ng_btsocket_l2cap_default_msg_input(struct ng_mesg *msg, hook_p hook) rt = (ng_btsocket_l2cap_rtentry_t *) NG_HOOK_PRIVATE(hook); if (rt == NULL) { MALLOC(rt, ng_btsocket_l2cap_rtentry_p, sizeof(*rt), - M_NETGRAPH_BTSOCKET_L2CAP, M_NOWAIT|M_ZERO); + M_NETGRAPH_BTSOCKET_L2CAP, M_WAITOK | M_NULLOK | M_ZERO); if (rt == NULL) { mtx_unlock(&ng_btsocket_l2cap_rt_mtx); break; @@ -1925,7 +1926,7 @@ ng_btsocket_l2cap_attach(struct socket *so, int proto, struct thread *td) /* Allocate the PCB */ MALLOC(pcb, ng_btsocket_l2cap_pcb_p, sizeof(*pcb), - M_NETGRAPH_BTSOCKET_L2CAP, M_NOWAIT | M_ZERO); + M_NETGRAPH_BTSOCKET_L2CAP, M_WAITOK | M_NULLOK | M_ZERO); if (pcb == NULL) return (ENOMEM); @@ -2405,7 +2406,7 @@ ng_btsocket_l2cap_peeraddr(struct socket *so, struct sockaddr **nam) sa.l2cap_len = sizeof(sa); sa.l2cap_family = AF_BLUETOOTH; - *nam = sodupsockaddr((struct sockaddr *) &sa, M_NOWAIT); + *nam = sodupsockaddr((struct sockaddr *) &sa, M_WAITOK | M_NULLOK); return ((*nam == NULL)? ENOMEM : 0); } /* ng_btsocket_l2cap_peeraddr */ @@ -2501,12 +2502,12 @@ 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_DONTWAIT); + m = m_dup(pcb->so->so_snd.sb_mb, MB_DONTWAIT); if (m == NULL) return (ENOBUFS); /* Create L2CA packet header */ - M_PREPEND(m, sizeof(*hdr), M_DONTWAIT); + M_PREPEND(m, sizeof(*hdr), MB_DONTWAIT); if (m != NULL) if (m->m_len < sizeof(*hdr)) m = m_pullup(m, sizeof(*hdr)); @@ -2558,7 +2559,7 @@ ng_btsocket_l2cap_sockaddr(struct socket *so, struct sockaddr **nam) sa.l2cap_len = sizeof(sa); sa.l2cap_family = AF_BLUETOOTH; - *nam = sodupsockaddr((struct sockaddr *) &sa, M_NOWAIT); + *nam = sodupsockaddr((struct sockaddr *) &sa, M_WAITOK | M_NULLOK); return ((*nam == NULL)? ENOMEM : 0); } /* ng_btsocket_l2cap_sockaddr */ diff --git a/sys/netgraph7/bluetooth/socket/ng_btsocket_l2cap_raw.c b/sys/netgraph7/bluetooth/socket/ng_btsocket_l2cap_raw.c index 06d6f91ee2..2bb4234ac5 100644 --- a/sys/netgraph7/bluetooth/socket/ng_btsocket_l2cap_raw.c +++ b/sys/netgraph7/bluetooth/socket/ng_btsocket_l2cap_raw.c @@ -29,6 +29,7 @@ * * $Id: ng_btsocket_l2cap_raw.c,v 1.12 2003/09/14 23:29:06 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c,v 1.20 2006/11/06 13:42:04 rwatson Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/socket/ng_btsocket_l2cap_raw.c,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ #include @@ -50,13 +51,13 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "bluetooth/include/ng_bluetooth.h" +#include "bluetooth/include/ng_hci.h" +#include "bluetooth/include/ng_l2cap.h" +#include "bluetooth/include/ng_btsocket.h" +#include "bluetooth/include/ng_btsocket_l2cap.h" /* MALLOC define */ #ifdef NG_SEPARATE_MALLOC @@ -374,7 +375,7 @@ ng_btsocket_l2cap_raw_input(void *context, int pending) MALLOC(rt, ng_btsocket_l2cap_rtentry_p, sizeof(*rt), M_NETGRAPH_BTSOCKET_L2CAP_RAW, - M_NOWAIT|M_ZERO); + M_WAITOK | M_NULLOK | M_ZERO); if (rt == NULL) break; @@ -613,7 +614,7 @@ ng_btsocket_l2cap_raw_attach(struct socket *so, int proto, struct thread *td) /* Allocate the PCB */ MALLOC(pcb, ng_btsocket_l2cap_raw_pcb_p, sizeof(*pcb), - M_NETGRAPH_BTSOCKET_L2CAP_RAW, M_NOWAIT|M_ZERO); + M_NETGRAPH_BTSOCKET_L2CAP_RAW, M_WAITOK | M_NULLOK | M_ZERO); if (pcb == NULL) return (ENOMEM); @@ -840,7 +841,7 @@ ng_btsocket_l2cap_raw_control(struct socket *so, u_long cmd, caddr_t data, } NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_NODE_GET_CON_LIST, - 0, M_NOWAIT); + 0, M_WAITOK | M_NULLOK); if (msg == NULL) { error = ENOMEM; break; @@ -895,7 +896,7 @@ ng_btsocket_l2cap_raw_control(struct socket *so, u_long cmd, caddr_t data, } NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, - NGM_L2CAP_NODE_GET_CHAN_LIST, 0, M_NOWAIT); + NGM_L2CAP_NODE_GET_CHAN_LIST, 0, M_WAITOK | M_NULLOK); if (msg == NULL) { error = ENOMEM; break; @@ -955,7 +956,7 @@ ng_btsocket_l2cap_raw_control(struct socket *so, u_long cmd, caddr_t data, NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_L2CA_PING, sizeof(*ip) + p->echo_size, - M_NOWAIT); + M_WAITOK | M_NULLOK); if (msg == NULL) { error = ENOMEM; break; @@ -1025,7 +1026,7 @@ ng_btsocket_l2cap_raw_control(struct socket *so, u_long cmd, caddr_t data, NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_L2CA_GET_INFO, sizeof(*ip) + p->info_size, - M_NOWAIT); + M_WAITOK | M_NULLOK); if (msg == NULL) { error = ENOMEM; break; @@ -1173,7 +1174,7 @@ ng_btsocket_l2cap_raw_peeraddr(struct socket *so, struct sockaddr **nam) sa.l2cap_len = sizeof(sa); sa.l2cap_family = AF_BLUETOOTH; - *nam = sodupsockaddr((struct sockaddr *) &sa, M_NOWAIT); + *nam = sodupsockaddr((struct sockaddr *) &sa, M_WAITOK | M_NULLOK); return ((*nam == NULL)? ENOMEM : 0); } /* ng_btsocket_l2cap_raw_peeraddr */ @@ -1215,7 +1216,7 @@ ng_btsocket_l2cap_raw_sockaddr(struct socket *so, struct sockaddr **nam) sa.l2cap_len = sizeof(sa); sa.l2cap_family = AF_BLUETOOTH; - *nam = sodupsockaddr((struct sockaddr *) &sa, M_NOWAIT); + *nam = sodupsockaddr((struct sockaddr *) &sa, M_WAITOK | M_NULLOK); return ((*nam == NULL)? ENOMEM : 0); } /* ng_btsocket_l2cap_raw_sockaddr */ @@ -1247,7 +1248,7 @@ ng_btsocket_l2cap_raw_send_ngmsg(hook_p hook, int cmd, void *arg, int arglen) struct ng_mesg *msg = NULL; int error = 0; - NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, cmd, arglen, M_NOWAIT); + NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, cmd, arglen, M_WAITOK | M_NULLOK); if (msg == NULL) return (ENOMEM); @@ -1272,7 +1273,7 @@ ng_btsocket_l2cap_raw_send_sync_ngmsg(ng_btsocket_l2cap_raw_pcb_p pcb, mtx_assert(&pcb->pcb_mtx, MA_OWNED); - NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, cmd, 0, M_NOWAIT); + NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, cmd, 0, M_WAITOK | M_NULLOK); if (msg == NULL) return (ENOMEM); diff --git a/sys/netgraph7/bluetooth/socket/ng_btsocket_rfcomm.c b/sys/netgraph7/bluetooth/socket/ng_btsocket_rfcomm.c index 3eaeccf524..0f232cb4c2 100644 --- a/sys/netgraph7/bluetooth/socket/ng_btsocket_rfcomm.c +++ b/sys/netgraph7/bluetooth/socket/ng_btsocket_rfcomm.c @@ -29,6 +29,7 @@ * * $Id: ng_btsocket_rfcomm.c,v 1.28 2003/09/14 23:29:06 max Exp $ * $FreeBSD: src/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c,v 1.27 2007/10/29 19:06:47 emax Exp $ + * $DragonFly: src/sys/netgraph7/bluetooth/socket/ng_btsocket_rfcomm.c,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ #include @@ -52,14 +53,14 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "bluetooth/include/ng_bluetooth.h" +#include "bluetooth/include/ng_hci.h" +#include "bluetooth/include/ng_l2cap.h" +#include "bluetooth/include/ng_btsocket.h" +#include "bluetooth/include/ng_btsocket_l2cap.h" +#include "bluetooth/include/ng_btsocket_rfcomm.h" /* MALLOC define */ #ifdef NG_SEPARATE_MALLOC @@ -400,7 +401,7 @@ ng_btsocket_rfcomm_attach(struct socket *so, int proto, struct thread *td) /* Allocate the PCB */ MALLOC(pcb, ng_btsocket_rfcomm_pcb_p, sizeof(*pcb), - M_NETGRAPH_BTSOCKET_RFCOMM, M_NOWAIT | M_ZERO); + M_NETGRAPH_BTSOCKET_RFCOMM, M_WAITOK | M_NULLOK | M_ZERO); if (pcb == NULL) return (ENOMEM); @@ -934,7 +935,7 @@ ng_btsocket_rfcomm_peeraddr(struct socket *so, struct sockaddr **nam) sa.rfcomm_len = sizeof(sa); sa.rfcomm_family = AF_BLUETOOTH; - *nam = sodupsockaddr((struct sockaddr *) &sa, M_NOWAIT); + *nam = sodupsockaddr((struct sockaddr *) &sa, M_WAITOK | M_NULLOK); return ((*nam == NULL)? ENOMEM : 0); } /* ng_btsocket_rfcomm_peeraddr */ @@ -1000,7 +1001,7 @@ ng_btsocket_rfcomm_sockaddr(struct socket *so, struct sockaddr **nam) sa.rfcomm_len = sizeof(sa); sa.rfcomm_family = AF_BLUETOOTH; - *nam = sodupsockaddr((struct sockaddr *) &sa, M_NOWAIT); + *nam = sodupsockaddr((struct sockaddr *) &sa, M_WAITOK | M_NULLOK); return ((*nam == NULL)? ENOMEM : 0); } /* ng_btsocket_rfcomm_sockaddr */ @@ -1265,7 +1266,7 @@ ng_btsocket_rfcomm_session_create(ng_btsocket_rfcomm_session_p *sp, /* Allocate the RFCOMM session */ MALLOC(s, ng_btsocket_rfcomm_session_p, sizeof(*s), - M_NETGRAPH_BTSOCKET_RFCOMM, M_NOWAIT | M_ZERO); + M_NETGRAPH_BTSOCKET_RFCOMM, M_WAITOK | M_NULLOK | M_ZERO); if (s == NULL) return (ENOMEM); @@ -3006,7 +3007,7 @@ ng_btsocket_rfcomm_send_command(ng_btsocket_rfcomm_session_p s, /* NOT REACHED */ } - MGETHDR(m, M_DONTWAIT, MT_DATA); + MGETHDR(m, MB_DONTWAIT, MT_DATA); if (m == NULL) return (ENOBUFS); @@ -3037,14 +3038,14 @@ ng_btsocket_rfcomm_send_uih(ng_btsocket_rfcomm_session_p s, u_int8_t address, mtx_assert(&s->session_mtx, MA_OWNED); - MGETHDR(m, M_DONTWAIT, MT_DATA); + MGETHDR(m, MB_DONTWAIT, MT_DATA); if (m == NULL) { NG_FREE_M(data); return (ENOBUFS); } m->m_pkthdr.len = m->m_len = sizeof(*hdr); - MGET(mcrc, M_DONTWAIT, MT_DATA); + MGET(mcrc, MB_DONTWAIT, MT_DATA); if (mcrc == NULL) { NG_FREE_M(data); return (ENOBUFS); @@ -3111,7 +3112,7 @@ ng_btsocket_rfcomm_send_msc(ng_btsocket_rfcomm_pcb_p pcb) mtx_assert(&pcb->session->session_mtx, MA_OWNED); mtx_assert(&pcb->pcb_mtx, MA_OWNED); - MGETHDR(m, M_DONTWAIT, MT_DATA); + MGETHDR(m, MB_DONTWAIT, MT_DATA); if (m == NULL) return (ENOBUFS); @@ -3149,7 +3150,7 @@ ng_btsocket_rfcomm_send_pn(ng_btsocket_rfcomm_pcb_p pcb) mtx_assert(&pcb->session->session_mtx, MA_OWNED); mtx_assert(&pcb->pcb_mtx, MA_OWNED); - MGETHDR(m, M_DONTWAIT, MT_DATA); + MGETHDR(m, MB_DONTWAIT, MT_DATA); if (m == NULL) return (ENOBUFS); @@ -3520,7 +3521,7 @@ ng_btsocket_rfcomm_prepare_packet(struct sockbuf *sb, int length) struct mbuf *top = NULL, *m = NULL, *n = NULL, *nextpkt = NULL; int mlen, noff, len; - MGETHDR(top, M_DONTWAIT, MT_DATA); + MGETHDR(top, MB_DONTWAIT, MT_DATA); if (top == NULL) return (NULL); @@ -3544,7 +3545,7 @@ ng_btsocket_rfcomm_prepare_packet(struct sockbuf *sb, int length) length -= len; if (length > 0 && m->m_len == mlen) { - MGET(m->m_next, M_DONTWAIT, MT_DATA); + MGET(m->m_next, MB_DONTWAIT, MT_DATA); if (m->m_next == NULL) { NG_FREE_M(top); return (NULL); diff --git a/sys/netgraph7/dragonfly.h b/sys/netgraph7/dragonfly.h new file mode 100644 index 0000000000..aca15dc126 --- /dev/null +++ b/sys/netgraph7/dragonfly.h @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2008 The DragonFly Project. All rights reserved. + * + * This code is derived from software contributed to The DragonFly Project + * by Matthew Dillon + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of The DragonFly Project nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific, prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $DragonFly: src/sys/netgraph7/dragonfly.h,v 1.1 2008/06/26 23:05:35 dillon Exp $ + */ + +#include +#include + +struct mtx { + struct lock lock; +}; + +#define mtx_contested(mtx) 0 + +#define mtx_lock(mtx) lockmgr(&(mtx)->lock, LK_EXCLUSIVE|LK_RETRY) +#define mtx_unlock(mtx) lockmgr(&(mtx)->lock, LK_RELEASE) +#define mtx_assert(mtx, unused) \ + (lockstatus(&(mtx)->lock, curthread) == LK_EXCLUSIVE) +#define mtx_init(mtx, name, something, type) \ + lockinit(&(mtx)->lock, name, 0, 0) +#define mtx_destroy(mtx) \ + lockuninit(&(mtx)->lock) +#define mtx_trylock(mtx) \ + (lockmgr(&(mtx)->lock, LK_EXCLUSIVE|LK_NOWAIT) == 0) + +#define printf kprintf +#define snprintf ksnprintf + +typedef struct objcache *objcache_t; +#define uma_zone_t objcache_t + +#define CTR1(ktr_line, ...) +#define CTR2(ktr_line, ...) +#define CTR3(ktr_line, ...) +#define CTR4(ktr_line, ...) +#define CTR5(ktr_line, ...) +#define CTR6(ktr_line, ...) +#define cpu_spinwait() cpu_pause() + +#define splnet() 0 +#define splx(v) + diff --git a/sys/netgraph7/netflow/netflow.c b/sys/netgraph7/netflow/netflow.c index 96ba4951d9..9bc2525be7 100644 --- a/sys/netgraph7/netflow/netflow.c +++ b/sys/netgraph7/netflow/netflow.c @@ -25,11 +25,10 @@ * SUCH DAMAGE. * * $SourceForge: netflow.c,v 1.41 2004/09/05 11:41:10 glebius Exp $ + * $FreeBSD: src/sys/netgraph/netflow/netflow.c,v 1.29 2008/05/09 23:02:57 julian Exp $ + * $DragonFly: src/sys/netgraph7/netflow/netflow.c,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ -static const char rcs_id[] = - "@(#) $FreeBSD: src/sys/netgraph/netflow/netflow.c,v 1.29 2008/05/09 23:02:57 julian Exp $"; - #include #include #include @@ -48,11 +47,11 @@ static const char rcs_id[] = #include #include -#include -#include +#include "ng_message.h" +#include "netgraph.h" -#include -#include +#include "netflow/netflow.h" +#include "netflow/ng_netflow.h" #define NBUCKETS (65536) /* must be power of 2 */ @@ -158,7 +157,7 @@ get_export_dgram(priv_p priv) struct netflow_v5_export_dgram *dgram; struct mbuf *m; - m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + m = m_getcl(MB_DONTWAIT, MT_DATA, M_PKTHDR); if (m == NULL) return (NULL); item = ng_package_data(m, NG_NOFLAGS); @@ -243,7 +242,7 @@ hash_insert(priv_p priv, struct flow_hash_entry *hsh, struct flow_rec *r, mtx_assert(&hsh->mtx, MA_OWNED); - fle = uma_zalloc_arg(priv->zone, priv, M_NOWAIT); + fle = uma_zalloc_arg(priv->zone, priv, M_WAITOK | M_NULLOK); if (fle == NULL) { atomic_add_32(&priv->info.nfinfo_alloc_failed, 1); return (ENOMEM); @@ -564,7 +563,7 @@ ng_netflow_flow_show(priv_p priv, uint32_t last, struct ng_mesg *resp) continue; TAILQ_FOREACH(fle, &hsh->head, fle_hash) { - if (hsh->mtx.mtx_lock & MTX_CONTESTED) + if (mtx_contested(&hsh->mtx) break; bcopy(&fle->f, &(data->entries[data->nentries]), @@ -688,7 +687,7 @@ ng_netflow_expire(void *arg) * Interrupt thread wants this entry! * Quick! Quick! Bail out! */ - if (hsh->mtx.mtx_lock & MTX_CONTESTED) + if (mtx_contested(&hsh->mtx)) break; /* diff --git a/sys/netgraph7/netflow/ng_netflow.c b/sys/netgraph7/netflow/ng_netflow.c index c853008b4c..b2bf46393b 100644 --- a/sys/netgraph7/netflow/ng_netflow.c +++ b/sys/netgraph7/netflow/ng_netflow.c @@ -25,11 +25,10 @@ * SUCH DAMAGE. * * $SourceForge: ng_netflow.c,v 1.30 2004/09/05 11:37:43 glebius Exp $ + * $FreeBSD: src/sys/netgraph/netflow/ng_netflow.c,v 1.17 2008/04/16 16:47:14 kris Exp $ + * $DragonFly: src/sys/netgraph7/netflow/ng_netflow.c,v 1.2 2008/06/26 23:05:40 dillon Exp $ */ -static const char rcs_id[] = - "@(#) $FreeBSD: src/sys/netgraph/netflow/ng_netflow.c,v 1.17 2008/04/16 16:47:14 kris Exp $"; - #include #include #include @@ -51,11 +50,11 @@ static const char rcs_id[] = #include #include -#include -#include -#include -#include -#include +#include "ng_message.h" +#include "ng_parse.h" +#include "netgraph.h" +#include "netflow/netflow.h" +#include "netflow/ng_netflow.h" /* Netgraph methods */ static ng_constructor_t ng_netflow_constructor; @@ -170,7 +169,7 @@ ng_netflow_constructor(node_p node) int error = 0; /* Initialize private data */ - MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_NOWAIT); + MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_WAITOK | M_NULLOK); if (priv == NULL) return (ENOMEM); bzero(priv, sizeof(*priv)); @@ -305,7 +304,7 @@ ng_netflow_rcvmsg (node_p node, item_p item, hook_p lasthook) struct ng_netflow_info *i; NG_MKRESPONSE(resp, msg, sizeof(struct ng_netflow_info), - M_NOWAIT); + M_WAITOK | M_NULLOK); i = (struct ng_netflow_info *)resp->data; ng_netflow_copyinfo(priv, i); @@ -328,7 +327,7 @@ ng_netflow_rcvmsg (node_p node, item_p item, hook_p lasthook) ERROUT(EINVAL); NG_MKRESPONSE(resp, msg, - sizeof(struct ng_netflow_ifinfo), M_NOWAIT); + sizeof(struct ng_netflow_ifinfo), M_WAITOK | M_NULLOK); i = (struct ng_netflow_ifinfo *)resp->data; memcpy((void *)i, (void *)&priv->ifaces[*index].info, sizeof(priv->ifaces[*index].info)); @@ -408,7 +407,7 @@ ng_netflow_rcvmsg (node_p node, item_p item, hook_p lasthook) last = (uint32_t *)msg->data; - NG_MKRESPONSE(resp, msg, NGRESP_SIZE, M_NOWAIT); + NG_MKRESPONSE(resp, msg, NGRESP_SIZE, M_WAITOK | M_NULLOK); if (!resp) ERROUT(ENOMEM); diff --git a/sys/netgraph7/netgraph.h b/sys/netgraph7/netgraph.h index 3f1284afa8..aec5274368 100644 --- a/sys/netgraph7/netgraph.h +++ b/sys/netgraph7/netgraph.h @@ -38,6 +38,7 @@ * Author: Julian Elischer * * $FreeBSD: src/sys/netgraph/netgraph.h,v 1.74 2008/06/24 18:49:49 gnn Exp $ + * $DragonFly: src/sys/netgraph7/netgraph.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: netgraph.h,v 1.29 1999/11/01 07:56:13 julian Exp $ */ @@ -52,7 +53,8 @@ #include #include #include -#include +/*#include */ +#include "dragonfly.h" #ifdef HAVE_KERNEL_OPTION_HEADERS #include "opt_netgraph.h" diff --git a/sys/netgraph7/ng_UI.c b/sys/netgraph7/ng_UI.c index ee0c169f6f..a0b1e90ae9 100644 --- a/sys/netgraph7/ng_UI.c +++ b/sys/netgraph7/ng_UI.c @@ -38,6 +38,7 @@ * Author: Julian Elischer * * $FreeBSD: src/sys/netgraph/ng_UI.c,v 1.20 2005/01/07 01:45:39 imp Exp $ + * $DragonFly: src/sys/netgraph7/ng_UI.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_UI.c,v 1.14 1999/11/01 09:24:51 julian Exp $ */ @@ -50,9 +51,9 @@ #include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_UI.h" /* * DEFINITIONS @@ -103,7 +104,7 @@ ng_UI_constructor(node_p node) priv_p priv; /* Allocate private structure */ - MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); + MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_WAITOK | M_NULLOK | M_ZERO); if (priv == NULL) { return (ENOMEM); } @@ -191,7 +192,7 @@ ng_UI_rcvdata(hook_p hook, item_p item) m_adj(m, ptr - start); NG_FWD_NEW_DATA(error, item, priv->uplink, m); /* m -> NULL */ } else if (hook == priv->uplink) { - M_PREPEND(m, 1, M_DONTWAIT); /* Prepend IP NLPID */ + M_PREPEND(m, 1, MB_DONTWAIT); /* Prepend IP NLPID */ if (!m) ERROUT(ENOBUFS); mtod(m, u_char *)[0] = HDLC_UI; diff --git a/sys/netgraph7/ng_UI.h b/sys/netgraph7/ng_UI.h index f925050167..25c84c3595 100644 --- a/sys/netgraph7/ng_UI.h +++ b/sys/netgraph7/ng_UI.h @@ -38,6 +38,7 @@ * Author: Julian Elischer * * $FreeBSD: src/sys/netgraph/ng_UI.h,v 1.5 2005/01/07 01:45:39 imp Exp $ + * $DragonFly: src/sys/netgraph7/ng_UI.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_UI.h,v 1.6 1999/01/20 00:54:15 archie Exp $ */ diff --git a/sys/netgraph7/ng_async.c b/sys/netgraph7/ng_async.c index 2a27fecd4a..d53f824bec 100644 --- a/sys/netgraph7/ng_async.c +++ b/sys/netgraph7/ng_async.c @@ -38,6 +38,7 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_async.c,v 1.22 2005/01/07 01:45:39 imp Exp $ + * $DragonFly: src/sys/netgraph7/ng_async.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_async.c,v 1.17 1999/11/01 09:24:51 julian Exp $ */ @@ -53,10 +54,10 @@ #include #include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_async.h" +#include "ng_parse.h" #include @@ -183,7 +184,7 @@ nga_constructor(node_p node) { sc_p sc; - MALLOC(sc, sc_p, sizeof(*sc), M_NETGRAPH_ASYNC, M_NOWAIT | M_ZERO); + MALLOC(sc, sc_p, sizeof(*sc), M_NETGRAPH_ASYNC, M_WAITOK | M_NULLOK | M_ZERO); if (sc == NULL) return (ENOMEM); sc->amode = MODE_HUNT; @@ -191,11 +192,11 @@ nga_constructor(node_p node) sc->cfg.amru = NG_ASYNC_DEFAULT_MRU; sc->cfg.smru = NG_ASYNC_DEFAULT_MRU; MALLOC(sc->abuf, u_char *, - ASYNC_BUF_SIZE(sc->cfg.smru), M_NETGRAPH_ASYNC, M_NOWAIT); + ASYNC_BUF_SIZE(sc->cfg.smru), M_NETGRAPH_ASYNC, M_WAITOK | M_NULLOK); if (sc->abuf == NULL) goto fail; MALLOC(sc->sbuf, u_char *, - SYNC_BUF_SIZE(sc->cfg.amru), M_NETGRAPH_ASYNC, M_NOWAIT); + SYNC_BUF_SIZE(sc->cfg.amru), M_NETGRAPH_ASYNC, M_WAITOK | M_NULLOK); if (sc->sbuf == NULL) { FREE(sc->abuf, M_NETGRAPH_ASYNC); fail: @@ -275,7 +276,7 @@ nga_rcvmsg(node_p node, item_p item, hook_p lasthook) case NGM_ASYNC_COOKIE: switch (msg->header.cmd) { case NGM_ASYNC_CMD_GET_STATS: - NG_MKRESPONSE(resp, msg, sizeof(sc->stats), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(sc->stats), M_WAITOK | M_NULLOK); if (resp == NULL) ERROUT(ENOMEM); *((struct ng_async_stat *) resp->data) = sc->stats; @@ -299,7 +300,7 @@ nga_rcvmsg(node_p node, item_p item, hook_p lasthook) cfg->enabled = !!cfg->enabled; /* normalize */ if (cfg->smru > sc->cfg.smru) { /* reallocate buffer */ MALLOC(buf, u_char *, ASYNC_BUF_SIZE(cfg->smru), - M_NETGRAPH_ASYNC, M_NOWAIT); + M_NETGRAPH_ASYNC, M_WAITOK | M_NULLOK); if (!buf) ERROUT(ENOMEM); FREE(sc->abuf, M_NETGRAPH_ASYNC); @@ -307,7 +308,7 @@ nga_rcvmsg(node_p node, item_p item, hook_p lasthook) } if (cfg->amru > sc->cfg.amru) { /* reallocate buffer */ MALLOC(buf, u_char *, SYNC_BUF_SIZE(cfg->amru), - M_NETGRAPH_ASYNC, M_NOWAIT); + M_NETGRAPH_ASYNC, M_WAITOK | M_NULLOK); if (!buf) ERROUT(ENOMEM); FREE(sc->sbuf, M_NETGRAPH_ASYNC); @@ -323,7 +324,7 @@ nga_rcvmsg(node_p node, item_p item, hook_p lasthook) break; } case NGM_ASYNC_CMD_GET_CONFIG: - NG_MKRESPONSE(resp, msg, sizeof(sc->cfg), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(sc->cfg), M_WAITOK | M_NULLOK); if (!resp) ERROUT(ENOMEM); *((struct ng_async_cfg *) resp->data) = sc->cfg; diff --git a/sys/netgraph7/ng_async.h b/sys/netgraph7/ng_async.h index b0ea22da1d..b042216333 100644 --- a/sys/netgraph7/ng_async.h +++ b/sys/netgraph7/ng_async.h @@ -38,6 +38,7 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_async.h,v 1.11 2005/01/07 01:45:39 imp Exp $ + * $DragonFly: src/sys/netgraph7/ng_async.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_async.h,v 1.5 1999/01/25 01:17:14 archie Exp $ */ diff --git a/sys/netgraph7/ng_atmllc.c b/sys/netgraph7/ng_atmllc.c index 9aa0d0cfd8..1cfd2d40b7 100644 --- a/sys/netgraph7/ng_atmllc.c +++ b/sys/netgraph7/ng_atmllc.c @@ -24,6 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netgraph/ng_atmllc.c,v 1.3 2005/01/07 01:45:39 imp Exp $ + * $DragonFly: src/sys/netgraph7/ng_atmllc.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ #include @@ -34,9 +35,9 @@ #include #include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_atmllc.h" #include #include /* for M_HASFCS and ETHER_HDR_LEN */ @@ -81,7 +82,7 @@ ng_atmllc_constructor(node_p node) struct ng_atmllc_priv *priv; MALLOC(priv, struct ng_atmllc_priv *, sizeof(*priv), M_NETGRAPH, - M_NOWAIT | M_ZERO); + M_WAITOK | M_NULLOK | M_ZERO); if (priv == NULL) { return (ENOMEM); } @@ -206,7 +207,7 @@ ng_atmllc_rcvdata(hook_p hook, item_p item) m_adj(m, sizeof(struct atmllc) + padding); } else if (hook == priv->ether) { /* Add the LLC header */ - M_PREPEND(m, NG_ATMLLC_HEADER_LEN + 2, M_DONTWAIT); + M_PREPEND(m, NG_ATMLLC_HEADER_LEN + 2, MB_DONTWAIT); if (m == NULL) { printf("ng_atmllc: M_PREPEND failed\n"); NG_FREE_ITEM(item); @@ -223,7 +224,7 @@ ng_atmllc_rcvdata(hook_p hook, item_p item) outhook = priv->atm; } else if (hook == priv->fddi) { /* Add the LLC header */ - M_PREPEND(m, NG_ATMLLC_HEADER_LEN + 3, M_DONTWAIT); + M_PREPEND(m, NG_ATMLLC_HEADER_LEN + 3, MB_DONTWAIT); if (m == NULL) { printf("ng_atmllc: M_PREPEND failed\n"); NG_FREE_ITEM(item); diff --git a/sys/netgraph7/ng_atmllc.h b/sys/netgraph7/ng_atmllc.h index f9d009a3e7..aab421231b 100644 --- a/sys/netgraph7/ng_atmllc.h +++ b/sys/netgraph7/ng_atmllc.h @@ -24,6 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netgraph/ng_atmllc.h,v 1.2 2005/01/07 01:45:39 imp Exp $ + * $DragonFly: src/sys/netgraph7/ng_atmllc.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ #ifndef _NETGRAPH_ATMLLC_H_ diff --git a/sys/netgraph7/ng_base.c b/sys/netgraph7/ng_base.c index 2e410f5ccb..7d1b4faa37 100644 --- a/sys/netgraph7/ng_base.c +++ b/sys/netgraph7/ng_base.c @@ -39,6 +39,7 @@ * Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_base.c,v 1.159 2008/04/19 05:30:49 mav Exp $ + * $DragonFly: src/sys/netgraph7/ng_base.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_base.c,v 1.39 1999/01/28 23:54:53 julian Exp $ */ @@ -50,7 +51,7 @@ #include #include #include -#include +/*#include */ #include #include #include @@ -65,9 +66,9 @@ #include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_parse.h" MODULE_VERSION(netgraph, NG_ABI_VERSION); @@ -234,9 +235,9 @@ MALLOC_DEFINE(M_NETGRAPH_MSG, "netgraph_msg", "netgraph name storage"); /* Should not be visible outside this file */ #define _NG_ALLOC_HOOK(hook) \ - MALLOC(hook, hook_p, sizeof(*hook), M_NETGRAPH_HOOK, M_NOWAIT | M_ZERO) + MALLOC(hook, hook_p, sizeof(*hook), M_NETGRAPH_HOOK, M_WAITOK | M_NULLOK | M_ZERO) #define _NG_ALLOC_NODE(node) \ - MALLOC(node, node_p, sizeof(*node), M_NETGRAPH_NODE, M_NOWAIT | M_ZERO) + MALLOC(node, node_p, sizeof(*node), M_NETGRAPH_NODE, M_WAITOK | M_NULLOK | M_ZERO) #define NG_QUEUE_LOCK_INIT(n) \ mtx_init(&(n)->q_mtx, "ng_node", NULL, MTX_DEF) @@ -2499,7 +2500,7 @@ ng_generic_msg(node_p here, item_p item, hook_p lasthook) { struct nodeinfo *ni; - NG_MKRESPONSE(resp, msg, sizeof(*ni), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(*ni), M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -2523,7 +2524,7 @@ ng_generic_msg(node_p here, item_p item, hook_p lasthook) /* Get response struct */ NG_MKRESPONSE(resp, msg, sizeof(*hl) - + (nhooks * sizeof(struct linkinfo)), M_NOWAIT); + + (nhooks * sizeof(struct linkinfo)), M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -2585,7 +2586,7 @@ ng_generic_msg(node_p here, item_p item, hook_p lasthook) /* Get response struct */ NG_MKRESPONSE(resp, msg, sizeof(*nl) - + (num * sizeof(struct nodeinfo)), M_NOWAIT); + + (num * sizeof(struct nodeinfo)), M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -2636,7 +2637,7 @@ ng_generic_msg(node_p here, item_p item, hook_p lasthook) /* Get response struct */ NG_MKRESPONSE(resp, msg, sizeof(*tl) - + (num * sizeof(struct typeinfo)), M_NOWAIT); + + (num * sizeof(struct typeinfo)), M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -2680,7 +2681,7 @@ ng_generic_msg(node_p here, item_p item, hook_p lasthook) } /* Get a response message with lots of room */ - NG_MKRESPONSE(resp, msg, sizeof(*ascii) + bufSize, M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(*ascii) + bufSize, M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -2756,7 +2757,7 @@ ng_generic_msg(node_p here, item_p item, hook_p lasthook) ascii->data[ascii->header.arglen - 1] = '\0'; /* Get a response message with lots of room */ - NG_MKRESPONSE(resp, msg, sizeof(*binary) + bufSize, M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(*binary) + bufSize, M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; diff --git a/sys/netgraph7/ng_bpf.c b/sys/netgraph7/ng_bpf.c index c11e816359..925d7c1905 100644 --- a/sys/netgraph7/ng_bpf.c +++ b/sys/netgraph7/ng_bpf.c @@ -38,6 +38,7 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_bpf.c,v 1.24 2008/02/04 19:26:53 mav Exp $ + * $DragonFly: src/sys/netgraph7/ng_bpf.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_bpf.c,v 1.3 1999/12/03 20:30:23 archie Exp $ */ @@ -68,10 +69,10 @@ #include #endif -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_parse.h" +#include "ng_bpf.h" #ifdef NG_SEPARATE_MALLOC MALLOC_DEFINE(M_NETGRAPH_BPF, "netgraph_bpf", "netgraph bpf node "); @@ -274,7 +275,7 @@ ng_bpf_newhook(node_p node, hook_p hook, const char *name) int error; /* Create hook private structure */ - MALLOC(hip, hinfo_p, sizeof(*hip), M_NETGRAPH_BPF, M_NOWAIT | M_ZERO); + MALLOC(hip, hinfo_p, sizeof(*hip), M_NETGRAPH_BPF, M_WAITOK | M_NULLOK | M_ZERO); if (hip == NULL) return (ENOMEM); hip->hook = hook; @@ -348,7 +349,7 @@ ng_bpf_rcvmsg(node_p node, item_p item, hook_p lasthook) /* Build response */ hp = ((hinfo_p)NG_HOOK_PRIVATE(hook))->prog; NG_MKRESPONSE(resp, msg, - NG_BPF_HOOKPROG_SIZE(hp->bpf_prog_len), M_NOWAIT); + NG_BPF_HOOKPROG_SIZE(hp->bpf_prog_len), M_WAITOK | M_NULLOK); if (resp == NULL) ERROUT(ENOMEM); bcopy(hp, resp->data, @@ -376,7 +377,7 @@ ng_bpf_rcvmsg(node_p node, item_p item, hook_p lasthook) /* Build response (if desired) */ if (msg->header.cmd != NGM_BPF_CLR_STATS) { NG_MKRESPONSE(resp, - msg, sizeof(*stats), M_NOWAIT); + msg, sizeof(*stats), M_WAITOK | M_NULLOK); if (resp == NULL) ERROUT(ENOMEM); bcopy(stats, resp->data, sizeof(*stats)); diff --git a/sys/netgraph7/ng_bpf.h b/sys/netgraph7/ng_bpf.h index 540b4af870..a4aaebe4de 100644 --- a/sys/netgraph7/ng_bpf.h +++ b/sys/netgraph7/ng_bpf.h @@ -38,6 +38,7 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_bpf.h,v 1.11 2005/02/12 18:10:26 ru Exp $ + * $DragonFly: src/sys/netgraph7/ng_bpf.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_bpf.h,v 1.3 1999/12/03 20:30:23 archie Exp $ */ diff --git a/sys/netgraph7/ng_bridge.c b/sys/netgraph7/ng_bridge.c index befd97eca0..0a1afdf194 100644 --- a/sys/netgraph7/ng_bridge.c +++ b/sys/netgraph7/ng_bridge.c @@ -38,6 +38,7 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_bridge.c,v 1.31 2005/02/09 15:14:44 ru Exp $ + * $DragonFly: src/sys/netgraph7/ng_bridge.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ /* @@ -74,10 +75,10 @@ #include #include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_parse.h" +#include "ng_bridge.h" #ifdef NG_SEPARATE_MALLOC MALLOC_DEFINE(M_NETGRAPH_BRIDGE, "netgraph_bridge", "netgraph bridge node "); @@ -297,14 +298,14 @@ ng_bridge_constructor(node_p node) priv_p priv; /* Allocate and initialize private info */ - MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH_BRIDGE, M_NOWAIT | M_ZERO); + MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH_BRIDGE, M_WAITOK | M_NULLOK | M_ZERO); if (priv == NULL) return (ENOMEM); ng_callout_init(&priv->timer); /* Allocate and initialize hash table, etc. */ MALLOC(priv->tab, struct ng_bridge_bucket *, - MIN_BUCKETS * sizeof(*priv->tab), M_NETGRAPH_BRIDGE, M_NOWAIT | M_ZERO); + MIN_BUCKETS * sizeof(*priv->tab), M_NETGRAPH_BRIDGE, M_WAITOK | M_NULLOK | M_ZERO); if (priv->tab == NULL) { FREE(priv, M_NETGRAPH_BRIDGE); return (ENOMEM); @@ -359,7 +360,7 @@ ng_bridge_newhook(node_p node, hook_p hook, const char *name) if (priv->links[linkNum] != NULL) return (EISCONN); MALLOC(priv->links[linkNum], struct ng_bridge_link *, - sizeof(*priv->links[linkNum]), M_NETGRAPH_BRIDGE, M_NOWAIT|M_ZERO); + sizeof(*priv->links[linkNum]), M_NETGRAPH_BRIDGE, M_WAITOK | M_NULLOK | M_ZERO); if (priv->links[linkNum] == NULL) return (ENOMEM); priv->links[linkNum]->hook = hook; @@ -392,7 +393,7 @@ ng_bridge_rcvmsg(node_p node, item_p item, hook_p lasthook) struct ng_bridge_config *conf; NG_MKRESPONSE(resp, msg, - sizeof(struct ng_bridge_config), M_NOWAIT); + sizeof(struct ng_bridge_config), M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -459,7 +460,7 @@ ng_bridge_rcvmsg(node_p node, item_p item, hook_p lasthook) /* Get/clear stats */ if (msg->header.cmd != NGM_BRIDGE_CLR_STATS) { NG_MKRESPONSE(resp, msg, - sizeof(link->stats), M_NOWAIT); + sizeof(link->stats), M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -478,7 +479,7 @@ ng_bridge_rcvmsg(node_p node, item_p item, hook_p lasthook) int i = 0, bucket; NG_MKRESPONSE(resp, msg, sizeof(*ary) - + (priv->numHosts * sizeof(*ary->hosts)), M_NOWAIT); + + (priv->numHosts * sizeof(*ary->hosts)), M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -707,7 +708,7 @@ ng_bridge_rcvdata(hook_p hook, item_p item) * It's usable link but not the reserved (first) one. * Copy mbuf info for sending. */ - m2 = m_dup(m, M_DONTWAIT); /* XXX m_copypacket() */ + m2 = m_dup(m, MB_DONTWAIT); /* XXX m_copypacket() */ if (m2 == NULL) { link->stats.memoryFailures++; NG_FREE_ITEM(item); @@ -850,7 +851,7 @@ ng_bridge_put(priv_p priv, const u_char *addr, int linkNum) /* Allocate and initialize new hashtable entry */ MALLOC(hent, struct ng_bridge_hent *, - sizeof(*hent), M_NETGRAPH_BRIDGE, M_NOWAIT); + sizeof(*hent), M_NETGRAPH_BRIDGE, M_WAITOK | M_NULLOK); if (hent == NULL) return (0); bcopy(addr, hent->host.addr, ETHER_ADDR_LEN); diff --git a/sys/netgraph7/ng_bridge.h b/sys/netgraph7/ng_bridge.h index 66685fd661..7ca5944b10 100644 --- a/sys/netgraph7/ng_bridge.h +++ b/sys/netgraph7/ng_bridge.h @@ -38,6 +38,7 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_bridge.h,v 1.4 2005/10/28 14:41:28 ru Exp $ + * $DragonFly: src/sys/netgraph7/ng_bridge.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ #ifndef _NETGRAPH_NG_BRIDGE_H_ diff --git a/sys/netgraph7/ng_car.c b/sys/netgraph7/ng_car.c index 27cf8a1e91..c5978a4153 100644 --- a/sys/netgraph7/ng_car.c +++ b/sys/netgraph7/ng_car.c @@ -25,6 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netgraph/ng_car.c,v 1.7 2008/03/30 07:53:51 mav Exp $ + * $DragonFly: src/sys/netgraph7/ng_car.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ /* @@ -43,10 +44,10 @@ #include #include -#include -#include -#include -#include +#include "ng_message.h" +#include "ng_parse.h" +#include "netgraph.h" +#include "ng_car.h" #define NG_CAR_QUEUE_SIZE 100 /* Maximum queue size for SHAPE mode */ #define NG_CAR_QUEUE_MIN_TH 8 /* Minimum RED threshhold for SHAPE mode */ @@ -186,7 +187,7 @@ ng_car_constructor(node_p node) priv_p priv; /* Initialize private descriptor. */ - priv = malloc(sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); + priv = kmalloc(sizeof(*priv), M_NETGRAPH, M_WAITOK | M_NULLOK | M_ZERO); if (priv == NULL) return (ENOMEM); @@ -393,7 +394,7 @@ ng_car_rcvmsg(node_p node, item_p item, hook_p lasthook) struct ng_car_bulkstats *bstats; NG_MKRESPONSE(resp, msg, - sizeof(*bstats), M_NOWAIT); + sizeof(*bstats), M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -418,7 +419,7 @@ ng_car_rcvmsg(node_p node, item_p item, hook_p lasthook) struct ng_car_bulkconf *bconf; NG_MKRESPONSE(resp, msg, - sizeof(*bconf), M_NOWAIT); + sizeof(*bconf), M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -540,7 +541,7 @@ ng_car_shutdown(node_p node) mtx_destroy(&priv->upper.q_mtx); mtx_destroy(&priv->lower.q_mtx); NG_NODE_UNREF(priv->node); - free(priv, M_NETGRAPH); + kfree(priv, M_NETGRAPH); return (0); } diff --git a/sys/netgraph7/ng_car.h b/sys/netgraph7/ng_car.h index 596a13839c..1469dd908f 100644 --- a/sys/netgraph7/ng_car.h +++ b/sys/netgraph7/ng_car.h @@ -25,6 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netgraph/ng_car.h,v 1.2 2007/12/19 22:50:14 mav Exp $ + * $DragonFly: src/sys/netgraph7/ng_car.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ #ifndef _NETGRAPH_NG_CAR_H_ diff --git a/sys/netgraph7/ng_cisco.c b/sys/netgraph7/ng_cisco.c index 296230624b..29e642f647 100644 --- a/sys/netgraph7/ng_cisco.c +++ b/sys/netgraph7/ng_cisco.c @@ -38,6 +38,7 @@ * Author: Julian Elischer * * $FreeBSD: src/sys/netgraph/ng_cisco.c,v 1.29 2007/11/30 23:27:39 julian Exp $ + * $DragonFly: src/sys/netgraph7/ng_cisco.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_cisco.c,v 1.25 1999/11/01 09:24:51 julian Exp $ */ @@ -60,10 +61,10 @@ #include #include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_parse.h" +#include "ng_cisco.h" #define CISCO_MULTICAST 0x8f /* Cisco multicast address */ #define CISCO_UNICAST 0x0f /* Cisco unicast address */ @@ -193,7 +194,7 @@ cisco_constructor(node_p node) { sc_p sc; - MALLOC(sc, sc_p, sizeof(*sc), M_NETGRAPH, M_NOWAIT | M_ZERO); + MALLOC(sc, sc_p, sizeof(*sc), M_NETGRAPH, M_WAITOK | M_NULLOK | M_ZERO); if (sc == NULL) return (ENOMEM); @@ -264,7 +265,7 @@ cisco_rcvmsg(node_p node, item_p item, hook_p lasthook) char *arg; int pos; - NG_MKRESPONSE(resp, msg, NG_TEXTRESPONSE, M_NOWAIT); + NG_MKRESPONSE(resp, msg, NG_TEXTRESPONSE, M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -289,7 +290,7 @@ cisco_rcvmsg(node_p node, item_p item, hook_p lasthook) struct in_addr *ips; NG_MKRESPONSE(resp, msg, - 2 * sizeof(*ips), M_NOWAIT); + 2 * sizeof(*ips), M_WAITOK | M_NULLOK); if (!resp) { error = ENOMEM; break; @@ -316,7 +317,7 @@ cisco_rcvmsg(node_p node, item_p item, hook_p lasthook) { struct ng_cisco_stats *stat; - NG_MKRESPONSE(resp, msg, sizeof(*stat), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(*stat), M_WAITOK | M_NULLOK); if (!resp) { error = ENOMEM; break; @@ -362,7 +363,7 @@ cisco_rcvdata(hook_p hook, item_p item) /* OK so it came from a protocol, heading out. Prepend general data packet header. For now, IP,IPX only */ m = NGI_M(item); /* still associated with item */ - M_PREPEND(m, CISCO_HEADER_LEN, M_DONTWAIT); + M_PREPEND(m, CISCO_HEADER_LEN, MB_DONTWAIT); if (!m) { error = ENOBUFS; goto out; @@ -525,7 +526,7 @@ cisco_input(sc_p sc, item_p item) if (sc->inet.hook == NULL) goto nomsg; NG_MKMESSAGE(msg, NGM_CISCO_COOKIE, - NGM_CISCO_GET_IPADDR, 0, M_NOWAIT); + NGM_CISCO_GET_IPADDR, 0, M_WAITOK | M_NULLOK); if (msg == NULL) goto nomsg; NG_SEND_MSG_HOOK(dummy_error, @@ -609,7 +610,7 @@ cisco_send(sc_p sc, int type, long par1, long par2) getmicrouptime(&time); - MGETHDR(m, M_DONTWAIT, MT_DATA); + MGETHDR(m, MB_DONTWAIT, MT_DATA); if (!m) return (ENOBUFS); @@ -646,7 +647,7 @@ cisco_notify(sc_p sc, uint32_t cmd) if (sc->inet.hook == NULL) /* nothing to notify */ return; - NG_MKMESSAGE(msg, NGM_FLOW_COOKIE, cmd, 0, M_NOWAIT); + NG_MKMESSAGE(msg, NGM_FLOW_COOKIE, cmd, 0, M_WAITOK | M_NULLOK); if (msg != NULL) NG_SEND_MSG_HOOK(dummy_error, sc->node, msg, sc->inet.hook, 0); } diff --git a/sys/netgraph7/ng_cisco.h b/sys/netgraph7/ng_cisco.h index ac916ad83d..fc0f049f2b 100644 --- a/sys/netgraph7/ng_cisco.h +++ b/sys/netgraph7/ng_cisco.h @@ -38,6 +38,7 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_cisco.h,v 1.8 2005/01/07 01:45:39 imp Exp $ + * $DragonFly: src/sys/netgraph7/ng_cisco.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_cisco.h,v 1.6 1999/01/25 01:21:48 archie Exp $ */ diff --git a/sys/netgraph7/ng_deflate.c b/sys/netgraph7/ng_deflate.c index d5753df649..a651162d81 100644 --- a/sys/netgraph7/ng_deflate.c +++ b/sys/netgraph7/ng_deflate.c @@ -25,6 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netgraph/ng_deflate.c,v 1.3 2007/01/15 05:55:56 glebius Exp $ + * $DragonFly: src/sys/netgraph7/ng_deflate.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ /* @@ -41,10 +42,10 @@ #include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_parse.h" +#include "ng_deflate.h" #include "opt_netgraph.h" @@ -175,7 +176,7 @@ ng_deflate_constructor(node_p node) priv_p priv; /* Allocate private structure. */ - priv = malloc(sizeof(*priv), M_NETGRAPH_DEFLATE, M_WAITOK | M_ZERO); + priv = kmalloc(sizeof(*priv), M_NETGRAPH_DEFLATE, M_WAITOK | M_ZERO); NG_NODE_SET_PRIVATE(node, priv); @@ -296,7 +297,7 @@ ng_deflate_rcvmsg(node_p node, item_p item, hook_p lasthook) /* Create response if requested. */ if (msg->header.cmd != NGM_DEFLATE_CLR_STATS) { NG_MKRESPONSE(resp, msg, - sizeof(struct ng_deflate_stats), M_NOWAIT); + sizeof(struct ng_deflate_stats), M_WAITOK | M_NULLOK); if (resp == NULL) ERROUT(ENOMEM); bcopy(&priv->stats, resp->data, @@ -353,7 +354,7 @@ ng_deflate_rcvdata(hook_p hook, item_p item) /* Need to send a reset-request. */ NG_MKMESSAGE(msg, NGM_DEFLATE_COOKIE, - NGM_DEFLATE_RESETREQ, 0, M_NOWAIT); + NGM_DEFLATE_RESETREQ, 0, M_WAITOK | M_NULLOK); if (msg == NULL) return (error); NG_SEND_MSG_ID(error, node, msg, @@ -383,7 +384,7 @@ ng_deflate_shutdown(node_p node) inflateEnd(&priv->cx); } - free(priv, M_NETGRAPH_DEFLATE); + kfree(priv, M_NETGRAPH_DEFLATE); NG_NODE_SET_PRIVATE(node, NULL); NG_NODE_UNREF(node); /* let the node escape */ return (0); @@ -424,14 +425,14 @@ static void * z_alloc(void *notused, u_int items, u_int size) { - return (malloc(items * size, M_NETGRAPH_DEFLATE, M_NOWAIT)); + return (kmalloc(items * size, M_NETGRAPH_DEFLATE, M_WAITOK | M_NULLOK)); } static void z_free(void *notused, void *ptr) { - free(ptr, M_NETGRAPH_DEFLATE); + kfree(ptr, M_NETGRAPH_DEFLATE); } /* diff --git a/sys/netgraph7/ng_deflate.h b/sys/netgraph7/ng_deflate.h index ec5a12513c..65dcf9e1bc 100644 --- a/sys/netgraph7/ng_deflate.h +++ b/sys/netgraph7/ng_deflate.h @@ -25,6 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netgraph/ng_deflate.h,v 1.1 2006/12/28 15:44:05 glebius Exp $ + * $DragonFly: src/sys/netgraph7/ng_deflate.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ #ifndef _NETGRAPH_NG_DEFLATE_H_ diff --git a/sys/netgraph7/ng_device.c b/sys/netgraph7/ng_device.c index 88636fe04c..bda3221eb3 100644 --- a/sys/netgraph7/ng_device.c +++ b/sys/netgraph7/ng_device.c @@ -28,6 +28,7 @@ * netgraph node. * * $FreeBSD: src/sys/netgraph/ng_device.c,v 1.22 2006/11/02 17:37:21 andre Exp $ + * $DragonFly: src/sys/netgraph7/ng_device.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ * */ @@ -56,9 +57,9 @@ #include #include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_device.h" #define ERROUT(x) do { error = (x); goto done; } while (0) @@ -163,7 +164,7 @@ ng_device_constructor(node_p node) DBG; - MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); + MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_WAITOK | M_ZERO); if (priv == NULL) return (ENOMEM); @@ -214,7 +215,7 @@ ng_device_rcvmsg(node_p node, item_p item, hook_p lasthook) case NGM_DEVICE_GET_DEVNAME: /* XXX: Fix when MAX_NGD us bigger */ NG_MKRESPONSE(resp, msg, - strlen(NG_DEVICE_DEVNAME) + 4, M_NOWAIT); + strlen(NG_DEVICE_DEVNAME) + 4, M_WAITOK); if (resp == NULL) ERROUT(ENOMEM); @@ -384,7 +385,7 @@ ngdioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td DBG; NG_MKMESSAGE(msg, NGM_DEVICE_COOKIE, cmd, sizeof(struct ngd_param_s), - M_NOWAIT); + M_WAITOK); if (msg == NULL) { printf("%s(): msg == NULL\n",__func__); goto nomsg; @@ -466,7 +467,7 @@ ngdwrite(struct cdev *dev, struct uio *uio, int flag) if (uio->uio_resid < 0 || uio->uio_resid > IP_MAXPACKET) return (EIO); - if ((m = m_uiotombuf(uio, M_DONTWAIT, 0, 0, M_PKTHDR)) == NULL) + if ((m = m_uiotombuf(uio, MB_DONTWAIT, 0, 0, M_PKTHDR)) == NULL) return (ENOBUFS); NG_SEND_DATA_ONLY(error, priv->hook, m); diff --git a/sys/netgraph7/ng_device.h b/sys/netgraph7/ng_device.h index f7b2ccdf92..2451f9ffa6 100644 --- a/sys/netgraph7/ng_device.h +++ b/sys/netgraph7/ng_device.h @@ -23,6 +23,7 @@ * * * $FreeBSD: src/sys/netgraph/ng_device.h,v 1.5 2005/01/07 01:45:39 imp Exp $ + * $DragonFly: src/sys/netgraph7/ng_device.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ * */ diff --git a/sys/netgraph7/ng_echo.c b/sys/netgraph7/ng_echo.c index ee42955c61..78caf5fcbd 100644 --- a/sys/netgraph7/ng_echo.c +++ b/sys/netgraph7/ng_echo.c @@ -38,6 +38,7 @@ * Author: Julian Elisher * * $FreeBSD: src/sys/netgraph/ng_echo.c,v 1.13 2005/04/15 10:14:00 glebius Exp $ + * $DragonFly: src/sys/netgraph7/ng_echo.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_echo.c,v 1.13 1999/11/01 09:24:51 julian Exp $ */ @@ -52,9 +53,9 @@ #include #include #include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_echo.h" /* Netgraph methods */ static ng_constructor_t nge_cons; diff --git a/sys/netgraph7/ng_echo.h b/sys/netgraph7/ng_echo.h index 483245be31..e3cf6151ee 100644 --- a/sys/netgraph7/ng_echo.h +++ b/sys/netgraph7/ng_echo.h @@ -38,6 +38,7 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_echo.h,v 1.4 2005/01/07 01:45:39 imp Exp $ + * $DragonFly: src/sys/netgraph7/ng_echo.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_echo.h,v 1.3 1999/01/20 00:22:12 archie Exp $ */ diff --git a/sys/netgraph7/ng_eiface.c b/sys/netgraph7/ng_eiface.c index 17d66f71a9..dcdbc6cc69 100644 --- a/sys/netgraph7/ng_eiface.c +++ b/sys/netgraph7/ng_eiface.c @@ -26,6 +26,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netgraph/ng_eiface.c,v 1.39 2007/07/26 10:54:33 glebius Exp $ + * $DragonFly: src/sys/netgraph7/ng_eiface.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ #include @@ -43,10 +44,10 @@ #include #include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_parse.h" +#include "ng_eiface.h" #include #include @@ -337,13 +338,13 @@ ng_eiface_constructor(node_p node) u_char eaddr[6] = {0,0,0,0,0,0}; /* Allocate node and interface private structures */ - MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); + MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_WAITOK | M_NULLOK | M_ZERO); if (priv == NULL) return (ENOMEM); ifp = priv->ifp = if_alloc(IFT_ETHER); if (ifp == NULL) { - free(priv, M_NETGRAPH); + kfree(priv, M_NETGRAPH); return (ENOSPC); } @@ -431,7 +432,7 @@ ng_eiface_rcvmsg(node_p node, item_p item, hook_p lasthook) } case NGM_EIFACE_GET_IFNAME: - NG_MKRESPONSE(resp, msg, IFNAMSIZ, M_NOWAIT); + NG_MKRESPONSE(resp, msg, IFNAMSIZ, M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -451,7 +452,7 @@ ng_eiface_rcvmsg(node_p node, item_p item, hook_p lasthook) buflen = 0; TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) buflen += SA_SIZE(ifa->ifa_addr); - NG_MKRESPONSE(resp, msg, buflen, M_NOWAIT); + NG_MKRESPONSE(resp, msg, buflen, M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; diff --git a/sys/netgraph7/ng_eiface.h b/sys/netgraph7/ng_eiface.h index e670d9826c..0a1ab67c71 100644 --- a/sys/netgraph7/ng_eiface.h +++ b/sys/netgraph7/ng_eiface.h @@ -29,6 +29,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netgraph/ng_eiface.h,v 1.9 2005/02/03 11:52:42 ru Exp $ + * $DragonFly: src/sys/netgraph7/ng_eiface.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ #ifndef _NETGRAPH_NG_EIFACE_H_ diff --git a/sys/netgraph7/ng_etf.c b/sys/netgraph7/ng_etf.c index 5a01d67ecb..7d4041c515 100644 --- a/sys/netgraph7/ng_etf.c +++ b/sys/netgraph7/ng_etf.c @@ -31,6 +31,7 @@ * Author: Julian Elischer * * $FreeBSD: src/sys/netgraph/ng_etf.c,v 1.9 2005/03/14 20:49:48 glebius Exp $ + * $DragonFly: src/sys/netgraph7/ng_etf.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ #include @@ -45,10 +46,10 @@ #include -#include -#include -#include -#include +#include "ng_message.h" +#include "ng_parse.h" +#include "ng_etf.h" +#include "netgraph.h" /* If you do complicated mallocs you may want to do this */ /* and use it for your mallocs */ @@ -181,7 +182,7 @@ ng_etf_constructor(node_p node) /* Initialize private descriptor */ MALLOC(privdata, etf_p, sizeof(*privdata), M_NETGRAPH_ETF, - M_NOWAIT | M_ZERO); + M_WAITOK | M_NULLOK | M_ZERO); if (privdata == NULL) return (ENOMEM); for (i = 0; i < HASHSIZE; i++) { @@ -218,7 +219,7 @@ ng_etf_newhook(node_p node, hook_p hook, const char *name) * later be associated with a filter rule. */ MALLOC(hpriv, struct ETF_hookinfo *, sizeof(*hpriv), - M_NETGRAPH_ETF, M_NOWAIT | M_ZERO); + M_NETGRAPH_ETF, M_WAITOK | M_NULLOK | M_ZERO); if (hpriv == NULL) { return (ENOMEM); } @@ -263,7 +264,7 @@ ng_etf_rcvmsg(node_p node, item_p item, hook_p lasthook) { struct ng_etfstat *stats; - NG_MKRESPONSE(resp, msg, sizeof(*stats), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(*stats), M_WAITOK | M_NULLOK); if (!resp) { error = ENOMEM; break; @@ -318,7 +319,7 @@ ng_etf_rcvmsg(node_p node, item_p item, hook_p lasthook) * hashtable ready for matching. */ MALLOC(fil, struct filter *, sizeof(*fil), - M_NETGRAPH_ETF, M_NOWAIT | M_ZERO); + M_NETGRAPH_ETF, M_WAITOK | M_NULLOK | M_ZERO); if (fil == NULL) { error = ENOMEM; break; diff --git a/sys/netgraph7/ng_etf.h b/sys/netgraph7/ng_etf.h index 3ae8441ff6..15a3d49081 100644 --- a/sys/netgraph7/ng_etf.h +++ b/sys/netgraph7/ng_etf.h @@ -31,6 +31,7 @@ * Author: Julian Elischer * * $FreeBSD: src/sys/netgraph/ng_etf.h,v 1.5 2005/01/07 01:45:39 imp Exp $ + * $DragonFly: src/sys/netgraph7/ng_etf.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ #ifndef _NETGRAPH_NG_ETF_H_ diff --git a/sys/netgraph7/ng_ether.c b/sys/netgraph7/ng_ether.c index fe589c8347..910f128d5a 100644 --- a/sys/netgraph7/ng_ether.c +++ b/sys/netgraph7/ng_ether.c @@ -40,6 +40,7 @@ * Julian Elischer * * $FreeBSD: src/sys/netgraph/ng_ether.c,v 1.62 2007/03/20 00:36:10 bms Exp $ + * $DragonFly: src/sys/netgraph7/ng_ether.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ /* @@ -63,10 +64,10 @@ #include #include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_parse.h" +#include "ng_ether.h" #define IFP2NG(ifp) (IFP2AC((ifp))->ac_netgraph) @@ -291,7 +292,7 @@ ng_ether_attach(struct ifnet *ifp) } /* Allocate private data */ - MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); + MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_WAITOK | M_NULLOK | M_ZERO); if (priv == NULL) { log(LOG_ERR, "%s: can't %s for %s\n", __func__, "allocate memory", ifp->if_xname); @@ -353,7 +354,7 @@ ng_ether_link_state(struct ifnet *ifp, int state) else return; - NG_MKMESSAGE(msg, NGM_FLOW_COOKIE, cmd, 0, M_NOWAIT); + NG_MKMESSAGE(msg, NGM_FLOW_COOKIE, cmd, 0, M_WAITOK | M_NULLOK); if (msg != NULL) NG_SEND_MSG_HOOK(dummy_error, node, msg, priv->lower, 0); } @@ -425,7 +426,7 @@ ng_ether_rcvmsg(node_p node, item_p item, hook_p lasthook) case NGM_ETHER_COOKIE: switch (msg->header.cmd) { case NGM_ETHER_GET_IFNAME: - NG_MKRESPONSE(resp, msg, IFNAMSIZ, M_NOWAIT); + NG_MKRESPONSE(resp, msg, IFNAMSIZ, M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -433,7 +434,7 @@ ng_ether_rcvmsg(node_p node, item_p item, hook_p lasthook) strlcpy(resp->data, priv->ifp->if_xname, IFNAMSIZ); break; case NGM_ETHER_GET_IFINDEX: - NG_MKRESPONSE(resp, msg, sizeof(u_int32_t), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(u_int32_t), M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -441,7 +442,7 @@ ng_ether_rcvmsg(node_p node, item_p item, hook_p lasthook) *((u_int32_t *)resp->data) = priv->ifp->if_index; break; case NGM_ETHER_GET_ENADDR: - NG_MKRESPONSE(resp, msg, ETHER_ADDR_LEN, M_NOWAIT); + NG_MKRESPONSE(resp, msg, ETHER_ADDR_LEN, M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -460,7 +461,7 @@ ng_ether_rcvmsg(node_p node, item_p item, hook_p lasthook) break; } case NGM_ETHER_GET_PROMISC: - NG_MKRESPONSE(resp, msg, sizeof(u_int32_t), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(u_int32_t), M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -484,7 +485,7 @@ ng_ether_rcvmsg(node_p node, item_p item, hook_p lasthook) break; } case NGM_ETHER_GET_AUTOSRC: - NG_MKRESPONSE(resp, msg, sizeof(u_int32_t), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(u_int32_t), M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; diff --git a/sys/netgraph7/ng_ether.h b/sys/netgraph7/ng_ether.h index d60a949af1..ca53f08fd4 100644 --- a/sys/netgraph7/ng_ether.h +++ b/sys/netgraph7/ng_ether.h @@ -39,6 +39,7 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_ether.h,v 1.14 2005/02/14 12:01:09 glebius Exp $ + * $DragonFly: src/sys/netgraph7/ng_ether.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_ether.h,v 1.1 1999/02/02 03:17:22 julian Exp $ */ diff --git a/sys/netgraph7/ng_fec.c b/sys/netgraph7/ng_fec.c index 0b5bdbb7af..039743d204 100644 --- a/sys/netgraph7/ng_fec.c +++ b/sys/netgraph7/ng_fec.c @@ -35,6 +35,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/netgraph/ng_fec.c,v 1.30 2007/05/18 15:05:49 dwmalone Exp $ + * $DragonFly: src/sys/netgraph7/ng_fec.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ /*- * Copyright (c) 1996-1999 Whistle Communications, Inc. @@ -121,10 +122,10 @@ #include #endif -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_parse.h" +#include "ng_fec.h" /* * We need a way to stash a pointer to our netgraph node in the @@ -285,7 +286,7 @@ ng_fec_get_unit(int *unit) newlen = (2 * ng_fec_units_len) + 4; MALLOC(newarray, int *, newlen * sizeof(*ng_fec_units), - M_NETGRAPH, M_NOWAIT); + M_NETGRAPH, M_WAITOK | M_NULLOK); if (newarray == NULL) { mtx_unlock(&ng_fec_mtx); return (ENOMEM); @@ -404,7 +405,7 @@ ng_fec_addport(struct ng_fec_private *priv, char *iface) /* Allocate new list entry. */ MALLOC(new, struct ng_fec_portlist *, - sizeof(struct ng_fec_portlist), M_NETGRAPH, M_NOWAIT); + sizeof(struct ng_fec_portlist), M_NETGRAPH, M_WAITOK | M_NULLOK); if (new == NULL) return(ENOMEM); @@ -546,7 +547,7 @@ ng_fec_ether_cmdmulti(struct ifnet *trifp, struct ng_fec_portlist *p, int set) error = if_addmulti(ifp, (struct sockaddr *)&sdl, &rifma); if (error) return (error); - mc = malloc(sizeof(struct ng_fec_mc), M_DEVBUF, M_NOWAIT); + mc = kmalloc(sizeof(struct ng_fec_mc), M_DEVBUF, M_WAITOK | M_NULLOK); if (mc == NULL) return (ENOMEM); mc->mc_ifma = rifma; @@ -556,7 +557,7 @@ ng_fec_ether_cmdmulti(struct ifnet *trifp, struct ng_fec_portlist *p, int set) while ((mc = SLIST_FIRST(&p->fec_mc_head)) != NULL) { SLIST_REMOVE(&p->fec_mc_head, mc, ng_fec_mc, mc_entries); if_delmulti_ifma(mc->mc_ifma); - free(mc, M_DEVBUF); + kfree(mc, M_DEVBUF); } } return (0); @@ -1196,7 +1197,7 @@ ng_fec_constructor(node_p node) int error = 0; /* Allocate node and interface private structures */ - MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); + MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_WAITOK | M_NULLOK | M_ZERO); if (priv == NULL) return (ENOMEM); diff --git a/sys/netgraph7/ng_fec.h b/sys/netgraph7/ng_fec.h index 0144023c94..d5e31ce811 100644 --- a/sys/netgraph7/ng_fec.h +++ b/sys/netgraph7/ng_fec.h @@ -35,6 +35,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/netgraph/ng_fec.h,v 1.3 2005/01/07 01:45:39 imp Exp $ + * $DragonFly: src/sys/netgraph7/ng_fec.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ /*- * Copyright (c) 1996-1999 Whistle Communications, Inc. diff --git a/sys/netgraph7/ng_frame_relay.c b/sys/netgraph7/ng_frame_relay.c index 638c6701f1..f76ee6aa75 100644 --- a/sys/netgraph7/ng_frame_relay.c +++ b/sys/netgraph7/ng_frame_relay.c @@ -38,6 +38,7 @@ * Author: Julian Elischer * * $FreeBSD: src/sys/netgraph/ng_frame_relay.c,v 1.25 2006/01/14 21:49:31 glebius Exp $ + * $DragonFly: src/sys/netgraph7/ng_frame_relay.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_frame_relay.c,v 1.20 1999/11/01 09:24:51 julian Exp $ */ @@ -59,9 +60,9 @@ #include #include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_frame_relay.h" /* * Line info, and status per channel. @@ -212,7 +213,7 @@ ngfrm_constructor(node_p node) { sc_p sc; - MALLOC(sc, sc_p, sizeof(*sc), M_NETGRAPH, M_NOWAIT | M_ZERO); + MALLOC(sc, sc_p, sizeof(*sc), M_NETGRAPH, M_WAITOK | M_NULLOK | M_ZERO); if (!sc) return (ENOMEM); sc->addrlen = 2; /* default */ @@ -362,7 +363,7 @@ ngfrm_rcvdata(hook_p hook, item_p item) alen = sc->addrlen; if (alen == 0) alen = 2; /* default value for transmit */ - M_PREPEND(m, alen, M_DONTWAIT); + M_PREPEND(m, alen, MB_DONTWAIT); if (m == NULL) { error = ENOBUFS; goto bad; diff --git a/sys/netgraph7/ng_frame_relay.h b/sys/netgraph7/ng_frame_relay.h index f0b0843091..4be554f3c5 100644 --- a/sys/netgraph7/ng_frame_relay.h +++ b/sys/netgraph7/ng_frame_relay.h @@ -38,6 +38,7 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_frame_relay.h,v 1.4 2005/01/07 01:45:39 imp Exp $ + * $DragonFly: src/sys/netgraph7/ng_frame_relay.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_frame_relay.h,v 1.7 1999/01/20 00:22:13 archie Exp $ */ diff --git a/sys/netgraph7/ng_gif.c b/sys/netgraph7/ng_gif.c index 3cd6bbc0c2..3974c694e3 100644 --- a/sys/netgraph7/ng_gif.c +++ b/sys/netgraph7/ng_gif.c @@ -63,6 +63,7 @@ * OF SUCH DAMAGE. * * $FreeBSD: src/sys/netgraph/ng_gif.c,v 1.19 2005/06/10 16:49:21 brooks Exp $ + * $DragonFly: src/sys/netgraph7/ng_gif.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ /* @@ -84,10 +85,10 @@ #include #include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_parse.h" +#include "ng_gif.h" #define IFP2NG(ifp) ((struct ng_node *)((struct gif_softc *)(ifp->if_softc))->gif_netgraph) #define IFP2NG_SET(ifp, val) (((struct gif_softc *)(ifp->if_softc))->gif_netgraph = (val)) @@ -240,7 +241,7 @@ ng_gif_attach(struct ifnet *ifp) } /* Allocate private data */ - MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); + MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_WAITOK | M_NULLOK | M_ZERO); if (priv == NULL) { log(LOG_ERR, "%s: can't %s for %s\n", __func__, "allocate memory", ifp->if_xname); @@ -309,7 +310,7 @@ ng_gif_glue_af(struct mbuf **mp, int af) * hopefully everything after that will not * need one. So let's just use M_PREPEND. */ - M_PREPEND(m, sizeof (tmp_af), M_DONTWAIT); + M_PREPEND(m, sizeof (tmp_af), MB_DONTWAIT); if (m == NULL) { error = ENOBUFS; goto done; @@ -405,7 +406,7 @@ ng_gif_rcvmsg(node_p node, item_p item, hook_p lasthook) case NGM_GIF_COOKIE: switch (msg->header.cmd) { case NGM_GIF_GET_IFNAME: - NG_MKRESPONSE(resp, msg, IFNAMSIZ, M_NOWAIT); + NG_MKRESPONSE(resp, msg, IFNAMSIZ, M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -413,7 +414,7 @@ ng_gif_rcvmsg(node_p node, item_p item, hook_p lasthook) strlcpy(resp->data, priv->ifp->if_xname, IFNAMSIZ); break; case NGM_GIF_GET_IFINDEX: - NG_MKRESPONSE(resp, msg, sizeof(u_int32_t), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(u_int32_t), M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; diff --git a/sys/netgraph7/ng_gif.h b/sys/netgraph7/ng_gif.h index d284f26540..096828daed 100644 --- a/sys/netgraph7/ng_gif.h +++ b/sys/netgraph7/ng_gif.h @@ -63,6 +63,7 @@ * OF SUCH DAMAGE. * * $FreeBSD: src/sys/netgraph/ng_gif.h,v 1.5 2005/01/07 01:45:39 imp Exp $ + * $DragonFly: src/sys/netgraph7/ng_gif.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ #ifndef _NETGRAPH_NG_GIF_H_ diff --git a/sys/netgraph7/ng_gif_demux.c b/sys/netgraph7/ng_gif_demux.c index 133590ebd3..990056eb1c 100644 --- a/sys/netgraph7/ng_gif_demux.c +++ b/sys/netgraph7/ng_gif_demux.c @@ -63,6 +63,7 @@ * OF SUCH DAMAGE. * * $FreeBSD: src/sys/netgraph/ng_gif_demux.c,v 1.10 2005/01/07 01:45:39 imp Exp $ + * $DragonFly: src/sys/netgraph7/ng_gif_demux.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ /* @@ -83,10 +84,10 @@ #include #include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_parse.h" +#include "ng_gif_demux.h" #ifdef NG_SEPARATE_MALLOC MALLOC_DEFINE(M_NETGRAPH_GIF_DEMUX, "netgraph_gif_demux", @@ -234,7 +235,7 @@ ng_gif_demux_constructor(node_p node) /* Allocate and initialize private info */ MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH_GIF_DEMUX, - M_NOWAIT | M_ZERO); + M_WAITOK | M_NULLOK | M_ZERO); if (priv == NULL) return (ENOMEM); priv->node = node; @@ -344,7 +345,7 @@ ng_gif_demux_rcvdata(hook_p hook, item_p item) * Add address family header and set the output hook. */ iffam = get_iffam_from_hook(priv, hook); - M_PREPEND(m, sizeof (iffam->family), M_DONTWAIT); + M_PREPEND(m, sizeof (iffam->family), MB_DONTWAIT); if (m == NULL) { NG_FREE_M(m); NG_FREE_ITEM(item); diff --git a/sys/netgraph7/ng_gif_demux.h b/sys/netgraph7/ng_gif_demux.h index f4293cd4e1..83cef7fb93 100644 --- a/sys/netgraph7/ng_gif_demux.h +++ b/sys/netgraph7/ng_gif_demux.h @@ -30,6 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netgraph/ng_gif_demux.h,v 1.5 2005/01/07 01:45:39 imp Exp $ + * $DragonFly: src/sys/netgraph7/ng_gif_demux.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ #ifndef _NETGRAPH_NG_GIF_DEMUX_H_ diff --git a/sys/netgraph7/ng_hole.c b/sys/netgraph7/ng_hole.c index c98b052e58..3cdfe1bb61 100644 --- a/sys/netgraph7/ng_hole.c +++ b/sys/netgraph7/ng_hole.c @@ -38,6 +38,7 @@ * Author: Julian Elisher * * $FreeBSD: src/sys/netgraph/ng_hole.c,v 1.15 2005/12/09 07:09:44 ru Exp $ + * $DragonFly: src/sys/netgraph7/ng_hole.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_hole.c,v 1.10 1999/11/01 09:24:51 julian Exp $ */ @@ -50,10 +51,10 @@ #include #include #include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_parse.h" +#include "ng_hole.h" /* Per hook private info. */ struct ng_hole_hookinfo { @@ -132,7 +133,7 @@ ngh_newhook(node_p node, hook_p hook, const char *name) hinfo_p hip; /* Create hook private structure. */ - MALLOC(hip, hinfo_p, sizeof(*hip), M_NETGRAPH, M_NOWAIT | M_ZERO); + MALLOC(hip, hinfo_p, sizeof(*hip), M_NETGRAPH, M_WAITOK | M_NULLOK | M_ZERO); if (hip == NULL) return (ENOMEM); NG_HOOK_SET_PRIVATE(hook, hip); @@ -173,7 +174,7 @@ ngh_rcvmsg(node_p node, item_p item, hook_p lasthook) /* Build response (if desired). */ if (msg->header.cmd != NGM_HOLE_CLR_STATS) { NG_MKRESPONSE(resp, msg, sizeof(*stats), - M_NOWAIT); + M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; diff --git a/sys/netgraph7/ng_hole.h b/sys/netgraph7/ng_hole.h index 72097572ae..c04e842993 100644 --- a/sys/netgraph7/ng_hole.h +++ b/sys/netgraph7/ng_hole.h @@ -38,6 +38,7 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_hole.h,v 1.6 2005/01/07 01:45:39 imp Exp $ + * $DragonFly: src/sys/netgraph7/ng_hole.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_hole.h,v 1.3 1999/01/20 00:22:13 archie Exp $ */ diff --git a/sys/netgraph7/ng_hub.c b/sys/netgraph7/ng_hub.c index 3f6bfaead3..694ea3b1ad 100644 --- a/sys/netgraph7/ng_hub.c +++ b/sys/netgraph7/ng_hub.c @@ -24,6 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netgraph/ng_hub.c,v 1.3 2004/06/26 22:24:16 julian Exp $ + * $DragonFly: src/sys/netgraph7/ng_hub.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ #include @@ -32,9 +33,9 @@ #include #include -#include -#include -#include +#include "ng_message.h" +#include "ng_hub.h" +#include "netgraph.h" static ng_constructor_t ng_hub_constructor; static ng_rcvdata_t ng_hub_rcvdata; @@ -76,7 +77,7 @@ ng_hub_rcvdata(hook_p hook, item_p item) if (--nhooks == 1) NG_FWD_ITEM_HOOK(error, item, hook2); else { - if ((m2 = m_dup(m, M_DONTWAIT)) == NULL) { + if ((m2 = m_dup(m, MB_DONTWAIT)) == NULL) { NG_FREE_ITEM(item); return (ENOBUFS); } diff --git a/sys/netgraph7/ng_hub.h b/sys/netgraph7/ng_hub.h index 4d5f308a13..c2d0379893 100644 --- a/sys/netgraph7/ng_hub.h +++ b/sys/netgraph7/ng_hub.h @@ -24,6 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netgraph/ng_hub.h,v 1.1 2004/04/17 12:42:16 ru Exp $ + * $DragonFly: src/sys/netgraph7/ng_hub.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ #ifndef _NETGRAPH_NG_HUB_H_ diff --git a/sys/netgraph7/ng_iface.c b/sys/netgraph7/ng_iface.c index b3a1bdca27..7162da3448 100644 --- a/sys/netgraph7/ng_iface.c +++ b/sys/netgraph7/ng_iface.c @@ -38,6 +38,7 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_iface.c,v 1.48 2008/01/31 08:51:48 mav Exp $ + * $DragonFly: src/sys/netgraph7/ng_iface.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_iface.c,v 1.33 1999/11/01 09:24:51 julian Exp $ */ @@ -77,11 +78,11 @@ #include -#include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_parse.h" +#include "ng_iface.h" +#include "ng_cisco.h" #ifdef NG_SEPARATE_MALLOC MALLOC_DEFINE(M_NETGRAPH_IFACE, "netgraph_iface", "netgraph iface node "); @@ -373,7 +374,7 @@ ng_iface_output(struct ifnet *ifp, struct mbuf *m, ng_iface_bpftap(ifp, m, dst->sa_family); if (ALTQ_IS_ENABLED(&ifp->if_snd)) { - M_PREPEND(m, sizeof(sa_family_t), M_DONTWAIT); + M_PREPEND(m, sizeof(sa_family_t), MB_DONTWAIT); if (m == NULL) { IFQ_LOCK(&ifp->if_snd); IFQ_INC_DROPS(&ifp->if_snd); @@ -509,7 +510,7 @@ ng_iface_constructor(node_p node) priv_p priv; /* Allocate node and interface private structures */ - MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH_IFACE, M_NOWAIT|M_ZERO); + MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH_IFACE, M_WAITOK | M_NULLOK | M_ZERO); if (priv == NULL) return (ENOMEM); ifp = if_alloc(IFT_PROPVIRTUAL); @@ -594,7 +595,7 @@ ng_iface_rcvmsg(node_p node, item_p item, hook_p lasthook) case NGM_IFACE_COOKIE: switch (msg->header.cmd) { case NGM_IFACE_GET_IFNAME: - NG_MKRESPONSE(resp, msg, IFNAMSIZ, M_NOWAIT); + NG_MKRESPONSE(resp, msg, IFNAMSIZ, M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -625,7 +626,7 @@ ng_iface_rcvmsg(node_p node, item_p item, hook_p lasthook) } case NGM_IFACE_GET_IFINDEX: - NG_MKRESPONSE(resp, msg, sizeof(uint32_t), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(uint32_t), M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -650,7 +651,7 @@ ng_iface_rcvmsg(node_p node, item_p item, hook_p lasthook) if (ifa->ifa_addr->sa_family != AF_INET) continue; - NG_MKRESPONSE(resp, msg, sizeof(ips), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(ips), M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; diff --git a/sys/netgraph7/ng_iface.h b/sys/netgraph7/ng_iface.h index ca5bc7d0f1..b064e292b3 100644 --- a/sys/netgraph7/ng_iface.h +++ b/sys/netgraph7/ng_iface.h @@ -38,6 +38,7 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_iface.h,v 1.9 2005/02/13 16:36:41 archie Exp $ + * $DragonFly: src/sys/netgraph7/ng_iface.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_iface.h,v 1.5 1999/01/20 00:22:13 archie Exp $ */ diff --git a/sys/netgraph7/ng_ip_input.c b/sys/netgraph7/ng_ip_input.c index af002dfa79..ae1adc11b5 100644 --- a/sys/netgraph7/ng_ip_input.c +++ b/sys/netgraph7/ng_ip_input.c @@ -65,6 +65,7 @@ * Derived from: ng_hole.c * * $FreeBSD: src/sys/netgraph/ng_ip_input.c,v 1.4 2005/01/07 01:45:39 imp Exp $ + * $DragonFly: src/sys/netgraph7/ng_ip_input.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ /* @@ -83,9 +84,9 @@ #include #include #include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_ip_input.h" /* Netgraph methods */ static ng_constructor_t ngipi_cons; diff --git a/sys/netgraph7/ng_ip_input.h b/sys/netgraph7/ng_ip_input.h index 2c167b9d9b..ad983c19fd 100644 --- a/sys/netgraph7/ng_ip_input.h +++ b/sys/netgraph7/ng_ip_input.h @@ -65,6 +65,7 @@ * Derived from: ng_hole.h * * $FreeBSD: src/sys/netgraph/ng_ip_input.h,v 1.3 2005/01/07 01:45:39 imp Exp $ + * $DragonFly: src/sys/netgraph7/ng_ip_input.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ #ifndef _NETGRAPH_NG_IP_INPUT_H_ diff --git a/sys/netgraph7/ng_ipfw.c b/sys/netgraph7/ng_ipfw.c index 44242bbdba..0c94d4fa72 100644 --- a/sys/netgraph7/ng_ipfw.c +++ b/sys/netgraph7/ng_ipfw.c @@ -24,6 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netgraph/ng_ipfw.c,v 1.9 2006/02/14 15:22:24 ru Exp $ + * $DragonFly: src/sys/netgraph7/ng_ipfw.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ #include @@ -45,10 +46,10 @@ #include #include -#include -#include -#include -#include +#include "ng_message.h" +#include "ng_parse.h" +#include "ng_ipfw.h" +#include "netgraph.h" static int ng_ipfw_mod_event(module_t mod, int event, void *data); static ng_constructor_t ng_ipfw_constructor; @@ -162,7 +163,7 @@ ng_ipfw_newhook(node_p node, hook_p hook, const char *name) return (EINVAL); /* Allocate memory for this hook's private data */ - MALLOC(hpriv, hpriv_p, sizeof(*hpriv), M_NETGRAPH, M_NOWAIT | M_ZERO); + MALLOC(hpriv, hpriv_p, sizeof(*hpriv), M_NETGRAPH, M_WAITOK | M_NULLOK | M_ZERO); if (hpriv== NULL) return (ENOMEM); @@ -286,7 +287,7 @@ ng_ipfw_input(struct mbuf **m0, int dir, struct ip_fw_args *fwa, int tee) *m0 = NULL; /* it belongs now to netgraph */ if ((ngit = (struct ng_ipfw_tag *)m_tag_alloc(NGM_IPFW_COOKIE, - 0, TAGSIZ, M_NOWAIT|M_ZERO)) == NULL) { + 0, TAGSIZ, MB_DONTWAIT)) == NULL) { m_freem(m); return (ENOMEM); } @@ -296,7 +297,7 @@ ng_ipfw_input(struct mbuf **m0, int dir, struct ip_fw_args *fwa, int tee) m_tag_prepend(m, &ngit->mt); } else - if ((m = m_dup(*m0, M_DONTWAIT)) == NULL) + if ((m = m_dup(*m0, MB_DONTWAIT)) == NULL) return (ENOMEM); /* which is ignored */ if (m->m_len < sizeof(struct ip) && diff --git a/sys/netgraph7/ng_ipfw.h b/sys/netgraph7/ng_ipfw.h index 2d174bd4aa..d047698ac7 100644 --- a/sys/netgraph7/ng_ipfw.h +++ b/sys/netgraph7/ng_ipfw.h @@ -24,6 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netgraph/ng_ipfw.h,v 1.2 2006/02/17 09:42:49 glebius Exp $ + * $DragonFly: src/sys/netgraph7/ng_ipfw.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ #define NG_IPFW_NODE_TYPE "ipfw" diff --git a/sys/netgraph7/ng_ksocket.c b/sys/netgraph7/ng_ksocket.c index 137899deed..3ad98aaa86 100644 --- a/sys/netgraph7/ng_ksocket.c +++ b/sys/netgraph7/ng_ksocket.c @@ -38,6 +38,7 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_ksocket.c,v 1.61 2008/03/07 21:12:56 mav Exp $ + * $DragonFly: src/sys/netgraph7/ng_ksocket.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_ksocket.c,v 1.1 1999/11/16 20:04:40 archie Exp $ */ @@ -60,10 +61,10 @@ #include #include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_parse.h" +#include "ng_ksocket.h" #include #include @@ -524,7 +525,7 @@ ng_ksocket_constructor(node_p node) /* Allocate private structure */ MALLOC(priv, priv_p, sizeof(*priv), - M_NETGRAPH_KSOCKET, M_NOWAIT | M_ZERO); + M_NETGRAPH_KSOCKET, M_WAITOK | M_NULLOK | M_ZERO); if (priv == NULL) return (ENOMEM); @@ -659,7 +660,7 @@ ng_ksocket_connect(hook_p hook) * of the hook, those queued operations will fail. */ if (priv->flags & KSF_CLONED) { - ng_send_fn(node, NULL, &ng_ksocket_incoming2, so, M_NOWAIT); + ng_send_fn(node, NULL, &ng_ksocket_incoming2, so, M_WAITOK | M_NULLOK); } return (0); @@ -801,7 +802,7 @@ ng_ksocket_rcvmsg(node_p node, item_p item, hook_p lasthook) len = (sa == NULL) ? 0 : sa->sa_len; /* Send it back in a response */ - NG_MKRESPONSE(resp, msg, len, M_NOWAIT); + NG_MKRESPONSE(resp, msg, len, M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; goto bail; @@ -829,7 +830,7 @@ ng_ksocket_rcvmsg(node_p node, item_p item, hook_p lasthook) /* Get response with room for option value */ NG_MKRESPONSE(resp, msg, sizeof(*ksopt) - + NG_KSOCKET_MAX_OPTLEN, M_NOWAIT); + + NG_KSOCKET_MAX_OPTLEN, M_WAITOK | M_NULLOK); if (resp == NULL) ERROUT(ENOMEM); @@ -1053,7 +1054,7 @@ ng_ksocket_incoming2(node_p node, hook_p hook, void *arg1, int arg2) } if (!(so->so_state & SS_ISCONNECTING)) { NG_MKMESSAGE(response, NGM_KSOCKET_COOKIE, - NGM_KSOCKET_CONNECT, sizeof(int32_t), M_NOWAIT); + NGM_KSOCKET_CONNECT, sizeof(int32_t), M_WAITOK | M_NULLOK); if (response != NULL) { response->header.flags |= NGF_RESP; response->header.token = priv->response_token; @@ -1128,7 +1129,7 @@ ng_ksocket_incoming2(node_p node, hook_p hook, void *arg1, int arg2) stag = (struct sa_tag *)m_tag_alloc(NGM_KSOCKET_COOKIE, NG_KSOCKET_TAG_SOCKADDR, sizeof(ng_ID_t) + - sa->sa_len, M_NOWAIT); + sa->sa_len, MB_DONTWAIT); if (stag == NULL) { FREE(sa, M_SONAME); goto sendit; @@ -1148,7 +1149,7 @@ sendit: /* Forward data with optional peer sockaddr as packet tag */ * to indicate end-of-file. */ if (so->so_rcv.sb_state & SBS_CANTRCVMORE && !(priv->flags & KSF_EOFSEEN)) { - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, MB_DONTWAIT, MT_DATA); if (m != NULL) { m->m_len = m->m_pkthdr.len = 0; NG_SEND_DATA_ONLY(error, priv->hook, m); @@ -1223,7 +1224,7 @@ ng_ksocket_finish_accept(priv_p priv) len += sa->sa_len; NG_MKMESSAGE(resp, NGM_KSOCKET_COOKIE, NGM_KSOCKET_ACCEPT, len, - M_NOWAIT); + M_WAITOK | M_NULLOK); if (resp == NULL) { soclose(so); goto out; diff --git a/sys/netgraph7/ng_ksocket.h b/sys/netgraph7/ng_ksocket.h index c897f1c052..d266177099 100644 --- a/sys/netgraph7/ng_ksocket.h +++ b/sys/netgraph7/ng_ksocket.h @@ -38,6 +38,7 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_ksocket.h,v 1.13 2005/10/28 14:41:28 ru Exp $ + * $DragonFly: src/sys/netgraph7/ng_ksocket.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_ksocket.h,v 1.1 1999/11/16 20:04:40 archie Exp $ */ diff --git a/sys/netgraph7/ng_l2tp.c b/sys/netgraph7/ng_l2tp.c index 6efb5cc4f0..1458e5c672 100644 --- a/sys/netgraph7/ng_l2tp.c +++ b/sys/netgraph7/ng_l2tp.c @@ -37,6 +37,7 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_l2tp.c,v 1.25 2008/03/16 21:33:12 mav Exp $ + * $DragonFly: src/sys/netgraph7/ng_l2tp.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ /* @@ -56,10 +57,10 @@ #include #include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_parse.h" +#include "ng_l2tp.h" #ifdef NG_SEPARATE_MALLOC MALLOC_DEFINE(M_NETGRAPH_L2TP, "netgraph_l2tp", "netgraph l2tp node"); @@ -364,7 +365,7 @@ ng_l2tp_constructor(node_p node) int i; /* Allocate private structure */ - MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH_L2TP, M_NOWAIT | M_ZERO); + MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH_L2TP, M_WAITOK | M_NULLOK | M_ZERO); if (priv == NULL) return (ENOMEM); NG_NODE_SET_PRIVATE(node, priv); @@ -429,7 +430,7 @@ ng_l2tp_newhook(node_p node, hook_p hook, const char *name) /* Create hook private structure */ MALLOC(hpriv, hookpriv_p, - sizeof(*hpriv), M_NETGRAPH_L2TP, M_NOWAIT | M_ZERO); + sizeof(*hpriv), M_NETGRAPH_L2TP, M_WAITOK | M_NULLOK | M_ZERO); if (hpriv == NULL) return (ENOMEM); hpriv->conf.session_id = htons(session_id); @@ -498,7 +499,7 @@ ng_l2tp_rcvmsg(node_p node, item_p item, hook_p lasthook) { struct ng_l2tp_config *conf; - NG_MKRESPONSE(resp, msg, sizeof(*conf), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(*conf), M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -560,7 +561,7 @@ ng_l2tp_rcvmsg(node_p node, item_p item, hook_p lasthook) } /* Send response */ - NG_MKRESPONSE(resp, msg, sizeof(hpriv->conf), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(hpriv->conf), M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -579,7 +580,7 @@ ng_l2tp_rcvmsg(node_p node, item_p item, hook_p lasthook) { if (msg->header.cmd != NGM_L2TP_CLR_STATS) { NG_MKRESPONSE(resp, msg, - sizeof(priv->stats), M_NOWAIT); + sizeof(priv->stats), M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -615,7 +616,7 @@ ng_l2tp_rcvmsg(node_p node, item_p item, hook_p lasthook) if (msg->header.cmd != NGM_L2TP_CLR_SESSION_STATS) { NG_MKRESPONSE(resp, msg, - sizeof(hpriv->stats), M_NOWAIT); + sizeof(hpriv->stats), M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -957,7 +958,7 @@ ng_l2tp_rcvdata_lower(hook_p h, item_p item) mtx_unlock(&seq->mtx); /* Prepend session ID to packet. */ - M_PREPEND(m, 2, M_DONTWAIT); + M_PREPEND(m, 2, MB_DONTWAIT); if (m == NULL) { seq->inproc = 0; priv->stats.memoryFailures++; @@ -1093,7 +1094,7 @@ ng_l2tp_rcvdata_ctrl(hook_p hook, item_p item) mtx_unlock(&seq->mtx); /* Copy packet */ - if ((m = L2TP_COPY_MBUF(m, M_DONTWAIT)) == NULL) { + if ((m = L2TP_COPY_MBUF(m, MB_DONTWAIT)) == NULL) { priv->stats.memoryFailures++; ERROUT(ENOBUFS); } @@ -1143,7 +1144,7 @@ ng_l2tp_rcvdata(hook_p hook, item_p item) M_PREPEND(m, 6 + (2 * (hpriv->conf.include_length != 0)) + (4 * (hpriv->conf.enable_dseq != 0)), - M_DONTWAIT); + MB_DONTWAIT); if (m == NULL) { priv->stats.memoryFailures++; NG_FREE_ITEM(item); @@ -1189,7 +1190,7 @@ ng_l2tp_seq_failure(priv_p priv) struct ng_mesg *msg; int error; - NG_MKMESSAGE(msg, NGM_L2TP_COOKIE, NGM_L2TP_ACK_FAILURE, 0, M_NOWAIT); + NG_MKMESSAGE(msg, NGM_L2TP_COOKIE, NGM_L2TP_ACK_FAILURE, 0, M_WAITOK | M_NULLOK); if (msg == NULL) return; NG_SEND_MSG_ID(error, priv->node, msg, priv->ftarget, 0); @@ -1420,7 +1421,7 @@ ng_l2tp_seq_recv_nr(priv_p priv, u_int16_t nr) */ for (i = 0; i < j; i++) { struct mbuf *m; - if ((m = L2TP_COPY_MBUF(xwin[i], M_DONTWAIT)) == NULL) + if ((m = L2TP_COPY_MBUF(xwin[i], MB_DONTWAIT)) == NULL) priv->stats.memoryFailures++; else ng_l2tp_xmit_ctrl(priv, m, ns); @@ -1496,7 +1497,7 @@ ng_l2tp_seq_rack_timeout(node_p node, hook_p hook, void *arg1, int arg2) seq->acks = 0; /* Retransmit oldest unack'd packet */ - if ((m = L2TP_COPY_MBUF(seq->xwin[0], M_DONTWAIT)) == NULL) + if ((m = L2TP_COPY_MBUF(seq->xwin[0], MB_DONTWAIT)) == NULL) priv->stats.memoryFailures++; else ng_l2tp_xmit_ctrl(priv, m, seq->ns++); @@ -1534,7 +1535,7 @@ ng_l2tp_xmit_ctrl(priv_p priv, struct mbuf *m, u_int16_t ns) if (m == NULL) { /* Create a new mbuf for ZLB packet */ - MGETHDR(m, M_DONTWAIT, MT_DATA); + MGETHDR(m, MB_DONTWAIT, MT_DATA); if (m == NULL) { priv->stats.memoryFailures++; return (ENOBUFS); @@ -1553,7 +1554,7 @@ ng_l2tp_xmit_ctrl(priv_p priv, struct mbuf *m, u_int16_t ns) m_adj(m, 2); /* Make room for L2TP header */ - M_PREPEND(m, 12, M_DONTWAIT); + M_PREPEND(m, 12, MB_DONTWAIT); if (m == NULL) { priv->stats.memoryFailures++; return (ENOBUFS); diff --git a/sys/netgraph7/ng_l2tp.h b/sys/netgraph7/ng_l2tp.h index b5f731cd87..e1cc0a0fe3 100644 --- a/sys/netgraph7/ng_l2tp.h +++ b/sys/netgraph7/ng_l2tp.h @@ -37,6 +37,7 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_l2tp.h,v 1.5 2005/01/07 01:45:39 imp Exp $ + * $DragonFly: src/sys/netgraph7/ng_l2tp.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ #ifndef _NETGRAPH_NG_L2TP_H_ diff --git a/sys/netgraph7/ng_lmi.c b/sys/netgraph7/ng_lmi.c index 26ef9c8187..40e434c2da 100644 --- a/sys/netgraph7/ng_lmi.c +++ b/sys/netgraph7/ng_lmi.c @@ -38,6 +38,7 @@ * Author: Julian Elischer * * $FreeBSD: src/sys/netgraph/ng_lmi.c,v 1.25 2006/01/14 14:17:27 glebius Exp $ + * $DragonFly: src/sys/netgraph7/ng_lmi.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_lmi.c,v 1.38 1999/11/01 09:24:52 julian Exp $ */ @@ -60,9 +61,9 @@ #include #include #include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_lmi.h" /* * Human readable names for LMI @@ -185,7 +186,7 @@ nglmi_constructor(node_p node) { sc_p sc; - MALLOC(sc, sc_p, sizeof(*sc), M_NETGRAPH, M_NOWAIT | M_ZERO); + MALLOC(sc, sc_p, sizeof(*sc), M_NETGRAPH, M_WAITOK | M_NULLOK | M_ZERO); if (sc == NULL) return (ENOMEM); @@ -319,7 +320,7 @@ nglmi_inquire(sc_p sc, int full) if (sc->lmi_channel == NULL) return; - MGETHDR(m, M_DONTWAIT, MT_DATA); + MGETHDR(m, MB_DONTWAIT, MT_DATA); if (m == NULL) { log(LOG_ERR, "nglmi: unable to start up LMI processing\n"); return; @@ -330,7 +331,7 @@ nglmi_inquire(sc_p sc, int full) * that device driver would put it in the beginning of queue */ ptag = (struct ng_tag_prio *)m_tag_alloc(NGM_GENERIC_COOKIE, NG_TAG_PRIO, - (sizeof(struct ng_tag_prio) - sizeof(struct m_tag)), M_NOWAIT); + (sizeof(struct ng_tag_prio) - sizeof(struct m_tag)), MB_DONTWAIT); if (ptag != NULL) { /* if it failed, well, it was optional anyhow */ ptag->priority = NG_PRIO_LINKSTATE; ptag->discardability = -1; @@ -456,7 +457,7 @@ nglmi_rcvmsg(node_p node, item_p item, hook_p lasthook) char *arg; int pos, count; - NG_MKRESPONSE(resp, msg, NG_TEXTRESPONSE, M_NOWAIT); + NG_MKRESPONSE(resp, msg, NG_TEXTRESPONSE, M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -502,7 +503,7 @@ nglmi_rcvmsg(node_p node, item_p item, hook_p lasthook) struct nglmistat *stat; int k; - NG_MKRESPONSE(resp, msg, sizeof(*stat), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(*stat), M_WAITOK | M_NULLOK); if (!resp) { error = ENOMEM; break; diff --git a/sys/netgraph7/ng_lmi.h b/sys/netgraph7/ng_lmi.h index 3d187e64e3..148032cc8d 100644 --- a/sys/netgraph7/ng_lmi.h +++ b/sys/netgraph7/ng_lmi.h @@ -38,6 +38,7 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_lmi.h,v 1.4 2005/01/07 01:45:39 imp Exp $ + * $DragonFly: src/sys/netgraph7/ng_lmi.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_lmi.h,v 1.9 1999/01/20 00:22:13 archie Exp $ */ diff --git a/sys/netgraph7/ng_message.h b/sys/netgraph7/ng_message.h index ff5ce01088..7796d5f689 100644 --- a/sys/netgraph7/ng_message.h +++ b/sys/netgraph7/ng_message.h @@ -38,6 +38,7 @@ * Author: Julian Elischer * * $FreeBSD: src/sys/netgraph/ng_message.h,v 1.29 2006/10/17 11:01:20 glebius Exp $ + * $DragonFly: src/sys/netgraph7/ng_message.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_message.h,v 1.12 1999/01/25 01:17:44 archie Exp $ */ diff --git a/sys/netgraph7/ng_mppc.c b/sys/netgraph7/ng_mppc.c index 423d6989ea..087d320f4e 100644 --- a/sys/netgraph7/ng_mppc.c +++ b/sys/netgraph7/ng_mppc.c @@ -39,6 +39,7 @@ * * $Whistle: ng_mppc.c,v 1.4 1999/11/25 00:10:12 archie Exp $ * $FreeBSD: src/sys/netgraph/ng_mppc.c,v 1.31 2007/05/18 15:28:01 mav Exp $ + * $DragonFly: src/sys/netgraph7/ng_mppc.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ /* @@ -56,19 +57,19 @@ #include #include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_mppc.h" #include "opt_netgraph.h" -#if !defined(NETGRAPH_MPPC_COMPRESSION) && !defined(NETGRAPH_MPPC_ENCRYPTION) +#if !defined(NETGRAPH7_MPPC_COMPRESSION) && !defined(NETGRAPH7_MPPC_ENCRYPTION) #ifdef KLD_MODULE -/* XXX NETGRAPH_MPPC_COMPRESSION isn't functional yet */ -#define NETGRAPH_MPPC_ENCRYPTION +/* XXX NETGRAPH7_MPPC_COMPRESSION isn't functional yet */ +#define NETGRAPH7_MPPC_ENCRYPTION #else /* This case is indicative of an error in sys/conf files */ -#error Need either NETGRAPH_MPPC_COMPRESSION or NETGRAPH_MPPC_ENCRYPTION +#error Need either NETGRAPH7_MPPC_COMPRESSION or NETGRAPH7_MPPC_ENCRYPTION #endif #endif @@ -78,11 +79,11 @@ MALLOC_DEFINE(M_NETGRAPH_MPPC, "netgraph_mppc", "netgraph mppc node "); #define M_NETGRAPH_MPPC M_NETGRAPH #endif -#ifdef NETGRAPH_MPPC_COMPRESSION +#ifdef NETGRAPH7_MPPC_COMPRESSION /* XXX this file doesn't exist yet, but hopefully someday it will... */ #include #endif -#ifdef NETGRAPH_MPPC_ENCRYPTION +#ifdef NETGRAPH7_MPPC_ENCRYPTION #include #endif #include @@ -127,10 +128,10 @@ struct ng_mppc_dir { hook_p hook; /* netgraph hook */ u_int16_t cc:12; /* coherency count */ u_char flushed; /* clean history (xmit only) */ -#ifdef NETGRAPH_MPPC_COMPRESSION +#ifdef NETGRAPH7_MPPC_COMPRESSION u_char *history; /* compression history */ #endif -#ifdef NETGRAPH_MPPC_ENCRYPTION +#ifdef NETGRAPH7_MPPC_ENCRYPTION u_char key[MPPE_KEY_LEN]; /* session key */ struct rc4_state rc4; /* rc4 state */ #endif @@ -157,7 +158,7 @@ static int ng_mppc_compress(node_p node, struct mbuf **datap); static int ng_mppc_decompress(node_p node, struct mbuf **datap); -#ifdef NETGRAPH_MPPC_ENCRYPTION +#ifdef NETGRAPH7_MPPC_ENCRYPTION static void ng_mppc_getkey(const u_char *h, u_char *h2, int len); static void ng_mppc_updatekey(u_int32_t bits, u_char *key0, u_char *key, struct rc4_state *rc4); @@ -177,7 +178,7 @@ static struct ng_type ng_mppc_typestruct = { }; NETGRAPH_INIT(mppc, &ng_mppc_typestruct); -#ifdef NETGRAPH_MPPC_ENCRYPTION +#ifdef NETGRAPH7_MPPC_ENCRYPTION /* Depend on separate rc4 module */ MODULE_DEPEND(ng_mppc, rc4, 1, 1, 1); #endif @@ -200,7 +201,7 @@ ng_mppc_constructor(node_p node) priv_p priv; /* Allocate private structure */ - MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH_MPPC, M_NOWAIT | M_ZERO); + MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH_MPPC, M_WAITOK | M_NULLOK | M_ZERO); if (priv == NULL) return (ENOMEM); @@ -270,11 +271,11 @@ ng_mppc_rcvmsg(node_p node, item_p item, hook_p lasthook) if (cfg->enable) { if ((cfg->bits & ~MPPC_VALID_BITS) != 0) ERROUT(EINVAL); -#ifndef NETGRAPH_MPPC_COMPRESSION +#ifndef NETGRAPH7_MPPC_COMPRESSION if ((cfg->bits & MPPC_BIT) != 0) ERROUT(EPROTONOSUPPORT); #endif -#ifndef NETGRAPH_MPPC_ENCRYPTION +#ifndef NETGRAPH7_MPPC_ENCRYPTION if ((cfg->bits & MPPE_BITS) != 0) ERROUT(EPROTONOSUPPORT); #endif @@ -288,7 +289,7 @@ ng_mppc_rcvmsg(node_p node, item_p item, hook_p lasthook) /* Configuration is OK, reset to it */ d->cfg = *cfg; -#ifdef NETGRAPH_MPPC_COMPRESSION +#ifdef NETGRAPH7_MPPC_COMPRESSION /* Initialize state buffers for compression */ if (d->history != NULL) { FREE(d->history, M_NETGRAPH_MPPC); @@ -298,7 +299,7 @@ ng_mppc_rcvmsg(node_p node, item_p item, hook_p lasthook) MALLOC(d->history, u_char *, isComp ? MPPC_SizeOfCompressionHistory() : MPPC_SizeOfDecompressionHistory(), - M_NETGRAPH_MPPC, M_NOWAIT); + M_NETGRAPH_MPPC, M_WAITOK | M_NULLOK); if (d->history == NULL) ERROUT(ENOMEM); if (isComp) @@ -310,7 +311,7 @@ ng_mppc_rcvmsg(node_p node, item_p item, hook_p lasthook) } #endif -#ifdef NETGRAPH_MPPC_ENCRYPTION +#ifdef NETGRAPH7_MPPC_ENCRYPTION /* Generate initial session keys for encryption */ if ((cfg->bits & MPPE_BITS) != 0) { const int keylen = KEYLEN(cfg->bits); @@ -391,7 +392,7 @@ ng_mppc_rcvdata(hook_p hook, item_p item) /* Need to send a reset-request */ NG_MKMESSAGE(msg, NGM_MPPC_COOKIE, - NGM_MPPC_RESETREQ, 0, M_NOWAIT); + NGM_MPPC_RESETREQ, 0, M_WAITOK | M_NULLOK); if (msg == NULL) return (error); NG_SEND_MSG_ID(error, node, msg, @@ -419,7 +420,7 @@ ng_mppc_shutdown(node_p node) const priv_p priv = NG_NODE_PRIVATE(node); /* Take down netgraph node */ -#ifdef NETGRAPH_MPPC_COMPRESSION +#ifdef NETGRAPH7_MPPC_COMPRESSION if (priv->xmit.history != NULL) FREE(priv->xmit.history, M_NETGRAPH_MPPC); if (priv->recv.history != NULL) @@ -480,7 +481,7 @@ ng_mppc_compress(node_p node, struct mbuf **datap) } /* Compress packet (if compression enabled) */ -#ifdef NETGRAPH_MPPC_COMPRESSION +#ifdef NETGRAPH7_MPPC_COMPRESSION if ((d->cfg.bits & MPPC_BIT) != 0) { u_short flags = MPPC_MANDATORY_COMPRESS_FLAGS; u_char *inbuf, *outbuf; @@ -491,7 +492,7 @@ ng_mppc_compress(node_p node, struct mbuf **datap) /* Work with contiguous regions of memory. */ inlen = m->m_pkthdr.len; - inbuf = malloc(inlen, M_NETGRAPH_MPPC, M_NOWAIT); + inbuf = kmalloc(inlen, M_NETGRAPH_MPPC, M_WAITOK | M_NULLOK); if (inbuf == NULL) { m_freem(m); return (ENOMEM); @@ -499,10 +500,10 @@ ng_mppc_compress(node_p node, struct mbuf **datap) m_copydata(m, 0, inlen, (caddr_t)inbuf); outlen = MPPC_MAX_BLOWUP(inlen); - outbuf = malloc(outlen, M_NETGRAPH_MPPC, M_NOWAIT); + outbuf = kmalloc(outlen, M_NETGRAPH_MPPC, M_WAITOK | M_NULLOK); if (outbuf == NULL) { m_freem(m); - free(inbuf, M_NETGRAPH_MPPC); + kfree(inbuf, M_NETGRAPH_MPPC); return (ENOMEM); } @@ -534,8 +535,8 @@ ng_mppc_compress(node_p node, struct mbuf **datap) d->flushed = (rtn & MPPC_EXPANDED) != 0 || (flags & MPPC_SAVE_HISTORY) == 0; - free(inbuf, M_NETGRAPH_MPPC); - free(outbuf, M_NETGRAPH_MPPC); + kfree(inbuf, M_NETGRAPH_MPPC); + kfree(outbuf, M_NETGRAPH_MPPC); /* Check m_devget() result. */ if (m == NULL) @@ -544,7 +545,7 @@ ng_mppc_compress(node_p node, struct mbuf **datap) #endif /* Now encrypt packet (if encryption enabled) */ -#ifdef NETGRAPH_MPPC_ENCRYPTION +#ifdef NETGRAPH7_MPPC_ENCRYPTION if ((d->cfg.bits & MPPE_BITS) != 0) { struct mbuf *m1; @@ -563,7 +564,7 @@ ng_mppc_compress(node_p node, struct mbuf **datap) } /* We must own the mbuf chain exclusively to modify it. */ - m = m_unshare(m, M_DONTWAIT); + m = m_unshare(m, MB_DONTWAIT); if (m == NULL) return (ENOMEM); @@ -581,7 +582,7 @@ ng_mppc_compress(node_p node, struct mbuf **datap) MPPC_CCOUNT_INC(d->cc); /* Install header */ - M_PREPEND(m, MPPC_HDRLEN, M_DONTWAIT); + M_PREPEND(m, MPPC_HDRLEN, MB_DONTWAIT); if (m != NULL) *(mtod(m, uint16_t *)) = htons(header); @@ -617,11 +618,11 @@ ng_mppc_decompress(node_p node, struct mbuf **datap) /* If flushed bit set, we can always handle packet */ if ((header & MPPC_FLAG_FLUSHED) != 0) { -#ifdef NETGRAPH_MPPC_COMPRESSION +#ifdef NETGRAPH7_MPPC_COMPRESSION if (d->history != NULL) MPPC_InitDecompressionHistory(d->history); #endif -#ifdef NETGRAPH_MPPC_ENCRYPTION +#ifdef NETGRAPH7_MPPC_ENCRYPTION if ((d->cfg.bits & MPPE_BITS) != 0) { u_int rekey; @@ -662,7 +663,7 @@ ng_mppc_decompress(node_p node, struct mbuf **datap) /* Decrypt packet */ if ((header & MPPC_FLAG_ENCRYPTED) != 0) { -#ifdef NETGRAPH_MPPC_ENCRYPTION +#ifdef NETGRAPH7_MPPC_ENCRYPTION struct mbuf *m1; #endif @@ -673,7 +674,7 @@ ng_mppc_decompress(node_p node, struct mbuf **datap) goto failed; } -#ifdef NETGRAPH_MPPC_ENCRYPTION +#ifdef NETGRAPH7_MPPC_ENCRYPTION /* Update key if it's time (always in stateless mode) */ if ((d->cfg.bits & MPPE_STATELESS) != 0 || (d->cc & MPPE_UPDATE_MASK) == MPPE_UPDATE_FLAG) { @@ -682,7 +683,7 @@ ng_mppc_decompress(node_p node, struct mbuf **datap) } /* We must own the mbuf chain exclusively to modify it. */ - m = m_unshare(m, M_DONTWAIT); + m = m_unshare(m, MB_DONTWAIT); if (m == NULL) return (ENOMEM); @@ -717,7 +718,7 @@ failed: return (EINVAL); } -#ifdef NETGRAPH_MPPC_COMPRESSION +#ifdef NETGRAPH7_MPPC_COMPRESSION /* Decompress packet */ if ((header & MPPC_FLAG_COMPRESSED) != 0) { int flags = MPPC_MANDATORY_DECOMPRESS_FLAGS; @@ -729,7 +730,7 @@ failed: /* Copy payload into a contiguous region of memory. */ len = m->m_pkthdr.len; - buf = malloc(len, M_NETGRAPH_MPPC, M_NOWAIT); + buf = kmalloc(len, M_NETGRAPH_MPPC, M_WAITOK | M_NULLOK); if (buf == NULL) { m_freem(m); return (ENOMEM); @@ -737,11 +738,11 @@ failed: m_copydata(m, 0, len, (caddr_t)buf); /* Allocate a buffer for decompressed data */ - decompbuf = malloc(MPPC_DECOMP_BUFSIZE + MPPC_DECOMP_SAFETY, - M_NETGRAPH_MPPC, M_NOWAIT); + decompbuf = kmalloc(MPPC_DECOMP_BUFSIZE + MPPC_DECOMP_SAFETY, + M_NETGRAPH_MPPC, M_WAITOK | M_NULLOK); if (decompbuf == NULL) { m_freem(m); - free(buf, M_NETGRAPH_MPPC); + kfree(buf, M_NETGRAPH_MPPC); return (ENOMEM); } decomplen = MPPC_DECOMP_BUFSIZE; @@ -764,18 +765,18 @@ failed: || (rtn & MPPC_DECOMP_OK) != MPPC_DECOMP_OK) { log(LOG_ERR, "%s: decomp returned 0x%x", __func__, rtn); - free(buf, M_NETGRAPH_MPPC); - free(decompbuf, M_NETGRAPH_MPPC); + kfree(buf, M_NETGRAPH_MPPC); + kfree(decompbuf, M_NETGRAPH_MPPC); goto failed; } /* Replace compressed data with decompressed data */ - free(buf, M_NETGRAPH_MPPC); + kfree(buf, M_NETGRAPH_MPPC); len = decomplen - destCnt; m_freem(m); m = m_devget((caddr_t)decompbuf, len, 0, NULL, NULL); - free(decompbuf, M_NETGRAPH_MPPC); + kfree(decompbuf, M_NETGRAPH_MPPC); } #endif @@ -793,18 +794,18 @@ ng_mppc_reset_req(node_p node) const priv_p priv = NG_NODE_PRIVATE(node); struct ng_mppc_dir *const d = &priv->xmit; -#ifdef NETGRAPH_MPPC_COMPRESSION +#ifdef NETGRAPH7_MPPC_COMPRESSION if (d->history != NULL) MPPC_InitCompressionHistory(d->history); #endif -#ifdef NETGRAPH_MPPC_ENCRYPTION +#ifdef NETGRAPH7_MPPC_ENCRYPTION if ((d->cfg.bits & MPPE_STATELESS) == 0) rc4_init(&d->rc4, d->key, KEYLEN(d->cfg.bits)); #endif d->flushed = 1; } -#ifdef NETGRAPH_MPPC_ENCRYPTION +#ifdef NETGRAPH7_MPPC_ENCRYPTION /* * Generate a new encryption key */ diff --git a/sys/netgraph7/ng_mppc.h b/sys/netgraph7/ng_mppc.h index 81c5461849..582eae9305 100644 --- a/sys/netgraph7/ng_mppc.h +++ b/sys/netgraph7/ng_mppc.h @@ -39,6 +39,7 @@ * * $Whistle: ng_mppc.h,v 1.3 2000/02/12 01:17:22 archie Exp $ * $FreeBSD: src/sys/netgraph/ng_mppc.h,v 1.5 2005/01/07 01:45:39 imp Exp $ + * $DragonFly: src/sys/netgraph7/ng_mppc.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ #ifndef _NETGRAPH_NG_MPPC_H_ diff --git a/sys/netgraph7/ng_nat.c b/sys/netgraph7/ng_nat.c index a1f85326a9..78c626b783 100644 --- a/sys/netgraph7/ng_nat.c +++ b/sys/netgraph7/ng_nat.c @@ -24,6 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netgraph/ng_nat.c,v 1.12 2008/06/01 15:13:32 mav Exp $ + * $DragonFly: src/sys/netgraph7/ng_nat.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ #include @@ -44,10 +45,10 @@ #include -#include -#include -#include -#include +#include "ng_message.h" +#include "ng_parse.h" +#include "ng_nat.h" +#include "netgraph.h" static ng_constructor_t ng_nat_constructor; static ng_rcvmsg_t ng_nat_rcvmsg; @@ -273,7 +274,7 @@ ng_nat_constructor(node_p node) /* Initialize private descriptor. */ MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, - M_NOWAIT | M_ZERO); + M_WAITOK | M_NULLOK | M_ZERO); if (priv == NULL) return (ENOMEM); @@ -393,8 +394,8 @@ ng_nat_rcvmsg(node_p node, item_p item, hook_p lasthook) break; } - if ((entry = malloc(sizeof(struct ng_nat_rdr_lst), - M_NETGRAPH, M_NOWAIT | M_ZERO)) == NULL) { + if ((entry = kmalloc(sizeof(struct ng_nat_rdr_lst), + M_NETGRAPH, M_WAITOK | M_NULLOK | M_ZERO)) == NULL) { error = ENOMEM; break; } @@ -433,7 +434,7 @@ ng_nat_rcvmsg(node_p node, item_p item, hook_p lasthook) STAILQ_INSERT_TAIL(&priv->redirhead, entry, entries); /* Response with id of newly added entry. */ - NG_MKRESPONSE(resp, msg, sizeof(entry->rdr.id), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(entry->rdr.id), M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -452,8 +453,8 @@ ng_nat_rcvmsg(node_p node, item_p item, hook_p lasthook) break; } - if ((entry = malloc(sizeof(struct ng_nat_rdr_lst), - M_NETGRAPH, M_NOWAIT | M_ZERO)) == NULL) { + if ((entry = kmalloc(sizeof(struct ng_nat_rdr_lst), + M_NETGRAPH, M_WAITOK | M_NULLOK | M_ZERO)) == NULL) { error = ENOMEM; break; } @@ -485,7 +486,7 @@ ng_nat_rcvmsg(node_p node, item_p item, hook_p lasthook) STAILQ_INSERT_TAIL(&priv->redirhead, entry, entries); /* Response with id of newly added entry. */ - NG_MKRESPONSE(resp, msg, sizeof(entry->rdr.id), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(entry->rdr.id), M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -504,8 +505,8 @@ ng_nat_rcvmsg(node_p node, item_p item, hook_p lasthook) break; } - if ((entry = malloc(sizeof(struct ng_nat_rdr_lst), - M_NETGRAPH, M_NOWAIT | M_ZERO)) == NULL) { + if ((entry = kmalloc(sizeof(struct ng_nat_rdr_lst), + M_NETGRAPH, M_WAITOK | M_NULLOK | M_ZERO)) == NULL) { error = ENOMEM; break; } @@ -539,7 +540,7 @@ ng_nat_rcvmsg(node_p node, item_p item, hook_p lasthook) STAILQ_INSERT_TAIL(&priv->redirhead, entry, entries); /* Response with id of newly added entry. */ - NG_MKRESPONSE(resp, msg, sizeof(entry->rdr.id), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(entry->rdr.id), M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -625,7 +626,7 @@ ng_nat_rcvmsg(node_p node, item_p item, hook_p lasthook) int i = 0; NG_MKRESPONSE(resp, msg, sizeof(*ary) + - (priv->rdrcount) * sizeof(*entry), M_NOWAIT); + (priv->rdrcount) * sizeof(*entry), M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; diff --git a/sys/netgraph7/ng_nat.h b/sys/netgraph7/ng_nat.h index 8653cf601c..8adc9f9902 100644 --- a/sys/netgraph7/ng_nat.h +++ b/sys/netgraph7/ng_nat.h @@ -24,6 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netgraph/ng_nat.h,v 1.4 2008/03/04 11:10:54 mav Exp $ + * $DragonFly: src/sys/netgraph7/ng_nat.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ #define NG_NAT_NODE_TYPE "nat" diff --git a/sys/netgraph7/ng_one2many.c b/sys/netgraph7/ng_one2many.c index 56e6cffa1e..f4923e65a1 100644 --- a/sys/netgraph7/ng_one2many.c +++ b/sys/netgraph7/ng_one2many.c @@ -38,6 +38,7 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_one2many.c,v 1.21 2005/03/11 10:29:38 glebius Exp $ + * $DragonFly: src/sys/netgraph7/ng_one2many.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ /* @@ -56,10 +57,10 @@ #include #include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_parse.h" +#include "ng_one2many.h" /* Per-link private data */ struct ng_one2many_link { @@ -187,7 +188,7 @@ ng_one2many_constructor(node_p node) priv_p priv; /* Allocate and initialize private info */ - MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); + MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_WAITOK | M_NULLOK | M_ZERO); if (priv == NULL) return (ENOMEM); priv->conf.xmitAlg = NG_ONE2MANY_XMIT_ROUNDROBIN; @@ -307,7 +308,7 @@ ng_one2many_rcvmsg(node_p node, item_p item, hook_p lasthook) { struct ng_one2many_config *conf; - NG_MKRESPONSE(resp, msg, sizeof(*conf), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(*conf), M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -342,7 +343,7 @@ ng_one2many_rcvmsg(node_p node, item_p item, hook_p lasthook) /* Get/clear stats */ if (msg->header.cmd != NGM_ONE2MANY_CLR_STATS) { NG_MKRESPONSE(resp, msg, - sizeof(link->stats), M_NOWAIT); + sizeof(link->stats), M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -460,7 +461,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_DONTWAIT); /* XXX m_copypacket() */ + m2 = m_dup(m, MB_DONTWAIT); /* XXX m_copypacket() */ if (m2 == NULL) { mdst->stats.memoryFailures++; NG_FREE_ITEM(item); @@ -603,7 +604,7 @@ ng_one2many_notify(priv_p priv, uint32_t cmd) if (priv->one.hook == NULL) return; - NG_MKMESSAGE(msg, NGM_FLOW_COOKIE, cmd, 0, M_NOWAIT); + NG_MKMESSAGE(msg, NGM_FLOW_COOKIE, cmd, 0, M_WAITOK | M_NULLOK); if (msg != NULL) NG_SEND_MSG_HOOK(dummy_error, priv->node, msg, priv->one.hook, 0); } diff --git a/sys/netgraph7/ng_one2many.h b/sys/netgraph7/ng_one2many.h index c233a53c72..9e4ba7f796 100644 --- a/sys/netgraph7/ng_one2many.h +++ b/sys/netgraph7/ng_one2many.h @@ -38,6 +38,7 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_one2many.h,v 1.8 2005/01/07 01:45:39 imp Exp $ + * $DragonFly: src/sys/netgraph7/ng_one2many.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ #ifndef _NETGRAPH_NG_ONE2MANY_H_ diff --git a/sys/netgraph7/ng_parse.c b/sys/netgraph7/ng_parse.c index 255a45d026..2e6e1ae49e 100644 --- a/sys/netgraph7/ng_parse.c +++ b/sys/netgraph7/ng_parse.c @@ -39,6 +39,7 @@ * * $Whistle: ng_parse.c,v 1.3 1999/11/29 01:43:48 archie Exp $ * $FreeBSD: src/sys/netgraph/ng_parse.c,v 1.30 2007/06/23 00:02:20 mjacob Exp $ + * $DragonFly: src/sys/netgraph7/ng_parse.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ #include @@ -57,9 +58,9 @@ #include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_parse.h" #ifdef NG_SEPARATE_MALLOC MALLOC_DEFINE(M_NETGRAPH_PARSE, "netgraph_parse", "netgraph parse info"); @@ -1219,7 +1220,7 @@ ng_parse_composite(const struct ng_parse_type *type, const char *s, int align, len, blen, error = 0; /* Initialize */ - MALLOC(foff, int *, num * sizeof(*foff), M_NETGRAPH_PARSE, M_NOWAIT | M_ZERO); + MALLOC(foff, int *, num * sizeof(*foff), M_NETGRAPH_PARSE, M_WAITOK | M_NULLOK | M_ZERO); if (foff == NULL) { error = ENOMEM; goto done; @@ -1395,7 +1396,7 @@ ng_unparse_composite(const struct ng_parse_type *type, const u_char *data, u_char *workBuf; /* Get workspace for checking default values */ - MALLOC(workBuf, u_char *, workSize, M_NETGRAPH_PARSE, M_NOWAIT); + MALLOC(workBuf, u_char *, workSize, M_NETGRAPH_PARSE, M_WAITOK | M_NULLOK); if (workBuf == NULL) return (ENOMEM); @@ -1745,7 +1746,7 @@ ng_get_string_token(const char *s, int *startp, int *lenp, int *slenp) start = *startp; if (s[*startp] != '"') return (NULL); - MALLOC(cbuf, char *, strlen(s + start), M_NETGRAPH_PARSE, M_NOWAIT); + MALLOC(cbuf, char *, strlen(s + start), M_NETGRAPH_PARSE, M_WAITOK | M_NULLOK); if (cbuf == NULL) return (NULL); strcpy(cbuf, s + start + 1); @@ -1828,7 +1829,7 @@ ng_encode_string(const char *raw, int slen) int off = 0; int i; - MALLOC(cbuf, char *, strlen(raw) * 4 + 3, M_NETGRAPH_PARSE, M_NOWAIT); + MALLOC(cbuf, char *, strlen(raw) * 4 + 3, M_NETGRAPH_PARSE, M_WAITOK | M_NULLOK); if (cbuf == NULL) return (NULL); cbuf[off++] = '"'; diff --git a/sys/netgraph7/ng_parse.h b/sys/netgraph7/ng_parse.h index 6f32c58c09..8f43bb525e 100644 --- a/sys/netgraph7/ng_parse.h +++ b/sys/netgraph7/ng_parse.h @@ -39,6 +39,7 @@ * * $Whistle: ng_parse.h,v 1.2 1999/11/29 01:43:48 archie Exp $ * $FreeBSD: src/sys/netgraph/ng_parse.h,v 1.13 2005/10/28 14:41:28 ru Exp $ + * $DragonFly: src/sys/netgraph7/ng_parse.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ #ifndef _NETGRAPH_NG_PARSE_H_ diff --git a/sys/netgraph7/ng_ppp.c b/sys/netgraph7/ng_ppp.c index 657268e890..1418f9b0af 100644 --- a/sys/netgraph7/ng_ppp.c +++ b/sys/netgraph7/ng_ppp.c @@ -59,6 +59,7 @@ * Authors: Archie Cobbs , Alexander Motin * * $FreeBSD: src/sys/netgraph/ng_ppp.c,v 1.75 2008/02/06 20:37:34 mav Exp $ + * $DragonFly: src/sys/netgraph7/ng_ppp.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_ppp.c,v 1.24 1999/11/01 09:24:52 julian Exp $ */ @@ -100,11 +101,11 @@ #include #include -#include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_parse.h" +#include "ng_ppp.h" +#include "ng_vjc.h" #ifdef NG_SEPARATE_MALLOC MALLOC_DEFINE(M_NETGRAPH_PPP, "netgraph_ppp", "netgraph ppp node"); @@ -490,7 +491,7 @@ ng_ppp_constructor(node_p node) int i; /* Allocate private structure */ - MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH_PPP, M_NOWAIT | M_ZERO); + MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH_PPP, M_WAITOK | M_NULLOK | M_ZERO); if (priv == NULL) return (ENOMEM); @@ -614,7 +615,7 @@ ng_ppp_rcvmsg(node_p node, item_p item, hook_p lasthook) struct ng_ppp_node_conf *conf; int i; - NG_MKRESPONSE(resp, msg, sizeof(*conf), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(*conf), M_WAITOK | M_NULLOK); if (resp == NULL) ERROUT(ENOMEM); conf = (struct ng_ppp_node_conf *)resp->data; @@ -628,7 +629,7 @@ ng_ppp_rcvmsg(node_p node, item_p item, hook_p lasthook) struct ng_ppp_mp_state *info; int i; - NG_MKRESPONSE(resp, msg, sizeof(*info), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(*info), M_WAITOK | M_NULLOK); if (resp == NULL) ERROUT(ENOMEM); info = (struct ng_ppp_mp_state *)resp->data; @@ -664,7 +665,7 @@ ng_ppp_rcvmsg(node_p node, item_p item, hook_p lasthook) if (msg->header.cmd == NGM_PPP_GET_LINK_STATS64 || msg->header.cmd == NGM_PPP_GETCLR_LINK_STATS64) { NG_MKRESPONSE(resp, msg, - sizeof(struct ng_ppp_link_stat64), M_NOWAIT); + sizeof(struct ng_ppp_link_stat64), M_WAITOK | M_NULLOK); if (resp == NULL) ERROUT(ENOMEM); bcopy(stats, resp->data, sizeof(*stats)); @@ -674,7 +675,7 @@ ng_ppp_rcvmsg(node_p node, item_p item, hook_p lasthook) msg->header.cmd == NGM_PPP_GETCLR_LINK_STATS) { struct ng_ppp_link_stat *rs; NG_MKRESPONSE(resp, msg, - sizeof(struct ng_ppp_link_stat), M_NOWAIT); + sizeof(struct ng_ppp_link_stat), M_WAITOK | M_NULLOK); if (resp == NULL) ERROUT(ENOMEM); rs = (struct ng_ppp_link_stat *)resp->data; @@ -2077,7 +2078,7 @@ deliver: /* Split off next fragment as "m2" */ m2 = m; if (!lastFragment) { - struct mbuf *n = m_split(m, len, M_DONTWAIT); + struct mbuf *n = m_split(m, len, MB_DONTWAIT); if (n == NULL) { NG_FREE_M(m); @@ -2085,7 +2086,7 @@ deliver: NG_FREE_ITEM(item); return (ENOMEM); } - m_tag_copy_chain(n, m, M_DONTWAIT); + m_tag_copy_chain(n, m, MB_DONTWAIT); m = n; } @@ -2427,7 +2428,7 @@ ng_ppp_cutproto(struct mbuf *m, uint16_t *proto) static struct mbuf * ng_ppp_prepend(struct mbuf *m, const void *buf, int len) { - M_PREPEND(m, len, M_DONTWAIT); + M_PREPEND(m, len, MB_DONTWAIT); if (m == NULL || (m->m_len < len && (m = m_pullup(m, len)) == NULL)) return (NULL); bcopy(buf, mtod(m, uint8_t *), len); diff --git a/sys/netgraph7/ng_ppp.h b/sys/netgraph7/ng_ppp.h index 99dddf05ba..ce717ead7c 100644 --- a/sys/netgraph7/ng_ppp.h +++ b/sys/netgraph7/ng_ppp.h @@ -38,6 +38,7 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_ppp.h,v 1.14 2007/08/01 20:49:35 mav Exp $ + * $DragonFly: src/sys/netgraph7/ng_ppp.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_ppp.h,v 1.8 1999/01/25 02:40:02 archie Exp $ */ diff --git a/sys/netgraph7/ng_pppoe.c b/sys/netgraph7/ng_pppoe.c index 0ed0adb48f..197cc0f77e 100644 --- a/sys/netgraph7/ng_pppoe.c +++ b/sys/netgraph7/ng_pppoe.c @@ -38,6 +38,7 @@ * Author: Julian Elischer * * $FreeBSD: src/sys/netgraph/ng_pppoe.c,v 1.94 2008/03/03 19:36:03 mav Exp $ + * $DragonFly: src/sys/netgraph7/ng_pppoe.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_pppoe.c,v 1.10 1999/11/01 09:24:52 julian Exp $ */ @@ -51,11 +52,11 @@ #include #include -#include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_parse.h" +#include "ng_pppoe.h" +#include "ng_ether.h" #ifdef NG_SEPARATE_MALLOC MALLOC_DEFINE(M_NETGRAPH_PPPOE, "netgraph_pppoe", "netgraph pppoe node"); @@ -460,7 +461,7 @@ pppoe_broadcast_padi(node_p node, struct mbuf *m0) LIST_FOREACH(sp, &privp->listeners, sessions) { struct mbuf *m; - m = m_dup(m0, M_DONTWAIT); + m = m_dup(m0, MB_DONTWAIT); if (m == NULL) return (ENOMEM); NG_SEND_DATA_ONLY(error, sp->hook, m); @@ -611,7 +612,7 @@ ng_pppoe_constructor(node_p node) int i; /* Initialize private descriptor. */ - privp = malloc(sizeof(*privp), M_NETGRAPH_PPPOE, M_NOWAIT | M_ZERO); + privp = kmalloc(sizeof(*privp), M_NETGRAPH_PPPOE, M_WAITOK | M_NULLOK | M_ZERO); if (privp == NULL) return (ENOMEM); @@ -662,7 +663,7 @@ ng_pppoe_newhook(node_p node, hook_p hook, const char *name) * The infrastructure has already checked that it's unique, * so just allocate it and hook it in. */ - sp = malloc(sizeof(*sp), M_NETGRAPH_PPPOE, M_NOWAIT | M_ZERO); + sp = kmalloc(sizeof(*sp), M_NETGRAPH_PPPOE, M_WAITOK | M_NULLOK | M_ZERO); if (sp == NULL) return (ENOMEM); @@ -693,7 +694,7 @@ ng_pppoe_connect(hook_p hook) * If this is Ethernet hook, then request MAC address * from our downstream. */ - NG_MKMESSAGE(msg, NGM_ETHER_COOKIE, NGM_ETHER_GET_ENADDR, 0, M_NOWAIT); + NG_MKMESSAGE(msg, NGM_ETHER_COOKIE, NGM_ETHER_GET_ENADDR, 0, M_WAITOK | M_NULLOK); if (msg == NULL) return (ENOBUFS); @@ -797,15 +798,15 @@ ng_pppoe_rcvmsg(node_p node, item_p item, hook_p lasthook) /* * Set up prototype header. */ - neg = malloc(sizeof(*neg), M_NETGRAPH_PPPOE, - M_NOWAIT | M_ZERO); + neg = kmalloc(sizeof(*neg), M_NETGRAPH_PPPOE, + M_WAITOK | M_NULLOK | M_ZERO); if (neg == NULL) LEAVE(ENOMEM); - neg->m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + neg->m = m_getcl(MB_DONTWAIT, MT_DATA, M_PKTHDR); if (neg->m == NULL) { - free(neg, M_NETGRAPH_PPPOE); + kfree(neg, M_NETGRAPH_PPPOE); LEAVE(ENOBUFS); } neg->m->m_pkthdr.rcvif = NULL; @@ -827,7 +828,7 @@ ng_pppoe_rcvmsg(node_p node, item_p item, hook_p lasthook) { struct ngpppoestat *stats; - NG_MKRESPONSE(resp, msg, sizeof(*stats), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(*stats), M_WAITOK | M_NULLOK); if (!resp) LEAVE(ENOMEM); @@ -977,7 +978,7 @@ ng_pppoe_rcvmsg(node_p node, item_p item, hook_p lasthook) if (privp->flags & COMPAT_DLINK) len += strlen(NG_PPPOE_DLINK) + 1; - NG_MKRESPONSE(resp, msg, len, M_NOWAIT); + NG_MKRESPONSE(resp, msg, len, M_WAITOK | M_NULLOK); if (resp == NULL) LEAVE(ENOMEM); @@ -1080,7 +1081,7 @@ pppoe_start(sessp sp) ng_callout(&neg->handle, node, hook, PPPOE_INITIAL_TIMEOUT * hz, pppoe_ticker, NULL, 0); neg->timeout = PPPOE_INITIAL_TIMEOUT * 2; - m0 = m_copypacket(neg->m, M_DONTWAIT); + m0 = m_copypacket(neg->m, MB_DONTWAIT); NG_SEND_DATA_ONLY(error, privp->ethernet_hook, m0); } @@ -1094,7 +1095,7 @@ send_acname(sessp sp, const struct pppoe_tag *tag) CTR2(KTR_NET, "%20s: called %d", __func__, sp->Session_ID); NG_MKMESSAGE(msg, NGM_PPPOE_COOKIE, NGM_PPPOE_ACNAME, - sizeof(struct ngpppoe_sts), M_NOWAIT); + sizeof(struct ngpppoe_sts), M_WAITOK | M_NULLOK); if (msg == NULL) return (ENOMEM); @@ -1116,7 +1117,7 @@ send_sessionid(sessp sp) CTR2(KTR_NET, "%20s: called %d", __func__, sp->Session_ID); NG_MKMESSAGE(msg, NGM_PPPOE_COOKIE, NGM_PPPOE_SESSIONID, - sizeof(uint16_t), M_NOWAIT); + sizeof(uint16_t), M_WAITOK | M_NULLOK); if (msg == NULL) return (ENOMEM); @@ -1163,7 +1164,7 @@ ng_pppoe_rcvdata(hook_p hook, item_p item) * Bang in a pre-made header, and set the length up * to be correct. Then send it to the ethernet driver. */ - M_PREPEND(m, sizeof(*wh), M_DONTWAIT); + M_PREPEND(m, sizeof(*wh), MB_DONTWAIT); if (m == NULL) LEAVE(ENOBUFS); @@ -1253,7 +1254,7 @@ ng_pppoe_rcvdata(hook_p hook, item_p item) */ ng_callout(&neg->handle, node, hook, PPPOE_OFFER_TIMEOUT * hz, pppoe_ticker, NULL, 0); - m0 = m_copypacket(sp->neg->m, M_DONTWAIT); + m0 = m_copypacket(sp->neg->m, MB_DONTWAIT); NG_FWD_NEW_DATA(error, item, privp->ethernet_hook, m0); privp->packets_out++; break; @@ -1340,7 +1341,7 @@ ng_pppoe_rcvdata_ether(hook_p hook, item_p item) * Put it into a cluster. */ struct mbuf *n; - n = m_dup(m, M_DONTWAIT); + n = m_dup(m, MB_DONTWAIT); m_freem(m); m = n; if (m) { @@ -1473,7 +1474,7 @@ ng_pppoe_rcvdata_ether(hook_p hook, item_p item) PPPOE_INITIAL_TIMEOUT * hz, pppoe_ticker, NULL, 0); neg->timeout = PPPOE_INITIAL_TIMEOUT * 2; - m0 = m_copypacket(neg->m, M_DONTWAIT); + m0 = m_copypacket(neg->m, MB_DONTWAIT); NG_FWD_NEW_DATA(error, item, privp->ethernet_hook, m0); break; case PADR_CODE: @@ -1531,7 +1532,7 @@ ng_pppoe_rcvdata_ether(hook_p hook, item_p item) sp->state = PPPOE_NEWCONNECTED; /* Send the PADS without a timeout - we're now connected. */ - m0 = m_copypacket(sp->neg->m, M_DONTWAIT); + m0 = m_copypacket(sp->neg->m, MB_DONTWAIT); NG_FWD_NEW_DATA(error, item, privp->ethernet_hook, m0); /* @@ -1601,7 +1602,7 @@ ng_pppoe_rcvdata_ether(hook_p hook, item_p item) = ETHERTYPE_PPPOE_SESS; sp->pkt_hdr.ph.code = 0; m_freem(neg->m); - free(sp->neg, M_NETGRAPH_PPPOE); + kfree(sp->neg, M_NETGRAPH_PPPOE); sp->neg = NULL; pppoe_send_event(sp, NGM_PPPOE_SUCCESS); break; @@ -1647,7 +1648,7 @@ ng_pppoe_rcvdata_ether(hook_p hook, item_p item) */ m_freem(sp->neg->m); ng_uncallout(&sp->neg->handle, node); - free(sp->neg, M_NETGRAPH_PPPOE); + kfree(sp->neg, M_NETGRAPH_PPPOE); sp->neg = NULL; } else { LEAVE (ENETUNREACH); @@ -1698,7 +1699,7 @@ ng_pppoe_shutdown(node_p node) mtx_destroy(&privp->sesshash[i].mtx); NG_NODE_SET_PRIVATE(node, NULL); NG_NODE_UNREF(privp->node); - free(privp, M_NETGRAPH_PPPOE); + kfree(privp, M_NETGRAPH_PPPOE); return (0); } @@ -1737,7 +1738,7 @@ ng_pppoe_disconnect(hook_p hook) struct mbuf *m; /* Generate a packet of that type. */ - MGETHDR(m, M_DONTWAIT, MT_DATA); + MGETHDR(m, MB_DONTWAIT, MT_DATA); if (m == NULL) log(LOG_NOTICE, "ng_pppoe[%x]: session out of " "mbufs\n", node->nd_ID); @@ -1790,9 +1791,9 @@ ng_pppoe_disconnect(hook_p hook) ng_uncallout(&sp->neg->handle, node); if (sp->neg->m) m_freem(sp->neg->m); - free(sp->neg, M_NETGRAPH_PPPOE); + kfree(sp->neg, M_NETGRAPH_PPPOE); } - free(sp, M_NETGRAPH_PPPOE); + kfree(sp, M_NETGRAPH_PPPOE); NG_HOOK_SET_PRIVATE(hook, NULL); } if ((NG_NODE_NUMHOOKS(node) == 0) && @@ -1824,7 +1825,7 @@ pppoe_ticker(node_p node, hook_p hook, void *arg1, int arg2) case PPPOE_SINIT: case PPPOE_SREQ: /* Timeouts on these produce resends. */ - m0 = m_copypacket(sp->neg->m, M_DONTWAIT); + m0 = m_copypacket(sp->neg->m, MB_DONTWAIT); NG_SEND_DATA_ONLY( error, privp->ethernet_hook, m0); ng_callout(&neg->handle, node, hook, neg->timeout * hz, pppoe_ticker, NULL, 0); @@ -1905,7 +1906,7 @@ pppoe_send_event(sessp sp, enum cmd cmdid) CTR2(KTR_NET, "%20s: called %d", __func__, sp->Session_ID); NG_MKMESSAGE(msg, NGM_PPPOE_COOKIE, cmdid, - sizeof(struct ngpppoe_sts), M_NOWAIT); + sizeof(struct ngpppoe_sts), M_WAITOK | M_NULLOK); if (msg == NULL) return (ENOMEM); sts = (struct ngpppoe_sts *)msg->data; diff --git a/sys/netgraph7/ng_pppoe.h b/sys/netgraph7/ng_pppoe.h index 8dfbec0888..319fc460a1 100644 --- a/sys/netgraph7/ng_pppoe.h +++ b/sys/netgraph7/ng_pppoe.h @@ -38,6 +38,7 @@ * Author: Julian Elischer * * $FreeBSD: src/sys/netgraph/ng_pppoe.h,v 1.25 2007/12/26 19:15:07 mav Exp $ + * $DragonFly: src/sys/netgraph7/ng_pppoe.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_pppoe.h,v 1.7 1999/10/16 10:16:43 julian Exp $ */ diff --git a/sys/netgraph7/ng_pptpgre.c b/sys/netgraph7/ng_pptpgre.c index 0816710ebb..39758ac633 100644 --- a/sys/netgraph7/ng_pptpgre.c +++ b/sys/netgraph7/ng_pptpgre.c @@ -38,6 +38,7 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_pptpgre.c,v 1.42 2008/03/26 21:19:03 mav Exp $ + * $DragonFly: src/sys/netgraph7/ng_pptpgre.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_pptpgre.c,v 1.7 1999/12/08 00:10:06 archie Exp $ */ @@ -68,10 +69,10 @@ #include #include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_parse.h" +#include "ng_pptpgre.h" /* GRE packet format, as used by PPTP */ struct greheader { @@ -280,7 +281,7 @@ ng_pptpgre_constructor(node_p node) int i; /* Allocate private structure */ - MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); + MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_WAITOK | M_NULLOK | M_ZERO); if (priv == NULL) return (ENOMEM); @@ -338,7 +339,7 @@ ng_pptpgre_newhook(node_p node, hook_p hook, const char *name) if (hex[i] != '\0') return (EINVAL); - hpriv = malloc(sizeof(*hpriv), M_NETGRAPH, M_NOWAIT | M_ZERO); + hpriv = kmalloc(sizeof(*hpriv), M_NETGRAPH, M_WAITOK | M_NULLOK | M_ZERO); if (hpriv == NULL) return (ENOMEM); @@ -412,7 +413,7 @@ ng_pptpgre_rcvmsg(node_p node, item_p item, hook_p lasthook) hpriv = &priv->uppersess; } else ERROUT(EINVAL); - NG_MKRESPONSE(resp, msg, sizeof(hpriv->conf), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(hpriv->conf), M_WAITOK | M_NULLOK); if (resp == NULL) ERROUT(ENOMEM); bcopy(&hpriv->conf, resp->data, sizeof(hpriv->conf)); @@ -424,7 +425,7 @@ ng_pptpgre_rcvmsg(node_p node, item_p item, hook_p lasthook) { if (msg->header.cmd != NGM_PPTPGRE_CLR_STATS) { NG_MKRESPONSE(resp, msg, - sizeof(priv->stats), M_NOWAIT); + sizeof(priv->stats), M_WAITOK | M_NULLOK); if (resp == NULL) ERROUT(ENOMEM); bcopy(&priv->stats, @@ -495,7 +496,7 @@ ng_pptpgre_disconnect(hook_p hook) LIST_REMOVE(hpriv, sessions); mtx_destroy(&hpriv->mtx); - free(hpriv, M_NETGRAPH); + kfree(hpriv, M_NETGRAPH); } /* Go away if no longer connected to anything */ @@ -599,7 +600,7 @@ ng_pptpgre_xmit(hpriv_p hpriv, item_p item) /* Prepend GRE header to outgoing frame */ grelen = sizeof(*gre) + sizeof(u_int32_t) * (gre->hasSeq + gre->hasAck); if (m == NULL) { - MGETHDR(m, M_DONTWAIT, MT_DATA); + MGETHDR(m, MB_DONTWAIT, MT_DATA); if (m == NULL) { priv->stats.memoryFailures++; ERROUT(ENOBUFS); @@ -607,7 +608,7 @@ ng_pptpgre_xmit(hpriv_p hpriv, item_p item) m->m_len = m->m_pkthdr.len = grelen; m->m_pkthdr.rcvif = NULL; } else { - M_PREPEND(m, grelen, M_DONTWAIT); + M_PREPEND(m, grelen, MB_DONTWAIT); if (m == NULL || (m->m_len < grelen && (m = m_pullup(m, grelen)) == NULL)) { priv->stats.memoryFailures++; diff --git a/sys/netgraph7/ng_pptpgre.h b/sys/netgraph7/ng_pptpgre.h index 90f0c5bb4e..723480b839 100644 --- a/sys/netgraph7/ng_pptpgre.h +++ b/sys/netgraph7/ng_pptpgre.h @@ -38,6 +38,7 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_pptpgre.h,v 1.10 2008/03/24 22:55:22 mav Exp $ + * $DragonFly: src/sys/netgraph7/ng_pptpgre.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_pptpgre.h,v 1.3 1999/12/08 00:11:36 archie Exp $ */ diff --git a/sys/netgraph7/ng_pred1.c b/sys/netgraph7/ng_pred1.c index 8d6cc7dddf..83af41f581 100644 --- a/sys/netgraph7/ng_pred1.c +++ b/sys/netgraph7/ng_pred1.c @@ -25,6 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netgraph/ng_pred1.c,v 1.3 2008/01/27 02:04:12 mav Exp $ + * $DragonFly: src/sys/netgraph7/ng_pred1.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ /* @@ -39,10 +40,10 @@ #include #include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_parse.h" +#include "ng_pred1.h" #include "opt_netgraph.h" @@ -188,7 +189,7 @@ ng_pred1_constructor(node_p node) priv_p priv; /* Allocate private structure. */ - priv = malloc(sizeof(*priv), M_NETGRAPH_PRED1, M_WAITOK | M_ZERO); + priv = kmalloc(sizeof(*priv), M_NETGRAPH_PRED1, M_WAITOK | M_ZERO); NG_NODE_SET_PRIVATE(node, priv); @@ -268,7 +269,7 @@ ng_pred1_rcvmsg(node_p node, item_p item, hook_p lasthook) /* Create response. */ if (msg->header.cmd != NGM_PRED1_CLR_STATS) { NG_MKRESPONSE(resp, msg, - sizeof(struct ng_pred1_stats), M_NOWAIT); + sizeof(struct ng_pred1_stats), M_WAITOK | M_NULLOK); if (resp == NULL) ERROUT(ENOMEM); bcopy(&priv->stats, resp->data, @@ -324,7 +325,7 @@ ng_pred1_rcvdata(hook_p hook, item_p item) /* Need to send a reset-request. */ NG_MKMESSAGE(msg, NGM_PRED1_COOKIE, - NGM_PRED1_RESETREQ, 0, M_NOWAIT); + NGM_PRED1_RESETREQ, 0, M_WAITOK | M_NULLOK); if (msg == NULL) return (error); NG_SEND_MSG_ID(error, node, msg, @@ -346,7 +347,7 @@ ng_pred1_shutdown(node_p node) { const priv_p priv = NG_NODE_PRIVATE(node); - free(priv, M_NETGRAPH_PRED1); + kfree(priv, M_NETGRAPH_PRED1); NG_NODE_SET_PRIVATE(node, NULL); NG_NODE_UNREF(node); /* Let the node escape. */ return (0); diff --git a/sys/netgraph7/ng_pred1.h b/sys/netgraph7/ng_pred1.h index ae60d87c44..8c27a0fc77 100644 --- a/sys/netgraph7/ng_pred1.h +++ b/sys/netgraph7/ng_pred1.h @@ -25,6 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netgraph/ng_pred1.h,v 1.1 2006/12/29 09:54:32 glebius Exp $ + * $DragonFly: src/sys/netgraph7/ng_pred1.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ #ifndef _NETGRAPH_NG_PRED1_H_ diff --git a/sys/netgraph7/ng_rfc1490.c b/sys/netgraph7/ng_rfc1490.c index 20c46bed43..e954806ba7 100644 --- a/sys/netgraph7/ng_rfc1490.c +++ b/sys/netgraph7/ng_rfc1490.c @@ -38,6 +38,7 @@ * Author: Julian Elischer * * $FreeBSD: src/sys/netgraph/ng_rfc1490.c,v 1.24 2005/01/07 01:45:39 imp Exp $ + * $DragonFly: src/sys/netgraph7/ng_rfc1490.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_rfc1490.c,v 1.22 1999/11/01 09:24:52 julian Exp $ */ @@ -60,10 +61,10 @@ #include #include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_parse.h" +#include "ng_rfc1490.h" /* * DEFINITIONS @@ -165,7 +166,7 @@ ng_rfc1490_constructor(node_p node) priv_p priv; /* Allocate private structure */ - MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); + MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_WAITOK | M_NULLOK | M_ZERO); if (priv == NULL) return (ENOMEM); @@ -248,7 +249,7 @@ ng_rfc1490_rcvmsg(node_p node, item_p item, hook_p lasthook) } case NGM_RFC1490_GET_ENCAP: - NG_MKRESPONSE(resp, msg, strlen(priv->enc->name) + 1, M_NOWAIT); + NG_MKRESPONSE(resp, msg, strlen(priv->enc->name) + 1, M_WAITOK | M_NULLOK); if (resp == NULL) ERROUT(ENOMEM); @@ -387,7 +388,7 @@ switch_on_etype: etype = ntohs(*((const u_int16_t *)ptr)); break; } } else if (hook == priv->ppp) { - M_PREPEND(m, 2, M_DONTWAIT); /* Prepend PPP NLPID */ + M_PREPEND(m, 2, MB_DONTWAIT); /* Prepend PPP NLPID */ if (!m) ERROUT(ENOBUFS); mtod(m, u_char *)[0] = HDLC_UI; @@ -396,7 +397,7 @@ switch_on_etype: etype = ntohs(*((const u_int16_t *)ptr)); } else if (hook == priv->inet) { switch (priv->enc->method) { case NG_RFC1490_ENCAP_IETF_IP: - M_PREPEND(m, 2, M_DONTWAIT); /* Prepend IP NLPID */ + M_PREPEND(m, 2, MB_DONTWAIT); /* Prepend IP NLPID */ if (!m) ERROUT(ENOBUFS); mtod(m, u_char *)[0] = HDLC_UI; @@ -408,7 +409,7 @@ switch_on_etype: etype = ntohs(*((const u_int16_t *)ptr)); * HDLC_UI PAD NLIPID OUI PID * 03 00 80 00 00 00 08 00 */ - M_PREPEND(m, 8, M_DONTWAIT); + M_PREPEND(m, 8, MB_DONTWAIT); if (!m) ERROUT(ENOBUFS); mtod(m, u_char *)[0] = HDLC_UI; @@ -419,7 +420,7 @@ switch_on_etype: etype = ntohs(*((const u_int16_t *)ptr)); = htons(ETHERTYPE_IP); /* PID */ break; case NG_RFC1490_ENCAP_CISCO: - M_PREPEND(m, 2, M_DONTWAIT); /* Prepend IP ethertype */ + M_PREPEND(m, 2, MB_DONTWAIT); /* Prepend IP ethertype */ if (!m) ERROUT(ENOBUFS); *((u_int16_t *)mtod(m, u_int16_t *)) = htons(ETHERTYPE_IP); @@ -427,7 +428,7 @@ switch_on_etype: etype = ntohs(*((const u_int16_t *)ptr)); } NG_FWD_NEW_DATA(error, item, priv->downlink, m); } else if (hook == priv->ethernet) { - M_PREPEND(m, 8, M_DONTWAIT); /* Prepend NLPID, OUI, PID */ + M_PREPEND(m, 8, MB_DONTWAIT); /* Prepend NLPID, OUI, PID */ if (!m) ERROUT(ENOBUFS); mtod(m, u_char *)[0] = HDLC_UI; diff --git a/sys/netgraph7/ng_rfc1490.h b/sys/netgraph7/ng_rfc1490.h index 478e1dc0d1..613b239ea2 100644 --- a/sys/netgraph7/ng_rfc1490.h +++ b/sys/netgraph7/ng_rfc1490.h @@ -38,6 +38,7 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_rfc1490.h,v 1.7 2005/01/07 01:45:39 imp Exp $ + * $DragonFly: src/sys/netgraph7/ng_rfc1490.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_rfc1490.h,v 1.7 1999/01/20 00:54:15 archie Exp $ */ diff --git a/sys/netgraph7/ng_sample.c b/sys/netgraph7/ng_sample.c index d78f7bcce9..6a9a46ee0b 100644 --- a/sys/netgraph7/ng_sample.c +++ b/sys/netgraph7/ng_sample.c @@ -38,6 +38,7 @@ * Author: Julian Elischer * * $FreeBSD: src/sys/netgraph/ng_sample.c,v 1.30 2005/02/06 19:24:59 glebius Exp $ + * $DragonFly: src/sys/netgraph7/ng_sample.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_sample.c,v 1.13 1999/11/01 09:24:52 julian Exp $ */ @@ -50,10 +51,10 @@ #include #include -#include -#include -#include -#include +#include "ng_message.h" +#include "ng_parse.h" +#include "ng_sample.h" +#include "netgraph.h" /* If you do complicated mallocs you may want to do this */ /* and use it for your mallocs */ @@ -155,7 +156,7 @@ ng_xxx_constructor(node_p node) /* Initialize private descriptor */ MALLOC(privdata, xxx_p, sizeof(*privdata), M_NETGRAPH, - M_NOWAIT | M_ZERO); + M_WAITOK | M_NULLOK | M_ZERO); if (privdata == NULL) return (ENOMEM); for (i = 0; i < XXX_NUM_DLCIS; i++) { @@ -275,7 +276,7 @@ ng_xxx_rcvmsg(node_p node, item_p item, hook_p lasthook) { struct ngxxxstat *stats; - NG_MKRESPONSE(resp, msg, sizeof(*stats), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(*stats), M_WAITOK | M_NULLOK); if (!resp) { error = ENOMEM; break; diff --git a/sys/netgraph7/ng_sample.h b/sys/netgraph7/ng_sample.h index c7c13bd8b2..4293546e8f 100644 --- a/sys/netgraph7/ng_sample.h +++ b/sys/netgraph7/ng_sample.h @@ -38,6 +38,7 @@ * Author: Julian Elischer * * $FreeBSD: src/sys/netgraph/ng_sample.h,v 1.7 2005/01/07 01:45:39 imp Exp $ + * $DragonFly: src/sys/netgraph7/ng_sample.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_sample.h,v 1.3 1999/01/20 00:22:14 archie Exp $ */ diff --git a/sys/netgraph7/ng_socket.c b/sys/netgraph7/ng_socket.c index f8db8fa2a6..237f97a50a 100644 --- a/sys/netgraph7/ng_socket.c +++ b/sys/netgraph7/ng_socket.c @@ -38,6 +38,7 @@ * Author: Julian Elischer * * $FreeBSD: src/sys/netgraph/ng_socket.c,v 1.85 2008/03/11 21:58:48 mav Exp $ + * $DragonFly: src/sys/netgraph7/ng_socket.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_socket.c,v 1.28 1999/11/01 09:24:52 julian Exp $ */ @@ -67,10 +68,10 @@ #ifdef NOTYET #include #endif -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_socketvar.h" +#include "ng_socket.h" #ifdef NG_SEPARATE_MALLOC MALLOC_DEFINE(M_NETGRAPH_PATH, "netgraph_path", "netgraph path info "); @@ -226,7 +227,7 @@ ngc_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, * the sockaddr header, and make sure it's NUL terminated. */ len = sap->sg_len - 2; - path = malloc(len + 1, M_NETGRAPH_PATH, M_WAITOK); + path = kmalloc(len + 1, M_NETGRAPH_PATH, M_WAITOK); bcopy(sap->sg_data, path, len); path[len] = '\0'; @@ -241,11 +242,11 @@ ngc_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, * Move the data into a linear buffer as well. * Messages are not delivered in mbufs. */ - msg = malloc(len + 1, M_NETGRAPH_MSG, M_WAITOK); + msg = kmalloc(len + 1, M_NETGRAPH_MSG, M_WAITOK); m_copydata(m, 0, len, (char *)msg); if (msg->header.version != NG_VERSION) { - free(msg, M_NETGRAPH_MSG); + kfree(msg, M_NETGRAPH_MSG); error = EINVAL; goto release; } @@ -270,13 +271,13 @@ ngc_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, mkp->type); error = kern_kldload(curthread, filename, &fileid); if (error != 0) { - free(msg, M_NETGRAPH_MSG); + kfree(msg, M_NETGRAPH_MSG); goto release; } /* See if type has been loaded successfully. */ if ((type = ng_findtype(mkp->type)) == NULL) { - free(msg, M_NETGRAPH_MSG); + kfree(msg, M_NETGRAPH_MSG); (void)kern_kldunload(curthread, fileid, LINKER_UNLOAD_NORMAL); error = ENXIO; @@ -285,7 +286,7 @@ ngc_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, } } - item = ng_package_msg(msg, M_WAITOK); + item = ng_package_msg(msg, NG_WAITOK); if ((error = ng_address_path((pcbp->sockdata->node), item, path, 0)) != 0) { #ifdef TRACE_MESSAGES @@ -331,7 +332,7 @@ ngc_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, release: if (path != NULL) - free(path, M_NETGRAPH_PATH); + kfree(path, M_NETGRAPH_PATH); if (control != NULL) m_freem(control); if (m != NULL) @@ -490,7 +491,7 @@ ng_getsockaddr(struct socket *so, struct sockaddr **addr) if (NG_NODE_HAS_NAME(node)) sg_len += namelen = strlen(NG_NODE_NAME(node)); - sg = malloc(sg_len, M_SONAME, M_WAITOK | M_ZERO); + sg = kmalloc(sg_len, M_SONAME, M_WAITOK | M_ZERO); if (NG_NODE_HAS_NAME(node)) bcopy(NG_NODE_NAME(node), sg->sg_data, namelen); @@ -521,11 +522,11 @@ ng_attach_cntl(struct socket *so) int error; /* Allocate node private info */ - priv = malloc(sizeof(*priv), M_NETGRAPH_SOCK, M_WAITOK | M_ZERO); + priv = kmalloc(sizeof(*priv), M_NETGRAPH_SOCK, M_WAITOK | M_ZERO); /* Setup protocol control block */ if ((error = ng_attach_common(so, NG_CONTROL)) != 0) { - free(priv, M_NETGRAPH_SOCK); + kfree(priv, M_NETGRAPH_SOCK); return (error); } pcbp = sotongpcb(so); @@ -540,7 +541,7 @@ ng_attach_cntl(struct socket *so) /* Make the generic node components */ if ((error = ng_make_node_common(&typestruct, &priv->node)) != 0) { - free(priv, M_NETGRAPH_SOCK); + kfree(priv, M_NETGRAPH_SOCK); ng_detach_common(pcbp, NG_CONTROL); return (error); } @@ -575,7 +576,7 @@ ng_attach_common(struct socket *so, int type) return (error); /* Allocate the pcb. */ - pcbp = malloc(sizeof(struct ngpcb), M_PCB, M_WAITOK | M_ZERO); + pcbp = kmalloc(sizeof(struct ngpcb), M_PCB, M_WAITOK | M_ZERO); pcbp->type = type; /* Link the pcb and the socket. */ @@ -615,7 +616,7 @@ ng_detach_common(struct ngpcb *pcbp, int which) } pcbp->ng_socket->so_pcb = NULL; - free(pcbp, M_PCB); + kfree(pcbp, M_PCB); } /* @@ -630,7 +631,7 @@ ng_socket_free_priv(struct ngsock *priv) if (priv->refs == 0) { mtx_destroy(&priv->mtx); - free(priv, M_NETGRAPH_SOCK); + kfree(priv, M_NETGRAPH_SOCK); return; } diff --git a/sys/netgraph7/ng_socket.h b/sys/netgraph7/ng_socket.h index 0d832b4655..308c0e34d9 100644 --- a/sys/netgraph7/ng_socket.h +++ b/sys/netgraph7/ng_socket.h @@ -38,6 +38,7 @@ * Author: Julian Elischer * * $FreeBSD: src/sys/netgraph/ng_socket.h,v 1.7 2006/10/17 11:03:55 glebius Exp $ + * $DragonFly: src/sys/netgraph7/ng_socket.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_socket.h,v 1.5 1999/01/20 00:22:14 archie Exp $ */ diff --git a/sys/netgraph7/ng_socketvar.h b/sys/netgraph7/ng_socketvar.h index 67d38f7c32..d886432f9c 100644 --- a/sys/netgraph7/ng_socketvar.h +++ b/sys/netgraph7/ng_socketvar.h @@ -38,6 +38,7 @@ * Author: Julian Elischer * * $FreeBSD: src/sys/netgraph/ng_socketvar.h,v 1.10 2005/07/05 17:35:20 glebius Exp $ + * $DragonFly: src/sys/netgraph7/ng_socketvar.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_socketvar.h,v 1.1 1999/01/20 21:35:39 archie Exp $ */ diff --git a/sys/netgraph7/ng_source.c b/sys/netgraph7/ng_source.c index 01e4daa982..1ee3f5767e 100644 --- a/sys/netgraph7/ng_source.c +++ b/sys/netgraph7/ng_source.c @@ -36,11 +36,11 @@ * DAMAGE. * * Author: Dave Chapeskie + * + * $FreeBSD: src/sys/netgraph/ng_source.c,v 1.30 2007/03/02 14:36:19 emaste Exp $ + * $DragonFly: src/sys/netgraph7/ng_source.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ -#include -__FBSDID("$FreeBSD: src/sys/netgraph/ng_source.c,v 1.30 2007/03/02 14:36:19 emaste Exp $"); - /* * This node is used for high speed packet geneneration. It queues * all data recieved on its 'input' hook and when told to start via @@ -68,11 +68,11 @@ __FBSDID("$FreeBSD: src/sys/netgraph/ng_source.c,v 1.30 2007/03/02 14:36:19 emas #include #include #include -#include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_parse.h" +#include "ng_ether.h" +#include "ng_source.h" #define NG_SOURCE_INTR_TICKS 1 #define NG_SOURCE_DRIVER_IFQ_MAXLEN (4*1024) @@ -272,7 +272,7 @@ ng_source_constructor(node_p node) { sc_p sc; - sc = malloc(sizeof(*sc), M_NETGRAPH, M_NOWAIT | M_ZERO); + sc = kmalloc(sizeof(*sc), M_NETGRAPH, M_WAITOK | M_NULLOK | M_ZERO); if (sc == NULL) return (ENOMEM); @@ -320,7 +320,7 @@ ng_source_connect(hook_p hook) */ if (hook == sc->output) { NG_MKMESSAGE(msg, NGM_ETHER_COOKIE, NGM_ETHER_GET_IFNAME, - 0, M_NOWAIT); + 0, M_WAITOK | M_NULLOK); if (msg == NULL) return (ENOBUFS); @@ -362,7 +362,7 @@ ng_source_rcvmsg(node_p node, item_p item, hook_p lasthook) if (msg->header.cmd != NGM_SOURCE_CLR_STATS) { NG_MKRESPONSE(resp, msg, - sizeof(*stats), M_NOWAIT); + sizeof(*stats), M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; goto done; @@ -447,7 +447,7 @@ ng_source_rcvmsg(node_p node, item_p item, hook_p lasthook) { struct ng_source_embed_info *embed; - NG_MKRESPONSE(resp, msg, sizeof(*embed), M_DONTWAIT); + NG_MKRESPONSE(resp, msg, sizeof(*embed), M_WAITOK); if (resp == NULL) { error = ENOMEM; goto done; @@ -486,7 +486,7 @@ ng_source_rcvmsg(node_p node, item_p item, hook_p lasthook) error = EINVAL; goto done; } - NG_MKRESPONSE(resp, msg, sizeof(*embed), M_DONTWAIT); + NG_MKRESPONSE(resp, msg, sizeof(*embed), M_WAITOK); if (resp == NULL) { error = ENOMEM; goto done; @@ -582,7 +582,7 @@ ng_source_rmnode(node_p node) ng_source_clr_data(sc); NG_NODE_SET_PRIVATE(node, NULL); NG_NODE_UNREF(node); - free(sc, M_NETGRAPH); + kfree(sc, M_NETGRAPH); return (0); } @@ -647,7 +647,7 @@ ng_source_set_autosrc(sc_p sc, uint32_t flag) int error = 0; NG_MKMESSAGE(msg, NGM_ETHER_COOKIE, NGM_ETHER_SET_AUTOSRC, - sizeof (uint32_t), M_NOWAIT); + sizeof (uint32_t), M_WAITOK | M_NULLOK); if (msg == NULL) return(ENOBUFS); @@ -878,9 +878,9 @@ ng_source_dup_mod(sc_p sc, struct mbuf *m0, struct mbuf **m_ptr) /* Duplicate the packet. */ if (modify) - m = m_dup(m0, M_DONTWAIT); + m = m_dup(m0, MB_DONTWAIT); else - m = m_copypacket(m0, M_DONTWAIT); + m = m_copypacket(m0, MB_DONTWAIT); if (m == NULL) { error = ENOBUFS; goto done; diff --git a/sys/netgraph7/ng_source.h b/sys/netgraph7/ng_source.h index cbbb38a162..5704773c6b 100644 --- a/sys/netgraph7/ng_source.h +++ b/sys/netgraph7/ng_source.h @@ -37,6 +37,7 @@ * Author: Dave Chapeskie * * $FreeBSD: src/sys/netgraph/ng_source.h,v 1.9 2007/03/02 01:44:04 emaste Exp $ + * $DragonFly: src/sys/netgraph7/ng_source.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ #ifndef _NETGRAPH_NG_SOURCE_H_ diff --git a/sys/netgraph7/ng_split.c b/sys/netgraph7/ng_split.c index aa3620006c..c02f727355 100644 --- a/sys/netgraph7/ng_split.c +++ b/sys/netgraph7/ng_split.c @@ -26,6 +26,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netgraph/ng_split.c,v 1.7 2005/08/29 13:47:08 glebius Exp $ + * $DragonFly: src/sys/netgraph7/ng_split.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ * */ @@ -40,9 +41,9 @@ #include #include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_split.h" /* Netgraph methods */ static ng_constructor_t ng_split_constructor; @@ -85,7 +86,7 @@ ng_split_constructor(node_p node) priv_p priv; /* Allocate node */ - MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_ZERO | M_NOWAIT); + MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_ZERO | M_WAITOK | M_NULLOK); if (priv == NULL) return (ENOMEM); diff --git a/sys/netgraph7/ng_split.h b/sys/netgraph7/ng_split.h index d581b34857..52b6659a43 100644 --- a/sys/netgraph7/ng_split.h +++ b/sys/netgraph7/ng_split.h @@ -26,6 +26,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netgraph/ng_split.h,v 1.5 2005/10/25 20:56:12 ru Exp $ + * $DragonFly: src/sys/netgraph7/ng_split.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ * */ diff --git a/sys/netgraph7/ng_sppp.c b/sys/netgraph7/ng_sppp.c index ddfb554310..35bb7141c4 100644 --- a/sys/netgraph7/ng_sppp.c +++ b/sys/netgraph7/ng_sppp.c @@ -15,9 +15,10 @@ * works or modified versions. * * Cronyx Id: ng_sppp.c,v 1.1.2.10 2004/03/01 15:17:21 rik Exp $ + * + * $FreeBSD: src/sys/netgraph/ng_sppp.c,v 1.11 2006/12/29 13:59:50 jhb Exp $ + * $DragonFly: src/sys/netgraph7/ng_sppp.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ -#include -__FBSDID("$FreeBSD: src/sys/netgraph/ng_sppp.c,v 1.11 2006/12/29 13:59:50 jhb Exp $"); #include #include @@ -38,10 +39,10 @@ __FBSDID("$FreeBSD: src/sys/netgraph/ng_sppp.c,v 1.11 2006/12/29 13:59:50 jhb Ex #include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_parse.h" +#include "ng_sppp.h" #ifdef NG_SEPARATE_MALLOC MALLOC_DEFINE(M_NETGRAPH_SPPP, "netgraph_sppp", "netgraph sppp node "); @@ -122,7 +123,7 @@ ng_sppp_get_unit (int *unit) newlen = (2 * ng_sppp_units_len) + sizeof (*ng_sppp_units); MALLOC (newarray, unsigned char *, - newlen * sizeof (*ng_sppp_units), M_NETGRAPH_SPPP, M_NOWAIT); + newlen * sizeof (*ng_sppp_units), M_NETGRAPH_SPPP, M_WAITOK | M_NULLOK); if (newarray == NULL) return (ENOMEM); bcopy (ng_sppp_units, newarray, @@ -248,7 +249,7 @@ ng_sppp_constructor (node_p node) int error = 0; /* Allocate node and interface private structures */ - MALLOC (priv, priv_p, sizeof(*priv), M_NETGRAPH_SPPP, M_NOWAIT|M_ZERO); + MALLOC (priv, priv_p, sizeof(*priv), M_NETGRAPH_SPPP, M_WAITOK | M_NULLOK | M_ZERO); if (priv == NULL) return (ENOMEM); @@ -333,7 +334,7 @@ ng_sppp_rcvmsg (node_p node, item_p item, hook_p lasthook) case NGM_SPPP_COOKIE: switch (msg->header.cmd) { case NGM_SPPP_GET_IFNAME: - NG_MKRESPONSE (resp, msg, IFNAMSIZ, M_NOWAIT); + NG_MKRESPONSE (resp, msg, IFNAMSIZ, M_WAITOK | M_NULLOK); if (!resp) { error = ENOMEM; break; diff --git a/sys/netgraph7/ng_sppp.h b/sys/netgraph7/ng_sppp.h index 8c9ad429b5..ddb97dc4d0 100644 --- a/sys/netgraph7/ng_sppp.h +++ b/sys/netgraph7/ng_sppp.h @@ -15,6 +15,7 @@ * works or modified versions. * * $FreeBSD: src/sys/netgraph/ng_sppp.h,v 1.3 2005/02/03 13:03:31 ru Exp $ + * $DragonFly: src/sys/netgraph7/ng_sppp.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ * Cronyx Id: ng_sppp.h,v 1.1.2.6 2004/03/01 15:17:21 rik Exp $ */ diff --git a/sys/netgraph7/ng_tag.c b/sys/netgraph7/ng_tag.c index 603060ad4c..ecff17c6dd 100644 --- a/sys/netgraph7/ng_tag.c +++ b/sys/netgraph7/ng_tag.c @@ -28,6 +28,7 @@ * (ng_bpf by Archie Cobbs ) * * $FreeBSD: src/sys/netgraph/ng_tag.c,v 1.1 2006/06/27 12:45:28 glebius Exp $ + * $DragonFly: src/sys/netgraph7/ng_tag.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ /* @@ -63,10 +64,10 @@ #include #include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_parse.h" +#include "ng_tag.h" #ifdef NG_SEPARATE_MALLOC MALLOC_DEFINE(M_NETGRAPH_TAG, "netgraph_tag", "netgraph tag node "); @@ -572,7 +573,7 @@ ng_tag_rcvdata(hook_p hook, item_p item) tag_len = dhip->out_tag_len; if ((cookie != 0) || (type != 0)) { - tag = m_tag_alloc(cookie, type, tag_len, M_NOWAIT); + tag = m_tag_alloc(cookie, type, tag_len, MB_DONTWAIT); /* XXX may be free the mbuf if tag allocation failed? */ if (tag != NULL) { if (tag_len != 0) { diff --git a/sys/netgraph7/ng_tag.h b/sys/netgraph7/ng_tag.h index 14744b7f09..539d9bad04 100644 --- a/sys/netgraph7/ng_tag.h +++ b/sys/netgraph7/ng_tag.h @@ -25,6 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netgraph/ng_tag.h,v 1.1 2006/06/27 12:45:28 glebius Exp $ + * $DragonFly: src/sys/netgraph7/ng_tag.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ #ifndef _NETGRAPH_NG_TAG_H_ diff --git a/sys/netgraph7/ng_tcpmss.c b/sys/netgraph7/ng_tcpmss.c index 8e4098921c..fa098d025b 100644 --- a/sys/netgraph7/ng_tcpmss.c +++ b/sys/netgraph7/ng_tcpmss.c @@ -30,6 +30,7 @@ * tcpmssd Ruslan Ermilov * * $FreeBSD: src/sys/netgraph/ng_tcpmss.c,v 1.4 2007/01/15 05:01:31 glebius Exp $ + * $DragonFly: src/sys/netgraph7/ng_tcpmss.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ /* @@ -57,10 +58,10 @@ #include #include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_parse.h" +#include "ng_tcpmss.h" /* Per hook info. */ typedef struct { @@ -159,7 +160,7 @@ ng_tcpmss_newhook(node_p node, hook_p hook, const char *name) { hpriv_p priv; - MALLOC(priv, hpriv_p, sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); + MALLOC(priv, hpriv_p, sizeof(*priv), M_NETGRAPH, M_WAITOK | M_NULLOK | M_ZERO); if (priv == NULL) return (ENOMEM); @@ -204,7 +205,7 @@ ng_tcpmss_rcvmsg /* Create response. */ if (msg->header.cmd != NGM_TCPMSS_CLR_STATS) { NG_MKRESPONSE(resp, msg, - sizeof(struct ng_tcpmss_hookstat), M_NOWAIT); + sizeof(struct ng_tcpmss_hookstat), M_WAITOK | M_NULLOK); if (resp == NULL) ERROUT(ENOMEM); bcopy(&priv->stats, resp->data, diff --git a/sys/netgraph7/ng_tcpmss.h b/sys/netgraph7/ng_tcpmss.h index bec96ef3bd..bf19cba010 100644 --- a/sys/netgraph7/ng_tcpmss.h +++ b/sys/netgraph7/ng_tcpmss.h @@ -27,6 +27,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netgraph/ng_tcpmss.h,v 1.1 2005/06/10 08:02:34 glebius Exp $ + * $DragonFly: src/sys/netgraph7/ng_tcpmss.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ #ifndef _NETGRAPH_TCPMSS_H_ diff --git a/sys/netgraph7/ng_tee.c b/sys/netgraph7/ng_tee.c index c1ce9c871a..d2995d2371 100644 --- a/sys/netgraph7/ng_tee.c +++ b/sys/netgraph7/ng_tee.c @@ -39,6 +39,7 @@ * Author: Julian Elischer * * $FreeBSD: src/sys/netgraph/ng_tee.c,v 1.35 2008/02/24 10:13:32 mav Exp $ + * $DragonFly: src/sys/netgraph7/ng_tee.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_tee.c,v 1.18 1999/11/01 09:24:52 julian Exp $ */ @@ -57,10 +58,10 @@ #include #include #include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_parse.h" +#include "ng_tee.h" /* Per hook info */ struct hookinfo { @@ -153,7 +154,7 @@ ng_tee_constructor(node_p node) { sc_p privdata; - MALLOC(privdata, sc_p, sizeof(*privdata), M_NETGRAPH, M_NOWAIT|M_ZERO); + MALLOC(privdata, sc_p, sizeof(*privdata), M_NETGRAPH, M_WAITOK | M_NULLOK | M_ZERO); if (privdata == NULL) return (ENOMEM); @@ -226,7 +227,7 @@ ng_tee_rcvmsg(node_p node, item_p item, hook_p lasthook) if (msg->header.cmd != NGM_TEE_CLR_STATS) { NG_MKRESPONSE(resp, msg, - sizeof(*stats), M_NOWAIT); + sizeof(*stats), M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; goto done; @@ -307,7 +308,7 @@ ng_tee_rcvdata(hook_p hook, item_p item) struct mbuf *m2; /* Copy packet (failure will not stop the original)*/ - m2 = m_dup(m, M_DONTWAIT); + m2 = m_dup(m, MB_DONTWAIT); if (m2) { /* Deliver duplicate */ h = hinfo->dup; diff --git a/sys/netgraph7/ng_tee.h b/sys/netgraph7/ng_tee.h index da3e22096e..fa7e8156c0 100644 --- a/sys/netgraph7/ng_tee.h +++ b/sys/netgraph7/ng_tee.h @@ -39,6 +39,7 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_tee.h,v 1.8 2005/01/07 01:45:39 imp Exp $ + * $DragonFly: src/sys/netgraph7/ng_tee.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_tee.h,v 1.2 1999/01/20 00:22:14 archie Exp $ */ diff --git a/sys/netgraph7/ng_tty.c b/sys/netgraph7/ng_tty.c index 69717f51e9..01e2d61d15 100644 --- a/sys/netgraph7/ng_tty.c +++ b/sys/netgraph7/ng_tty.c @@ -38,6 +38,7 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_tty.c,v 1.37 2006/11/06 13:42:03 rwatson Exp $ + * $DragonFly: src/sys/netgraph7/ng_tty.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_tty.c,v 1.21 1999/11/01 09:24:52 julian Exp $ */ @@ -75,9 +76,9 @@ #include #include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_tty.h" /* Misc defs */ #define MAX_MBUFQ 3 /* Max number of queued mbufs */ @@ -365,7 +366,7 @@ ngt_input(int c, struct tty *tp) /* Get a new header mbuf if we need one */ if (!(m = sc->m)) { - MGETHDR(m, M_DONTWAIT, MT_DATA); + MGETHDR(m, MB_DONTWAIT, MT_DATA); if (!m) { if (sc->flags & FLG_DEBUG) log(LOG_ERR, @@ -641,7 +642,7 @@ ngt_rcvmsg(node_p node, item_p item, hook_p lasthook) break; } case NGM_TTY_GET_HOTCHAR: - NG_MKRESPONSE(resp, msg, sizeof(int), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(int), M_WAITOK | M_NULLOK); if (!resp) ERROUT(ENOMEM); /* Race condition here is OK */ diff --git a/sys/netgraph7/ng_tty.h b/sys/netgraph7/ng_tty.h index e4e79f8ed2..febfcedc4d 100644 --- a/sys/netgraph7/ng_tty.h +++ b/sys/netgraph7/ng_tty.h @@ -39,6 +39,7 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_tty.h,v 1.4 2005/01/07 01:45:39 imp Exp $ + * $DragonFly: src/sys/netgraph7/ng_tty.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_tty.h,v 1.7 1999/01/20 00:22:15 archie Exp $ */ diff --git a/sys/netgraph7/ng_vjc.c b/sys/netgraph7/ng_vjc.c index bca3ca399a..2cfc867324 100644 --- a/sys/netgraph7/ng_vjc.c +++ b/sys/netgraph7/ng_vjc.c @@ -39,6 +39,7 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_vjc.c,v 1.26 2005/12/04 00:25:03 ru Exp $ + * $DragonFly: src/sys/netgraph7/ng_vjc.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_vjc.c,v 1.17 1999/11/01 09:24:52 julian Exp $ */ @@ -55,10 +56,10 @@ #include #include -#include -#include -#include -#include +#include "ng_message.h" +#include "netgraph.h" +#include "ng_parse.h" +#include "ng_vjc.h" #include #include @@ -243,7 +244,7 @@ ng_vjc_constructor(node_p node) priv_p priv; /* Allocate private structure */ - MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); + MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_WAITOK | M_NULLOK | M_ZERO); if (priv == NULL) return (ENOMEM); @@ -326,7 +327,7 @@ ng_vjc_rcvmsg(node_p node, item_p item, hook_p lasthook) { struct ngm_vjc_config *conf; - NG_MKRESPONSE(resp, msg, sizeof(*conf), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(*conf), M_WAITOK | M_NULLOK); if (resp == NULL) ERROUT(ENOMEM); conf = (struct ngm_vjc_config *)resp->data; @@ -341,7 +342,7 @@ ng_vjc_rcvmsg(node_p node, item_p item, hook_p lasthook) int i; /* Get response structure */ - NG_MKRESPONSE(resp, msg, sizeof(*sl), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(*sl), M_WAITOK | M_NULLOK); if (resp == NULL) ERROUT(ENOMEM); sl = (struct slcompress *)resp->data; @@ -473,7 +474,7 @@ ng_vjc_rcvdata(hook_p hook, item_p item) m_adj(m, vjlen); /* Copy the reconstructed TCP/IP headers into a new mbuf */ - MGETHDR(hm, M_DONTWAIT, MT_DATA); + MGETHDR(hm, MB_DONTWAIT, MT_DATA); if (hm == NULL) { priv->slc.sls_errorin++; NG_FREE_M(m); @@ -483,7 +484,7 @@ ng_vjc_rcvdata(hook_p hook, item_p item) hm->m_len = 0; hm->m_pkthdr.rcvif = NULL; if (hlen > MHLEN) { /* unlikely, but can happen */ - MCLGET(hm, M_DONTWAIT); + MCLGET(hm, MB_DONTWAIT); if ((hm->m_flags & M_EXT) == 0) { m_freem(hm); priv->slc.sls_errorin++; diff --git a/sys/netgraph7/ng_vjc.h b/sys/netgraph7/ng_vjc.h index 26da5a0c20..43ad5cbf8c 100644 --- a/sys/netgraph7/ng_vjc.h +++ b/sys/netgraph7/ng_vjc.h @@ -39,6 +39,7 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_vjc.h,v 1.9 2005/01/07 01:45:39 imp Exp $ + * $DragonFly: src/sys/netgraph7/ng_vjc.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ * $Whistle: ng_vjc.h,v 1.6 1999/01/25 02:40:22 archie Exp $ */ diff --git a/sys/netgraph7/ng_vlan.c b/sys/netgraph7/ng_vlan.c index 4d44c6fc87..30e00da8c9 100644 --- a/sys/netgraph7/ng_vlan.c +++ b/sys/netgraph7/ng_vlan.c @@ -26,6 +26,7 @@ * Author: Ruslan Ermilov * * $FreeBSD: src/sys/netgraph/ng_vlan.c,v 1.5 2007/06/11 15:29:02 imp Exp $ + * $DragonFly: src/sys/netgraph7/ng_vlan.c,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ #include @@ -41,10 +42,10 @@ #include #include -#include -#include -#include -#include +#include "ng_message.h" +#include "ng_parse.h" +#include "ng_vlan.h" +#include "netgraph.h" static ng_constructor_t ng_vlan_constructor; static ng_rcvmsg_t ng_vlan_rcvmsg; @@ -161,7 +162,7 @@ ng_vlan_constructor(node_p node) priv_p priv; int i; - MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); + MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_WAITOK | M_NULLOK | M_ZERO); if (priv == NULL) return (ENOMEM); for (i = 0; i < HASHSIZE; i++) @@ -242,7 +243,7 @@ ng_vlan_rcvmsg(node_p node, item_p item, hook_p lasthook) } /* Create filter. */ MALLOC(f, struct filter *, sizeof(*f), - M_NETGRAPH, M_NOWAIT | M_ZERO); + M_NETGRAPH, M_WAITOK | M_NULLOK | M_ZERO); if (f == NULL) { error = ENOMEM; break; @@ -277,7 +278,7 @@ ng_vlan_rcvmsg(node_p node, item_p item, hook_p lasthook) break; case NGM_VLAN_GET_TABLE: NG_MKRESPONSE(resp, msg, sizeof(*t) + - priv->nent * sizeof(*t->filter), M_NOWAIT); + priv->nent * sizeof(*t->filter), M_WAITOK | M_NULLOK); if (resp == NULL) { error = ENOMEM; break; @@ -319,7 +320,7 @@ ng_vlan_rcvmsg(node_p node, item_p item, hook_p lasthook) for (i = 0, chain = priv->hashtable; i < HASHSIZE; i++, chain++) LIST_FOREACH(f, chain, next) { - NG_COPYMESSAGE(copy, msg, M_NOWAIT); + NG_COPYMESSAGE(copy, msg, M_WAITOK | M_NULLOK); if (copy == NULL) continue; NG_SEND_MSG_HOOK(error, node, copy, f->hook, 0); @@ -408,7 +409,7 @@ ng_vlan_rcvdata(hook_p hook, item_p item) NG_FREE_M(m); return (EOPNOTSUPP); } - M_PREPEND(m, ETHER_VLAN_ENCAP_LEN, M_DONTWAIT); + M_PREPEND(m, ETHER_VLAN_ENCAP_LEN, MB_DONTWAIT); /* M_PREPEND takes care of m_len and m_pkthdr.len. */ if (m == NULL || (m->m_len < sizeof(*evl) && (m = m_pullup(m, sizeof(*evl))) == NULL)) { diff --git a/sys/netgraph7/ng_vlan.h b/sys/netgraph7/ng_vlan.h index b74920c1e3..097424a435 100644 --- a/sys/netgraph7/ng_vlan.h +++ b/sys/netgraph7/ng_vlan.h @@ -26,6 +26,7 @@ * Author: Ruslan Ermilov * * $FreeBSD: src/sys/netgraph/ng_vlan.h,v 1.2 2005/10/28 14:41:28 ru Exp $ + * $DragonFly: src/sys/netgraph7/ng_vlan.h,v 1.2 2008/06/26 23:05:35 dillon Exp $ */ #ifndef _NETGRAPH_NG_VLAN_H_ -- 2.41.0