Use m_get/m_gethdr instead of compat macros.

Sponsored by:	Nginx, Inc.
This commit is contained in:
Gleb Smirnoff 2013-03-15 12:55:30 +00:00
parent 39f6074e2e
commit dc4ad05ecd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=248324
10 changed files with 16 additions and 22 deletions

View File

@ -656,13 +656,9 @@ ndis_ptom(m0, p)
for (buf = priv->npp_head; buf != NULL; buf = buf->mdl_next) {
if (buf == priv->npp_head)
#ifdef MT_HEADER
MGETHDR(m, M_NOWAIT, MT_HEADER);
#else
MGETHDR(m, M_NOWAIT, MT_DATA);
#endif
m = m_gethdr(M_NOWAIT, MT_DATA);
else
MGET(m, M_NOWAIT, MT_DATA);
m = m_get(M_NOWAIT, MT_DATA);
if (m == NULL) {
m_freem(*m0);
*m0 = NULL;

View File

@ -234,7 +234,7 @@ bstp_transmit_tcn(struct bstp_state *bs, struct bstp_port *bp)
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
return;
MGETHDR(m, M_NOWAIT, MT_DATA);
m = m_gethdr(M_NOWAIT, MT_DATA);
if (m == NULL)
return;
@ -348,7 +348,7 @@ bstp_send_bpdu(struct bstp_state *bs, struct bstp_port *bp,
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
return;
MGETHDR(m, M_NOWAIT, MT_DATA);
m = m_gethdr(M_NOWAIT, MT_DATA);
if (m == NULL)
return;

View File

@ -384,8 +384,7 @@ gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
mob_h.hcrc = gre_in_cksum((u_int16_t *)&mob_h, msiz);
if ((m->m_data - msiz) < m->m_pktdat) {
/* need new mbuf */
MGETHDR(m0, M_NOWAIT, MT_DATA);
m0 = m_gethdr(M_NOWAIT, MT_DATA);
if (m0 == NULL) {
_IF_DROP(&ifp->if_snd);
m_freem(m);

View File

@ -764,7 +764,7 @@ carp_send_ad_locked(struct carp_softc *sc)
if (sc->sc_naddrs) {
struct ip *ip;
MGETHDR(m, M_NOWAIT, MT_HEADER);
m = m_gethdr(M_NOWAIT, MT_DATA);
if (m == NULL) {
CARPSTATS_INC(carps_onomem);
goto resched;
@ -832,7 +832,7 @@ carp_send_ad_locked(struct carp_softc *sc)
if (sc->sc_naddrs6) {
struct ip6_hdr *ip6;
MGETHDR(m, M_NOWAIT, MT_HEADER);
m = m_gethdr(M_NOWAIT, MT_DATA);
if (m == NULL) {
CARPSTATS_INC(carps_onomem);
goto resched;

View File

@ -1406,7 +1406,7 @@ ip_forward(struct mbuf *m, int srcrt)
* assume exclusive access to the IP header in `m', so any
* data in a cluster may change before we reach icmp_error().
*/
MGETHDR(mcopy, M_NOWAIT, m->m_type);
mcopy = m_gethdr(M_NOWAIT, m->m_type);
if (mcopy != NULL && !m_dup_pkthdr(mcopy, m, M_NOWAIT)) {
/*
* It's probably ok if the pkthdr dup fails (because

View File

@ -2083,13 +2083,12 @@ bw_upcalls_send(void)
* Allocate a new mbuf, initialize it with the header and
* the payload for the pending calls.
*/
MGETHDR(m, M_NOWAIT, MT_DATA);
m = m_gethdr(M_NOWAIT, MT_DATA);
if (m == NULL) {
log(LOG_WARNING, "bw_upcalls_send: cannot allocate mbuf\n");
return;
}
m->m_len = m->m_pkthdr.len = 0;
m_copyback(m, 0, sizeof(struct igmpmsg), (caddr_t)&igmpmsg);
m_copyback(m, sizeof(struct igmpmsg), len, (caddr_t)&V_bw_upcalls[0]);
@ -2430,7 +2429,7 @@ pim_register_send_upcall(struct ip *ip, struct vif *vifp,
/*
* Add a new mbuf with an upcall header
*/
MGETHDR(mb_first, M_NOWAIT, MT_DATA);
mb_first = m_gethdr(M_NOWAIT, MT_DATA);
if (mb_first == NULL) {
m_freem(mb_copy);
return ENOBUFS;
@ -2488,7 +2487,7 @@ pim_register_send_rp(struct ip *ip, struct vif *vifp, struct mbuf *mb_copy,
/*
* Add a new mbuf with the encapsulating header
*/
MGETHDR(mb_first, M_NOWAIT, MT_DATA);
mb_first = m_gethdr(M_NOWAIT, MT_DATA);
if (mb_first == NULL) {
m_freem(mb_copy);
return ENOBUFS;

View File

@ -495,7 +495,7 @@ ip_insertoptions(struct mbuf *m, struct mbuf *opt, int *phlen)
if (p->ipopt_dst.s_addr)
ip->ip_dst = p->ipopt_dst;
if (m->m_flags & M_EXT || m->m_data - optlen < m->m_pktdat) {
MGETHDR(n, M_NOWAIT, MT_DATA);
n = m_gethdr(M_NOWAIT, MT_DATA);
if (n == NULL) {
*phlen = 0;
return (m);

View File

@ -784,7 +784,7 @@ ip_fragment(struct ip *ip, struct mbuf **m_frag, int mtu,
struct mbuf *m;
int mhlen = sizeof (struct ip);
MGETHDR(m, M_NOWAIT, MT_DATA);
m = m_gethdr(M_NOWAIT, MT_DATA);
if (m == NULL) {
error = ENOBUFS;
IPSTAT_INC(ips_odropped);
@ -951,7 +951,7 @@ ip_ctloutput(struct socket *so, struct sockopt *sopt)
error = EMSGSIZE;
break;
}
MGET(m, sopt->sopt_td ? M_WAITOK : M_NOWAIT, MT_DATA);
m = m_get(sopt->sopt_td ? M_WAITOK : M_NOWAIT, MT_DATA);
if (m == NULL) {
error = ENOBUFS;
break;

View File

@ -1860,7 +1860,7 @@ ipsec_hdrsiz_tcp(struct tcpcb *tp)
if ((tp == NULL) || ((inp = tp->t_inpcb) == NULL))
return (0);
MGETHDR(m, M_NOWAIT, MT_DATA);
m = m_gethdr(M_NOWAIT, MT_DATA);
if (!m)
return (0);

View File

@ -2168,7 +2168,7 @@ pf_send_tcp(struct mbuf *replyto, const struct pf_rule *r, sa_family_t af,
pfse = malloc(sizeof(*pfse), M_PFTEMP, M_NOWAIT);
if (pfse == NULL)
return;
m = m_gethdr(M_NOWAIT, MT_HEADER);
m = m_gethdr(M_NOWAIT, MT_DATA);
if (m == NULL) {
free(pfse, M_PFTEMP);
return;