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-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

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

Cache object: 34ff2fd48697519e8f261e15cc33d42a


[ 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.