-
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.
- Loading branch information
Wang YanQing
authored and
Yann E. MORIN
committed
Dec 27, 2012
1 parent
2b12cf9
commit ada551b
Showing
25 changed files
with
389 additions
and
407 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
refs/heads/master: 62dc989921df2a98d1a73aacd085abe941cb9828 | ||
refs/heads/master: 77bdcfe5484fef0da899ec8e74b08dd21b031f66 |
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
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
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
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
Oops, something went wrong.