diff options
author | des <des@FreeBSD.org> | 2008-10-23 15:53:51 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2008-10-23 15:53:51 +0000 |
commit | 66f807ed8b3634dc73d9f7526c484e43f094c0ee (patch) | |
tree | 21e792ce590e1bcf9b343890605a1b4c6a9016b3 /sys/netgraph/bluetooth | |
parent | a779c60ce0a41cd14710a8a12cfa22955108b27a (diff) | |
download | FreeBSD-src-66f807ed8b3634dc73d9f7526c484e43f094c0ee.zip FreeBSD-src-66f807ed8b3634dc73d9f7526c484e43f094c0ee.tar.gz |
Retire the MALLOC and FREE macros. They are an abomination unto style(9).
MFC after: 3 months
Diffstat (limited to 'sys/netgraph/bluetooth')
-rw-r--r-- | sys/netgraph/bluetooth/drivers/h4/ng_h4.c | 8 | ||||
-rw-r--r-- | sys/netgraph/bluetooth/hci/ng_hci_main.c | 4 | ||||
-rw-r--r-- | sys/netgraph/bluetooth/hci/ng_hci_misc.c | 8 | ||||
-rw-r--r-- | sys/netgraph/bluetooth/l2cap/ng_l2cap_main.c | 4 | ||||
-rw-r--r-- | sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.c | 12 | ||||
-rw-r--r-- | sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.h | 2 | ||||
-rw-r--r-- | sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c | 14 | ||||
-rw-r--r-- | sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c | 8 | ||||
-rw-r--r-- | sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c | 9 | ||||
-rw-r--r-- | sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c | 10 | ||||
-rw-r--r-- | sys/netgraph/bluetooth/socket/ng_btsocket_sco.c | 8 |
11 files changed, 41 insertions, 46 deletions
diff --git a/sys/netgraph/bluetooth/drivers/h4/ng_h4.c b/sys/netgraph/bluetooth/drivers/h4/ng_h4.c index 853a31a..2bf1717 100644 --- a/sys/netgraph/bluetooth/drivers/h4/ng_h4.c +++ b/sys/netgraph/bluetooth/drivers/h4/ng_h4.c @@ -161,7 +161,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); + sc = malloc(sizeof(*sc), M_NETGRAPH_H4, M_NOWAIT|M_ZERO); if (sc == NULL) return (ENOMEM); @@ -187,7 +187,7 @@ ng_h4_open(struct cdev *dev, struct tty *tp) mtx_destroy(&sc->outq.ifq_mtx); bzero(sc, sizeof(*sc)); - FREE(sc, M_NETGRAPH_H4); + free(sc, M_NETGRAPH_H4); return (error); } @@ -204,7 +204,7 @@ ng_h4_open(struct cdev *dev, struct tty *tp) NG_NODE_UNREF(sc->node); mtx_destroy(&sc->outq.ifq_mtx); bzero(sc, sizeof(*sc)); - FREE(sc, M_NETGRAPH_H4); + free(sc, M_NETGRAPH_H4); return (error); } @@ -765,7 +765,7 @@ ng_h4_shutdown(node_p node) NG_NODE_UNREF(node); mtx_destroy(&sc->outq.ifq_mtx); bzero(sc, sizeof(*sc)); - FREE(sc, M_NETGRAPH_H4); + free(sc, M_NETGRAPH_H4); return (0); } /* ng_h4_shutdown */ diff --git a/sys/netgraph/bluetooth/hci/ng_hci_main.c b/sys/netgraph/bluetooth/hci/ng_hci_main.c index 7ea23c8..f6efbb4 100644 --- a/sys/netgraph/bluetooth/hci/ng_hci_main.c +++ b/sys/netgraph/bluetooth/hci/ng_hci_main.c @@ -109,7 +109,7 @@ ng_hci_constructor(node_p node) { ng_hci_unit_p unit = NULL; - MALLOC(unit, ng_hci_unit_p, sizeof(*unit), M_NETGRAPH_HCI, + unit = malloc(sizeof(*unit), M_NETGRAPH_HCI, M_NOWAIT | M_ZERO); if (unit == NULL) return (ENOMEM); @@ -170,7 +170,7 @@ ng_hci_shutdown(node_p node) NG_BT_MBUFQ_DESTROY(&unit->cmdq); bzero(unit, sizeof(*unit)); - FREE(unit, M_NETGRAPH_HCI); + free(unit, M_NETGRAPH_HCI); return (0); } /* ng_hci_shutdown */ diff --git a/sys/netgraph/bluetooth/hci/ng_hci_misc.c b/sys/netgraph/bluetooth/hci/ng_hci_misc.c index d7a185c..252a580 100644 --- a/sys/netgraph/bluetooth/hci/ng_hci_misc.c +++ b/sys/netgraph/bluetooth/hci/ng_hci_misc.c @@ -176,7 +176,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, + n = malloc(sizeof(*n), M_NETGRAPH_HCI, M_NOWAIT | M_ZERO); if (n != NULL) { getmicrotime(&n->updated); @@ -195,7 +195,7 @@ ng_hci_free_neighbor(ng_hci_neighbor_p n) { LIST_REMOVE(n, next); bzero(n, sizeof(*n)); - FREE(n, M_NETGRAPH_HCI); + free(n, M_NETGRAPH_HCI); } /* ng_hci_free_neighbor */ /* @@ -258,7 +258,7 @@ ng_hci_new_con(ng_hci_unit_p unit, int link_type) int num_pkts; static int fake_con_handle = 0x0f00; - MALLOC(con, ng_hci_unit_con_p, sizeof(*con), M_NETGRAPH_HCI, + con = malloc(sizeof(*con), M_NETGRAPH_HCI, M_NOWAIT | M_ZERO); if (con != NULL) { con->unit = unit; @@ -321,7 +321,7 @@ ng_hci_free_con(ng_hci_unit_con_p con) NG_BT_ITEMQ_DESTROY(&con->conq); bzero(con, sizeof(*con)); - FREE(con, M_NETGRAPH_HCI); + free(con, M_NETGRAPH_HCI); } /* ng_hci_free_con */ /* diff --git a/sys/netgraph/bluetooth/l2cap/ng_l2cap_main.c b/sys/netgraph/bluetooth/l2cap/ng_l2cap_main.c index 7d5b300..23c6b01 100644 --- a/sys/netgraph/bluetooth/l2cap/ng_l2cap_main.c +++ b/sys/netgraph/bluetooth/l2cap/ng_l2cap_main.c @@ -113,7 +113,7 @@ ng_l2cap_constructor(node_p node) ng_l2cap_p l2cap = NULL; /* Create new L2CAP node */ - MALLOC(l2cap, ng_l2cap_p, sizeof(*l2cap), + l2cap = malloc(sizeof(*l2cap), M_NETGRAPH_L2CAP, M_NOWAIT|M_ZERO); if (l2cap == NULL) return (ENOMEM); @@ -148,7 +148,7 @@ ng_l2cap_shutdown(node_p node) ng_l2cap_cleanup(l2cap); bzero(l2cap, sizeof(*l2cap)); - FREE(l2cap, M_NETGRAPH_L2CAP); + free(l2cap, M_NETGRAPH_L2CAP); return (0); } /* ng_l2cap_shutdown */ diff --git a/sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.c b/sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.c index 635298a..3791dcd 100644 --- a/sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.c +++ b/sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.c @@ -104,7 +104,7 @@ ng_l2cap_new_con(ng_l2cap_p l2cap, bdaddr_p bdaddr) ng_l2cap_con_p con = NULL; /* Create new connection descriptor */ - MALLOC(con, ng_l2cap_con_p, sizeof(*con), M_NETGRAPH_L2CAP, + con = malloc(sizeof(*con), M_NETGRAPH_L2CAP, M_NOWAIT|M_ZERO); if (con == NULL) return (NULL); @@ -284,7 +284,7 @@ ng_l2cap_free_con(ng_l2cap_con_p con) LIST_REMOVE(con, next); bzero(con, sizeof(*con)); - FREE(con, M_NETGRAPH_L2CAP); + free(con, M_NETGRAPH_L2CAP); } /* ng_l2cap_free_con */ /* @@ -329,7 +329,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, + ch = malloc(sizeof(*ch), M_NETGRAPH_L2CAP, M_NOWAIT|M_ZERO); if (ch == NULL) return (NULL); @@ -357,7 +357,7 @@ ng_l2cap_new_chan(ng_l2cap_p l2cap, ng_l2cap_con_p con, u_int16_t psm) ng_l2cap_con_ref(con); } else { bzero(ch, sizeof(*ch)); - FREE(ch, M_NETGRAPH_L2CAP); + free(ch, M_NETGRAPH_L2CAP); ch = NULL; } @@ -408,7 +408,7 @@ ng_l2cap_free_chan(ng_l2cap_chan_p ch) ng_l2cap_con_unref(ch->con); bzero(ch, sizeof(*ch)); - FREE(ch, M_NETGRAPH_L2CAP); + free(ch, M_NETGRAPH_L2CAP); } /* ng_l2cap_free_chan */ /* @@ -425,7 +425,7 @@ ng_l2cap_new_cmd(ng_l2cap_con_p con, ng_l2cap_chan_p ch, u_int8_t ident, ("%s: %s - invalid channel pointer!\n", __func__, NG_NODE_NAME(con->l2cap->node))); - MALLOC(cmd, ng_l2cap_cmd_p, sizeof(*cmd), M_NETGRAPH_L2CAP, + cmd = malloc(sizeof(*cmd), M_NETGRAPH_L2CAP, M_NOWAIT|M_ZERO); if (cmd == NULL) return (NULL); diff --git a/sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.h b/sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.h index ad97107..22cff48 100644 --- a/sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.h +++ b/sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.h @@ -76,7 +76,7 @@ do { \ KASSERT(!callout_pending(&(cmd)->timo), ("Pending callout!")); \ NG_FREE_M((cmd)->aux); \ bzero((cmd), sizeof(*(cmd))); \ - FREE((cmd), M_NETGRAPH_L2CAP); \ + free((cmd), M_NETGRAPH_L2CAP); \ } while (0) ng_l2cap_cmd_p ng_l2cap_new_cmd (ng_l2cap_con_p, ng_l2cap_chan_p, diff --git a/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c b/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c index 6b30022..8bde536 100644 --- a/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c +++ b/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c @@ -783,14 +783,10 @@ ng_btsocket_hci_raw_init(void) /* * Security filter - * XXX never FREE()ed + * XXX never free()ed */ - - ng_btsocket_hci_raw_sec_filter = NULL; - - MALLOC(ng_btsocket_hci_raw_sec_filter, - struct ng_btsocket_hci_raw_sec_filter *, - sizeof(struct ng_btsocket_hci_raw_sec_filter), + ng_btsocket_hci_raw_sec_filter = + malloc(sizeof(struct ng_btsocket_hci_raw_sec_filter), M_NETGRAPH_BTSOCKET_HCI_RAW, M_NOWAIT|M_ZERO); if (ng_btsocket_hci_raw_sec_filter == NULL) { printf("%s: Could not allocate security filter!\n", __func__); @@ -914,7 +910,7 @@ ng_btsocket_hci_raw_attach(struct socket *so, int proto, struct thread *td) if (error != 0) return (error); - MALLOC(pcb, ng_btsocket_hci_raw_pcb_p, sizeof(*pcb), + pcb = malloc(sizeof(*pcb), M_NETGRAPH_BTSOCKET_HCI_RAW, M_NOWAIT|M_ZERO); if (pcb == NULL) return (ENOMEM); @@ -1493,7 +1489,7 @@ ng_btsocket_hci_raw_detach(struct socket *so) mtx_destroy(&pcb->pcb_mtx); bzero(pcb, sizeof(*pcb)); - FREE(pcb, M_NETGRAPH_BTSOCKET_HCI_RAW); + free(pcb, M_NETGRAPH_BTSOCKET_HCI_RAW); so->so_pcb = NULL; } /* ng_btsocket_hci_raw_detach */ diff --git a/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c b/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c index 11ef1df..b7b42fc 100644 --- a/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c +++ b/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c @@ -1563,7 +1563,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), + rt = malloc(sizeof(*rt), M_NETGRAPH_BTSOCKET_L2CAP, M_NOWAIT|M_ZERO); if (rt == NULL) { mtx_unlock(&ng_btsocket_l2cap_rt_mtx); @@ -1788,7 +1788,7 @@ ng_btsocket_l2cap_rtclean(void *context, int pending) NG_HOOK_UNREF(rt->hook); /* Remove extra reference */ bzero(rt, sizeof(*rt)); - FREE(rt, M_NETGRAPH_BTSOCKET_L2CAP); + free(rt, M_NETGRAPH_BTSOCKET_L2CAP); } rt = rt_next; @@ -1930,7 +1930,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), + pcb = malloc(sizeof(*pcb), M_NETGRAPH_BTSOCKET_L2CAP, M_NOWAIT | M_ZERO); if (pcb == NULL) return (ENOMEM); @@ -2310,7 +2310,7 @@ ng_btsocket_l2cap_detach(struct socket *so) mtx_destroy(&pcb->pcb_mtx); bzero(pcb, sizeof(*pcb)); - FREE(pcb, M_NETGRAPH_BTSOCKET_L2CAP); + free(pcb, M_NETGRAPH_BTSOCKET_L2CAP); soisdisconnected(so); so->so_pcb = NULL; diff --git a/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c b/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c index f7190f7..2d2e006 100644 --- a/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c +++ b/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c @@ -377,8 +377,7 @@ ng_btsocket_l2cap_raw_input(void *context, int pending) rt = (ng_btsocket_l2cap_rtentry_t *) NG_HOOK_PRIVATE(hook); if (rt == NULL) { - MALLOC(rt, ng_btsocket_l2cap_rtentry_p, - sizeof(*rt), + rt = malloc( sizeof(*rt), M_NETGRAPH_BTSOCKET_L2CAP_RAW, M_NOWAIT|M_ZERO); if (rt == NULL) @@ -496,7 +495,7 @@ ng_btsocket_l2cap_raw_rtclean(void *context, int pending) NG_HOOK_UNREF(rt->hook); /* Remove extra reference */ bzero(rt, sizeof(*rt)); - FREE(rt, M_NETGRAPH_BTSOCKET_L2CAP_RAW); + free(rt, M_NETGRAPH_BTSOCKET_L2CAP_RAW); } rt = rt_next; @@ -618,7 +617,7 @@ ng_btsocket_l2cap_raw_attach(struct socket *so, int proto, struct thread *td) return (error); /* Allocate the PCB */ - MALLOC(pcb, ng_btsocket_l2cap_raw_pcb_p, sizeof(*pcb), + pcb = malloc(sizeof(*pcb), M_NETGRAPH_BTSOCKET_L2CAP_RAW, M_NOWAIT|M_ZERO); if (pcb == NULL) return (ENOMEM); @@ -1129,7 +1128,7 @@ ng_btsocket_l2cap_raw_detach(struct socket *so) mtx_destroy(&pcb->pcb_mtx); bzero(pcb, sizeof(*pcb)); - FREE(pcb, M_NETGRAPH_BTSOCKET_L2CAP_RAW); + free(pcb, M_NETGRAPH_BTSOCKET_L2CAP_RAW); so->so_pcb = NULL; } /* ng_btsocket_l2cap_raw_detach */ diff --git a/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c b/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c index a3f344d..0fc1938 100644 --- a/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c +++ b/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c @@ -405,7 +405,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), + pcb = malloc(sizeof(*pcb), M_NETGRAPH_BTSOCKET_RFCOMM, M_NOWAIT | M_ZERO); if (pcb == NULL) return (ENOMEM); @@ -751,7 +751,7 @@ ng_btsocket_rfcomm_detach(struct socket *so) mtx_destroy(&pcb->pcb_mtx); bzero(pcb, sizeof(*pcb)); - FREE(pcb, M_NETGRAPH_BTSOCKET_RFCOMM); + free(pcb, M_NETGRAPH_BTSOCKET_RFCOMM); soisdisconnected(so); so->so_pcb = NULL; @@ -1069,7 +1069,7 @@ ng_btsocket_rfcomm_sessions_task(void *ctx, int pending) mtx_destroy(&s->session_mtx); bzero(s, sizeof(*s)); - FREE(s, M_NETGRAPH_BTSOCKET_RFCOMM); + free(s, M_NETGRAPH_BTSOCKET_RFCOMM); } else mtx_unlock(&s->session_mtx); @@ -1270,7 +1270,7 @@ ng_btsocket_rfcomm_session_create(ng_btsocket_rfcomm_session_p *sp, mtx_assert(&ng_btsocket_rfcomm_sessions_mtx, MA_OWNED); /* Allocate the RFCOMM session */ - MALLOC(s, ng_btsocket_rfcomm_session_p, sizeof(*s), + s = malloc(sizeof(*s), M_NETGRAPH_BTSOCKET_RFCOMM, M_NOWAIT | M_ZERO); if (s == NULL) return (ENOMEM); @@ -1390,7 +1390,7 @@ bad: mtx_destroy(&s->session_mtx); bzero(s, sizeof(*s)); - FREE(s, M_NETGRAPH_BTSOCKET_RFCOMM); + free(s, M_NETGRAPH_BTSOCKET_RFCOMM); return (error); } /* ng_btsocket_rfcomm_session_create */ diff --git a/sys/netgraph/bluetooth/socket/ng_btsocket_sco.c b/sys/netgraph/bluetooth/socket/ng_btsocket_sco.c index ea20759..9dae14a 100644 --- a/sys/netgraph/bluetooth/socket/ng_btsocket_sco.c +++ b/sys/netgraph/bluetooth/socket/ng_btsocket_sco.c @@ -828,7 +828,7 @@ ng_btsocket_sco_default_msg_input(struct ng_mesg *msg, hook_p hook) break; if (rt == NULL) { - MALLOC(rt, ng_btsocket_sco_rtentry_p, sizeof(*rt), + rt = malloc(sizeof(*rt), M_NETGRAPH_BTSOCKET_SCO, M_NOWAIT|M_ZERO); if (rt == NULL) break; @@ -1083,7 +1083,7 @@ ng_btsocket_sco_rtclean(void *context, int pending) NG_HOOK_UNREF(rt->hook); /* Remove extra reference */ bzero(rt, sizeof(*rt)); - FREE(rt, M_NETGRAPH_BTSOCKET_SCO); + free(rt, M_NETGRAPH_BTSOCKET_SCO); } rt = rt_next; @@ -1221,7 +1221,7 @@ ng_btsocket_sco_attach(struct socket *so, int proto, struct thread *td) } /* Allocate the PCB */ - MALLOC(pcb, ng_btsocket_sco_pcb_p, sizeof(*pcb), + pcb = malloc(sizeof(*pcb), M_NETGRAPH_BTSOCKET_SCO, M_NOWAIT | M_ZERO); if (pcb == NULL) return (ENOMEM); @@ -1538,7 +1538,7 @@ ng_btsocket_sco_detach(struct socket *so) mtx_destroy(&pcb->pcb_mtx); bzero(pcb, sizeof(*pcb)); - FREE(pcb, M_NETGRAPH_BTSOCKET_SCO); + free(pcb, M_NETGRAPH_BTSOCKET_SCO); soisdisconnected(so); so->so_pcb = NULL; |