mbuf.h (90227) | mbuf.h (97681) |
---|---|
1/*- 2 * Copyright (c) 1982, 1986, 1988, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)mbuf.h 8.5 (Berkeley) 2/19/95 | 1/*- 2 * Copyright (c) 1982, 1986, 1988, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)mbuf.h 8.5 (Berkeley) 2/19/95 |
34 * $FreeBSD: head/sys/sys/mbuf.h 90227 2002-02-05 02:00:56Z dillon $ | 34 * $FreeBSD: head/sys/sys/mbuf.h 97681 2002-05-31 22:09:57Z archie $ |
35 */ 36 37#ifndef _SYS_MBUF_H_ 38#define _SYS_MBUF_H_ 39 40/* 41 * Mbufs are of a single size, MSIZE (machine/param.h), which 42 * includes overhead. An mbuf may add a single "mbuf cluster" of size --- 296 unchanged lines hidden (view full) --- 339 */ 340#define MH_ALIGN(m, len) do { \ 341 (m)->m_data += (MHLEN - (len)) & ~(sizeof(long) - 1); \ 342} while (0) 343 344/* 345 * Compute the amount of space available 346 * before the current start of data in an mbuf. | 35 */ 36 37#ifndef _SYS_MBUF_H_ 38#define _SYS_MBUF_H_ 39 40/* 41 * Mbufs are of a single size, MSIZE (machine/param.h), which 42 * includes overhead. An mbuf may add a single "mbuf cluster" of size --- 296 unchanged lines hidden (view full) --- 339 */ 340#define MH_ALIGN(m, len) do { \ 341 (m)->m_data += (MHLEN - (len)) & ~(sizeof(long) - 1); \ 342} while (0) 343 344/* 345 * Compute the amount of space available 346 * before the current start of data in an mbuf. |
347 * 348 * The M_WRITABLE() is a temporary, conservative safety measure: the burden 349 * of checking writability of the mbuf data area rests solely with the caller. |
|
347 */ 348#define M_LEADINGSPACE(m) \ 349 ((m)->m_flags & M_EXT ? \ 350 (M_WRITABLE(m) ? (m)->m_data - (m)->m_ext.ext_buf : 0): \ 351 (m)->m_flags & M_PKTHDR ? (m)->m_data - (m)->m_pktdat : \ 352 (m)->m_data - (m)->m_dat) 353 354/* 355 * Compute the amount of space available 356 * after the end of data in an mbuf. | 350 */ 351#define M_LEADINGSPACE(m) \ 352 ((m)->m_flags & M_EXT ? \ 353 (M_WRITABLE(m) ? (m)->m_data - (m)->m_ext.ext_buf : 0): \ 354 (m)->m_flags & M_PKTHDR ? (m)->m_data - (m)->m_pktdat : \ 355 (m)->m_data - (m)->m_dat) 356 357/* 358 * Compute the amount of space available 359 * after the end of data in an mbuf. |
360 * 361 * The M_WRITABLE() is a temporary, conservative safety measure: the burden 362 * of checking writability of the mbuf data area rests solely with the caller. |
|
357 */ 358#define M_TRAILINGSPACE(m) \ | 363 */ 364#define M_TRAILINGSPACE(m) \ |
359 ((m)->m_flags & M_EXT ? (m)->m_ext.ext_buf + \ 360 (m)->m_ext.ext_size - ((m)->m_data + (m)->m_len) : \ | 365 ((m)->m_flags & M_EXT ? \ 366 (M_WRITABLE(m) ? (m)->m_ext.ext_buf + (m)->m_ext.ext_size \ 367 - ((m)->m_data + (m)->m_len) : 0) : \ |
361 &(m)->m_dat[MLEN] - ((m)->m_data + (m)->m_len)) 362 363/* 364 * Arrange to prepend space of size plen to mbuf m. 365 * If a new mbuf must be allocated, how specifies whether to wait. 366 * If the allocation fails, the original mbuf chain is freed and m is 367 * set to NULL. 368 */ --- 82 unchanged lines hidden --- | 368 &(m)->m_dat[MLEN] - ((m)->m_data + (m)->m_len)) 369 370/* 371 * Arrange to prepend space of size plen to mbuf m. 372 * If a new mbuf must be allocated, how specifies whether to wait. 373 * If the allocation fails, the original mbuf chain is freed and m is 374 * set to NULL. 375 */ --- 82 unchanged lines hidden --- |