container_of(ptr, type, member)
/**
+ * list_entry - get the struct for the tail entry
+ * @ptr: the list_head head pointer.
+ * @type: the type of the struct this is embedded in.
+ * @member: the name of the list_struct within the struct.
+ */
+#define list_tail_entry(head, type, member) ({ \
+ type * tail = NULL; \
+ if ((head)->prev != (head)) { \
+ tail = list_entry((head)->prev, type, member); \
+ } \
+ tail; \
+})
+
+/**
+ * list_first_entry - get the struct for the first entry
+ * @ptr: the list_head head pointer.
+ * @type: the type of the struct this is embedded in.
+ * @member: the name of the list_struct within the struct.
+ */
+#define list_first_entry(head, type, member) \
+({ \
+ type * first = NULL; \
+ if ((head)->next != (head)) { \
+ first = list_entry((head)->next, type, member); \
+ } \
+ first; \
+ })
+
+
+
+/**
+ * list_next_entry -- get the struct for the next entry in a list
+ * @ptr: current list entry
+ * @type: type of the struct this is embedded in
+ * @member: name of the list struct within the struct
+ */
+#define list_next_entry(node, type, member) \
+ ({ \
+ type * next = NULL; \
+ if ((node)->next != (node)) { \
+ next = list_entry((node)->next, type, member); \
+ } \
+ next; \
+ })
+
+
+/**
* list_for_each - iterate over a list
* @pos: the &struct list_head to use as a loop counter.
* @head: the head for your list.