Netgraph port from FreeBSD - initial porting work
authorMatthew Dillon <dillon@dragonflybsd.org>
Thu, 26 Jun 2008 23:05:40 +0000 (23:05 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Thu, 26 Jun 2008 23:05:40 +0000 (23:05 +0000)
* 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.

161 files changed:
sys/netgraph7/atm/ccatm/ng_ccatm.c
sys/netgraph7/atm/ccatm/ng_ccatm_cust.h
sys/netgraph7/atm/ng_atm.c
sys/netgraph7/atm/ng_atm.h
sys/netgraph7/atm/ng_ccatm.h
sys/netgraph7/atm/ng_sscfu.h
sys/netgraph7/atm/ng_sscop.h
sys/netgraph7/atm/ng_uni.h
sys/netgraph7/atm/ngatmbase.c
sys/netgraph7/atm/ngatmbase.h
sys/netgraph7/atm/sscfu/ng_sscfu.c
sys/netgraph7/atm/sscfu/ng_sscfu_cust.h
sys/netgraph7/atm/sscop/ng_sscop.c
sys/netgraph7/atm/sscop/ng_sscop_cust.h
sys/netgraph7/atm/uni/ng_uni.c
sys/netgraph7/atm/uni/ng_uni_cust.h
sys/netgraph7/bluetooth/common/ng_bluetooth.c
sys/netgraph7/bluetooth/drivers/bt3c/ng_bt3c_pccard.c
sys/netgraph7/bluetooth/drivers/bt3c/ng_bt3c_var.h
sys/netgraph7/bluetooth/drivers/h4/ng_h4.c
sys/netgraph7/bluetooth/drivers/h4/ng_h4_prse.h
sys/netgraph7/bluetooth/drivers/h4/ng_h4_var.h
sys/netgraph7/bluetooth/drivers/ubt/ng_ubt.c
sys/netgraph7/bluetooth/drivers/ubt/ng_ubt_var.h
sys/netgraph7/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c
sys/netgraph7/bluetooth/hci/ng_hci_cmds.c
sys/netgraph7/bluetooth/hci/ng_hci_cmds.h
sys/netgraph7/bluetooth/hci/ng_hci_evnt.c
sys/netgraph7/bluetooth/hci/ng_hci_evnt.h
sys/netgraph7/bluetooth/hci/ng_hci_main.c
sys/netgraph7/bluetooth/hci/ng_hci_misc.c
sys/netgraph7/bluetooth/hci/ng_hci_misc.h
sys/netgraph7/bluetooth/hci/ng_hci_prse.h
sys/netgraph7/bluetooth/hci/ng_hci_ulpi.c
sys/netgraph7/bluetooth/hci/ng_hci_ulpi.h
sys/netgraph7/bluetooth/hci/ng_hci_var.h
sys/netgraph7/bluetooth/include/ng_bluetooth.h
sys/netgraph7/bluetooth/include/ng_bt3c.h
sys/netgraph7/bluetooth/include/ng_btsocket.h
sys/netgraph7/bluetooth/include/ng_btsocket_hci_raw.h
sys/netgraph7/bluetooth/include/ng_btsocket_l2cap.h
sys/netgraph7/bluetooth/include/ng_btsocket_rfcomm.h
sys/netgraph7/bluetooth/include/ng_h4.h
sys/netgraph7/bluetooth/include/ng_hci.h
sys/netgraph7/bluetooth/include/ng_l2cap.h
sys/netgraph7/bluetooth/include/ng_ubt.h
sys/netgraph7/bluetooth/l2cap/ng_l2cap_cmds.c
sys/netgraph7/bluetooth/l2cap/ng_l2cap_cmds.h
sys/netgraph7/bluetooth/l2cap/ng_l2cap_evnt.c
sys/netgraph7/bluetooth/l2cap/ng_l2cap_evnt.h
sys/netgraph7/bluetooth/l2cap/ng_l2cap_llpi.c
sys/netgraph7/bluetooth/l2cap/ng_l2cap_llpi.h
sys/netgraph7/bluetooth/l2cap/ng_l2cap_main.c
sys/netgraph7/bluetooth/l2cap/ng_l2cap_misc.c
sys/netgraph7/bluetooth/l2cap/ng_l2cap_misc.h
sys/netgraph7/bluetooth/l2cap/ng_l2cap_prse.h
sys/netgraph7/bluetooth/l2cap/ng_l2cap_ulpi.c
sys/netgraph7/bluetooth/l2cap/ng_l2cap_ulpi.h
sys/netgraph7/bluetooth/l2cap/ng_l2cap_var.h
sys/netgraph7/bluetooth/socket/ng_btsocket.c
sys/netgraph7/bluetooth/socket/ng_btsocket_hci_raw.c
sys/netgraph7/bluetooth/socket/ng_btsocket_l2cap.c
sys/netgraph7/bluetooth/socket/ng_btsocket_l2cap_raw.c
sys/netgraph7/bluetooth/socket/ng_btsocket_rfcomm.c
sys/netgraph7/dragonfly.h [new file with mode: 0644]
sys/netgraph7/netflow/netflow.c
sys/netgraph7/netflow/ng_netflow.c
sys/netgraph7/netgraph.h
sys/netgraph7/ng_UI.c
sys/netgraph7/ng_UI.h
sys/netgraph7/ng_async.c
sys/netgraph7/ng_async.h
sys/netgraph7/ng_atmllc.c
sys/netgraph7/ng_atmllc.h
sys/netgraph7/ng_base.c
sys/netgraph7/ng_bpf.c
sys/netgraph7/ng_bpf.h
sys/netgraph7/ng_bridge.c
sys/netgraph7/ng_bridge.h
sys/netgraph7/ng_car.c
sys/netgraph7/ng_car.h
sys/netgraph7/ng_cisco.c
sys/netgraph7/ng_cisco.h
sys/netgraph7/ng_deflate.c
sys/netgraph7/ng_deflate.h
sys/netgraph7/ng_device.c
sys/netgraph7/ng_device.h
sys/netgraph7/ng_echo.c
sys/netgraph7/ng_echo.h
sys/netgraph7/ng_eiface.c
sys/netgraph7/ng_eiface.h
sys/netgraph7/ng_etf.c
sys/netgraph7/ng_etf.h
sys/netgraph7/ng_ether.c
sys/netgraph7/ng_ether.h
sys/netgraph7/ng_fec.c
sys/netgraph7/ng_fec.h
sys/netgraph7/ng_frame_relay.c
sys/netgraph7/ng_frame_relay.h
sys/netgraph7/ng_gif.c
sys/netgraph7/ng_gif.h
sys/netgraph7/ng_gif_demux.c
sys/netgraph7/ng_gif_demux.h
sys/netgraph7/ng_hole.c
sys/netgraph7/ng_hole.h
sys/netgraph7/ng_hub.c
sys/netgraph7/ng_hub.h
sys/netgraph7/ng_iface.c
sys/netgraph7/ng_iface.h
sys/netgraph7/ng_ip_input.c
sys/netgraph7/ng_ip_input.h
sys/netgraph7/ng_ipfw.c
sys/netgraph7/ng_ipfw.h
sys/netgraph7/ng_ksocket.c
sys/netgraph7/ng_ksocket.h
sys/netgraph7/ng_l2tp.c
sys/netgraph7/ng_l2tp.h
sys/netgraph7/ng_lmi.c
sys/netgraph7/ng_lmi.h
sys/netgraph7/ng_message.h
sys/netgraph7/ng_mppc.c
sys/netgraph7/ng_mppc.h
sys/netgraph7/ng_nat.c
sys/netgraph7/ng_nat.h
sys/netgraph7/ng_one2many.c
sys/netgraph7/ng_one2many.h
sys/netgraph7/ng_parse.c
sys/netgraph7/ng_parse.h
sys/netgraph7/ng_ppp.c
sys/netgraph7/ng_ppp.h
sys/netgraph7/ng_pppoe.c
sys/netgraph7/ng_pppoe.h
sys/netgraph7/ng_pptpgre.c
sys/netgraph7/ng_pptpgre.h
sys/netgraph7/ng_pred1.c
sys/netgraph7/ng_pred1.h
sys/netgraph7/ng_rfc1490.c
sys/netgraph7/ng_rfc1490.h
sys/netgraph7/ng_sample.c
sys/netgraph7/ng_sample.h
sys/netgraph7/ng_socket.c
sys/netgraph7/ng_socket.h
sys/netgraph7/ng_socketvar.h
sys/netgraph7/ng_source.c
sys/netgraph7/ng_source.h
sys/netgraph7/ng_split.c
sys/netgraph7/ng_split.h
sys/netgraph7/ng_sppp.c
sys/netgraph7/ng_sppp.h
sys/netgraph7/ng_tag.c
sys/netgraph7/ng_tag.h
sys/netgraph7/ng_tcpmss.c
sys/netgraph7/ng_tcpmss.h
sys/netgraph7/ng_tee.c
sys/netgraph7/ng_tee.h
sys/netgraph7/ng_tty.c
sys/netgraph7/ng_tty.h
sys/netgraph7/ng_vjc.c
sys/netgraph7/ng_vjc.h
sys/netgraph7/ng_vlan.c
sys/netgraph7/ng_vlan.h

index 404f54e..c583a2e 100644 (file)
  * 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 <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netgraph/atm/ccatm/ng_ccatm.c,v 1.3 2006/09/30 12:37:43 netchild Exp $");
-
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
@@ -49,17 +48,17 @@ __FBSDID("$FreeBSD: src/sys/netgraph/atm/ccatm/ng_ccatm.c,v 1.3 2006/09/30 12:37
 #include <sys/sbuf.h>
 #include <machine/stdarg.h>
 
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/ng_parse.h>
+#include "ng_message.h"
+#include "netgraph.h"
+#include "ng_parse.h"
 #include <netnatm/unimsg.h>
 #include <netnatm/msg/unistruct.h>
 #include <netnatm/api/unisap.h>
 #include <netnatm/sig/unidef.h>
-#include <netgraph/atm/ngatmbase.h>
-#include <netgraph/atm/ng_uni.h>
+#include "atm/ngatmbase.h"
+#include "atm/ng_uni.h"
 #include <netnatm/api/atmapi.h>
-#include <netgraph/atm/ng_ccatm.h>
+#include "atm/ng_ccatm.h"
 #include <netnatm/api/ccatm.h>
 
 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;
index 0749a94..90596e1 100644 (file)
@@ -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 <sys/param.h>
 #include <sys/lock.h>
 #include <sys/mutex.h>
 #include <sys/mbuf.h>
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/atm/ngatmbase.h>
+#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)
index 9528ac5..53009c5 100644 (file)
  * SUCH DAMAGE.
  *
  * Author: Hartmut Brandt <harti@freebsd.org>
+ *
+ * $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 <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netgraph/atm/ng_atm.c,v 1.15 2005/08/10 06:25:40 obrien Exp $");
-
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
@@ -54,10 +54,10 @@ __FBSDID("$FreeBSD: src/sys/netgraph/atm/ng_atm.c,v 1.15 2005/08/10 06:25:40 obr
 #include <net/if_media.h>
 #include <net/if_atm.h>
 
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/ng_parse.h>
-#include <netgraph/atm/ng_atm.h>
+#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
index 4b40657..16e2865 100644 (file)
@@ -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_
index b0ab97a..ecaecf5 100644 (file)
@@ -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 $
  */
 
 /*
index 5a8950a..666c280 100644 (file)
@@ -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.
  */
index b4b2b3e..b15ab93 100644 (file)
@@ -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
  */
index b2dc2c5..b0edea5 100644 (file)
@@ -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
  */
index 47fa5bf..dd630a5 100644 (file)
  * 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 <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netgraph/atm/ngatmbase.c,v 1.3 2005/01/07 01:45:40 imp Exp $");
-
 #include <sys/param.h>
 #include <sys/module.h>
 #include <sys/kernel.h>
@@ -42,7 +43,7 @@ __FBSDID("$FreeBSD: src/sys/netgraph/atm/ngatmbase.c,v 1.3 2005/01/07 01:45:40 i
 #include <sys/mbuf.h>
 #include <machine/stdarg.h>
 #include <netnatm/unimsg.h>
-#include <netgraph/atm/ngatmbase.h>
+#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);
index 126cb0b..8539a25 100644 (file)
@@ -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.
  */
index 1cf1f5d..d433bdf 100644 (file)
  * Author: Hartmut Brandt <harti@freebsd.org>
  *
  * 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 <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netgraph/atm/sscfu/ng_sscfu.c,v 1.4 2005/01/07 01:45:41 imp Exp $");
-
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
@@ -44,14 +45,14 @@ __FBSDID("$FreeBSD: src/sys/netgraph/atm/sscfu/ng_sscfu.c,v 1.4 2005/01/07 01:45
 #include <sys/sbuf.h>
 #include <machine/stdarg.h>
 
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/ng_parse.h>
+#include "ng_message.h"
+#include "netgraph.h"
+#include "ng_parse.h"
 #include <netnatm/saal/sscopdef.h>
 #include <netnatm/saal/sscfudef.h>
-#include <netgraph/atm/ng_sscop.h>
-#include <netgraph/atm/ng_sscfu.h>
-#include <netgraph/atm/sscfu/ng_sscfu_cust.h>
+#include "atm/ng_sscop.h"
+#include "atm/ng_sscfu.h"
+#include "atm/sscfu/ng_sscfu_cust.h"
 #include <netnatm/saal/sscfu.h>
 
 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);
index 4605ad5..942fb28 100644 (file)
@@ -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 <sys/param.h>
 #include <sys/types.h>
@@ -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))
        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)
 
index 3b7e1c8..fd995de 100644 (file)
  * 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 <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netgraph/atm/sscop/ng_sscop.c,v 1.4 2005/08/10 06:25:40 obrien Exp $");
-
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
@@ -47,12 +47,12 @@ __FBSDID("$FreeBSD: src/sys/netgraph/atm/sscop/ng_sscop.c,v 1.4 2005/08/10 06:25
 #include <sys/stdint.h>
 #include <machine/stdarg.h>
 
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/ng_parse.h>
+#include "ng_message.h"
+#include "netgraph.h"
+#include "ng_parse.h"
 #include <netnatm/saal/sscopdef.h>
-#include <netgraph/atm/ng_sscop.h>
-#include <netgraph/atm/sscop/ng_sscop_cust.h>
+#include "atm/ng_sscop.h"
+#include "atm/sscop/ng_sscop_cust.h"
 #include <netnatm/saal/sscop.h>
 
 #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 *);
index d8f073b..bf95be8 100644 (file)
@@ -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 <sys/queue.h>
 #include <sys/systm.h>
 #include <sys/malloc.h>
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
 #include <machine/stdarg.h>
+#include "ng_message.h"
+#include "netgraph.h"
 
 #include <netnatm/saal/sscopdef.h>
 
@@ -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))
        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;                               \
index 3eb0584..f8ee24d 100644 (file)
  * 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 <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netgraph/atm/uni/ng_uni.c,v 1.6 2005/10/31 15:41:26 rwatson Exp $");
-
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
@@ -45,20 +45,20 @@ __FBSDID("$FreeBSD: src/sys/netgraph/atm/uni/ng_uni.c,v 1.6 2005/10/31 15:41:26
 #include <sys/sbuf.h>
 #include <machine/stdarg.h>
 
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/ng_parse.h>
+#include "ng_message.h"
+#include "netgraph.h"
+#include "ng_parse.h"
 #include <netnatm/unimsg.h>
 #include <netnatm/msg/unistruct.h>
-#include <netgraph/atm/ngatmbase.h>
+#include "netgraph/atm/ngatmbase.h"
 #include <netnatm/saal/sscopdef.h>
 #include <netnatm/saal/sscfudef.h>
-#include <netgraph/atm/uni/ng_uni_cust.h>
+#include "netgraph/atm/uni/ng_uni_cust.h"
 #include <netnatm/sig/uni.h>
 #include <netnatm/sig/unisig.h>
-#include <netgraph/atm/ng_sscop.h>
-#include <netgraph/atm/ng_sscfu.h>
-#include <netgraph/atm/ng_uni.h>
+#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]);
index 603c419..6c02d22 100644 (file)
@@ -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 <sys/param.h>
@@ -39,9 +41,9 @@
 #include <sys/lock.h>
 #include <sys/mutex.h>
 #include <sys/mbuf.h>
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/atm/ngatmbase.h>
+#include "ng_message.h"
+#include "netgraph.h"
+#include "atm/ngatmbase.h"
 
 #define        ASSERT(E, M) KASSERT(E,M)
 
index aa1bad3..309c2b8 100644 (file)
@@ -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 <sys/param.h>
@@ -38,7 +40,7 @@
 #include <sys/module.h>
 #include <sys/sysctl.h>
 
-#include <netgraph/bluetooth/include/ng_bluetooth.h>
+#include "bluetooth/include/ng_bluetooth.h"
 
 /*
  * Bluetooth stack sysctl globals
index a9b9716..08b42e3 100644 (file)
@@ -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 
  *
 #include <dev/pccard/pccardvar.h>
 #include "pccarddevs.h"
 
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/ng_parse.h>
-#include <netgraph/bluetooth/include/ng_bluetooth.h>
-#include <netgraph/bluetooth/include/ng_hci.h>
-#include <netgraph/bluetooth/include/ng_bt3c.h>
-#include <netgraph/bluetooth/drivers/bt3c/ng_bt3c_var.h>
+#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);
 
index a3bca3c..348bfd7 100644 (file)
@@ -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 
  *
index a6c8316..96568ab 100644 (file)
@@ -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:
  * ---------
 #include <sys/ttycom.h>
 #include <net/if.h>
 #include <net/if_var.h>
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/ng_parse.h>
-#include <netgraph/bluetooth/include/ng_bluetooth.h>
-#include <netgraph/bluetooth/include/ng_hci.h>
-#include <netgraph/bluetooth/include/ng_h4.h>
-#include <netgraph/bluetooth/drivers/h4/ng_h4_var.h>
-#include <netgraph/bluetooth/drivers/h4/ng_h4_prse.h>
+#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
index fbf3931..cc19414 100644 (file)
@@ -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 $
  */
 
 /***************************************************************************
index e79c3b2..e87c756 100644 (file)
@@ -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:
  * ---------
index b8f17be..f1dd20f 100644 (file)
@@ -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 <sys/param.h>
 #include <dev/usb/usbdi_util.h>
 #include <dev/usb/usbdivar.h>
 
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/ng_parse.h>
-#include <netgraph/bluetooth/include/ng_bluetooth.h>
-#include <netgraph/bluetooth/include/ng_hci.h>
-#include <netgraph/bluetooth/include/ng_ubt.h>
-#include <netgraph/bluetooth/drivers/ubt/ng_ubt_var.h>
+#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
index ec8f15d..413d774 100644 (file)
@@ -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_
index a85b6eb..8c4ee8c 100644 (file)
@@ -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 <sys/param.h>
index aa31c00..289e01f 100644 (file)
@@ -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 <sys/param.h>
 #include <sys/malloc.h>
 #include <sys/mbuf.h>
 #include <sys/queue.h>
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/bluetooth/include/ng_bluetooth.h>
-#include <netgraph/bluetooth/include/ng_hci.h>
-#include <netgraph/bluetooth/hci/ng_hci_var.h>
-#include <netgraph/bluetooth/hci/ng_hci_cmds.h>
-#include <netgraph/bluetooth/hci/ng_hci_evnt.h>
-#include <netgraph/bluetooth/hci/ng_hci_ulpi.h>
-#include <netgraph/bluetooth/hci/ng_hci_misc.h>
+#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
index f802aac..f77cde2 100644 (file)
@@ -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_
index 6cab3ea..8642863 100644 (file)
@@ -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 <sys/param.h>
 #include <sys/malloc.h>
 #include <sys/mbuf.h>
 #include <sys/queue.h>
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/bluetooth/include/ng_bluetooth.h>
-#include <netgraph/bluetooth/include/ng_hci.h>
-#include <netgraph/bluetooth/hci/ng_hci_var.h>
-#include <netgraph/bluetooth/hci/ng_hci_cmds.h>
-#include <netgraph/bluetooth/hci/ng_hci_evnt.h>
-#include <netgraph/bluetooth/hci/ng_hci_ulpi.h>
-#include <netgraph/bluetooth/hci/ng_hci_misc.h>
+#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 *);
index e6949f6..5854421 100644 (file)
@@ -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_
index c7eb336..a29515c 100644 (file)
@@ -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 <sys/param.h>
 #include <sys/malloc.h>
 #include <sys/mbuf.h>
 #include <sys/queue.h>
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/ng_parse.h>
-#include <netgraph/bluetooth/include/ng_bluetooth.h>
-#include <netgraph/bluetooth/include/ng_hci.h>
-#include <netgraph/bluetooth/hci/ng_hci_var.h>
-#include <netgraph/bluetooth/hci/ng_hci_prse.h>
-#include <netgraph/bluetooth/hci/ng_hci_cmds.h>
-#include <netgraph/bluetooth/hci/ng_hci_evnt.h>
-#include <netgraph/bluetooth/hci/ng_hci_ulpi.h>
-#include <netgraph/bluetooth/hci/ng_hci_misc.h>
+#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;
index c4b6caf..b356429 100644 (file)
@@ -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 <sys/param.h>
 #include <sys/malloc.h>
 #include <sys/mbuf.h>
 #include <sys/queue.h>
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/bluetooth/include/ng_bluetooth.h>
-#include <netgraph/bluetooth/include/ng_hci.h>
-#include <netgraph/bluetooth/hci/ng_hci_var.h>
-#include <netgraph/bluetooth/hci/ng_hci_cmds.h>
-#include <netgraph/bluetooth/hci/ng_hci_evnt.h>
-#include <netgraph/bluetooth/hci/ng_hci_ulpi.h>
-#include <netgraph/bluetooth/hci/ng_hci_misc.h>
+#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;
index 7861b91..074fa3b 100644 (file)
@@ -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_
index 5856f17..10fa348 100644 (file)
@@ -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 $
  */
 
 /***************************************************************************
index 1da18d4..ec6ed46 100644 (file)
@@ -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 <sys/param.h>
 #include <sys/malloc.h>
 #include <sys/mbuf.h>
 #include <sys/queue.h>
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/bluetooth/include/ng_bluetooth.h>
-#include <netgraph/bluetooth/include/ng_hci.h>
-#include <netgraph/bluetooth/hci/ng_hci_var.h>
-#include <netgraph/bluetooth/hci/ng_hci_cmds.h>
-#include <netgraph/bluetooth/hci/ng_hci_evnt.h>
-#include <netgraph/bluetooth/hci/ng_hci_ulpi.h>
-#include <netgraph/bluetooth/hci/ng_hci_misc.h>
+#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);
 
index e3bfb44..33be008 100644 (file)
@@ -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_
index 8df13a8..6129b5d 100644 (file)
@@ -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_
index c59812b..d7ffb61 100644 (file)
@@ -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_
index 0cf5d5d..8da7ff7 100644 (file)
@@ -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 
  *
index 111d283..965758b 100644 (file)
@@ -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_
index 359a990..2830772 100644 (file)
@@ -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_
index 1597650..0415b0c 100644 (file)
@@ -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_
index 6e20bfd..51caff4 100644 (file)
@@ -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_
index a8a8fdc..091d0a4 100644 (file)
@@ -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:
  * ---------
index da47555..7d7e1d4 100644 (file)
@@ -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 $
  */
 
 /*
index 3be95d9..f455743 100644 (file)
@@ -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 $
  */
 
 /*
index 0233f08..d8f5ffd 100644 (file)
@@ -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_
index 44a0372..2068f35 100644 (file)
@@ -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 <sys/param.h>
 #include <sys/malloc.h>
 #include <sys/mbuf.h>
 #include <sys/queue.h>
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/bluetooth/include/ng_bluetooth.h>
-#include <netgraph/bluetooth/include/ng_hci.h>
-#include <netgraph/bluetooth/include/ng_l2cap.h>
-#include <netgraph/bluetooth/l2cap/ng_l2cap_var.h>
-#include <netgraph/bluetooth/l2cap/ng_l2cap_cmds.h>
-#include <netgraph/bluetooth/l2cap/ng_l2cap_evnt.h>
-#include <netgraph/bluetooth/l2cap/ng_l2cap_llpi.h>
-#include <netgraph/bluetooth/l2cap/ng_l2cap_ulpi.h>
-#include <netgraph/bluetooth/l2cap/ng_l2cap_misc.h>
+#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"
 
 /******************************************************************************
  ******************************************************************************
index 5c4f126..39e6f8e 100644 (file)
@@ -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;                                                  \
                                                                        \
index 2a79976..904f777 100644 (file)
@@ -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 <sys/param.h>
 #include <sys/malloc.h>
 #include <sys/mbuf.h>
 #include <sys/queue.h>
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/bluetooth/include/ng_bluetooth.h>
-#include <netgraph/bluetooth/include/ng_hci.h>
-#include <netgraph/bluetooth/include/ng_l2cap.h>
-#include <netgraph/bluetooth/l2cap/ng_l2cap_var.h>
-#include <netgraph/bluetooth/l2cap/ng_l2cap_cmds.h>
-#include <netgraph/bluetooth/l2cap/ng_l2cap_evnt.h>
-#include <netgraph/bluetooth/l2cap/ng_l2cap_llpi.h>
-#include <netgraph/bluetooth/l2cap/ng_l2cap_ulpi.h>
-#include <netgraph/bluetooth/l2cap/ng_l2cap_misc.h>
+#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;
 
index d4cd0c9..151d4f5 100644 (file)
@@ -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_
index d97e4e9..6d898b6 100644 (file)
@@ -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 <sys/param.h>
 #include <sys/malloc.h>
 #include <sys/mbuf.h>
 #include <sys/queue.h>
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/bluetooth/include/ng_bluetooth.h>
-#include <netgraph/bluetooth/include/ng_hci.h>
-#include <netgraph/bluetooth/include/ng_l2cap.h>
-#include <netgraph/bluetooth/l2cap/ng_l2cap_var.h>
-#include <netgraph/bluetooth/l2cap/ng_l2cap_cmds.h>
-#include <netgraph/bluetooth/l2cap/ng_l2cap_evnt.h>
-#include <netgraph/bluetooth/l2cap/ng_l2cap_llpi.h>
-#include <netgraph/bluetooth/l2cap/ng_l2cap_ulpi.h>
-#include <netgraph/bluetooth/l2cap/ng_l2cap_misc.h>
+#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;
 
index a630bd4..0c7847a 100644 (file)
@@ -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_
index 47905a8..a18e13f 100644 (file)
@@ -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 <sys/param.h>
 #include <sys/malloc.h>
 #include <sys/mbuf.h>
 #include <sys/queue.h>
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/ng_parse.h>
-#include <netgraph/bluetooth/include/ng_bluetooth.h>
-#include <netgraph/bluetooth/include/ng_hci.h>
-#include <netgraph/bluetooth/include/ng_l2cap.h>
-#include <netgraph/bluetooth/l2cap/ng_l2cap_var.h>
-#include <netgraph/bluetooth/l2cap/ng_l2cap_cmds.h>
-#include <netgraph/bluetooth/l2cap/ng_l2cap_evnt.h>
-#include <netgraph/bluetooth/l2cap/ng_l2cap_llpi.h>
-#include <netgraph/bluetooth/l2cap/ng_l2cap_ulpi.h>
-#include <netgraph/bluetooth/l2cap/ng_l2cap_misc.h>
-#include <netgraph/bluetooth/l2cap/ng_l2cap_prse.h>
+#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
index 8f69b4a..56cce16 100644 (file)
@@ -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 <sys/param.h>
 #include <sys/malloc.h>
 #include <sys/mbuf.h>
 #include <sys/queue.h>
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/bluetooth/include/ng_bluetooth.h>
-#include <netgraph/bluetooth/include/ng_hci.h>
-#include <netgraph/bluetooth/include/ng_l2cap.h>
-#include <netgraph/bluetooth/l2cap/ng_l2cap_var.h>
-#include <netgraph/bluetooth/l2cap/ng_l2cap_cmds.h>
-#include <netgraph/bluetooth/l2cap/ng_l2cap_evnt.h>
-#include <netgraph/bluetooth/l2cap/ng_l2cap_llpi.h>
-#include <netgraph/bluetooth/l2cap/ng_l2cap_ulpi.h>
-#include <netgraph/bluetooth/l2cap/ng_l2cap_misc.h>
+#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);
 
index e2da0e6..87a1d87 100644 (file)
@@ -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_
index bc2dba3..2e17c74 100644 (file)
@@ -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 $
  */
 
 /***************************************************************************
index ce2d93c..ef3e8fa 100644 (file)
@@ -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 <sys/param.h>
 #include <sys/malloc.h>
 #include <sys/mbuf.h>
 #include <sys/queue.h>
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/bluetooth/include/ng_hci.h>
-#include <netgraph/bluetooth/include/ng_l2cap.h>
-#include <netgraph/bluetooth/l2cap/ng_l2cap_var.h>
-#include <netgraph/bluetooth/l2cap/ng_l2cap_cmds.h>
-#include <netgraph/bluetooth/l2cap/ng_l2cap_evnt.h>
-#include <netgraph/bluetooth/l2cap/ng_l2cap_llpi.h>
-#include <netgraph/bluetooth/l2cap/ng_l2cap_ulpi.h>
-#include <netgraph/bluetooth/l2cap/ng_l2cap_misc.h>
+#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 {
index 4e9380c..f7cb0a8 100644 (file)
@@ -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_
index 2a93b9a..9a83c84 100644 (file)
@@ -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_
index 1bbccd6..3e2d10a 100644 (file)
@@ -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 <sys/param.h>
 #include <sys/socketvar.h>
 #include <sys/sysctl.h>
 #include <sys/taskqueue.h>
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/bluetooth/include/ng_bluetooth.h>
-#include <netgraph/bluetooth/include/ng_hci.h>
-#include <netgraph/bluetooth/include/ng_l2cap.h>
-#include <netgraph/bluetooth/include/ng_btsocket.h>
-#include <netgraph/bluetooth/include/ng_btsocket_hci_raw.h>
-#include <netgraph/bluetooth/include/ng_btsocket_l2cap.h>
-#include <netgraph/bluetooth/include/ng_btsocket_rfcomm.h>
+#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;
index 9f4a038..cc8bc69 100644 (file)
@@ -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 <sys/param.h>
 #include <sys/socketvar.h>
 #include <sys/sysctl.h>
 #include <sys/taskqueue.h>
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/bluetooth/include/ng_bluetooth.h>
-#include <netgraph/bluetooth/include/ng_hci.h>
-#include <netgraph/bluetooth/include/ng_l2cap.h>
-#include <netgraph/bluetooth/include/ng_btsocket.h>
-#include <netgraph/bluetooth/include/ng_btsocket_hci_raw.h>
+#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 */
index 82544be..874a9ed 100644 (file)
@@ -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 <sys/param.h>
 #include <sys/socketvar.h>
 #include <sys/sysctl.h>
 #include <sys/taskqueue.h>
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/bluetooth/include/ng_bluetooth.h>
-#include <netgraph/bluetooth/include/ng_hci.h>
-#include <netgraph/bluetooth/include/ng_l2cap.h>
-#include <netgraph/bluetooth/include/ng_btsocket.h>
-#include <netgraph/bluetooth/include/ng_btsocket_l2cap.h>
+#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 */
index 06d6f91..2bb4234 100644 (file)
@@ -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 <sys/param.h>
 #include <sys/socketvar.h>
 #include <sys/sysctl.h>
 #include <sys/taskqueue.h>
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/bluetooth/include/ng_bluetooth.h>
-#include <netgraph/bluetooth/include/ng_hci.h>
-#include <netgraph/bluetooth/include/ng_l2cap.h>
-#include <netgraph/bluetooth/include/ng_btsocket.h>
-#include <netgraph/bluetooth/include/ng_btsocket_l2cap.h>
+#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);
 
index 3eaeccf..0f232cb 100644 (file)
@@ -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 <sys/param.h>
 #include <sys/sysctl.h>
 #include <sys/taskqueue.h>
 #include <sys/uio.h>
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/bluetooth/include/ng_bluetooth.h>
-#include <netgraph/bluetooth/include/ng_hci.h>
-#include <netgraph/bluetooth/include/ng_l2cap.h>
-#include <netgraph/bluetooth/include/ng_btsocket.h>
-#include <netgraph/bluetooth/include/ng_btsocket_l2cap.h>
-#include <netgraph/bluetooth/include/ng_btsocket_rfcomm.h>
+#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 (file)
index 0000000..aca15dc
--- /dev/null
@@ -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 <dillon@backplane.com>
+ * 
+ * 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 <sys/lock.h>
+#include <sys/objcache.h>
+
+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)
+
index 96ba495..9bc2525 100644 (file)
  * 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 <sys/param.h>
 #include <sys/kernel.h>
 #include <sys/limits.h>
@@ -48,11 +47,11 @@ static const char rcs_id[] =
 #include <netinet/tcp.h>
 #include <netinet/udp.h>
 
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
+#include "ng_message.h"
+#include "netgraph.h"
 
-#include <netgraph/netflow/netflow.h>
-#include <netgraph/netflow/ng_netflow.h>
+#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;
 
                        /*
index c853008..b2bf463 100644 (file)
  * 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 <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
@@ -51,11 +50,11 @@ static const char rcs_id[] =
 #include <netinet/tcp.h>
 #include <netinet/udp.h>
 
-#include <netgraph/ng_message.h>
-#include <netgraph/ng_parse.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/netflow/netflow.h>
-#include <netgraph/netflow/ng_netflow.h>
+#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);
index 3f1284a..aec5274 100644 (file)
@@ -38,6 +38,7 @@
  * Author: Julian Elischer <julian@freebsd.org>
  *
  * $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 <sys/lock.h>
 #include <sys/malloc.h>
 #include <sys/module.h>
-#include <sys/mutex.h>
+/*#include <sys/mutex.h>*/
+#include "dragonfly.h"
 
 #ifdef HAVE_KERNEL_OPTION_HEADERS
 #include "opt_netgraph.h"
index ee0c169..a0b1e90 100644 (file)
@@ -38,6 +38,7 @@
  * Author: Julian Elischer <julian@freebsd.org>
  *
  * $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 <sys/errno.h>
 
 
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/ng_UI.h>
+#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;
index f925050..25c84c3 100644 (file)
@@ -38,6 +38,7 @@
  * Author: Julian Elischer <julian@freebsd.org>
  *
  * $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 $
  */
 
index 2a27fec..d53f824 100644 (file)
@@ -38,6 +38,7 @@
  * Author: Archie Cobbs <archie@freebsd.org>
  *
  * $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 $
  */
 
 #include <sys/malloc.h>
 #include <sys/errno.h>
 
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/ng_async.h>
-#include <netgraph/ng_parse.h>
+#include "ng_message.h"
+#include "netgraph.h"
+#include "ng_async.h"
+#include "ng_parse.h"
 
 #include <net/ppp_defs.h>
 
@@ -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;
index b0ea22d..b042216 100644 (file)
@@ -38,6 +38,7 @@
  * Author: Archie Cobbs <archie@freebsd.org>
  *
  * $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 $
  */
 
index 9aa0d0c..1cfd2d4 100644 (file)
@@ -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 <sys/param.h>
@@ -34,9 +35,9 @@
 #include <sys/socket.h>
 #include <sys/sockio.h>
 
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/ng_atmllc.h>
+#include "ng_message.h"
+#include "netgraph.h"
+#include "ng_atmllc.h"
 
 #include <net/if.h>
 #include <net/ethernet.h>      /* 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);
index f9d009a..aab4212 100644 (file)
@@ -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_
index 2e410f5..7d1b4fa 100644 (file)
@@ -39,6 +39,7 @@
  *          Archie Cobbs <archie@freebsd.org>
  *
  * $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 <sys/systm.h>
 #include <sys/ctype.h>
 #include <sys/errno.h>
-#include <sys/kdb.h>
+/*#include <sys/kdb.h>*/
 #include <sys/kernel.h>
 #include <sys/ktr.h>
 #include <sys/limits.h>
@@ -65,9 +66,9 @@
 
 #include <net/netisr.h>
 
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/ng_parse.h>
+#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;
index c11e816..925d7c1 100644 (file)
@@ -38,6 +38,7 @@
  * Author: Archie Cobbs <archie@freebsd.org>
  *
  * $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 $
  */
 
 #include <net/bpf_jitter.h>
 #endif
 
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/ng_parse.h>
-#include <netgraph/ng_bpf.h>
+#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));
index 540b4af..a4aaebe 100644 (file)
@@ -38,6 +38,7 @@
  * Author: Archie Cobbs <archie@freebsd.org>
  *
  * $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 $
  */
 
index befd97e..0a1afdf 100644 (file)
@@ -38,6 +38,7 @@
  * Author: Archie Cobbs <archie@freebsd.org>
  *
  * $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 $
  */
 
 /*
 #include <netinet/in.h>
 #include <netinet/ip_fw.h>
 
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/ng_parse.h>
-#include <netgraph/ng_bridge.h>
+#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);
index 66685fd..7ca5944 100644 (file)
@@ -38,6 +38,7 @@
  * Author: Archie Cobbs <archie@freebsd.org>
  *
  * $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_
index 27cf8a1..c5978a4 100644 (file)
@@ -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 $
  */
 
 /*
 #include <sys/malloc.h>
 #include <sys/mbuf.h>
 
-#include <netgraph/ng_message.h>
-#include <netgraph/ng_parse.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/ng_car.h>
+#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);
 }
 
index 596a138..1469dd9 100644 (file)
@@ -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_
index 2962306..29e642f 100644 (file)
@@ -38,6 +38,7 @@
  * Author: Julian Elischer <julian@freebsd.org>
  *
  * $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 $
  */
 
 #include <netipx/ipx.h>
 #include <netipx/ipx_if.h>
 
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/ng_parse.h>
-#include <netgraph/ng_cisco.h>
+#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);
 }
index ac916ad..fc0f049 100644 (file)
@@ -38,6 +38,7 @@
  * Author: Archie Cobbs <archie@freebsd.org>
  *
  * $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 $
  */
 
index d5753df..a651162 100644 (file)
@@ -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 $
  */
 
 /*
 
 #include <net/zlib.h>
 
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/ng_parse.h>
-#include <netgraph/ng_deflate.h>
+#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);
 }
 
 /*
index ec5a125..65dcf9e 100644 (file)
@@ -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_
index 88636fe..bda3221 100644 (file)
@@ -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 <netinet/in_systm.h>
 #include <netinet/ip.h>
 
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/ng_device.h>
+#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);
index f7b2ccd..2451f9f 100644 (file)
@@ -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 $
  *
  */
 
index ee42955..78caf5f 100644 (file)
@@ -38,6 +38,7 @@
  * Author: Julian Elisher <julian@freebsd.org>
  *
  * $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 <sys/kernel.h>
 #include <sys/malloc.h>
 #include <sys/mbuf.h>
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/ng_echo.h>
+#include "ng_message.h"
+#include "netgraph.h"
+#include "ng_echo.h"
 
 /* Netgraph methods */
 static ng_constructor_t        nge_cons;
index 483245b..e3cf615 100644 (file)
@@ -38,6 +38,7 @@
  * Author: Archie Cobbs <archie@freebsd.org>
  *
  * $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 $
  */
 
index 17d66f7..dcdbc6c 100644 (file)
@@ -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 <sys/param.h>
 #include <net/if_types.h>
 #include <net/netisr.h>
 
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/ng_parse.h>
-#include <netgraph/ng_eiface.h>
+#include "ng_message.h"
+#include "netgraph.h"
+#include "ng_parse.h"
+#include "ng_eiface.h"
 
 #include <net/bpf.h>
 #include <net/ethernet.h>
@@ -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;
index e670d98..0a1ab67 100644 (file)
@@ -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_
index 5a01d67..7d4041c 100644 (file)
@@ -31,6 +31,7 @@
  * Author: Julian Elischer <julian@freebsd.org>
  *
  * $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 <sys/param.h>
 
 #include <net/ethernet.h>
 
-#include <netgraph/ng_message.h>
-#include <netgraph/ng_parse.h>
-#include <netgraph/ng_etf.h>
-#include <netgraph/netgraph.h>
+#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;
index 3ae8441..15a3d49 100644 (file)
@@ -31,6 +31,7 @@
  * Author: Julian Elischer <julian@freebsd.org>
  *
  * $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_
index fe589c8..910f128 100644 (file)
@@ -40,6 +40,7 @@
  *         Julian Elischer <julian@freebsd.org>
  *
  * $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 $
  */
 
 /*
 #include <net/ethernet.h>
 #include <net/if_bridgevar.h>
 
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/ng_parse.h>
-#include <netgraph/ng_ether.h>
+#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;
index d60a949..ca53f08 100644 (file)
@@ -39,6 +39,7 @@
  * Author: Archie Cobbs <archie@freebsd.org>
  *
  * $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 $
  */
 
index 0b5bdbb..039743d 100644 (file)
@@ -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.
 #include <netinet/ip6.h>
 #endif
 
-#include <netgraph/ng_message.h>
-#include <netgraph/netgraph.h>
-#include <netgraph/ng_parse.h>
-#include <netgraph/ng_fec.h>
+#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);