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/dev/hptrr/list.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  * Copyright (c) HighPoint Technologies, Inc.
    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: releng/11.2/sys/dev/hptrr/list.h 331722 2018-03-29 02:50:57Z eadler $
   27  */
   28 #include <dev/hptrr/hptrr_config.h>
   29 /*
   30  * $Id: list.h,v 1.6 2006/10/31 06:25:28 gmm Exp $
   31  * Copyright (C) 2004-2005 HighPoint Technologies, Inc. All rights reserved.
   32  */
   33 #ifndef _HPT_LIST_H_
   34 #define _HPT_LIST_H_
   35 
   36 #ifndef _LINUX_LIST_H
   37 
   38 #ifndef HPT_INLINE
   39 #define HPT_INLINE __inline
   40 #endif
   41 
   42 struct list_head {
   43         struct list_head *next, *prev;
   44 };
   45 
   46 #define INIT_LIST_HEAD(ptr) do { (ptr)->next = (ptr); (ptr)->prev = (ptr); } while (0)
   47 
   48 static HPT_INLINE void __list_add(struct list_head * _new, struct list_head * prev, struct list_head * next)
   49 {
   50         next->prev = _new;
   51         _new->next = next;
   52         _new->prev = prev;
   53         prev->next = _new;
   54 }
   55 
   56 static HPT_INLINE void list_add(struct list_head *_new, struct list_head *head)
   57 {
   58         __list_add(_new, head, head->next);
   59 }
   60 
   61 static HPT_INLINE void list_add_tail(struct list_head *_new, struct list_head *head)
   62 {
   63         __list_add(_new, head->prev, head);
   64 }
   65 
   66 static HPT_INLINE void __list_del(struct list_head * prev, struct list_head * next)
   67 {
   68         next->prev = prev;
   69         prev->next = next;
   70 }
   71 
   72 static HPT_INLINE void list_del(struct list_head *entry)
   73 {
   74         __list_del(entry->prev, entry->next);
   75 }
   76 
   77 static HPT_INLINE void list_del_init(struct list_head *entry)
   78 {
   79         __list_del(entry->prev, entry->next);
   80         INIT_LIST_HEAD(entry); 
   81 }
   82 
   83 static HPT_INLINE int list_empty(struct list_head *head)
   84 {
   85         HPT_ASSERT(!(head->next==head && head->prev!=head));
   86         return head->next == head;
   87 }
   88 
   89 static HPT_INLINE void __list_splice(struct list_head *list,
   90                                  struct list_head *head)
   91 {
   92         struct list_head *first = list->next;
   93         struct list_head *last = list->prev;
   94         struct list_head *at = head->next;
   95 
   96         first->prev = head;
   97         head->next = first;
   98 
   99         last->next = at;
  100         at->prev = last;
  101 }
  102 
  103 static HPT_INLINE void list_splice(struct list_head *list, struct list_head *head)
  104 {
  105         if (!list_empty(list))
  106                 __list_splice(list, head);
  107 }
  108 
  109 static HPT_INLINE void list_splice_init(struct list_head *list, struct list_head *head)
  110 {
  111         if (!list_empty(list)) {
  112                 __list_splice(list, head);
  113                 INIT_LIST_HEAD(list);
  114         }
  115 }
  116 
  117 #define list_entry(ptr, type, member) \
  118         ((type *)((char *)(ptr)-(HPT_UPTR)(&((type *)0)->member)))
  119 
  120 #define list_for_each(pos, head) \
  121         for (pos = (head)->next; pos != (head); pos = pos->next)
  122 
  123 #define list_for_each_safe(pos, n, head) \
  124         for (pos = (head)->next, n = pos->next; pos != (head); \
  125                 pos = n, n = pos->next)
  126 
  127 #define get_first_item(attached, type, member) \
  128         ((type *)((char *)((attached)->next)-(HPT_UPTR)(&((type *)0)->member)))
  129 
  130 #endif
  131 
  132 #endif

Cache object: 99c4688889049030f37e422c1615d5a7


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