Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
klist.c File Reference
#include <linux/klist.h>
#include <linux/export.h>
#include <linux/sched.h>

Go to the source code of this file.

Data Structures

struct  klist_waiter
 

Macros

#define KNODE_DEAD   1LU
 
#define KNODE_KLIST_MASK   ~KNODE_DEAD
 

Functions

void klist_init (struct klist *k, void(*get)(struct klist_node *), void(*put)(struct klist_node *))
 
 EXPORT_SYMBOL_GPL (klist_init)
 
void klist_add_head (struct klist_node *n, struct klist *k)
 
 EXPORT_SYMBOL_GPL (klist_add_head)
 
void klist_add_tail (struct klist_node *n, struct klist *k)
 
 EXPORT_SYMBOL_GPL (klist_add_tail)
 
void klist_add_after (struct klist_node *n, struct klist_node *pos)
 
 EXPORT_SYMBOL_GPL (klist_add_after)
 
void klist_add_before (struct klist_node *n, struct klist_node *pos)
 
 EXPORT_SYMBOL_GPL (klist_add_before)
 
void klist_del (struct klist_node *n)
 
 EXPORT_SYMBOL_GPL (klist_del)
 
void klist_remove (struct klist_node *n)
 
 EXPORT_SYMBOL_GPL (klist_remove)
 
int klist_node_attached (struct klist_node *n)
 
 EXPORT_SYMBOL_GPL (klist_node_attached)
 
void klist_iter_init_node (struct klist *k, struct klist_iter *i, struct klist_node *n)
 
 EXPORT_SYMBOL_GPL (klist_iter_init_node)
 
void klist_iter_init (struct klist *k, struct klist_iter *i)
 
 EXPORT_SYMBOL_GPL (klist_iter_init)
 
void klist_iter_exit (struct klist_iter *i)
 
 EXPORT_SYMBOL_GPL (klist_iter_exit)
 
struct klist_nodeklist_next (struct klist_iter *i)
 
 EXPORT_SYMBOL_GPL (klist_next)
 

Macro Definition Documentation

#define KNODE_DEAD   1LU

Definition at line 45 of file klist.c.

#define KNODE_KLIST_MASK   ~KNODE_DEAD

Definition at line 46 of file klist.c.

Function Documentation

EXPORT_SYMBOL_GPL ( klist_init  )
EXPORT_SYMBOL_GPL ( klist_add_head  )
EXPORT_SYMBOL_GPL ( klist_add_tail  )
EXPORT_SYMBOL_GPL ( klist_add_after  )
EXPORT_SYMBOL_GPL ( klist_add_before  )
EXPORT_SYMBOL_GPL ( klist_del  )
EXPORT_SYMBOL_GPL ( klist_remove  )
EXPORT_SYMBOL_GPL ( klist_node_attached  )
EXPORT_SYMBOL_GPL ( klist_iter_init_node  )
EXPORT_SYMBOL_GPL ( klist_iter_init  )
EXPORT_SYMBOL_GPL ( klist_iter_exit  )
EXPORT_SYMBOL_GPL ( klist_next  )
void klist_add_after ( struct klist_node n,
struct klist_node pos 
)

klist_add_after - Init a klist_node and add it after an existing node
: node we're adding. : node to put
after

Definition at line 147 of file klist.c.

void klist_add_before ( struct klist_node n,
struct klist_node pos 
)

klist_add_before - Init a klist_node and add it before an existing node
: node we're adding. : node to put
after

Definition at line 163 of file klist.c.

void klist_add_head ( struct klist_node n,
struct klist k 
)

klist_add_head - Initialize a klist_node and add it to front.
: node we're adding. : klist it's going on.

Definition at line 123 of file klist.c.

void klist_add_tail ( struct klist_node n,
struct klist k 
)

klist_add_tail - Initialize a klist_node and add it to back.
: node we're adding. : klist it's going on.

Definition at line 135 of file klist.c.

void klist_del ( struct klist_node n)

klist_del - Decrement the reference count of node and try to remove.
: node we're deleting.

Definition at line 229 of file klist.c.

void klist_init ( struct klist k,
void(*)(struct klist_node *)  get,
void(*)(struct klist_node *)  put 
)

klist_init - Initialize a klist structure. : The klist we're initializing. : The get function for the embedding object (NULL if none) : The put function for the embedding object (NULL if none)

Initialises the klist structure. If the klist_node structures are going to be embedded in refcounted objects (necessary for safe deletion) then the get/put arguments are used to initialise functions that take and release references on the embedding objects.

Definition at line 85 of file klist.c.

void klist_iter_exit ( struct klist_iter i)

klist_iter_exit - Finish a list iteration. : Iterator structure.

Must be called when done iterating over list, as it decrements the refcount of the current node. Necessary in case iteration exited before the end of the list was reached, and always good form.

Definition at line 312 of file klist.c.

void klist_iter_init ( struct klist k,
struct klist_iter i 
)

klist_iter_init - Iniitalize a klist_iter structure. : klist we're iterating. : klist_iter structure we're filling.

Similar to klist_iter_init_node(), but start with the list head.

Definition at line 298 of file klist.c.

void klist_iter_init_node ( struct klist k,
struct klist_iter i,
struct klist_node n 
)

klist_iter_init_node - Initialize a klist_iter structure. : klist we're iterating. : klist_iter we're filling.
: node to start with.

Similar to klist_iter_init(), but starts the action off with
, instead of with the list head.

Definition at line 281 of file klist.c.

struct klist_node* klist_next ( struct klist_iter i)
read

klist_next - Ante up next node in list. : Iterator structure.

First grab list lock. Decrement the reference count of the previous node, if there was one. Grab the next node, increment its reference count, drop the lock, and return that next node.

Definition at line 334 of file klist.c.

int klist_node_attached ( struct klist_node n)

klist_node_attached - Say whether a node is bound to a list or not.
: Node that we're testing.

Definition at line 266 of file klist.c.

void klist_remove ( struct klist_node n)

klist_remove - Decrement the refcount of node and wait for it to go away.
: node we're removing.

Definition at line 239 of file klist.c.