elemy-utils 1.0.0
|
header library for kernel's like lists of any type structs More...
#include "elutils/c_decls.h"
Go to the source code of this file.
Data Structures | |
struct | psl_hd |
Macros | |
#define | offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) |
#define | container_of(ptr, type, member) ({ const typeof( ((type *)0)->member ) *__mptr = (ptr); (type *)( (char *)__mptr - offsetof(type,member) );}) |
#define | PSL_HD_INIT(name) { &(name), &(name) } |
static initializer. used for static initialize list More... | |
#define | PSL_HD(name) struct psl_hd name = PSL_HD_INIT(name) |
declaration of name wich is PSL_HD with init. used for declare static initialized list. More... | |
#define | psl_entry(ptr, type, member) container_of(ptr, type, member) |
#define | psl_for_each_entry(pos, head, member) |
#define | psl_for_each_entry_safe(pos, n, head, member) |
#define | psl_count(TYPE, head, member, pcount) |
#define | LIST_POISON1 ((void *) 0x00100100) |
#define | LIST_POISON2 ((void *) 0x00200200) |
#define | PSL_FIRST_ENTRY(ptr, type, member) psl_entry(ptr->next, type, member) |
#define | PSL_SHOW_STRING(PSL_HD, TYPE, PSL_LINK, STRING_NAME) |
Typedefs | |
typedef struct psl_hd | psl_hd_t |
Functions | |
static void | psl_init (psl_hd_t *list) |
init allocated list element. used for initialize dynamic allocated list. More... | |
static int | psl_empty (const struct psl_hd *head) |
static void | __psl_add (struct psl_hd *_new, struct psl_hd *prev, struct psl_hd *next) |
static void | psl_add (struct psl_hd *_new, struct psl_hd *head) |
static void | psl_add_tail (struct psl_hd *_new, struct psl_hd *head) |
static void | __psl_del (struct psl_hd *prev, struct psl_hd *next) |
static void | psl_del (struct psl_hd *entry) |
static int | psl_is_head (const struct psl_hd *list, const struct psl_hd *head) |
static struct psl_hd * | psl_first (const struct psl_hd *head) |
static void | psl_move_head2head (psl_hd_t *new_hd, psl_hd_t *old_hd) |
header library for kernel's like lists of any type structs
Author: ps (c) Sergey Pankov, 1997
Partly copied from include/linux/...
#define container_of | ( | ptr, | |
type, | |||
member | |||
) | ({ const typeof( ((type *)0)->member ) *__mptr = (ptr); (type *)( (char *)__mptr - offsetof(type,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 LIST_POISON1 ((void *) 0x00100100) |
#define LIST_POISON2 ((void *) 0x00200200) |
#define offsetof | ( | TYPE, | |
MEMBER | |||
) | ((size_t) &((TYPE *)0)->MEMBER) |
#define psl_count | ( | TYPE, | |
head, | |||
member, | |||
pcount | |||
) |
psl_count - count list of given type @TYPE: the type to use as a loop cursor. @head: the head for your list. @member: the name of the list_head within the struct. @res reference to counting result
#define psl_entry | ( | ptr, | |
type, | |||
member | |||
) | container_of(ptr, type, member) |
psl_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_head within the struct.
#define PSL_FIRST_ENTRY | ( | ptr, | |
type, | |||
member | |||
) | psl_entry(ptr->next, type, member) |
#define psl_for_each_entry | ( | pos, | |
head, | |||
member | |||
) |
psl_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_head within the struct.
#define psl_for_each_entry_safe | ( | pos, | |
n, | |||
head, | |||
member | |||
) |
psl_for_each_entry_safe - iterate over list of given type safe against removal of list entry @pos: the type * to use as a loop cursor.
: another type * to use as temporary storage @head: the head for your list. @member: the name of the list_head within the struct.
#define PSL_HD | ( | name | ) | struct psl_hd name = PSL_HD_INIT(name) |
declaration of name wich is PSL_HD with init. used for declare static initialized list.
#define PSL_HD_INIT | ( | name | ) | { &(name), &(name) } |
static initializer. used for static initialize list
#define PSL_SHOW_STRING | ( | PSL_HD, | |
TYPE, | |||
PSL_LINK, | |||
STRING_NAME | |||
) |
|
inlinestatic |
list_add - add a new entry @new: new entry to be added @head: list head to add it after
Insert a new entry after the specified head. This is good for implementing stacks.
psl_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.
|
inlinestatic |
list_del - deletes entry from list. @entry: the element to delete from the list. Note: list_empty() on entry does not return true after this, the entry is in an undefined state.
|
inlinestatic |
psl_empty - tests whether a list is empty @head: the list to test.
head | remeber that parameter is external var as head of list |
|
inlinestatic |
init allocated list element. used for initialize dynamic allocated list.
psl_is_head - tests whether @list is the list @head @list: the entry to test @head: the head of the list