#ifndef _LL_H_
#define _LL_H_
+#include <stdint.h>
+
/* linked list entry */
struct ll_entry {
struct ll_entry *prev;
struct ll {
struct ll_entry *head;
struct ll_entry *tail;
+ uint32_t cnt;
};
/**
void ll_init(struct ll *ll);
/**
- * Linked list insert
+ * Linked list insert head
*
* [in] ll, linked list where element is inserted
* [in] entry, entry to be added
*/
void ll_delete(struct ll *ll, struct ll_entry *entry);
+/**
+ * Linked list return next entry without deleting it
+ *
+ * Useful in performing search
+ *
+ * [in] Entry in the list
+ */
+static inline struct ll_entry *ll_next(struct ll_entry *entry)
+{
+ return entry->next;
+}
+
+/**
+ * Linked list return the head of the list without removing it
+ *
+ * Useful in performing search
+ *
+ * [in] ll, linked list
+ */
+static inline struct ll_entry *ll_head(struct ll *ll)
+{
+ return ll->head;
+}
+
+/**
+ * Linked list return the tail of the list without removing it
+ *
+ * Useful in performing search
+ *
+ * [in] ll, linked list
+ */
+static inline struct ll_entry *ll_tail(struct ll *ll)
+{
+ return ll->tail;
+}
+
+/**
+ * Linked list return the number of entries in the list
+ *
+ * [in] ll, linked list
+ */
+static inline uint32_t ll_cnt(struct ll *ll)
+{
+ return ll->cnt;
+}
#endif /* _LL_H_ */