diff options
author | Sam Leffler <sam@FreeBSD.org> | 2005-07-30 01:32:16 +0000 |
---|---|---|
committer | Sam Leffler <sam@FreeBSD.org> | 2005-07-30 01:32:16 +0000 |
commit | ab8ab90c5b5b5ca4a2072db8fb22fcfbed08b74c (patch) | |
tree | 2f8c453affdad041103ee8c4deb9a82d903fc6b1 /sys/kern/uipc_mbuf.c | |
parent | e29c976a589c22346361146f75b33548c892b0a7 (diff) | |
download | src-ab8ab90c5b5b5ca4a2072db8fb22fcfbed08b74c.tar.gz src-ab8ab90c5b5b5ca4a2072db8fb22fcfbed08b74c.zip |
Notes
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 ce00553f0ff5..6a0e9ba34f4c 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); +} |