7 * A simple most-recently-used cache, backed by a doubly-linked list.
11 * // Create a list. Zero-initialization is required.
12 * static struct mru cache;
13 * INIT_LIST_HEAD(&cache.list);
15 * // Add new item to the end of the list.
18 * mru_append(&cache, item);
20 * // Mark an item as used, moving it to the front of the list.
21 * mru_mark(&cache, item);
23 * // Reset the list to empty, cleaning up all resources.
26 * Note that you SHOULD NOT call mru_mark() and then continue traversing the
27 * list; it reorders the marked item to the front of the list, and therefore
28 * you will begin traversing the whole list again.
32 struct list_head list
;
36 void mru_append(struct mru
*head
, void *item
);
37 void mru_mark(struct mru
*head
, struct mru
*entry
);
38 void mru_clear(struct mru
*head
);