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/drm/drm_linux_list.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 /* drm_linux_list.h -- linux list functions for the BSDs.
    2  * Created: Mon Apr 7 14:30:16 1999 by anholt@FreeBSD.org */
    3 /*-
    4  * Copyright 2003 Eric Anholt
    5  * All Rights Reserved.
    6  *
    7  * Permission is hereby granted, free of charge, to any person obtaining a
    8  * copy of this software and associated documentation files (the "Software"),
    9  * to deal in the Software without restriction, including without limitation
   10  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
   11  * and/or sell copies of the Software, and to permit persons to whom the
   12  * Software is furnished to do so, subject to the following conditions:
   13  *
   14  * The above copyright notice and this permission notice (including the next
   15  * paragraph) shall be included in all copies or substantial portions of the
   16  * Software.
   17  *
   18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   19  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   20  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
   21  * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
   22  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
   23  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
   24  * OTHER DEALINGS IN THE SOFTWARE.
   25  *
   26  * Authors:
   27  *    Eric Anholt <anholt@FreeBSD.org>
   28  *
   29  * $FreeBSD$
   30  */
   31 
   32 struct list_head {
   33         struct list_head *next, *prev;
   34 };
   35 
   36 /* Cheat, assume the list_head is at the start of the struct */
   37 #define list_entry(entry, type, member) (type *)(entry)
   38 
   39 static __inline__ void
   40 INIT_LIST_HEAD(struct list_head *head) {
   41         (head)->next = head;
   42         (head)->prev = head;
   43 }
   44 
   45 static __inline__ int
   46 list_empty(struct list_head *head) {
   47         return (head)->next == head;
   48 }
   49 
   50 static __inline__ void
   51 list_add_tail(struct list_head *entry, struct list_head *head) {
   52         (entry)->prev = (head)->prev;
   53         (entry)->next = head;
   54         (head)->prev->next = entry;
   55         (head)->prev = entry;
   56 }
   57 
   58 static __inline__ void
   59 list_del(struct list_head *entry) {
   60         (entry)->next->prev = (entry)->prev;
   61         (entry)->prev->next = (entry)->next;
   62 }
   63 
   64 #define list_for_each(entry, head)                              \
   65     for (entry = (head)->next; entry != head; entry = (entry)->next)
   66 
   67 #define list_for_each_safe(entry, temp, head)                   \
   68     for (entry = (head)->next, temp = (entry)->next;            \
   69         temp != head;                                           \
   70         entry = temp, temp = temp->next)
   71 

Cache object: 367ad43c53e44d68c14b52ab37df52b8


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