summaryrefslogtreecommitdiffstats
path: root/sys/netinet
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2008-10-23 15:53:51 +0000
committerdes <des@FreeBSD.org>2008-10-23 15:53:51 +0000
commit66f807ed8b3634dc73d9f7526c484e43f094c0ee (patch)
tree21e792ce590e1bcf9b343890605a1b4c6a9016b3 /sys/netinet
parenta779c60ce0a41cd14710a8a12cfa22955108b27a (diff)
downloadFreeBSD-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/netinet')
-rw-r--r--sys/netinet/igmp.c2
-rw-r--r--sys/netinet/in_mcast.c38
-rw-r--r--sys/netinet/in_pcb.c4
-rw-r--r--sys/netinet/ip_carp.c18
-rw-r--r--sys/netinet/sctp_os_bsd.h8
-rw-r--r--sys/netinet/tcp_syncache.c3
6 files changed, 34 insertions, 39 deletions
diff --git a/sys/netinet/igmp.c b/sys/netinet/igmp.c
index 10bc50d..d047abe 100644
--- a/sys/netinet/igmp.c
+++ b/sys/netinet/igmp.c
@@ -158,7 +158,7 @@ find_rti(struct ifnet *ifp)
return (rti);
}
}
- MALLOC(rti, struct router_info *, sizeof *rti, M_IGMP, M_NOWAIT);
+ rti = malloc(sizeof *rti, M_IGMP, M_NOWAIT);
if (rti == NULL) {
IGMP_PRINTF("[igmp.c, _find_rti] --> no memory for entry\n");
return (NULL);
diff --git a/sys/netinet/in_mcast.c b/sys/netinet/in_mcast.c
index df841cb..16d92ce 100644
--- a/sys/netinet/in_mcast.c
+++ b/sys/netinet/in_mcast.c
@@ -189,7 +189,7 @@ imo_join_source(struct ip_moptions *imo, size_t gidx, sockunion_t *src)
return (EADDRNOTAVAIL);
/* Do not sleep with inp lock held. */
- MALLOC(nims, struct in_msource *, sizeof(struct in_msource),
+ nims = malloc(sizeof(struct in_msource),
M_IPMSOURCE, M_NOWAIT | M_ZERO);
if (nims == NULL)
return (ENOBUFS);
@@ -220,7 +220,7 @@ imo_leave_source(struct ip_moptions *imo, size_t gidx, sockunion_t *src)
return (EADDRNOTAVAIL);
TAILQ_REMOVE(&imf->imf_sources, ims, ims_next);
- FREE(ims, M_IPMSOURCE);
+ free(ims, M_IPMSOURCE);
imf->imf_nsources--;
return (0);
@@ -734,7 +734,7 @@ inp_freemoptions(struct ip_moptions *imo)
TAILQ_FOREACH_SAFE(ims, &imf->imf_sources,
ims_next, tims) {
TAILQ_REMOVE(&imf->imf_sources, ims, ims_next);
- FREE(ims, M_IPMSOURCE);
+ free(ims, M_IPMSOURCE);
imf->imf_nsources--;
}
KASSERT(imf->imf_nsources == 0,
@@ -817,8 +817,7 @@ inp_get_source_filters(struct inpcb *inp, struct sockopt *sopt)
* has asked for, but we always tell userland how big the
* buffer really needs to be.
*/
- MALLOC(tss, struct sockaddr_storage *,
- sizeof(struct sockaddr_storage) * msfr.msfr_nsrcs,
+ tss = malloc( sizeof(struct sockaddr_storage) * msfr.msfr_nsrcs,
M_TEMP, M_NOWAIT);
if (tss == NULL) {
error = ENOBUFS;
@@ -836,7 +835,7 @@ inp_get_source_filters(struct inpcb *inp, struct sockopt *sopt)
if (tss != NULL) {
error = copyout(tss, msfr.msfr_srcs,
sizeof(struct sockaddr_storage) * msfr.msfr_nsrcs);
- FREE(tss, M_TEMP);
+ free(tss, M_TEMP);
}
if (error)
@@ -1375,7 +1374,7 @@ inp_leave_group(struct inpcb *inp, struct sockopt *sopt)
if (imo->imo_mfilters != NULL) {
TAILQ_FOREACH_SAFE(ims, &imf->imf_sources, ims_next, tims) {
TAILQ_REMOVE(&imf->imf_sources, ims, ims_next);
- FREE(ims, M_IPMSOURCE);
+ free(ims, M_IPMSOURCE);
imf->imf_nsources--;
}
KASSERT(imf->imf_nsources == 0,
@@ -1536,7 +1535,7 @@ inp_set_source_filters(struct inpcb *inp, struct sockopt *sopt)
*/
TAILQ_FOREACH_SAFE(ims, &imf->imf_sources, ims_next, tims) {
TAILQ_REMOVE(&imf->imf_sources, ims, ims_next);
- FREE(ims, M_IPMSOURCE);
+ free(ims, M_IPMSOURCE);
imf->imf_nsources--;
}
KASSERT(imf->imf_nsources == 0,
@@ -1570,13 +1569,12 @@ inp_set_source_filters(struct inpcb *inp, struct sockopt *sopt)
* that we may copy them with a single copyin. This
* allows us to deal with page faults up-front.
*/
- MALLOC(kss, struct sockaddr_storage *,
- sizeof(struct sockaddr_storage) * msfr.msfr_nsrcs,
+ kss = malloc( sizeof(struct sockaddr_storage) * msfr.msfr_nsrcs,
M_TEMP, M_WAITOK);
error = copyin(msfr.msfr_srcs, kss,
sizeof(struct sockaddr_storage) * msfr.msfr_nsrcs);
if (error) {
- FREE(kss, M_TEMP);
+ free(kss, M_TEMP);
return (error);
}
@@ -1616,7 +1614,7 @@ inp_set_source_filters(struct inpcb *inp, struct sockopt *sopt)
break;
}
if (error) {
- FREE(kss, M_TEMP);
+ free(kss, M_TEMP);
return (error);
}
@@ -1625,8 +1623,7 @@ inp_set_source_filters(struct inpcb *inp, struct sockopt *sopt)
* entries we are about to allocate, in case we
* abruptly need to free them.
*/
- MALLOC(pnims, struct in_msource **,
- sizeof(struct in_msource *) * msfr.msfr_nsrcs,
+ pnims = malloc( sizeof(struct in_msource *) * msfr.msfr_nsrcs,
M_TEMP, M_WAITOK | M_ZERO);
/*
@@ -1637,18 +1634,17 @@ inp_set_source_filters(struct inpcb *inp, struct sockopt *sopt)
pkss = kss;
nims = NULL;
for (i = 0; i < msfr.msfr_nsrcs; i++, pkss++) {
- MALLOC(nims, struct in_msource *,
- sizeof(struct in_msource) * msfr.msfr_nsrcs,
+ nims = malloc( sizeof(struct in_msource) * msfr.msfr_nsrcs,
M_IPMSOURCE, M_WAITOK | M_ZERO);
pnims[i] = nims;
}
if (i < msfr.msfr_nsrcs) {
for (j = 0; j < i; j++) {
if (pnims[j] != NULL)
- FREE(pnims[j], M_IPMSOURCE);
+ free(pnims[j], M_IPMSOURCE);
}
- FREE(pnims, M_TEMP);
- FREE(kss, M_TEMP);
+ free(pnims, M_TEMP);
+ free(kss, M_TEMP);
return (ENOBUFS);
}
@@ -1667,8 +1663,8 @@ inp_set_source_filters(struct inpcb *inp, struct sockopt *sopt)
ims_next);
imf->imf_nsources++;
}
- FREE(pnims, M_TEMP);
- FREE(kss, M_TEMP);
+ free(pnims, M_TEMP);
+ free(kss, M_TEMP);
}
/*
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index 45c4798..7732133 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -963,7 +963,7 @@ in_sockaddr(in_port_t port, struct in_addr *addr_p)
{
struct sockaddr_in *sin;
- MALLOC(sin, struct sockaddr_in *, sizeof *sin, M_SONAME,
+ sin = malloc(sizeof *sin, M_SONAME,
M_WAITOK | M_ZERO);
sin->sin_family = AF_INET;
sin->sin_len = sizeof(*sin);
@@ -1301,7 +1301,7 @@ in_pcbinshash(struct inpcb *inp)
* If none exists, malloc one and tack it on.
*/
if (phd == NULL) {
- MALLOC(phd, struct inpcbport *, sizeof(struct inpcbport), M_PCB, M_NOWAIT);
+ phd = malloc(sizeof(struct inpcbport), M_PCB, M_NOWAIT);
if (phd == NULL) {
return (ENOBUFS); /* XXX */
}
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index 25b629d..f93b895 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -388,10 +388,10 @@ carp_clone_create(struct if_clone *ifc, int unit, caddr_t params)
struct carp_softc *sc;
struct ifnet *ifp;
- MALLOC(sc, struct carp_softc *, sizeof(*sc), M_CARP, M_WAITOK|M_ZERO);
+ sc = malloc(sizeof(*sc), M_CARP, M_WAITOK|M_ZERO);
ifp = SC2IFP(sc) = if_alloc(IFT_ETHER);
if (ifp == NULL) {
- FREE(sc, M_CARP);
+ free(sc, M_CARP);
return (ENOSPC);
}
@@ -497,7 +497,7 @@ carpdetach(struct carp_softc *sc, int unlock)
ifpromisc(sc->sc_carpdev, 0);
sc->sc_carpdev->if_carp = NULL;
CARP_LOCK_DESTROY(cif);
- FREE(cif, M_IFADDR);
+ free(cif, M_IFADDR);
} else if (unlock)
CARP_UNLOCK(cif);
sc->sc_carpdev = NULL;
@@ -1512,14 +1512,14 @@ carp_set_addr(struct carp_softc *sc, struct sockaddr_in *sin)
if (!ifp->if_carp) {
- MALLOC(cif, struct carp_if *, sizeof(*cif), M_CARP,
+ cif = malloc(sizeof(*cif), M_CARP,
M_WAITOK|M_ZERO);
if (!cif) {
error = ENOBUFS;
goto cleanup;
}
if ((error = ifpromisc(ifp, 1))) {
- FREE(cif, M_CARP);
+ free(cif, M_CARP);
goto cleanup;
}
@@ -1606,7 +1606,7 @@ carp_del_addr(struct carp_softc *sc, struct sockaddr_in *sin)
if (!--cif->vhif_nvrs) {
sc->sc_carpdev->if_carp = NULL;
CARP_LOCK_DESTROY(cif);
- FREE(cif, M_IFADDR);
+ free(cif, M_IFADDR);
} else {
CARP_UNLOCK(cif);
}
@@ -1702,14 +1702,14 @@ carp_set_addr6(struct carp_softc *sc, struct sockaddr_in6 *sin6)
}
if (!ifp->if_carp) {
- MALLOC(cif, struct carp_if *, sizeof(*cif), M_CARP,
+ cif = malloc(sizeof(*cif), M_CARP,
M_WAITOK|M_ZERO);
if (!cif) {
error = ENOBUFS;
goto cleanup;
}
if ((error = ifpromisc(ifp, 1))) {
- FREE(cif, M_CARP);
+ free(cif, M_CARP);
goto cleanup;
}
@@ -1807,7 +1807,7 @@ carp_del_addr6(struct carp_softc *sc, struct sockaddr_in6 *sin6)
if (!--cif->vhif_nvrs) {
CARP_LOCK_DESTROY(cif);
sc->sc_carpdev->if_carp = NULL;
- FREE(cif, M_IFADDR);
+ free(cif, M_IFADDR);
} else
CARP_UNLOCK(cif);
}
diff --git a/sys/netinet/sctp_os_bsd.h b/sys/netinet/sctp_os_bsd.h
index 9514f7a..8e88139 100644
--- a/sys/netinet/sctp_os_bsd.h
+++ b/sys/netinet/sctp_os_bsd.h
@@ -248,17 +248,17 @@ MALLOC_DECLARE(SCTP_M_SOCKOPT);
*/
#define SCTP_MALLOC(var, type, size, name) \
do { \
- MALLOC(var, type, size, name, M_NOWAIT); \
+ var = (type)malloc(size, name, M_NOWAIT); \
} while (0)
-#define SCTP_FREE(var, type) FREE(var, type)
+#define SCTP_FREE(var, type) free(var, type)
#define SCTP_MALLOC_SONAME(var, type, size) \
do { \
- MALLOC(var, type, size, M_SONAME, M_WAITOK | M_ZERO); \
+ var = (type)malloc(size, M_SONAME, M_WAITOK | M_ZERO); \
} while (0)
-#define SCTP_FREE_SONAME(var) FREE(var, M_SONAME)
+#define SCTP_FREE_SONAME(var) free(var, M_SONAME)
#define SCTP_PROCESS_STRUCT struct proc *
diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c
index b3846ce..d81a24e 100644
--- a/sys/netinet/tcp_syncache.c
+++ b/sys/netinet/tcp_syncache.c
@@ -247,8 +247,7 @@ syncache_init(void)
&V_tcp_syncache.cache_limit);
/* Allocate the hash table. */
- MALLOC(V_tcp_syncache.hashbase, struct syncache_head *,
- V_tcp_syncache.hashsize * sizeof(struct syncache_head),
+ V_tcp_syncache.hashbase = malloc( V_tcp_syncache.hashsize * sizeof(struct syncache_head),
M_SYNCACHE, M_WAITOK | M_ZERO);
/* Initialize the hash buckets. */
OpenPOWER on IntegriCloud