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/bufq_impl.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 /*      $NetBSD: bufq_impl.h,v 1.7 2008/04/30 12:09:02 reinoud Exp $    */
    2 /*      NetBSD: bufq.h,v 1.3 2005/03/31 11:28:53 yamt Exp       */
    3 /*      NetBSD: buf.h,v 1.75 2004/09/18 16:40:11 yamt Exp       */
    4 
    5 /*-
    6  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
    7  * All rights reserved.
    8  *
    9  * This code is derived from software contributed to The NetBSD Foundation
   10  * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
   11  * NASA Ames Research Center.
   12  *
   13  * Redistribution and use in source and binary forms, with or without
   14  * modification, are permitted provided that the following conditions
   15  * are met:
   16  * 1. Redistributions of source code must retain the above copyright
   17  *    notice, this list of conditions and the following disclaimer.
   18  * 2. Redistributions in binary form must reproduce the above copyright
   19  *    notice, this list of conditions and the following disclaimer in the
   20  *    documentation and/or other materials provided with the distribution.
   21  *
   22  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
   23  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
   24  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   25  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
   26  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   27  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   28  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   29  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   30  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   31  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   32  * POSSIBILITY OF SUCH DAMAGE.
   33  */
   34 
   35 /*
   36  * Copyright (c) 1982, 1986, 1989, 1993
   37  *      The Regents of the University of California.  All rights reserved.
   38  * (c) UNIX System Laboratories, Inc.
   39  * All or some portions of this file are derived from material licensed
   40  * to the University of California by American Telephone and Telegraph
   41  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
   42  * the permission of UNIX System Laboratories, Inc.
   43  *
   44  * Redistribution and use in source and binary forms, with or without
   45  * modification, are permitted provided that the following conditions
   46  * are met:
   47  * 1. Redistributions of source code must retain the above copyright
   48  *    notice, this list of conditions and the following disclaimer.
   49  * 2. Redistributions in binary form must reproduce the above copyright
   50  *    notice, this list of conditions and the following disclaimer in the
   51  *    documentation and/or other materials provided with the distribution.
   52  * 3. Neither the name of the University nor the names of its contributors
   53  *    may be used to endorse or promote products derived from this software
   54  *    without specific prior written permission.
   55  *
   56  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   57  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   58  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   59  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   60  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   61  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   62  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   63  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   64  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   65  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   66  * SUCH DAMAGE.
   67  *
   68  *      @(#)buf.h       8.9 (Berkeley) 3/30/95
   69  */
   70 
   71 #if !defined(_KERNEL)
   72 #error not supposed to be exposed to userland.
   73 #endif
   74 
   75 struct bufq_strat;
   76 
   77 /*
   78  * Device driver buffer queue.
   79  */
   80 struct bufq_state {
   81         void (*bq_put)(struct bufq_state *, struct buf *);
   82         struct buf *(*bq_get)(struct bufq_state *, int);
   83         struct buf *(*bq_cancel)(struct bufq_state *, struct buf *);
   84         void *bq_private;
   85         int bq_flags;                   /* Flags from bufq_alloc() */
   86         const struct bufq_strat *bq_strat;
   87 };
   88 
   89 static __inline void *bufq_private(const struct bufq_state *) __unused;
   90 static __inline int buf_inorder(const struct buf *, const struct buf *, int)
   91     __unused;
   92 
   93 #include <sys/null.h> /* for NULL */
   94 
   95 static __inline void *
   96 bufq_private(const struct bufq_state *bufq)
   97 {
   98 
   99         return bufq->bq_private;
  100 }
  101 
  102 /*
  103  * Check if two buf's are in ascending order.
  104  */
  105 static __inline int
  106 buf_inorder(const struct buf *bp, const struct buf *bq, int sortby)
  107 {
  108 
  109         if (bp == NULL || bq == NULL)
  110                 return (bq == NULL);
  111 
  112         if (sortby == BUFQ_SORT_CYLINDER) {
  113                 if (bp->b_cylinder != bq->b_cylinder)
  114                         return bp->b_cylinder < bq->b_cylinder;
  115                 else
  116                         return bp->b_rawblkno < bq->b_rawblkno;
  117         } else
  118                 return bp->b_rawblkno < bq->b_rawblkno;
  119 }
  120 
  121 struct bufq_strat {
  122         const char *bs_name;
  123         void (*bs_initfn)(struct bufq_state *);
  124         int bs_prio;
  125 };
  126 
  127 #define BUFQ_DEFINE(name, prio, initfn)                 \
  128 static const struct bufq_strat bufq_strat_##name = {    \
  129         .bs_name = #name,                               \
  130         .bs_prio = prio,                                        \
  131         .bs_initfn = initfn                             \
  132 };                                                      \
  133 __link_set_add_rodata(bufq_strats, bufq_strat_##name)

Cache object: 2dada19059e8135874ead91b477973e1


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