list.h File Reference
#include "build.h"
#include "ipcam_packet.h"
Go to the source code of this file.
Classes |
struct | IpCamList |
struct | list_head |
Defines |
#define | CAMLIST_ADD_DUP 1 |
#define | CAMLIST_ADD_OK 0 |
#define | INIT_LIST_HEAD(ptr) |
#define | list_entry(ptr, type, member) ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member))) |
#define | list_for_each(pos, head) |
#define | list_for_each_entry(pos, head, member) |
#define | list_for_each_entry_safe(pos, n, head, member) |
#define | list_for_each_prev(pos, head) |
#define | list_for_each_safe(pos, n, head) |
#define | LIST_HEAD(name) struct list_head name = LIST_HEAD_INIT(name) |
#define | LIST_HEAD_INIT(name) { &(name), &(name) } |
#define | WGE100_CAMINFO_LEN 100 |
Enumerations |
enum | IpCamStatus {
CamStatusDiscovered,
CamStatusConfigured,
CamStatusVideo,
CamStatusError,
CamStatusMissing
} |
Functions |
static void | __list_add (struct list_head *new_item, struct list_head *prev, struct list_head *next) |
static void | __list_del (struct list_head *prev, struct list_head *next) |
static void | __list_splice (struct list_head *list, struct list_head *head) |
static void | list_add (struct list_head *new_item, struct list_head *head) |
static void | list_add_tail (struct list_head *new_item, struct list_head *head) |
static void | list_del (struct list_head *entry) |
static void | list_del_init (struct list_head *entry) |
static int | list_empty (struct list_head *head) |
static void | list_move (struct list_head *list, struct list_head *head) |
static void | list_move_tail (struct list_head *list, struct list_head *head) |
static void | list_splice (struct list_head *list, struct list_head *head) |
static void | list_splice_init (struct list_head *list, struct list_head *head) |
int | wge100CamListAdd (IpCamList *ipCamList, IpCamList *newItem) |
void | wge100CamListDelAll (IpCamList *ipCamList) |
int | wge100CamListDelEntry (IpCamList *ipCamList, int index) |
int | wge100CamListFind (IpCamList *ipCamList, uint32_t serial) |
IpCamList * | wge100CamListGetEntry (const IpCamList *ipCamList, int index) |
int | wge100CamListInit (IpCamList *ipCamList) |
int | wge100CamListNumEntries (const IpCamList *ipCamList) |
Detailed Description
Macros in this file are from Linux Kernel (include/linux/list.h) and modified by simply removing hardware prefetching of list items. Here by copyright, credits attributed to wherever they belong. Kulesh Shanmugasundaram (kulesh [squiggly] isis.poly.edu)
Definition in file list.h.
Define Documentation
#define CAMLIST_ADD_DUP 1 |
#define INIT_LIST_HEAD |
( |
ptr |
|
) |
|
Value:do { \
(ptr)->next = (ptr); (ptr)->prev = (ptr); \
} while (0)
Definition at line 56 of file list.h.
#define list_entry |
( |
ptr, |
|
|
type, |
|
|
member |
|
) |
((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member))) |
list_entry - get the struct for this entry : the &struct list_head pointer. : the type of the struct this is embedded in. : the name of the list_struct within the struct.
Definition at line 216 of file list.h.
#define list_for_each |
( |
pos, |
|
|
head |
|
) |
|
Value:for (pos = (head)->next; pos != (head); \
pos = pos->next)
list_for_each - iterate over a list : the &struct list_head to use as a loop counter. : the head for your list.
Definition at line 224 of file list.h.
#define list_for_each_entry |
( |
pos, |
|
|
head, |
|
|
member |
|
) |
|
Value:for (pos = list_entry((head)->next, typeof(*pos), member); \
&pos->member != (head); \
pos = list_entry(pos->member.next, typeof(*pos), member))
list_for_each_entry - iterate over list of given type : the type * to use as a loop counter. : the head for your list. : the name of the list_struct within the struct.
Definition at line 252 of file list.h.
#define list_for_each_entry_safe |
( |
pos, |
|
|
n, |
|
|
head, |
|
|
member |
|
) |
|
Value:for (pos = list_entry((head)->next, typeof(*pos), member), \
n = list_entry(pos->member.next, typeof(*pos), member); \
&pos->member != (head); \
pos = n, n = list_entry(n->member.next, typeof(*n), member))
list_for_each_entry_safe - iterate over list of given type safe against removal of list entry : the type * to use as a loop counter.
: another type * to use as temporary storage : the head for your list. : the name of the list_struct within the struct.
Definition at line 264 of file list.h.
#define list_for_each_prev |
( |
pos, |
|
|
head |
|
) |
|
Value:for (pos = (head)->prev; pos != (head); \
pos = pos->prev)
list_for_each_prev - iterate over a list backwards : the &struct list_head to use as a loop counter. : the head for your list.
Definition at line 232 of file list.h.
#define list_for_each_safe |
( |
pos, |
|
|
n, |
|
|
head |
|
) |
|
Value:for (pos = (head)->next, n = pos->next; pos != (head); \
pos = n, n = pos->next)
list_for_each_safe - iterate over a list safe against removal of list entry : the &struct list_head to use as a loop counter.
: another &struct list_head to use as temporary storage : the head for your list.
Definition at line 242 of file list.h.
#define LIST_HEAD |
( |
name |
|
) |
struct list_head name = LIST_HEAD_INIT(name) |
#define LIST_HEAD_INIT |
( |
name |
|
) |
{ &(name), &(name) } |
#define WGE100_CAMINFO_LEN 100 |
Enumeration Type Documentation
- Enumerator:
CamStatusDiscovered |
|
CamStatusConfigured |
|
CamStatusVideo |
|
CamStatusError |
|
CamStatusMissing |
|
Definition at line 270 of file list.h.
Function Documentation
static void __list_del |
( |
struct list_head * |
prev, |
|
|
struct list_head * |
next | |
|
) |
| | [inline, static] |
static void __list_splice |
( |
struct list_head * |
list, |
|
|
struct list_head * |
head | |
|
) |
| | [inline, static] |
static void list_add |
( |
struct list_head * |
new_item, |
|
|
struct list_head * |
head | |
|
) |
| | [inline, static] |
list_add - add a new entry : new entry to be added : list head to add it after
Insert a new entry after the specified head. This is good for implementing stacks.
Definition at line 84 of file list.h.
static void list_add_tail |
( |
struct list_head * |
new_item, |
|
|
struct list_head * |
head | |
|
) |
| | [inline, static] |
list_add_tail - add a new entry : new entry to be added : list head to add it before
Insert a new entry before the specified head. This is useful for implementing queues.
Definition at line 97 of file list.h.
static void list_del |
( |
struct list_head * |
entry |
) |
[inline, static] |
list_del - deletes entry from list. : 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.
Definition at line 120 of file list.h.
static void list_del_init |
( |
struct list_head * |
entry |
) |
[inline, static] |
list_del_init - deletes entry from list and reinitialize it. : the element to delete from the list.
Definition at line 131 of file list.h.
static int list_empty |
( |
struct list_head * |
head |
) |
[inline, static] |
list_empty - tests whether a list is empty : the list to test.
Definition at line 164 of file list.h.
static void list_move |
( |
struct list_head * |
list, |
|
|
struct list_head * |
head | |
|
) |
| | [inline, static] |
list_move - delete from one list and add as another's head : the entry to move : the head that will precede our entry
Definition at line 142 of file list.h.
static void list_move_tail |
( |
struct list_head * |
list, |
|
|
struct list_head * |
head | |
|
) |
| | [inline, static] |
list_move_tail - delete from one list and add as another's tail : the entry to move : the head that will follow our entry
Definition at line 153 of file list.h.
static void list_splice |
( |
struct list_head * |
list, |
|
|
struct list_head * |
head | |
|
) |
| | [inline, static] |
list_splice - join two lists : the new list to add. : the place to add it in the first list.
Definition at line 188 of file list.h.
static void list_splice_init |
( |
struct list_head * |
list, |
|
|
struct list_head * |
head | |
|
) |
| | [inline, static] |
list_splice_init - join two lists and reinitialise the emptied list. : the new list to add. : the place to add it in the first list.
The list at is reinitialised
Definition at line 201 of file list.h.
Adds a new camera to camera list ipCamList if that serial number is not already in the list.
- Parameters:
-
| ipCamList | Pointer to the IpCamList head |
| newItem | Pointer to an IpCamList structure that describes the new camera |
- Returns:
- Returns CAMLIST_ADD_OK if the camera was added to the list, or CAMLIST_ADD_DUP if it was a duplicate.
Definition at line 65 of file list.c.
void wge100CamListDelAll |
( |
IpCamList * |
ipCamList |
) |
|
Utility function to remove all entries from a camera list.
- Parameters:
-
| ipCamList | Pointer to the camera list head |
- Returns:
- Returns 0 if successful.
Definition at line 191 of file list.c.
int wge100CamListDelEntry |
( |
IpCamList * |
ipCamList, |
|
|
int |
index | |
|
) |
| | |
Utility function to remove a specific element number from the camera list.
- Precondition:
- index must be less than the value returned by wge100CamListNumEntries().
- Parameters:
-
| ipCamList | Pointer to the camera list head |
| index | Number of the list element to remove (0..max) |
- Returns:
- Returns 0 if successful, -1 if index was invalid
Definition at line 146 of file list.c.
int wge100CamListFind |
( |
IpCamList * |
ipCamList, |
|
|
uint32_t |
serial | |
|
) |
| | |
Utility function to locate a camera with a particular serial number in a list.
- Parameters:
-
| ipCamList | Pointer to the list head |
| serial | Serial number (not including product ID) to look for |
- Returns:
- Returns the index of the camera, or -1 if not found
Definition at line 96 of file list.c.
Utility function to return a specific element number from the camera list.
- Precondition:
- index must be less than the value returned by wge100CamListNumEntries(). If it is greater, then the last element in the list will be returned.
- Parameters:
-
| ipCamList | Pointer to the camera list head |
| index | Number of the list element to returna (0..max) |
- Returns:
- Returns a pointer to the requested list element
Definition at line 123 of file list.c.
int wge100CamListInit |
( |
IpCamList * |
ipCamList |
) |
|
Initializes a new camera list using macros from list.h
- Parameters:
-
| ipCamList | Pointer to an IpCamList list element |
- Returns:
- Always returns zero.
Definition at line 50 of file list.c.
int wge100CamListNumEntries |
( |
const IpCamList * |
ipCamList |
) |
|
Utility function to determine the number of entries in an IpCamlist
- Parameters:
-
| ipCamList | Pointer to the list head to count. |
- Returns:
- Returns the number of elements in the list
Definition at line 171 of file list.c.