Switch from kernel style docs to doxygen format

This commit is contained in:
Nedko Arnaudov 2023-11-18 14:03:22 +02:00
parent 156313d2e8
commit 36d3991cac
2 changed files with 111 additions and 110 deletions

2
file.h
View File

@ -14,7 +14,7 @@
* @brief Read (small) file contents into newly allocated buffer
* Use this function with caution as big enough files may not fit in RAM.
*
* @param name of file to read
* @param filename name of file to read
*
* @return Newly allocated buffer where the contents if specified file are read into.
*/

219
klist.h
View File

@ -3,7 +3,7 @@
/* SPDX-License-Identifier: ( GPL-2.0 ) */
/**
* @file klist.h
* @brief Linux kernel header adapted for user-mode
* @brief Linux kernel linked list header implemenatation adapted for user-mode
*
* Linux kernel header adapted for user-mode. The 2.6.17-rt1 version was used.
*
@ -27,10 +27,11 @@
#endif
/**
* container_of - cast a member of a structure out to the containing structure
* @ptr: the pointer to the member.
* @type: the type of the container struct this is embedded in.
* @member: the name of the member within the struct.
* @brief cast a member of a structure out to the containing structure
*
* @param ptr the pointer to the member.
* @param type the type of the container struct this is embedded in.
* @param member the name of the member within the struct.
*
*/
#define container_of(ptr, type, member) ({ \
@ -90,8 +91,8 @@ static inline void __list_add(struct list_head *new,
/**
* list_add - add a new entry
* @new: new entry to be added
* @head: list head to add it after
* @param new new entry to be added
* @param head list head to add it after
*
* Insert a new entry after the specified head.
* This is good for implementing stacks.
@ -103,8 +104,8 @@ static inline void list_add(struct list_head *new, struct list_head *head)
/**
* list_add_tail - add a new entry
* @new: new entry to be added
* @head: list head to add it before
* @param new new entry to be added
* @param head list head to add it before
*
* Insert a new entry before the specified head.
* This is useful for implementing queues.
@ -132,8 +133,8 @@ static inline void __list_add_rcu(struct list_head * new,
/**
* list_add_rcu - add a new entry to rcu-protected list
* @new: new entry to be added
* @head: list head to add it after
* @param new new entry to be added
* @param head list head to add it after
*
* Insert a new entry after the specified head.
* This is good for implementing stacks.
@ -153,8 +154,8 @@ static inline void list_add_rcu(struct list_head *new, struct list_head *head)
/**
* list_add_tail_rcu - add a new entry to rcu-protected list
* @new: new entry to be added
* @head: list head to add it before
* @param new new entry to be added
* @param head list head to add it before
*
* Insert a new entry before the specified head.
* This is useful for implementing queues.
@ -188,7 +189,7 @@ static inline void __list_del(struct list_head * prev, struct list_head * next)
/**
* list_del - deletes entry from list.
* @entry: the element to delete from the list.
* @param entry the element to delete from the list.
* Note: list_empty on entry does not return true after this, the entry is
* in an undefined state.
*/
@ -201,7 +202,7 @@ static inline void list_del(struct list_head *entry)
/**
* list_del_rcu - deletes entry from list without re-initialization
* @entry: the element to delete from the list.
* @param entry the element to delete from the list.
*
* Note: list_empty on entry does not return true after this,
* the entry is in an undefined state. It is useful for RCU based
@ -231,8 +232,8 @@ static inline void list_del_rcu(struct list_head *entry)
/*
* list_replace_rcu - replace old entry by new one
* @old : the element to be replaced
* @new : the new element to insert
* @param old the element to be replaced
* @param new the new element to insert
*
* The old entry will be replaced with the new entry atomically.
*/
@ -249,7 +250,7 @@ static inline void list_replace_rcu(struct list_head *old,
/**
* list_del_init - deletes entry from list and reinitialize it.
* @entry: the element to delete from the list.
* @param entry the element to delete from the list.
*/
static inline void list_del_init(struct list_head *entry)
{
@ -259,8 +260,8 @@ static inline void list_del_init(struct list_head *entry)
/**
* list_move - delete from one list and add as another's head
* @list: the entry to move
* @head: the head that will precede our entry
* @param list the entry to move
* @param head the head that will precede our entry
*/
static inline void list_move(struct list_head *list, struct list_head *head)
{
@ -270,8 +271,8 @@ static inline void list_move(struct list_head *list, struct list_head *head)
/**
* list_move_tail - delete from one list and add as another's tail
* @list: the entry to move
* @head: the head that will follow our entry
* @param list the entry to move
* @param head the head that will follow our entry
*/
static inline void list_move_tail(struct list_head *list,
struct list_head *head)
@ -282,7 +283,7 @@ static inline void list_move_tail(struct list_head *list,
/**
* list_empty - tests whether a list is empty
* @head: the list to test.
* @param head the list to test.
*/
static inline int list_empty(const struct list_head *head)
{
@ -299,7 +300,7 @@ static inline int list_empty(const struct list_head *head)
* to the list entry is list_del_init(). Eg. it cannot be used
* if another CPU could re-list_add() it.
*
* @head: the list to test.
* @param head the list to test.
*/
static inline int list_empty_careful(const struct list_head *head)
{
@ -323,8 +324,8 @@ static inline void __list_splice(struct list_head *list,
/**
* list_splice - join two lists
* @list: the new list to add.
* @head: the place to add it in the first list.
* @param list the new list to add.
* @param head the place to add it in the first list.
*/
static inline void list_splice(struct list_head *list, struct list_head *head)
{
@ -334,8 +335,8 @@ static inline void list_splice(struct list_head *list, struct list_head *head)
/**
* list_splice_init - join two lists and reinitialise the emptied list.
* @list: the new list to add.
* @head: the place to add it in the first list.
* @param list the new list to add.
* @param head the place to add it in the first list.
*
* The list at @list is reinitialised
*/
@ -350,17 +351,17 @@ static inline void list_splice_init(struct list_head *list,
/**
* list_entry - get the struct for this entry
* @ptr: the &struct list_head pointer.
* @type: the type of the struct this is embedded in.
* @member: the name of the list_struct within the struct.
* @param ptr the &struct list_head pointer.
* @param type the type of the struct this is embedded in.
* @param member the name of the list_struct within the struct.
*/
#define list_entry(ptr, type, member) \
container_of(ptr, type, member)
/**
* list_for_each - iterate over a list
* @pos: the &struct list_head to use as a loop counter.
* @head: the head for your list.
* @param pos the &struct list_head to use as a loop counter.
* @param head the head for your list.
*/
#define list_for_each(pos, head) \
for (pos = (head)->next; prefetch(pos->next), pos != (head); \
@ -368,8 +369,8 @@ static inline void list_splice_init(struct list_head *list,
/**
* __list_for_each - iterate over a list
* @pos: the &struct list_head to use as a loop counter.
* @head: the head for your list.
* @param pos the &struct list_head to use as a loop counter.
* @param head the head for your list.
*
* This variant differs from list_for_each() in that it's the
* simplest possible list iteration code, no prefetching is done.
@ -381,8 +382,8 @@ static inline void list_splice_init(struct list_head *list,
/**
* list_for_each_prev - iterate over a list backwards
* @pos: the &struct list_head to use as a loop counter.
* @head: the head for your list.
* @param pos the &struct list_head to use as a loop counter.
* @param head the head for your list.
*/
#define list_for_each_prev(pos, head) \
for (pos = (head)->prev; prefetch(pos->prev), pos != (head); \
@ -390,9 +391,9 @@ static inline void list_splice_init(struct list_head *list,
/**
* list_for_each_safe - iterate over a list safe against removal of list entry
* @pos: the &struct list_head to use as a loop counter.
* @n: another &struct list_head to use as temporary storage
* @head: the head for your list.
* @param pos the &struct list_head to use as a loop counter.
* @param n another &struct list_head to use as temporary storage
* @param head the head for your list.
*/
#define list_for_each_safe(pos, n, head) \
for (pos = (head)->next, n = pos->next; pos != (head); \
@ -400,9 +401,9 @@ static inline void list_splice_init(struct list_head *list,
/**
* list_for_each_entry - iterate over list of given type
* @pos: the type * to use as a loop counter.
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
* @param pos the type * to use as a loop counter.
* @param head the head for your list.
* @param member the name of the list_struct within the struct.
*/
#define list_for_each_entry(pos, head, member) \
for (pos = list_entry((head)->next, typeof(*pos), member); \
@ -411,9 +412,9 @@ static inline void list_splice_init(struct list_head *list,
/**
* list_for_each_entry_reverse - iterate backwards over list of given type.
* @pos: the type * to use as a loop counter.
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
* @param pos the type * to use as a loop counter.
* @param head the head for your list.
* @param member the name of the list_struct within the struct.
*/
#define list_for_each_entry_reverse(pos, head, member) \
for (pos = list_entry((head)->prev, typeof(*pos), member); \
@ -423,9 +424,9 @@ static inline void list_splice_init(struct list_head *list,
/**
* list_prepare_entry - prepare a pos entry for use as a start point in
* list_for_each_entry_continue
* @pos: the type * to use as a start point
* @head: the head of the list
* @member: the name of the list_struct within the struct.
* @param pos the type * to use as a start point
* @param head the head of the list
* @param member the name of the list_struct within the struct.
*/
#define list_prepare_entry(pos, head, member) \
((pos) ? : list_entry(head, typeof(*pos), member))
@ -433,9 +434,9 @@ static inline void list_splice_init(struct list_head *list,
/**
* list_for_each_entry_continue - iterate over list of given type
* continuing after existing point
* @pos: the type * to use as a loop counter.
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
* @param pos the type * to use as a loop counter.
* @param head the head for your list.
* @param member the name of the list_struct within the struct.
*/
#define list_for_each_entry_continue(pos, head, member) \
for (pos = list_entry(pos->member.next, typeof(*pos), member); \
@ -445,9 +446,9 @@ static inline void list_splice_init(struct list_head *list,
/**
* list_for_each_entry_from - iterate over list of given type
* continuing from existing point
* @pos: the type * to use as a loop counter.
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
* @param pos the type * to use as a loop counter.
* @param head the head for your list.
* @param member the name of the list_struct within the struct.
*/
#define list_for_each_entry_from(pos, head, member) \
for (; prefetch(pos->member.next), &pos->member != (head); \
@ -455,10 +456,10 @@ static inline void list_splice_init(struct list_head *list,
/**
* list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
* @pos: the type * to use as a loop counter.
* @n: another type * to use as temporary storage
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
* @param pos the type * to use as a loop counter.
* @param n another type * to use as temporary storage
* @param head the head for your list.
* @param member the name of the list_struct within the struct.
*/
#define list_for_each_entry_safe(pos, n, head, member) \
for (pos = list_entry((head)->next, typeof(*pos), member), \
@ -469,10 +470,10 @@ static inline void list_splice_init(struct list_head *list,
/**
* list_for_each_entry_safe_continue - iterate over list of given type
* continuing after existing point safe against removal of list entry
* @pos: the type * to use as a loop counter.
* @n: another type * to use as temporary storage
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
* @param pos the type * to use as a loop counter.
* @param n another type * to use as temporary storage
* @param head the head for your list.
* @param member the name of the list_struct within the struct.
*/
#define list_for_each_entry_safe_continue(pos, n, head, member) \
for (pos = list_entry(pos->member.next, typeof(*pos), member), \
@ -483,10 +484,10 @@ static inline void list_splice_init(struct list_head *list,
/**
* list_for_each_entry_safe_from - iterate over list of given type
* from existing point safe against removal of list entry
* @pos: the type * to use as a loop counter.
* @n: another type * to use as temporary storage
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
* @param pos the type * to use as a loop counter.
* @param n another type * to use as temporary storage
* @param head the head for your list.
* @param member the name of the list_struct within the struct.
*/
#define list_for_each_entry_safe_from(pos, n, head, member) \
for (n = list_entry(pos->member.next, typeof(*pos), member); \
@ -496,10 +497,10 @@ static inline void list_splice_init(struct list_head *list,
/**
* list_for_each_entry_safe_reverse - iterate backwards over list of given type safe against
* removal of list entry
* @pos: the type * to use as a loop counter.
* @n: another type * to use as temporary storage
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
* @param pos the type * to use as a loop counter.
* @param n another type * to use as temporary storage
* @param head the head for your list.
* @param member the name of the list_struct within the struct.
*/
#define list_for_each_entry_safe_reverse(pos, n, head, member) \
for (pos = list_entry((head)->prev, typeof(*pos), member), \
@ -509,8 +510,8 @@ static inline void list_splice_init(struct list_head *list,
/**
* list_for_each_rcu - iterate over an rcu-protected list
* @pos: the &struct list_head to use as a loop counter.
* @head: the head for your list.
* @param pos the &struct list_head to use as a loop counter.
* @param head the head for your list.
*
* This list-traversal primitive may safely run concurrently with
* the _rcu list-mutation primitives such as list_add_rcu()
@ -529,9 +530,9 @@ static inline void list_splice_init(struct list_head *list,
/**
* list_for_each_safe_rcu - iterate over an rcu-protected list safe
* against removal of list entry
* @pos: the &struct list_head to use as a loop counter.
* @n: another &struct list_head to use as temporary storage
* @head: the head for your list.
* @param pos the &struct list_head to use as a loop counter.
* @param n another &struct list_head to use as temporary storage
* @param head the head for your list.
*
* This list-traversal primitive may safely run concurrently with
* the _rcu list-mutation primitives such as list_add_rcu()
@ -544,9 +545,9 @@ static inline void list_splice_init(struct list_head *list,
/**
* list_for_each_entry_rcu - iterate over rcu list of given type
* @pos: the type * to use as a loop counter.
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
* @param pos the type * to use as a loop counter.
* @param head the head for your list.
* @param member the name of the list_struct within the struct.
*
* This list-traversal primitive may safely run concurrently with
* the _rcu list-mutation primitives such as list_add_rcu()
@ -562,8 +563,8 @@ static inline void list_splice_init(struct list_head *list,
/**
* list_for_each_continue_rcu - iterate over an rcu-protected list
* continuing after existing point.
* @pos: the &struct list_head to use as a loop counter.
* @head: the head for your list.
* @param pos the &struct list_head to use as a loop counter.
* @param head the head for your list.
*
* This list-traversal primitive may safely run concurrently with
* the _rcu list-mutation primitives such as list_add_rcu()
@ -626,7 +627,7 @@ static inline void hlist_del(struct hlist_node *n)
/**
* hlist_del_rcu - deletes entry from hash list without re-initialization
* @n: the element to delete from the hash list.
* @param n the element to delete from the hash list.
*
* Note: list_unhashed() on entry does not return true after this,
* the entry is in an undefined state. It is useful for RCU based
@ -659,8 +660,8 @@ static inline void hlist_del_init(struct hlist_node *n)
/*
* hlist_replace_rcu - replace old entry by new one
* @old : the element to be replaced
* @new : the new element to insert
* @param old the element to be replaced
* @param new the new element to insert
*
* The old entry will be replaced with the new entry atomically.
*/
@ -692,8 +693,8 @@ static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h)
/**
* hlist_add_head_rcu - adds the specified element to the specified hlist,
* while permitting racing traversals.
* @n: the element to add to the hash list.
* @h: the list to add to.
* @param n the element to add to the hash list.
* @param h the list to add to.
*
* The caller must take whatever precautions are necessary
* (such as holding appropriate locks) to avoid racing
@ -741,8 +742,8 @@ static inline void hlist_add_after(struct hlist_node *n,
/**
* hlist_add_before_rcu - adds the specified element to the specified hlist
* before the specified node while permitting racing traversals.
* @n: the new element to add to the hash list.
* @next: the existing element to add the new element before.
* @param n the new element to add to the hash list.
* @param next the existing element to add the new element before.
*
* The caller must take whatever precautions are necessary
* (such as holding appropriate locks) to avoid racing
@ -766,8 +767,8 @@ static inline void hlist_add_before_rcu(struct hlist_node *n,
/**
* hlist_add_after_rcu - adds the specified element to the specified hlist
* after the specified node while permitting racing traversals.
* @prev: the existing element to add the new element after.
* @n: the new element to add to the hash list.
* @param prev the existing element to add the new element after.
* @param n the new element to add to the hash list.
*
* The caller must take whatever precautions are necessary
* (such as holding appropriate locks) to avoid racing
@ -801,10 +802,10 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
/**
* hlist_for_each_entry - iterate over list of given type
* @tpos: the type * to use as a loop counter.
* @pos: the &struct hlist_node to use as a loop counter.
* @head: the head for your list.
* @member: the name of the hlist_node within the struct.
* @param tpos the type * to use as a loop counter.
* @param pos the &struct hlist_node to use as a loop counter.
* @param head the head for your list.
* @param member the name of the hlist_node within the struct.
*/
#define hlist_for_each_entry(tpos, pos, head, member) \
for (pos = (head)->first; \
@ -814,9 +815,9 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
/**
* hlist_for_each_entry_continue - iterate over a hlist continuing after existing point
* @tpos: the type * to use as a loop counter.
* @pos: the &struct hlist_node to use as a loop counter.
* @member: the name of the hlist_node within the struct.
* @param tpos the type * to use as a loop counter.
* @param pos the &struct hlist_node to use as a loop counter.
* @param member the name of the hlist_node within the struct.
*/
#define hlist_for_each_entry_continue(tpos, pos, member) \
for (pos = (pos)->next; \
@ -826,9 +827,9 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
/**
* hlist_for_each_entry_from - iterate over a hlist continuing from existing point
* @tpos: the type * to use as a loop counter.
* @pos: the &struct hlist_node to use as a loop counter.
* @member: the name of the hlist_node within the struct.
* @param tpos the type * to use as a loop counter.
* @param pos the &struct hlist_node to use as a loop counter.
* @param member the name of the hlist_node within the struct.
*/
#define hlist_for_each_entry_from(tpos, pos, member) \
for (; pos && ({ prefetch(pos->next); 1;}) && \
@ -837,11 +838,11 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
/**
* hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry
* @tpos: the type * to use as a loop counter.
* @pos: the &struct hlist_node to use as a loop counter.
* @n: another &struct hlist_node to use as temporary storage
* @head: the head for your list.
* @member: the name of the hlist_node within the struct.
* @param tpos the type * to use as a loop counter.
* @param pos the &struct hlist_node to use as a loop counter.
* @param n another &struct hlist_node to use as temporary storage
* @param head the head for your list.
* @param member the name of the hlist_node within the struct.
*/
#define hlist_for_each_entry_safe(tpos, pos, n, head, member) \
for (pos = (head)->first; \
@ -851,10 +852,10 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
/**
* hlist_for_each_entry_rcu - iterate over rcu list of given type
* @tpos: the type * to use as a loop counter.
* @pos: the &struct hlist_node to use as a loop counter.
* @head: the head for your list.
* @member: the name of the hlist_node within the struct.
* @param tpos the type * to use as a loop counter.
* @param pos the &struct hlist_node to use as a loop counter.
* @param head the head for your list.
* @param member the name of the hlist_node within the struct.
*
* This list-traversal primitive may safely run concurrently with
* the _rcu list-mutation primitives such as hlist_add_head_rcu()