On Mon, Nov 26, 2018 at 11:40:28AM +0100, Claudio Jeker wrote: > Since M_ALIGN and MH_ALIGN are not streight calls to m_align() convert the > users to call directly m_align() so that the macros can be removed at a > later stage. > > This diff has the streight forward bits in it. > There is one extra bit in revarprequest() where I make the function > more like arprequest() by setting m->m_pkthdr.ph_rtableid. This is a bit > more correct like this. > > OK?
OK bluhm@ > Index: kern/uipc_mbuf.c > =================================================================== > RCS file: /cvs/src/sys/kern/uipc_mbuf.c,v > retrieving revision 1.261 > diff -u -p -r1.261 uipc_mbuf.c > --- kern/uipc_mbuf.c 12 Nov 2018 07:45:52 -0000 1.261 > +++ kern/uipc_mbuf.c 12 Nov 2018 08:13:49 -0000 > @@ -618,7 +618,7 @@ m_prepend(struct mbuf *m, int len, int h > M_MOVE_PKTHDR(mn, m); > mn->m_next = m; > m = mn; > - MH_ALIGN(m, len); > + m_align(m, len); > m->m_len = len; > } > if (m->m_flags & M_PKTHDR) > @@ -1057,7 +1057,7 @@ m_split(struct mbuf *m0, int len0, int w > goto extpacket; > if (remain > MHLEN) { > /* m can't be the lead packet */ > - MH_ALIGN(n, 0); > + m_align(n, 0); > n->m_next = m_split(m, len, wait); > if (n->m_next == NULL) { > (void) m_free(n); > @@ -1068,7 +1068,7 @@ m_split(struct mbuf *m0, int len0, int w > return (n); > } > } else > - MH_ALIGN(n, remain); > + m_align(n, remain); > } else if (remain == 0) { > n = m->m_next; > m->m_next = NULL; > @@ -1077,7 +1077,7 @@ m_split(struct mbuf *m0, int len0, int w > MGET(n, wait, m->m_type); > if (n == NULL) > return (NULL); > - M_ALIGN(n, remain); > + m_align(n, remain); > } > extpacket: > if (m->m_flags & M_EXT) { > Index: kern/uipc_socket.c > =================================================================== > RCS file: /cvs/src/sys/kern/uipc_socket.c,v > retrieving revision 1.229 > diff -u -p -r1.229 uipc_socket.c > --- kern/uipc_socket.c 21 Nov 2018 16:50:49 -0000 1.229 > +++ kern/uipc_socket.c 22 Nov 2018 08:56:32 -0000 > @@ -577,7 +577,7 @@ nopages: > * for protocol headers in first mbuf. > */ > if (atomic && m == top && len < mlen - max_hdr) > - MH_ALIGN(m, len); > + m_align(m, len); > } > > error = uiomove(mtod(m, caddr_t), len, uio); > Index: net80211/ieee80211_output.c > =================================================================== > RCS file: /cvs/src/sys/net80211/ieee80211_output.c,v > retrieving revision 1.122 > diff -u -p -r1.122 ieee80211_output.c > --- net80211/ieee80211_output.c 14 Dec 2017 18:52:17 -0000 1.122 > +++ net80211/ieee80211_output.c 12 Nov 2018 08:15:11 -0000 > @@ -1262,7 +1262,7 @@ ieee80211_get_auth(struct ieee80211com * > MGETHDR(m, M_DONTWAIT, MT_DATA); > if (m == NULL) > return NULL; > - MH_ALIGN(m, 2 * 3); > + m_align(m, 2 * 3); > m->m_pkthdr.len = m->m_len = 2 * 3; > > frm = mtod(m, u_int8_t *); > @@ -1286,9 +1286,9 @@ ieee80211_get_deauth(struct ieee80211com > MGETHDR(m, M_DONTWAIT, MT_DATA); > if (m == NULL) > return NULL; > - MH_ALIGN(m, 2); > - > + m_align(m, 2); > m->m_pkthdr.len = m->m_len = 2; > + > *mtod(m, u_int16_t *) = htole16(reason); > > return m; > @@ -1446,9 +1446,9 @@ ieee80211_get_disassoc(struct ieee80211c > MGETHDR(m, M_DONTWAIT, MT_DATA); > if (m == NULL) > return NULL; > - MH_ALIGN(m, 2); > - > + m_align(m, 2); > m->m_pkthdr.len = m->m_len = 2; > + > *mtod(m, u_int16_t *) = htole16(reason); > > return m; > Index: netinet/if_ether.c > =================================================================== > RCS file: /cvs/src/sys/netinet/if_ether.c,v > retrieving revision 1.236 > diff -u -p -r1.236 if_ether.c > --- netinet/if_ether.c 11 Jun 2018 08:48:54 -0000 1.236 > +++ netinet/if_ether.c 12 Nov 2018 09:16:01 -0000 > @@ -246,7 +246,7 @@ arprequest(struct ifnet *ifp, u_int32_t > m->m_pkthdr.len = sizeof(*ea); > m->m_pkthdr.ph_rtableid = ifp->if_rdomain; > m->m_pkthdr.pf.prio = ifp->if_llprio; > - MH_ALIGN(m, sizeof(*ea)); > + m_align(m, sizeof(*ea)); > ea = mtod(m, struct ether_arp *); > eh = (struct ether_header *)sa.sa_data; > memset(ea, 0, sizeof(*ea)); > @@ -873,8 +873,9 @@ revarprequest(struct ifnet *ifp) > return; > m->m_len = sizeof(*ea); > m->m_pkthdr.len = sizeof(*ea); > + m->m_pkthdr.ph_rtableid = ifp->if_rdomain; > m->m_pkthdr.pf.prio = ifp->if_llprio; > - MH_ALIGN(m, sizeof(*ea)); > + m_align(m, sizeof(*ea)); > ea = mtod(m, struct ether_arp *); > eh = (struct ether_header *)sa.sa_data; > memset(ea, 0, sizeof(*ea)); > Index: netinet6/mld6.c > =================================================================== > RCS file: /cvs/src/sys/netinet6/mld6.c,v > retrieving revision 1.55 > diff -u -p -r1.55 mld6.c > --- netinet6/mld6.c 29 Oct 2017 14:56:36 -0000 1.55 > +++ netinet6/mld6.c 12 Nov 2018 08:56:43 -0000 > @@ -418,7 +418,7 @@ mld6_sendpkt(struct in6_multi *in6m, int > mh->m_pkthdr.ph_rtableid = ifp->if_rdomain; > mh->m_pkthdr.len = sizeof(struct ip6_hdr) + sizeof(struct mld_hdr); > mh->m_len = sizeof(struct ip6_hdr); > - MH_ALIGN(mh, sizeof(struct ip6_hdr)); > + m_align(mh, sizeof(struct ip6_hdr)); > > /* fill in the ip6 header */ > ip6 = mtod(mh, struct ip6_hdr *); > Index: nfs/nfs_subs.c > =================================================================== > RCS file: /cvs/src/sys/nfs/nfs_subs.c,v > retrieving revision 1.138 > diff -u -p -r1.138 nfs_subs.c > --- nfs/nfs_subs.c 9 Nov 2018 14:14:32 -0000 1.138 > +++ nfs/nfs_subs.c 12 Nov 2018 08:12:49 -0000 > @@ -583,7 +583,7 @@ nfsm_rpchead(struct nfsreq *req, struct > auth_len = (ngroups << 2) + 5 * NFSX_UNSIGNED; > authsiz = nfsm_rndup(auth_len); > /* The authorization size + the size of the static part */ > - MH_ALIGN(mb, authsiz + 10 * NFSX_UNSIGNED); > + m_align(mb, authsiz + 10 * NFSX_UNSIGNED); > break; > } >