summaryrefslogtreecommitdiffstats
path: root/sys/sys/mbuf.h
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2015-02-17 20:52:51 +0000
committerglebius <glebius@FreeBSD.org>2015-02-17 20:52:51 +0000
commit5a69729fb85fb7828b4cfe73a2d55d52af3a60f4 (patch)
treee02ab80764b545226d4d801e1cca50b3d4b2ca70 /sys/sys/mbuf.h
parentb42715ff599b5c1c22ff6007219090aae17676d8 (diff)
downloadFreeBSD-src-5a69729fb85fb7828b4cfe73a2d55d52af3a60f4.zip
FreeBSD-src-5a69729fb85fb7828b4cfe73a2d55d52af3a60f4.tar.gz
Use anonymous unions and structs to organize shared space in mbuf(9),
instead of preprocessor macros. This will make debugger output of 'print *m' exactly match the names we use in code, making life of a kernel hacker way more pleasant. And this also allows to rename struct_m_ext back to m_ext.
Diffstat (limited to 'sys/sys/mbuf.h')
-rw-r--r--sys/sys/mbuf.h24
1 files changed, 10 insertions, 14 deletions
diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h
index 4729320..11d8297 100644
--- a/sys/sys/mbuf.h
+++ b/sys/sys/mbuf.h
@@ -65,8 +65,8 @@
* they are sensible.
*/
struct mbuf;
-#define MHSIZE offsetof(struct mbuf, M_dat.M_databuf)
-#define MPKTHSIZE offsetof(struct mbuf, M_dat.MH.MH_dat.MH_databuf)
+#define MHSIZE offsetof(struct mbuf, m_dat)
+#define MPKTHSIZE offsetof(struct mbuf, m_pktdat)
#define MLEN ((int)(MSIZE - MHSIZE))
#define MHLEN ((int)(MSIZE - MPKTHSIZE))
#define MINCLSIZE (MHLEN + 1)
@@ -160,7 +160,7 @@ struct pkthdr {
* Compile-time assertions in uipc_mbuf.c test these values to ensure that
* they are correct.
*/
-struct struct_m_ext {
+struct m_ext {
volatile u_int *ext_cnt; /* pointer to ref count info */
caddr_t ext_buf; /* start of buffer */
uint32_t ext_size; /* size of buffer, for ext_free */
@@ -211,19 +211,15 @@ struct mbuf {
*/
union {
struct {
- struct pkthdr MH_pkthdr; /* M_PKTHDR set */
+ struct pkthdr m_pkthdr; /* M_PKTHDR set */
union {
- struct struct_m_ext MH_ext; /* M_EXT set */
- char MH_databuf[0];
- } MH_dat;
- } MH;
- char M_databuf[0]; /* !M_PKTHDR, !M_EXT */
- } M_dat;
+ struct m_ext m_ext; /* M_EXT set */
+ char m_pktdat[0];
+ };
+ };
+ char m_dat[0]; /* !M_PKTHDR, !M_EXT */
+ };
};
-#define m_pkthdr M_dat.MH.MH_pkthdr
-#define m_ext M_dat.MH.MH_dat.MH_ext
-#define m_pktdat M_dat.MH.MH_dat.MH_databuf
-#define m_dat M_dat.M_databuf
/*
* mbuf flags of global significance and layer crossing.
OpenPOWER on IntegriCloud