diff options
Diffstat (limited to 'src/include/ipxe')
| -rw-r--r-- | src/include/ipxe/list.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/include/ipxe/list.h b/src/include/ipxe/list.h index 4daf12b2e..b14a83d70 100644 --- a/src/include/ipxe/list.h +++ b/src/include/ipxe/list.h @@ -325,6 +325,19 @@ static inline void list_splice_tail_init ( struct list_head *list, list_entry ( (list)->next, type, member ) ) /** + * Get the container of the last entry in a list + * + * @v list List head + * @v type Containing type + * @v member Name of list field within containing type + * @ret first First list entry, or NULL + */ +#define list_last_entry( list, type, member ) \ + ( list_empty ( (list) ) ? \ + ( type * ) NULL : \ + list_entry ( (list)->prev, type, member ) ) + +/** * Iterate over a list * * @v pos Iterator |
