diff options
Diffstat (limited to 'sys/kern/uipc_mbuf.c')
-rw-r--r-- | sys/kern/uipc_mbuf.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index ce00553..6a0e9ba 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -1382,3 +1382,22 @@ nospace: m_freem(m_final); return (NULL); } + +/* + * Set the m_data pointer of a newly-allocated mbuf + * to place an object of the specified size at the + * end of the mbuf, longword aligned. + */ +void +m_align(struct mbuf *m, int len) +{ + int adjust; + + if (m->m_flags & M_EXT) + adjust = m->m_ext.ext_size - len; + else if (m->m_flags & M_PKTHDR) + adjust = MHLEN - len; + else + adjust = MLEN - len; + m->m_data += adjust &~ (sizeof(long)-1); +} |