Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/sys Style, use __nothing, and remove _M_ (unused, appear...
details: https://anonhg.NetBSD.org/src/rev/ac56c5d79b62
branches: trunk
changeset: 995547:ac56c5d79b62
user: maxv <maxv%NetBSD.org@localhost>
date: Thu Dec 27 14:24:11 2018 +0000
description:
Style, use __nothing, and remove _M_ (unused, appears to be a typo). No
functional change.
diffstat:
sys/sys/mbuf.h | 242 ++++++++++++++++++++++++++++----------------------------
1 files changed, 120 insertions(+), 122 deletions(-)
diffs (truncated from 478 to 300 lines):
diff -r 18f1bb15cfb4 -r ac56c5d79b62 sys/sys/mbuf.h
--- a/sys/sys/mbuf.h Thu Dec 27 14:05:54 2018 +0000
+++ b/sys/sys/mbuf.h Thu Dec 27 14:24:11 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mbuf.h,v 1.217 2018/12/27 14:03:55 maxv Exp $ */
+/* $NetBSD: mbuf.h,v 1.218 2018/12/27 14:24:11 maxv Exp $ */
/*
* Copyright (c) 1996, 1997, 1999, 2001, 2007 The NetBSD Foundation, Inc.
@@ -144,13 +144,13 @@
* Macros for type conversion
* mtod(m,t) - convert mbuf pointer to data pointer of correct type
*/
-#define mtod(m, t) ((t)((m)->m_data))
+#define mtod(m, t) ((t)((m)->m_data))
/* header at beginning of each mbuf */
struct m_hdr {
struct mbuf *mh_next; /* next buffer in chain */
struct mbuf *mh_nextpkt; /* next chain in queue/record */
- char *mh_data; /* location of data */
+ char *mh_data; /* location of data */
struct mowner *mh_owner; /* mbuf owner */
int mh_len; /* amount of data in this mbuf */
int mh_flags; /* flags; see below */
@@ -205,19 +205,19 @@
};
/* Checksumming flags (csum_flags). */
-#define M_CSUM_TCPv4 0x00000001 /* TCP header/payload */
-#define M_CSUM_UDPv4 0x00000002 /* UDP header/payload */
-#define M_CSUM_TCP_UDP_BAD 0x00000004 /* TCP/UDP checksum bad */
-#define M_CSUM_DATA 0x00000008 /* consult csum_data */
-#define M_CSUM_TCPv6 0x00000010 /* IPv6 TCP header/payload */
-#define M_CSUM_UDPv6 0x00000020 /* IPv6 UDP header/payload */
-#define M_CSUM_IPv4 0x00000040 /* IPv4 header */
-#define M_CSUM_IPv4_BAD 0x00000080 /* IPv4 header checksum bad */
-#define M_CSUM_TSOv4 0x00000100 /* TCPv4 segmentation offload */
-#define M_CSUM_TSOv6 0x00000200 /* TCPv6 segmentation offload */
+#define M_CSUM_TCPv4 0x00000001 /* TCP header/payload */
+#define M_CSUM_UDPv4 0x00000002 /* UDP header/payload */
+#define M_CSUM_TCP_UDP_BAD 0x00000004 /* TCP/UDP checksum bad */
+#define M_CSUM_DATA 0x00000008 /* consult csum_data */
+#define M_CSUM_TCPv6 0x00000010 /* IPv6 TCP header/payload */
+#define M_CSUM_UDPv6 0x00000020 /* IPv6 UDP header/payload */
+#define M_CSUM_IPv4 0x00000040 /* IPv4 header */
+#define M_CSUM_IPv4_BAD 0x00000080 /* IPv4 header checksum bad */
+#define M_CSUM_TSOv4 0x00000100 /* TCPv4 segmentation offload */
+#define M_CSUM_TSOv6 0x00000200 /* TCPv6 segmentation offload */
/* Checksum-assist quirks: keep separate from jump-table bits. */
-#define M_CSUM_NO_PSEUDOHDR 0x80000000 /* Rx csum_data does not include
+#define M_CSUM_NO_PSEUDOHDR 0x80000000 /* Rx csum_data does not include
* the UDP/TCP pseudo-hdr, and
* is not yet 1s-complemented.
*/
@@ -234,18 +234,18 @@
* words the offset of the UDP/TCP header in the packet.
* _OFFSET: Offset of the checksum field in the UDP/TCP header.
*/
-#define M_CSUM_DATA_IPv4_IPHL(x) ((x) >> 16)
-#define M_CSUM_DATA_IPv4_OFFSET(x) ((x) & 0xffff)
-#define M_CSUM_DATA_IPv6_IPHL(x) ((x) >> 16)
-#define M_CSUM_DATA_IPv6_OFFSET(x) ((x) & 0xffff)
-#define M_CSUM_DATA_IPv6_SET(x, v) (x) = ((x) & 0xffff) | ((v) << 16)
+#define M_CSUM_DATA_IPv4_IPHL(x) ((x) >> 16)
+#define M_CSUM_DATA_IPv4_OFFSET(x) ((x) & 0xffff)
+#define M_CSUM_DATA_IPv6_IPHL(x) ((x) >> 16)
+#define M_CSUM_DATA_IPv6_OFFSET(x) ((x) & 0xffff)
+#define M_CSUM_DATA_IPv6_SET(x, v) (x) = ((x) & 0xffff) | ((v) << 16)
/*
* Max # of pages we can attach to m_ext. This is carefully chosen
* to be able to handle SOSEND_LOAN_CHUNK with our minimum sized page.
*/
#ifdef MIN_PAGE_SIZE
-#define M_EXT_MAXPAGES ((65536 / MIN_PAGE_SIZE) + 1)
+#define M_EXT_MAXPAGES ((65536 / MIN_PAGE_SIZE) + 1)
#endif
/*
@@ -267,8 +267,8 @@
struct vm_page *extun_pgs[M_EXT_MAXPAGES];
#endif
} ext_un;
-#define ext_paddr ext_un.extun_paddr
-#define ext_pgs ext_un.extun_pgs
+#define ext_paddr ext_un.extun_paddr
+#define ext_pgs ext_un.extun_pgs
};
struct _m_ext {
@@ -276,13 +276,13 @@
struct _m_ext_storage ext_storage;
};
-#define M_PADDR_INVALID POOL_PADDR_INVALID
+#define M_PADDR_INVALID POOL_PADDR_INVALID
/*
* Definition of "struct mbuf".
* Don't change this without understanding how MHLEN/MLEN are defined.
*/
-#define MBUF_DEFINE(name, mhlen, mlen) \
+#define MBUF_DEFINE(name, mhlen, mlen) \
struct name { \
struct m_hdr m_hdr; \
union { \
@@ -296,20 +296,20 @@
char M_databuf[(mlen)]; \
} M_dat; \
}
-#define m_next m_hdr.mh_next
-#define m_len m_hdr.mh_len
-#define m_data m_hdr.mh_data
-#define m_owner m_hdr.mh_owner
-#define m_type m_hdr.mh_type
-#define m_flags m_hdr.mh_flags
-#define m_nextpkt m_hdr.mh_nextpkt
-#define m_paddr m_hdr.mh_paddr
-#define m_pkthdr M_dat.MH.MH_pkthdr
-#define m_ext_storage M_dat.MH.MH_dat.MH_ext.ext_storage
-#define m_ext_ref M_dat.MH.MH_dat.MH_ext.ext_ref
-#define m_ext m_ext_ref->m_ext_storage
-#define m_pktdat M_dat.MH.MH_dat.MH_databuf
-#define m_dat M_dat.M_databuf
+#define m_next m_hdr.mh_next
+#define m_len m_hdr.mh_len
+#define m_data m_hdr.mh_data
+#define m_owner m_hdr.mh_owner
+#define m_type m_hdr.mh_type
+#define m_flags m_hdr.mh_flags
+#define m_nextpkt m_hdr.mh_nextpkt
+#define m_paddr m_hdr.mh_paddr
+#define m_pkthdr M_dat.MH.MH_pkthdr
+#define m_ext_storage M_dat.MH.MH_dat.MH_ext.ext_storage
+#define m_ext_ref M_dat.MH.MH_dat.MH_ext.ext_ref
+#define m_ext m_ext_ref->m_ext_storage
+#define m_pktdat M_dat.MH.MH_dat.MH_databuf
+#define m_dat M_dat.M_databuf
/*
* Dummy mbuf structure to calculate the right values for MLEN/MHLEN, taking
@@ -318,11 +318,11 @@
MBUF_DEFINE(_mbuf_dummy, 1, 1);
/* normal data len */
-#define MLEN (MSIZE - offsetof(struct _mbuf_dummy, m_dat))
+#define MLEN (MSIZE - offsetof(struct _mbuf_dummy, m_dat))
/* data len w/pkthdr */
-#define MHLEN (MSIZE - offsetof(struct _mbuf_dummy, m_pktdat))
+#define MHLEN (MSIZE - offsetof(struct _mbuf_dummy, m_pktdat))
-#define MINCLSIZE (MHLEN+MLEN+1) /* smallest amount to put in cluster */
+#define MINCLSIZE (MHLEN+MLEN+1) /* smallest amount to put in cluster */
/*
* The *real* struct mbuf
@@ -330,40 +330,40 @@
MBUF_DEFINE(mbuf, MHLEN, MLEN);
/* mbuf flags */
-#define M_EXT 0x00000001 /* has associated external storage */
-#define M_PKTHDR 0x00000002 /* start of record */
-#define M_EOR 0x00000004 /* end of record */
-#define M_PROTO1 0x00000008 /* protocol-specific */
+#define M_EXT 0x00000001 /* has associated external storage */
+#define M_PKTHDR 0x00000002 /* start of record */
+#define M_EOR 0x00000004 /* end of record */
+#define M_PROTO1 0x00000008 /* protocol-specific */
/* mbuf pkthdr flags, also in m_flags */
-#define M_AUTHIPHDR 0x00000010 /* authenticated (IPsec) */
-#define M_DECRYPTED 0x00000020 /* decrypted (IPsec) */
-#define M_LOOP 0x00000040 /* received on loopback */
-#define M_BCAST 0x00000100 /* send/received as L2 broadcast */
-#define M_MCAST 0x00000200 /* send/received as L2 multicast */
-#define M_CANFASTFWD 0x00000400 /* packet can be fast-forwarded */
-#define M_ANYCAST6 0x00000800 /* received as IPv6 anycast */
+#define M_AUTHIPHDR 0x00000010 /* authenticated (IPsec) */
+#define M_DECRYPTED 0x00000020 /* decrypted (IPsec) */
+#define M_LOOP 0x00000040 /* received on loopback */
+#define M_BCAST 0x00000100 /* send/received as L2 broadcast */
+#define M_MCAST 0x00000200 /* send/received as L2 multicast */
+#define M_CANFASTFWD 0x00000400 /* packet can be fast-forwarded */
+#define M_ANYCAST6 0x00000800 /* received as IPv6 anycast */
-#define M_LINK0 0x00001000 /* link layer specific flag */
-#define M_LINK1 0x00002000 /* link layer specific flag */
-#define M_LINK2 0x00004000 /* link layer specific flag */
-#define M_LINK3 0x00008000 /* link layer specific flag */
-#define M_LINK4 0x00010000 /* link layer specific flag */
-#define M_LINK5 0x00020000 /* link layer specific flag */
-#define M_LINK6 0x00040000 /* link layer specific flag */
-#define M_LINK7 0x00080000 /* link layer specific flag */
+#define M_LINK0 0x00001000 /* link layer specific flag */
+#define M_LINK1 0x00002000 /* link layer specific flag */
+#define M_LINK2 0x00004000 /* link layer specific flag */
+#define M_LINK3 0x00008000 /* link layer specific flag */
+#define M_LINK4 0x00010000 /* link layer specific flag */
+#define M_LINK5 0x00020000 /* link layer specific flag */
+#define M_LINK6 0x00040000 /* link layer specific flag */
+#define M_LINK7 0x00080000 /* link layer specific flag */
-#define M_VLANTAG 0x00100000 /* ether_vtag is valid */
+#define M_VLANTAG 0x00100000 /* ether_vtag is valid */
/* additional flags for M_EXT mbufs */
-#define M_EXT_FLAGS 0xff000000
-#define M_EXT_CLUSTER 0x01000000 /* ext is a cluster */
-#define M_EXT_PAGES 0x02000000 /* ext_pgs is valid */
-#define M_EXT_ROMAP 0x04000000 /* ext mapping is r-o at MMU */
-#define M_EXT_RW 0x08000000 /* ext storage is writable */
+#define M_EXT_FLAGS 0xff000000
+#define M_EXT_CLUSTER 0x01000000 /* ext is a cluster */
+#define M_EXT_PAGES 0x02000000 /* ext_pgs is valid */
+#define M_EXT_ROMAP 0x04000000 /* ext mapping is r-o at MMU */
+#define M_EXT_RW 0x08000000 /* ext storage is writable */
/* for source-level compatibility */
-#define M_NOTIFICATION M_PROTO1
+#define M_NOTIFICATION M_PROTO1
#define M_FLAGS_BITS \
"\20\1EXT\2PKTHDR\3EOR\4PROTO1\5AUTHIPHDR\6DECRYPTED\7LOOP\10NONE" \
@@ -373,20 +373,20 @@
"\31EXT_CLUSTER\32EXT_PAGES\33EXT_ROMAP\34EXT_RW"
/* flags copied when copying m_pkthdr */
-#define M_COPYFLAGS (M_PKTHDR|M_EOR|M_BCAST|M_MCAST|M_CANFASTFWD| \
+#define M_COPYFLAGS (M_PKTHDR|M_EOR|M_BCAST|M_MCAST|M_CANFASTFWD| \
M_ANYCAST6|M_LINK0|M_LINK1|M_LINK2|M_AUTHIPHDR|M_DECRYPTED|M_LOOP| \
M_VLANTAG)
/* flag copied when shallow-copying external storage */
-#define M_EXTCOPYFLAGS (M_EXT|M_EXT_FLAGS)
+#define M_EXTCOPYFLAGS (M_EXT|M_EXT_FLAGS)
/* mbuf types */
-#define MT_FREE 0 /* should be on free list */
-#define MT_DATA 1 /* dynamic (data) allocation */
-#define MT_HEADER 2 /* packet header */
-#define MT_SONAME 3 /* socket name */
-#define MT_SOOPTS 4 /* socket options */
-#define MT_FTABLE 5 /* fragment reassembly header */
+#define MT_FREE 0 /* should be on free list */
+#define MT_DATA 1 /* dynamic (data) allocation */
+#define MT_HEADER 2 /* packet header */
+#define MT_SONAME 3 /* socket name */
+#define MT_SOOPTS 4 /* socket options */
+#define MT_FTABLE 5 /* fragment reassembly header */
#define MT_CONTROL 6 /* extra-data protocol message */
#define MT_OOBDATA 7 /* expedited data */
@@ -406,13 +406,11 @@
#endif
/* flags to m_get/MGET */
-#define M_DONTWAIT M_NOWAIT
-#define M_WAIT M_WAITOK
+#define M_DONTWAIT M_NOWAIT
+#define M_WAIT M_WAITOK
#ifdef MBUFTRACE
-/*
- * mbuf allocation tracing
- */
+/* Mbuf allocation tracing. */
void mowner_init(struct mbuf *, int);
void mowner_ref(struct mbuf *, int);
void m_claim(struct mbuf *, struct mowner *);
@@ -421,18 +419,18 @@
void mowner_detach(struct mowner *);
void m_claimm(struct mbuf *, struct mowner *);
#else
-#define mowner_init(m, type) do { } while (/* CONSTCOND */ 0)
-#define mowner_ref(m, flags) do { } while (/* CONSTCOND */ 0)
-#define mowner_revoke(m, all, flags) do { } while (/* CONSTCOND */ 0)
-#define m_claim(m, mowner) do { } while (/* CONSTCOND */ 0)
-#define mowner_attach(mo) do { } while (/* CONSTCOND */ 0)
-#define mowner_detach(mo) do { } while (/* CONSTCOND */ 0)
-#define m_claimm(m, mo) do { } while (/* CONSTCOND */ 0)
+#define mowner_init(m, type) __nothing
+#define mowner_ref(m, flags) __nothing
+#define mowner_revoke(m, all, flags) __nothing
+#define m_claim(m, mowner) __nothing
+#define mowner_attach(mo) __nothing
+#define mowner_detach(mo) __nothing
+#define m_claimm(m, mo) __nothing
#endif
-#define MCLAIM(m, mo) m_claim((m), (mo))
-#define MOWNER_ATTACH(mo) mowner_attach(mo)
-#define MOWNER_DETACH(mo) mowner_detach(mo)
+#define MCLAIM(m, mo) m_claim((m), (mo))
+#define MOWNER_ATTACH(mo) mowner_attach(mo)
+#define MOWNER_DETACH(mo) mowner_detach(mo)
/*
* mbuf allocation/deallocation macros:
Home |
Main Index |
Thread Index |
Old Index