Motr  M0
Queue

Data Structures

struct  m0_queue
 
struct  m0_queue_link
 

Macros

#define EOQ   ((struct m0_queue_link *)8)
 

Functions

M0_INTERNAL void m0_queue_init (struct m0_queue *q)
 
M0_INTERNAL void m0_queue_fini (struct m0_queue *q)
 
M0_INTERNAL bool m0_queue_is_empty (const struct m0_queue *q)
 
M0_INTERNAL void m0_queue_link_init (struct m0_queue_link *ql)
 
M0_INTERNAL void m0_queue_link_fini (struct m0_queue_link *ql)
 
M0_INTERNAL bool m0_queue_link_is_in (const struct m0_queue_link *ql)
 
M0_INTERNAL bool m0_queue_contains (const struct m0_queue *q, const struct m0_queue_link *ql)
 
M0_INTERNAL size_t m0_queue_length (const struct m0_queue *q)
 
M0_INTERNAL struct m0_queue_linkm0_queue_get (struct m0_queue *q)
 
M0_INTERNAL void m0_queue_put (struct m0_queue *q, struct m0_queue_link *ql)
 
M0_INTERNAL bool m0_queue_invariant (const struct m0_queue *q)
 

Variables

const struct m0_queue M0_QUEUE_INIT
 
struct m0_queue M0_XCA_DOMAIN
 
const struct m0_queue M0_QUEUE_INIT
 

Detailed Description

FIFO queue. Should be pretty self-explanatory.

When a queue is not empty, last element's m0_queue_link::ql_next is set to "end-of-queue" marker (EOQ). This guarantees that an element is in a queue iff ql_next is not NULL (see m0_queue_link_is_in()).

When a queue is empty, its head and tail are set to EOQ. This allows iteration over queue elements via loop of the form

for (scan = q->q_head; scan != EOQ; scan = scan->ql_next) { ... }

independently of whether the queue is empty.

Macro Definition Documentation

◆ EOQ

#define EOQ   ((struct m0_queue_link *)8)

Definition at line 46 of file queue.c.

Function Documentation

◆ m0_queue_contains()

M0_INTERNAL bool m0_queue_contains ( const struct m0_queue q,
const struct m0_queue_link ql 
)

Definition at line 86 of file queue.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_queue_fini()

M0_INTERNAL void m0_queue_fini ( struct m0_queue q)

Definition at line 59 of file queue.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_queue_get()

M0_INTERNAL struct m0_queue_link * m0_queue_get ( struct m0_queue q)

Returns queue head or NULL if queue is empty.

Definition at line 112 of file queue.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_queue_init()

M0_INTERNAL void m0_queue_init ( struct m0_queue q)

Definition at line 53 of file queue.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_queue_invariant()

M0_INTERNAL bool m0_queue_invariant ( const struct m0_queue q)

Definition at line 143 of file queue.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_queue_is_empty()

M0_INTERNAL bool m0_queue_is_empty ( const struct m0_queue q)

Definition at line 65 of file queue.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_queue_length()

M0_INTERNAL size_t m0_queue_length ( const struct m0_queue q)

Definition at line 100 of file queue.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_queue_link_fini()

M0_INTERNAL void m0_queue_link_fini ( struct m0_queue_link ql)

Definition at line 76 of file queue.c.

Here is the call graph for this function:

◆ m0_queue_link_init()

M0_INTERNAL void m0_queue_link_init ( struct m0_queue_link ql)

Definition at line 71 of file queue.c.

Here is the caller graph for this function:

◆ m0_queue_link_is_in()

M0_INTERNAL bool m0_queue_link_is_in ( const struct m0_queue_link ql)

Definition at line 81 of file queue.c.

Here is the caller graph for this function:

◆ m0_queue_put()

M0_INTERNAL void m0_queue_put ( struct m0_queue q,
struct m0_queue_link ql 
)

Definition at line 131 of file queue.c.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ M0_QUEUE_INIT [1/2]

const struct m0_queue M0_QUEUE_INIT

Static queue initializer. Assign this to a variable of type struct m0_queue to initialize empty queue.

Definition at line 48 of file queue.c.

◆ M0_QUEUE_INIT [2/2]

const struct m0_queue M0_QUEUE_INIT
Initial value:
= {
.q_head = EOQ,
.q_tail = EOQ
}
#define EOQ
Definition: queue.c:46

Static queue initializer. Assign this to a variable of type struct m0_queue to initialize empty queue.

Definition at line 48 of file queue.c.

◆ M0_XCA_DOMAIN

struct m0_queue M0_XCA_DOMAIN