mbuf.h (278914) | mbuf.h (278920) |
---|---|
1/*- 2 * Copyright (c) 1982, 1986, 1988, 1993 3 * The Regents of the University of California. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 14 unchanged lines hidden (view full) --- 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 * 30 * @(#)mbuf.h 8.5 (Berkeley) 2/19/95 | 1/*- 2 * Copyright (c) 1982, 1986, 1988, 1993 3 * The Regents of the University of California. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 14 unchanged lines hidden (view full) --- 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 * 30 * @(#)mbuf.h 8.5 (Berkeley) 2/19/95 |
31 * $FreeBSD: head/sys/sys/mbuf.h 278914 2015-02-17 19:32:11Z glebius $ | 31 * $FreeBSD: head/sys/sys/mbuf.h 278920 2015-02-17 20:52:51Z glebius $ |
32 */ 33 34#ifndef _SYS_MBUF_H_ 35#define _SYS_MBUF_H_ 36 37/* XXX: These includes suck. Sorry! */ 38#include <sys/queue.h> 39#ifdef _KERNEL --- 20 unchanged lines hidden (view full) --- 60 * MLEN is data length in a normal mbuf. 61 * MHLEN is data length in an mbuf with pktheader. 62 * MINCLSIZE is a smallest amount of data that should be put into cluster. 63 * 64 * Compile-time assertions in uipc_mbuf.c test these values to ensure that 65 * they are sensible. 66 */ 67struct mbuf; | 32 */ 33 34#ifndef _SYS_MBUF_H_ 35#define _SYS_MBUF_H_ 36 37/* XXX: These includes suck. Sorry! */ 38#include <sys/queue.h> 39#ifdef _KERNEL --- 20 unchanged lines hidden (view full) --- 60 * MLEN is data length in a normal mbuf. 61 * MHLEN is data length in an mbuf with pktheader. 62 * MINCLSIZE is a smallest amount of data that should be put into cluster. 63 * 64 * Compile-time assertions in uipc_mbuf.c test these values to ensure that 65 * they are sensible. 66 */ 67struct mbuf; |
68#define MHSIZE offsetof(struct mbuf, M_dat.M_databuf) 69#define MPKTHSIZE offsetof(struct mbuf, M_dat.MH.MH_dat.MH_databuf) | 68#define MHSIZE offsetof(struct mbuf, m_dat) 69#define MPKTHSIZE offsetof(struct mbuf, m_pktdat) |
70#define MLEN ((int)(MSIZE - MHSIZE)) 71#define MHLEN ((int)(MSIZE - MPKTHSIZE)) 72#define MINCLSIZE (MHLEN + 1) 73 74#ifdef _KERNEL 75/*- 76 * Macro for type conversion: convert mbuf pointer to data pointer of correct 77 * type: --- 77 unchanged lines hidden (view full) --- 155/* 156 * Description of external storage mapped into mbuf; valid only if M_EXT is 157 * set. 158 * Size ILP32: 28 159 * LP64: 48 160 * Compile-time assertions in uipc_mbuf.c test these values to ensure that 161 * they are correct. 162 */ | 70#define MLEN ((int)(MSIZE - MHSIZE)) 71#define MHLEN ((int)(MSIZE - MPKTHSIZE)) 72#define MINCLSIZE (MHLEN + 1) 73 74#ifdef _KERNEL 75/*- 76 * Macro for type conversion: convert mbuf pointer to data pointer of correct 77 * type: --- 77 unchanged lines hidden (view full) --- 155/* 156 * Description of external storage mapped into mbuf; valid only if M_EXT is 157 * set. 158 * Size ILP32: 28 159 * LP64: 48 160 * Compile-time assertions in uipc_mbuf.c test these values to ensure that 161 * they are correct. 162 */ |
163struct struct_m_ext { | 163struct m_ext { |
164 volatile u_int *ext_cnt; /* pointer to ref count info */ 165 caddr_t ext_buf; /* start of buffer */ 166 uint32_t ext_size; /* size of buffer, for ext_free */ 167 uint32_t ext_type:8, /* type of external storage */ 168 ext_flags:24; /* external storage mbuf flags */ 169 void (*ext_free) /* free routine if not the usual */ 170 (struct mbuf *, void *, void *); 171 void *ext_arg1; /* optional argument pointer */ --- 34 unchanged lines hidden (view full) --- 206 * A set of optional headers (packet header, external storage header) 207 * and internal data storage. Historically, these arrays were sized 208 * to MHLEN (space left after a packet header) and MLEN (space left 209 * after only a regular mbuf header); they are now variable size in 210 * order to support future work on variable-size mbufs. 211 */ 212 union { 213 struct { | 164 volatile u_int *ext_cnt; /* pointer to ref count info */ 165 caddr_t ext_buf; /* start of buffer */ 166 uint32_t ext_size; /* size of buffer, for ext_free */ 167 uint32_t ext_type:8, /* type of external storage */ 168 ext_flags:24; /* external storage mbuf flags */ 169 void (*ext_free) /* free routine if not the usual */ 170 (struct mbuf *, void *, void *); 171 void *ext_arg1; /* optional argument pointer */ --- 34 unchanged lines hidden (view full) --- 206 * A set of optional headers (packet header, external storage header) 207 * and internal data storage. Historically, these arrays were sized 208 * to MHLEN (space left after a packet header) and MLEN (space left 209 * after only a regular mbuf header); they are now variable size in 210 * order to support future work on variable-size mbufs. 211 */ 212 union { 213 struct { |
214 struct pkthdr MH_pkthdr; /* M_PKTHDR set */ | 214 struct pkthdr m_pkthdr; /* M_PKTHDR set */ |
215 union { | 215 union { |
216 struct struct_m_ext MH_ext; /* M_EXT set */ 217 char MH_databuf[0]; 218 } MH_dat; 219 } MH; 220 char M_databuf[0]; /* !M_PKTHDR, !M_EXT */ 221 } M_dat; | 216 struct m_ext m_ext; /* M_EXT set */ 217 char m_pktdat[0]; 218 }; 219 }; 220 char m_dat[0]; /* !M_PKTHDR, !M_EXT */ 221 }; |
222}; | 222}; |
223#define m_pkthdr M_dat.MH.MH_pkthdr 224#define m_ext M_dat.MH.MH_dat.MH_ext 225#define m_pktdat M_dat.MH.MH_dat.MH_databuf 226#define m_dat M_dat.M_databuf | |
227 228/* 229 * mbuf flags of global significance and layer crossing. 230 * Those of only protocol/layer specific significance are to be mapped 231 * to M_PROTO[1-12] and cleared at layer handoff boundaries. 232 * NB: Limited to the lower 24 bits. 233 */ 234#define M_EXT 0x00000001 /* has associated external storage */ --- 973 unchanged lines hidden --- | 223 224/* 225 * mbuf flags of global significance and layer crossing. 226 * Those of only protocol/layer specific significance are to be mapped 227 * to M_PROTO[1-12] and cleared at layer handoff boundaries. 228 * NB: Limited to the lower 24 bits. 229 */ 230#define M_EXT 0x00000001 /* has associated external storage */ --- 973 unchanged lines hidden --- |