From 7e1b3ae2b902031d3ec042a7f87fd3ecc98a4018 Mon Sep 17 00:00:00 2001 From: Lucas De Marchi Date: Thu, 8 Dec 2011 12:25:36 -0200 Subject: [PATCH] kmod_list: document exported functions --- libkmod/libkmod-list.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/libkmod/libkmod-list.c b/libkmod/libkmod-list.c index eff433e7..883a91a2 100644 --- a/libkmod/libkmod-list.c +++ b/libkmod/libkmod-list.c @@ -233,7 +233,7 @@ struct kmod_list *kmod_list_remove_data(struct kmod_list *list, /* * n must be greater to or equal the number of elements (we don't check the - * condition + * condition) */ struct kmod_list *kmod_list_remove_n_latest(struct kmod_list *list, unsigned int n) @@ -258,7 +258,19 @@ struct kmod_list *kmod_list_remove_n_latest(struct kmod_list *list, return list; } - +/** + * kmod_list_prev: + * @list: the head of the list + * @curr: the current node in the list + * + * Get the previous node in @list relative to @curr as if @list was not a + * circular list. I.e.: the previous of the head is NULL. It can be used to + * iterate a list by checking for NULL return to know when all elements were + * iterated. + * + * Returns: node previous to @curr or NULL if either this node is the head of + * the list or the list is empty. + */ KMOD_EXPORT struct kmod_list *kmod_list_prev(const struct kmod_list *list, const struct kmod_list *curr) { @@ -271,6 +283,19 @@ KMOD_EXPORT struct kmod_list *kmod_list_prev(const struct kmod_list *list, return container_of(curr->node.prev, struct kmod_list, node); } +/** + * kmod_list_next: + * @list: the head of the list + * @curr: the current node in the list + * + * Get the next node in @list relative to @curr as if @list was not a circular + * list. I.e. calling this function in the last node of the list returns + * NULL.. It can be used to iterate a list by checking for NULL return to know + * when all elements were iterated. + * + * Returns: node next to @curr or NULL if either this node is the last of or + * list is empty. + */ KMOD_EXPORT struct kmod_list *kmod_list_next(const struct kmod_list *list, const struct kmod_list *curr) { -- 2.47.2