diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2018-11-09 14:14:33 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2018-11-09 14:14:33 +0000 |
commit | d88cc6469042c405baedcb17b7058f99c72287c2 (patch) | |
tree | f562b108426adf6be5f524205424d1883bbb4cc5 /sys/net | |
parent | 1d8b1ac67aa3da258b770c8cbe93971237189152 (diff) |
M_LEADINGSPACE() and M_TRAILINGSPACE() are just wrappers for
m_leadingspace() and m_trailingspace(). Convert all callers to call
directly the functions and remove the defines.
OK krw@, mpi@
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/bsd-comp.c | 10 | ||||
-rw-r--r-- | sys/net/if_ppp.c | 7 | ||||
-rw-r--r-- | sys/net/ppp-deflate.c | 10 | ||||
-rw-r--r-- | sys/net/ppp_tty.c | 4 | ||||
-rw-r--r-- | sys/net/switchctl.c | 6 |
5 files changed, 18 insertions, 19 deletions
diff --git a/sys/net/bsd-comp.c b/sys/net/bsd-comp.c index fa4dfe2773c..16aeae4409a 100644 --- a/sys/net/bsd-comp.c +++ b/sys/net/bsd-comp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bsd-comp.c,v 1.15 2017/09/08 05:36:53 deraadt Exp $ */ +/* $OpenBSD: bsd-comp.c,v 1.16 2018/11/09 14:14:31 claudio Exp $ */ /* $NetBSD: bsd-comp.c,v 1.6 1996/10/13 02:10:58 christos Exp $ */ /* Because this code is derived from the 4.3BSD compress source: @@ -499,7 +499,7 @@ bsd_compress(state, mret, mp, slen, maxolen) if (maxolen - olen > MLEN) \ MCLGET(m, M_DONTWAIT); \ wptr = mtod(m, u_char *); \ - cp_end = wptr + M_TRAILINGSPACE(m); \ + cp_end = wptr + m_trailingspace(m); \ } else \ wptr = NULL; \ } \ @@ -542,7 +542,7 @@ bsd_compress(state, mret, mp, slen, maxolen) MCLGET(m, M_DONTWAIT); m->m_data += db->hdrlen; wptr = mtod(m, u_char *); - cp_end = wptr + M_TRAILINGSPACE(m); + cp_end = wptr + m_trailingspace(m); } else wptr = cp_end = NULL; @@ -876,7 +876,7 @@ bsd_decompress(state, cmp, dmpp) MCLGET(dmp, M_DONTWAIT); dmp->m_data += db->hdrlen; wptr = mtod(dmp, u_char *); - space = M_TRAILINGSPACE(dmp) - PPP_HDRLEN + 1; + space = m_trailingspace(dmp) - PPP_HDRLEN + 1; /* * Fill in the ppp header, but not the last byte of the protocol @@ -988,7 +988,7 @@ bsd_decompress(state, cmp, dmpp) m->m_next = NULL; dmp->m_next = m; MCLGET(m, M_DONTWAIT); - space = M_TRAILINGSPACE(m) - (codelen + extra); + space = m_trailingspace(m) - (codelen + extra); if (space < 0) { /* now that's what I call *compression*. */ m_freem(mret); diff --git a/sys/net/if_ppp.c b/sys/net/if_ppp.c index 5c2ad53602d..192ec7c91e0 100644 --- a/sys/net/if_ppp.c +++ b/sys/net/if_ppp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ppp.c,v 1.111 2018/02/19 08:59:52 mpi Exp $ */ +/* $OpenBSD: if_ppp.c,v 1.112 2018/11/09 14:14:31 claudio Exp $ */ /* $NetBSD: if_ppp.c,v 1.39 1997/05/17 21:11:59 christos Exp $ */ /* @@ -700,7 +700,6 @@ pppoutput(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst, /* * Add PPP header. If no space in first mbuf, allocate another. - * (This assumes M_LEADINGSPACE is always 0 for a cluster mbuf.) */ M_PREPEND(m0, PPP_HDRLEN, M_DONTWAIT); if (m0 == NULL) { @@ -1279,7 +1278,7 @@ ppp_inproc(struct ppp_softc *sc, struct mbuf *m) mp->m_next = NULL; if (hlen + PPP_HDRLEN > MHLEN) { MCLGET(mp, M_DONTWAIT); - if (M_TRAILINGSPACE(mp) < hlen + PPP_HDRLEN) { + if (m_trailingspace(mp) < hlen + PPP_HDRLEN) { m_freem(mp); /* lose if big headers and no clusters */ goto bad; @@ -1302,7 +1301,7 @@ ppp_inproc(struct ppp_softc *sc, struct mbuf *m) */ m->m_data += PPP_HDRLEN + xlen; m->m_len -= PPP_HDRLEN + xlen; - if (m->m_len <= M_TRAILINGSPACE(mp)) { + if (m->m_len <= m_trailingspace(mp)) { bcopy(mtod(m, u_char *), mtod(mp, u_char *) + mp->m_len, m->m_len); mp->m_len += m->m_len; diff --git a/sys/net/ppp-deflate.c b/sys/net/ppp-deflate.c index 384e30a0f8e..05bdb5d2aa0 100644 --- a/sys/net/ppp-deflate.c +++ b/sys/net/ppp-deflate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ppp-deflate.c,v 1.14 2017/09/08 05:36:53 deraadt Exp $ */ +/* $OpenBSD: ppp-deflate.c,v 1.15 2018/11/09 14:14:31 claudio Exp $ */ /* $NetBSD: ppp-deflate.c,v 1.1 1996/03/15 02:28:09 paulus Exp $ */ /* @@ -258,7 +258,7 @@ z_compress(arg, mret, mp, orig_len, maxolen) m->m_len = 0; if (maxolen + state->hdrlen > MLEN) MCLGET(m, M_DONTWAIT); - wspace = M_TRAILINGSPACE(m); + wspace = m_trailingspace(m); if (state->hdrlen + PPP_HDRLEN + 2 < wspace) { m->m_data += state->hdrlen; wspace -= state->hdrlen; @@ -319,7 +319,7 @@ z_compress(arg, mret, mp, orig_len, maxolen) if (maxolen - olen > MLEN) MCLGET(m, M_DONTWAIT); state->strm.next_out = mtod(m, u_char *); - state->strm.avail_out = wspace = M_TRAILINGSPACE(m); + state->strm.avail_out = wspace = m_trailingspace(m); } } if (m == NULL) { @@ -518,7 +518,7 @@ z_decompress(arg, mi, mop) mo->m_len = 0; mo->m_next = NULL; MCLGET(mo, M_DONTWAIT); - ospace = M_TRAILINGSPACE(mo); + ospace = m_trailingspace(mo); if (state->hdrlen + PPP_HDRLEN < ospace) { mo->m_data += state->hdrlen; ospace -= state->hdrlen; @@ -594,7 +594,7 @@ z_decompress(arg, mi, mop) } MCLGET(mo, M_DONTWAIT); state->strm.next_out = mtod(mo, u_char *); - state->strm.avail_out = ospace = M_TRAILINGSPACE(mo); + state->strm.avail_out = ospace = m_trailingspace(mo); } } } diff --git a/sys/net/ppp_tty.c b/sys/net/ppp_tty.c index 0fda9199fc5..2bd7d37d68e 100644 --- a/sys/net/ppp_tty.c +++ b/sys/net/ppp_tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ppp_tty.c,v 1.50 2018/05/15 09:21:52 mikeb Exp $ */ +/* $OpenBSD: ppp_tty.c,v 1.51 2018/11/09 14:14:31 claudio Exp $ */ /* $NetBSD: ppp_tty.c,v 1.12 1997/03/24 21:23:10 christos Exp $ */ /* @@ -358,7 +358,7 @@ pppwrite(struct tty *tp, struct uio *uio, int flag) m->m_len = 0; if (uio->uio_resid >= MCLBYTES / 2) MCLGET(m, M_DONTWAIT); - len = M_TRAILINGSPACE(m); + len = m_trailingspace(m); if (len > uio->uio_resid) len = uio->uio_resid; if ((error = uiomove(mtod(m, u_char *), len, uio)) != 0) { diff --git a/sys/net/switchctl.c b/sys/net/switchctl.c index 9365260ad52..c1f67416d38 100644 --- a/sys/net/switchctl.c +++ b/sys/net/switchctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: switchctl.c,v 1.12 2017/08/11 21:24:19 mpi Exp $ */ +/* $OpenBSD: switchctl.c,v 1.13 2018/11/09 14:14:31 claudio Exp $ */ /* * Copyright (c) 2016 Kazuya GODA <goda@openbsd.org> @@ -226,7 +226,7 @@ switchwrite(dev_t dev, struct uio *uio, int ioflag) } mhead = m; - /* M_TRAILINGSPACE() uses this to calculate space. */ + /* m_trailingspace() uses this to calculate space. */ m->m_len = 0; } else { /* Recover the mbuf from the last write and get its tail. */ @@ -238,7 +238,7 @@ switchwrite(dev_t dev, struct uio *uio, int ioflag) } while (len) { - trailing = ulmin(M_TRAILINGSPACE(m), len); + trailing = ulmin(m_trailingspace(m), len); if ((error = uiomove(mtod(m, caddr_t), trailing, uio)) != 0) goto save_return; |