summaryrefslogtreecommitdiffstats
path: root/sys/sys/mbuf.h
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2015-02-17 19:32:11 +0000
committerglebius <glebius@FreeBSD.org>2015-02-17 19:32:11 +0000
commit8de94edb0dafe01ef92c1342b0bbaa3b1c216d61 (patch)
treebb4b28514b271f3f425d29cb7d6bd92469d15c77 /sys/sys/mbuf.h
parent557c602e55ae9ccce10a6ec3f9e9fe16334bdfe1 (diff)
downloadFreeBSD-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/sys/mbuf.h')
-rw-r--r--sys/sys/mbuf.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h
index 2e94d2a..4729320 100644
--- a/sys/sys/mbuf.h
+++ b/sys/sys/mbuf.h
@@ -184,8 +184,16 @@ struct mbuf {
* Compile-time assertions in uipc_mbuf.c test these values to ensure
* that they are correct.
*/
- struct mbuf *m_next; /* next buffer in chain */
- struct mbuf *m_nextpkt; /* next chain in queue/record */
+ union { /* next buffer in chain */
+ struct mbuf *m_next;
+ SLIST_ENTRY(mbuf) m_slist;
+ STAILQ_ENTRY(mbuf) m_stailq;
+ };
+ union { /* next chain in queue/record */
+ struct mbuf *m_nextpkt;
+ SLIST_ENTRY(mbuf) m_slistpkt;
+ STAILQ_ENTRY(mbuf) m_stailqpkt;
+ };
caddr_t m_data; /* location of data */
int32_t m_len; /* amount of data in this mbuf */
uint32_t m_type:8, /* type of data in this mbuf */
OpenPOWER on IntegriCloud