The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/sys/mchain.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
    3  *
    4  * Copyright (c) 2000, 2001 Boris Popov
    5  * All rights reserved.
    6  *
    7  * Redistribution and use in source and binary forms, with or without
    8  * modification, are permitted provided that the following conditions
    9  * are met:
   10  * 1. Redistributions of source code must retain the above copyright
   11  *    notice, this list of conditions and the following disclaimer.
   12  * 2. Redistributions in binary form must reproduce the above copyright
   13  *    notice, this list of conditions and the following disclaimer in the
   14  *    documentation and/or other materials provided with the distribution.
   15  *
   16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   20  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   22  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   24  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   26  * SUCH DAMAGE.
   27  *
   28  * $FreeBSD: head/sys/sys/mchain.h 326256 2017-11-27 15:01:59Z pfg $
   29  */
   30 #ifndef _SYS_MCHAIN_H_
   31 #define _SYS_MCHAIN_H_
   32 
   33 #ifdef _KERNEL
   34 
   35 /*
   36  * Type of copy for mb_{put|get}_mem()
   37  */
   38 #define MB_MSYSTEM      0               /* use bcopy() */
   39 #define MB_MUSER        1               /* use copyin()/copyout() */
   40 #define MB_MINLINE      2               /* use an inline copy loop */
   41 #define MB_MZERO        3               /* bzero(), mb_put_mem only */
   42 #define MB_MCUSTOM      4               /* use an user defined function */
   43 
   44 struct mbuf;
   45 struct mbchain;
   46 
   47 typedef int mb_copy_t(struct mbchain *mbp, c_caddr_t src, caddr_t dst,
   48     size_t *srclen, size_t *dstlen);
   49 
   50 struct mbchain {
   51         struct mbuf *   mb_top;         /* head of mbufs chain */
   52         struct mbuf *   mb_cur;         /* current mbuf */
   53         int             mb_mleft;       /* free space in the current mbuf */
   54         int             mb_count;       /* total number of bytes */
   55         mb_copy_t *     mb_copy;        /* user defined copy function */
   56         void *          mb_udata;       /* user data */
   57 };
   58 
   59 struct mdchain {
   60         struct mbuf *   md_top;         /* head of mbufs chain */
   61         struct mbuf *   md_cur;         /* current mbuf */
   62         u_char *        md_pos;         /* offset in the current mbuf */
   63 };
   64 
   65 int  mb_init(struct mbchain *mbp);
   66 void mb_initm(struct mbchain *mbp, struct mbuf *m);
   67 void mb_done(struct mbchain *mbp);
   68 struct mbuf *mb_detach(struct mbchain *mbp);
   69 int  mb_fixhdr(struct mbchain *mbp);
   70 caddr_t mb_reserve(struct mbchain *mbp, int size);
   71 
   72 int  mb_put_padbyte(struct mbchain *mbp);
   73 int  mb_put_uint8(struct mbchain *mbp, u_int8_t x);
   74 int  mb_put_uint16be(struct mbchain *mbp, u_int16_t x);
   75 int  mb_put_uint16le(struct mbchain *mbp, u_int16_t x);
   76 int  mb_put_uint32be(struct mbchain *mbp, u_int32_t x);
   77 int  mb_put_uint32le(struct mbchain *mbp, u_int32_t x);
   78 int  mb_put_int64be(struct mbchain *mbp, int64_t x);
   79 int  mb_put_int64le(struct mbchain *mbp, int64_t x);
   80 int  mb_put_mem(struct mbchain *mbp, c_caddr_t source, int size, int type);
   81 int  mb_put_mbuf(struct mbchain *mbp, struct mbuf *m);
   82 int  mb_put_uio(struct mbchain *mbp, struct uio *uiop, int size);
   83 
   84 int  md_init(struct mdchain *mdp);
   85 void md_initm(struct mdchain *mbp, struct mbuf *m);
   86 void md_done(struct mdchain *mdp);
   87 void md_append_record(struct mdchain *mdp, struct mbuf *top);
   88 int  md_next_record(struct mdchain *mdp);
   89 int  md_get_uint8(struct mdchain *mdp, u_int8_t *x);
   90 int  md_get_uint16(struct mdchain *mdp, u_int16_t *x);
   91 int  md_get_uint16le(struct mdchain *mdp, u_int16_t *x);
   92 int  md_get_uint16be(struct mdchain *mdp, u_int16_t *x);
   93 int  md_get_uint32(struct mdchain *mdp, u_int32_t *x);
   94 int  md_get_uint32be(struct mdchain *mdp, u_int32_t *x);
   95 int  md_get_uint32le(struct mdchain *mdp, u_int32_t *x);
   96 int  md_get_int64(struct mdchain *mdp, int64_t *x);
   97 int  md_get_int64be(struct mdchain *mdp, int64_t *x);
   98 int  md_get_int64le(struct mdchain *mdp, int64_t *x);
   99 int  md_get_mem(struct mdchain *mdp, caddr_t target, int size, int type);
  100 int  md_get_mbuf(struct mdchain *mdp, int size, struct mbuf **m);
  101 int  md_get_uio(struct mdchain *mdp, struct uio *uiop, int size);
  102 
  103 #endif  /* ifdef _KERNEL */
  104 
  105 #endif  /* !_SYS_MCHAIN_H_ */

Cache object: a458dd5088a82bbef1feda888b3890ee


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.