list.h (297483) | list.h (300496) |
---|---|
1/*- 2 * Copyright (c) 2010 Isilon Systems, Inc. 3 * Copyright (c) 2010 iX Systems, Inc. 4 * Copyright (c) 2010 Panasas, Inc. 5 * Copyright (c) 2013-2016 Mellanox Technologies, Ltd. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 12 unchanged lines hidden (view full) --- 21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * | 1/*- 2 * Copyright (c) 2010 Isilon Systems, Inc. 3 * Copyright (c) 2010 iX Systems, Inc. 4 * Copyright (c) 2010 Panasas, Inc. 5 * Copyright (c) 2013-2016 Mellanox Technologies, Ltd. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 12 unchanged lines hidden (view full) --- 21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * |
29 * $FreeBSD: head/sys/compat/linuxkpi/common/include/linux/list.h 297483 2016-04-01 06:43:05Z sephe $ | 29 * $FreeBSD: head/sys/compat/linuxkpi/common/include/linux/list.h 300496 2016-05-23 12:03:40Z hselasky $ |
30 */ 31#ifndef _LINUX_LIST_H_ 32#define _LINUX_LIST_H_ 33 34/* 35 * Since LIST_HEAD conflicts with the linux definition we must include any 36 * FreeBSD header which requires it here so it is resolved with the correct 37 * definition prior to the undef. --- 66 unchanged lines hidden (view full) --- 104{ 105 new->next = old->next; 106 new->next->prev = new; 107 new->prev = old->prev; 108 new->prev->next = new; 109} 110 111static inline void | 30 */ 31#ifndef _LINUX_LIST_H_ 32#define _LINUX_LIST_H_ 33 34/* 35 * Since LIST_HEAD conflicts with the linux definition we must include any 36 * FreeBSD header which requires it here so it is resolved with the correct 37 * definition prior to the undef. --- 66 unchanged lines hidden (view full) --- 104{ 105 new->next = old->next; 106 new->next->prev = new; 107 new->prev = old->prev; 108 new->prev->next = new; 109} 110 111static inline void |
112list_replace_init(struct list_head *old, struct list_head *new) 113{ 114 list_replace(old, new); 115 INIT_LIST_HEAD(old); 116} 117 118static inline void |
|
112linux_list_add(struct list_head *new, struct list_head *prev, 113 struct list_head *next) 114{ 115 116 next->prev = new; 117 new->next = next; 118 new->prev = prev; 119 prev->next = new; --- 7 unchanged lines hidden (view full) --- 127 INIT_LIST_HEAD(entry); 128} 129 130#define list_entry(ptr, type, field) container_of(ptr, type, field) 131 132#define list_first_entry(ptr, type, member) \ 133 list_entry((ptr)->next, type, member) 134 | 119linux_list_add(struct list_head *new, struct list_head *prev, 120 struct list_head *next) 121{ 122 123 next->prev = new; 124 new->next = next; 125 new->prev = prev; 126 prev->next = new; --- 7 unchanged lines hidden (view full) --- 134 INIT_LIST_HEAD(entry); 135} 136 137#define list_entry(ptr, type, field) container_of(ptr, type, field) 138 139#define list_first_entry(ptr, type, member) \ 140 list_entry((ptr)->next, type, member) 141 |
142#define list_last_entry(ptr, type, member) \ 143 list_entry((ptr)->prev, type, member) 144 145#define list_first_entry_or_null(ptr, type, member) \ 146 (!list_empty(ptr) ? list_first_entry(ptr, type, member) : NULL) 147 |
|
135#define list_next_entry(ptr, member) \ 136 list_entry(((ptr)->member.next), typeof(*(ptr)), member) 137 | 148#define list_next_entry(ptr, member) \ 149 list_entry(((ptr)->member.next), typeof(*(ptr)), member) 150 |
151#define list_prev_entry(ptr, member) \ 152 list_entry(((ptr)->member.prev), typeof(*(ptr)), member) 153 |
|
138#define list_for_each(p, head) \ 139 for (p = (head)->next; p != (head); p = (p)->next) 140 141#define list_for_each_safe(p, n, head) \ 142 for (p = (head)->next, n = (p)->next; p != (head); p = n, n = (p)->next) 143 144#define list_for_each_entry(p, h, field) \ 145 for (p = list_entry((h)->next, typeof(*p), field); &(p)->field != (h); \ --- 285 unchanged lines hidden (view full) --- 431 for (; (pos); \ 432 pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member)) 433 434#define hlist_for_each_entry_safe(pos, n, head, member) \ 435 for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member); \ 436 (pos) && ({ n = (pos)->member.next; 1; }); \ 437 pos = hlist_entry_safe(n, typeof(*(pos)), member)) 438 | 154#define list_for_each(p, head) \ 155 for (p = (head)->next; p != (head); p = (p)->next) 156 157#define list_for_each_safe(p, n, head) \ 158 for (p = (head)->next, n = (p)->next; p != (head); p = n, n = (p)->next) 159 160#define list_for_each_entry(p, h, field) \ 161 for (p = list_entry((h)->next, typeof(*p), field); &(p)->field != (h); \ --- 285 unchanged lines hidden (view full) --- 447 for (; (pos); \ 448 pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member)) 449 450#define hlist_for_each_entry_safe(pos, n, head, member) \ 451 for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member); \ 452 (pos) && ({ n = (pos)->member.next; 1; }); \ 453 pos = hlist_entry_safe(n, typeof(*(pos)), member)) 454 |
455extern void list_sort(void *priv, struct list_head *head, int (*cmp)(void *priv, 456 struct list_head *a, struct list_head *b)); 457 |
|
439#endif /* _LINUX_LIST_H_ */ | 458#endif /* _LINUX_LIST_H_ */ |