diff options
author | glebius <glebius@FreeBSD.org> | 2015-02-17 19:32:11 +0000 |
---|---|---|
committer | glebius <glebius@FreeBSD.org> | 2015-02-17 19:32:11 +0000 |
commit | 8de94edb0dafe01ef92c1342b0bbaa3b1c216d61 (patch) | |
tree | bb4b28514b271f3f425d29cb7d6bd92469d15c77 /sys/kern/uipc_mbuf.c | |
parent | 557c602e55ae9ccce10a6ec3f9e9fe16334bdfe1 (diff) | |
download | FreeBSD-src-8de94edb0dafe01ef92c1342b0bbaa3b1c216d61.zip FreeBSD-src-8de94edb0dafe01ef92c1342b0bbaa3b1c216d61.tar.gz |
Use anonymous unions to add possibility to put mbufs into queue(3)
STAILQs and SLISTs using the same structure field as good old m_next
and m_nextpkt linkage occupy.
New code is encouraged to use queue(3) macros, instead of implementing
the wheel. However, better not to have a mixture of old style and
queue(3) in one file or subsystem.
Reviewed by: rwatson, rrs, rpaulo
Differential Revision: D1499
Diffstat (limited to 'sys/kern/uipc_mbuf.c')
-rw-r--r-- | sys/kern/uipc_mbuf.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index 7a5f624..bab8f50 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -120,6 +120,18 @@ CTASSERT(sizeof(struct struct_m_ext) == 28); #endif /* + * Assert that the queue(3) macros produce code of the same size as an old + * plain pointer does. + */ +#ifdef INVARIANTS +static struct mbuf m_assertbuf; +CTASSERT(sizeof(m_assertbuf.m_slist) == sizeof(m_assertbuf.m_next)); +CTASSERT(sizeof(m_assertbuf.m_stailq) == sizeof(m_assertbuf.m_next)); +CTASSERT(sizeof(m_assertbuf.m_slistpkt) == sizeof(m_assertbuf.m_nextpkt)); +CTASSERT(sizeof(m_assertbuf.m_stailqpkt) == sizeof(m_assertbuf.m_nextpkt)); +#endif + +/* * m_get2() allocates minimum mbuf that would fit "size" argument. */ struct mbuf * |