-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'rc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/…
…git/mmarek/kbuild Pull menuconfig portability fix from Michal Marek: "Here is a fix for v3.7 that makes menuconfig compile again on systems whose C library is lacking CIRCLEQ_* macros. I thought I sent it earlier, but apparently I did not." * 'rc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: menuconfig: Replace CIRCLEQ by list_head-style lists.
- Loading branch information
Showing
5 changed files
with
106 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
#ifndef LIST_H | ||
#define LIST_H | ||
|
||
/* | ||
* Copied from include/linux/... | ||
*/ | ||
|
||
#undef offsetof | ||
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) | ||
|
||
/** | ||
* container_of - cast a member of a structure out to the containing structure | ||
* @ptr: the pointer to the member. | ||
* @type: the type of the container struct this is embedded in. | ||
* @member: the name of the member within the struct. | ||
* | ||
*/ | ||
#define container_of(ptr, type, member) ({ \ | ||
const typeof( ((type *)0)->member ) *__mptr = (ptr); \ | ||
(type *)( (char *)__mptr - offsetof(type,member) );}) | ||
|
||
|
||
struct list_head { | ||
struct list_head *next, *prev; | ||
}; | ||
|
||
|
||
#define LIST_HEAD_INIT(name) { &(name), &(name) } | ||
|
||
#define LIST_HEAD(name) \ | ||
struct list_head name = LIST_HEAD_INIT(name) | ||
|
||
/** | ||
* list_entry - get the struct for this entry | ||
* @ptr: the &struct list_head pointer. | ||
* @type: the type of the struct this is embedded in. | ||
* @member: the name of the list_struct within the struct. | ||
*/ | ||
#define list_entry(ptr, type, member) \ | ||
container_of(ptr, type, member) | ||
|
||
/** | ||
* list_for_each_entry - iterate over list of given type | ||
* @pos: the type * to use as a loop cursor. | ||
* @head: the head for your list. | ||
* @member: the name of the list_struct within the struct. | ||
*/ | ||
#define list_for_each_entry(pos, head, member) \ | ||
for (pos = list_entry((head)->next, typeof(*pos), member); \ | ||
&pos->member != (head); \ | ||
pos = list_entry(pos->member.next, typeof(*pos), member)) | ||
|
||
/** | ||
* list_empty - tests whether a list is empty | ||
* @head: the list to test. | ||
*/ | ||
static inline int list_empty(const struct list_head *head) | ||
{ | ||
return head->next == head; | ||
} | ||
|
||
/* | ||
* Insert a new entry between two known consecutive entries. | ||
* | ||
* This is only for internal list manipulation where we know | ||
* the prev/next entries already! | ||
*/ | ||
static inline void __list_add(struct list_head *_new, | ||
struct list_head *prev, | ||
struct list_head *next) | ||
{ | ||
next->prev = _new; | ||
_new->next = next; | ||
_new->prev = prev; | ||
prev->next = _new; | ||
} | ||
|
||
/** | ||
* list_add_tail - add a new entry | ||
* @new: new entry to be added | ||
* @head: list head to add it before | ||
* | ||
* Insert a new entry before the specified head. | ||
* This is useful for implementing queues. | ||
*/ | ||
static inline void list_add_tail(struct list_head *_new, struct list_head *head) | ||
{ | ||
__list_add(_new, head->prev, head); | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters