upipe/uring.h header reference

Upipe ring of buffers More

Header inclusion  

Members  

Types  

Functions  

Macros  

Description  

This API defines rings of structures for use in LIFOs and FIFOs.

Members detail  

#define URING_FIFO_NULL  

This macro is declared in upipe/uring.h source file, line 252.

This macro represents a (NULL, NULL) FIFO descriptor.

#define URING_INDEX_NULL  

This macro is declared in upipe/uring.h source file, line 48.

This macro represents a NULL index position.

#define URING_LIFO_NULL  

This macro is declared in upipe/uring.h source file, line 131.

This macro represents a NULL LIFO descriptor.

#define _UPIPE_URING_H_  

This macro is declared in upipe/uring.h source file, line 32.

struct uring  

This struct is declared in upipe/uring.h source file, line 62.

This struct defines a ring of elements.

FieldDescription
uint16_t length;number of elements in the ring
struct uring_elem * elems;array of elements

struct uring_elem  

This struct is declared in upipe/uring.h source file, line 52.

This struct defines an element in the ring.

FieldDescription
uint16_t tag;tag incremented at each use
uring_index next;index of the next element
void * opaque;pointer to opaque structure

void * uring_elem_get(struct uring *uring, uring_index index)  

This function is declared in upipe/uring.h source file, line 110.

This function gets the opaque of a uring element.

Parameter list:

  • uring: pointer to uring structure
  • index: index of the element in the ring

The return value is opaque associated with the element, or NULL

void uring_elem_set(struct uring *uring, uring_index index, void *opaque)  

This function is declared in upipe/uring.h source file, line 97.

This function sets the opaque of a uring element.

Parameter list:

  • uring: pointer to uring structure
  • index: index of the element in the ring
  • opaque: opaque to associate with the element

typedef uatomic_uint32_t uring_fifo  

This typedef is declared in upipe/uring.h source file, line 250.

This typedef defines an atomic structure describing a FIFO, based on uring_fifo_val.

void uring_fifo_clean(struct uring *uring, uring_fifo *fifo_p)  

This function is declared in upipe/uring.h source file, line 434.

This function cleans up a FIFO.

Parameter list:

  • uring: pointer to uring structure
  • fifo_p: pointer to the FIFO descriptor

void uring_fifo_init(struct uring *uring, uring_fifo *fifo_p)  

This function is declared in upipe/uring.h source file, line 424.

This function initializes a FIFO.

Parameter list:

  • uring: pointer to uring structure
  • fifo_p: pointer to the FIFO descriptor

uring_index uring_fifo_pop(struct uring *uring, uring_fifo *fifo_p)  

This function is declared in upipe/uring.h source file, line 352.

This function pops an element from the head of a FIFO.

Parameter list:

  • uring: pointer to uring structure
  • fifo_p: pointer to the FIFO descriptor

The return value is index of the first FIFO element, or URING_INDEX_NULL

void uring_fifo_push(struct uring *uring, uring_fifo *fifo_p, uring_index index)  

This function is declared in upipe/uring.h source file, line 403.

This function pushes an element into the tail of a FIFO in a thread-safe manner.

Parameter list:

  • uring: pointer to uring structure
  • fifo_p: pointer to the FIFO descriptor
  • index: index of the element to push

typedef uint32_t uring_fifo_val  

This typedef is declared in upipe/uring.h source file, line 245.

This typedef defines a multiplexed structure from two element indexes (head and tail) and associated tags. The bit-field definition is:

bits
description
8
tail tag
8
tail index
8
head tag
8
head index

typedef uint16_t uring_index  

This typedef is declared in upipe/uring.h source file, line 46.

This typedef defines the position of an element in the uring array.

uring_lifo_val uring_init(struct uring *uring, uint16_t length, void *extra)  

This function is declared in upipe/uring.h source file, line 450.

This function initializes a ring. By default all elements are chained, and the first element is the head of the chain.

Parameter list:

  • uring: pointer to uring structure
  • length: number of elements in the ring
  • extra: mandatory extra space allocated by the caller, with the size returned by uring_sizeof

The return value is uring LIFO descriptor of the first element, for use in uring_lifo_init

typedef uatomic_uint32_t uring_lifo  

This typedef is declared in upipe/uring.h source file, line 129.

This typedef defines an atomic structure describing a LIFO, based on uring_lifo_val.

void uring_lifo_clean(struct uring *uring, uring_lifo *lifo_p)  

This function is declared in upipe/uring.h source file, line 188.

This function cleans up a LIFO.

Parameter list:

  • uring: pointer to uring structure
  • lifo_p: pointer to the LIFO descriptor

void uring_lifo_init(struct uring *uring, uring_lifo *lifo_p, uring_lifo_val lifo)  

This function is declared in upipe/uring.h source file, line 178.

This function initializes a LIFO.

Parameter list:

  • uring: pointer to uring structure
  • lifo_p: pointer to the LIFO descriptor
  • lifo: LIFO value returned by uring_init, or URING_LIFO_NULL

uring_index uring_lifo_pop(struct uring *uring, uring_lifo *lifo_p)  

This function is declared in upipe/uring.h source file, line 200.

This function pops an element from a LIFO.

Parameter list:

  • uring: pointer to uring structure
  • lifo_p: pointer to the LIFO descriptor

The return value is index of the first LIFO element, or URING_INDEX_NULL

void uring_lifo_push(struct uring *uring, uring_lifo *lifo_p, uring_index index)  

This function is declared in upipe/uring.h source file, line 225.

This function pushes an element into a LIFO.

Parameter list:

  • uring: pointer to uring structure
  • lifo_p: pointer to the LIFO descriptor
  • index: index of the element to push

typedef uint32_t uring_lifo_val  

This typedef is declared in upipe/uring.h source file, line 124.

This typedef defines a multiplexed structure from an element index (top) and a tag incremented at each use of the element. This is to avoid the ABA problem in concurrent operations. The bit-field definition is:

bits
description
16
tag
16
index

#define uring_sizeof(length)  

This macro is declared in upipe/uring.h source file, line 73.

This macro returns the required size of extra data space for uring.

Parameter list:

  • length: number of elements in the ring

The return value is size in octets to allocate

struct uring_elem * uring_elem_from_index(struct uring *uring, uring_index index)  

This function is for internal use only.

This function is declared in upipe/uring.h source file, line 83.

This function returns a pointer to an element from an index.

Parameter list:

  • index: of the element in the ring

The return value is pointer to the element in the ring

uring_index uring_fifo_find(struct uring *uring, uring_index start, uring_index find)  

This function is for internal use only.

This function is declared in upipe/uring.h source file, line 328.

This function finds in a chained list of elements the one pointing to a given index.

Parameter list:

  • uring: pointer to uring structure
  • start: index of the first element of the list
  • find: index to find

The return value is index of the element pointing to find, or URING_INDEX_NULL if not found

uring_index uring_fifo_get_head(struct uring *uring, uring_fifo_val fifo)  

This function is for internal use only.

This function is declared in upipe/uring.h source file, line 311.

This function returns the index of the head element of a FIFO descriptor

Parameter list:

  • fifo: FIFO multiplexed structure

The return value is index of the head element in the ring

uring_index uring_fifo_get_tail(struct uring *uring, uring_fifo_val fifo)  

This function is for internal use only.

This function is declared in upipe/uring.h source file, line 298.

This function returns the index of the tail element of a FIFO descriptor.

Parameter list:

  • fifo: FIFO multiplexed structure

The return value is index of the tail element in the ring

void uring_fifo_set_head(struct uring *uring, uring_fifo_val *fifo_p, uring_index index)  

This function is for internal use only.

This function is declared in upipe/uring.h source file, line 281.

This function sets the index of the head element of a FIFO descriptor.

Parameter list:

  • fifo_p: pointer to uring FIFO multiplexed structure
  • index: index of the head element in the ring

void uring_fifo_set_tail(struct uring *uring, uring_fifo_val *fifo_p, uring_index index)  

This function is for internal use only.

This function is declared in upipe/uring.h source file, line 263.

This function sets the index of the tail element of a FIFO descriptor.

Parameter list:

  • fifo_p: pointer to uring FIFO multiplexed structure
  • index: index of the tail element in the ring

uring_lifo_val uring_lifo_from_index(struct uring *uring, uring_index index)  

This function is for internal use only.

This function is declared in upipe/uring.h source file, line 160.

This function returns a LIFO value (multiplexed tag and index) for a given element index. There is no memory barrier in this function because we assume it's been done by the caller.

Parameter list:

  • uring: pointer to uring structure
  • index: index of the element in the ring

The return value is uring LIFO multiplexed structure

uring_index uring_lifo_to_index(struct uring *uring, uring_lifo_val lifo)  

This function is for internal use only.

This function is declared in upipe/uring.h source file, line 141.

This function returns the index of an element from a LIFO value.

Parameter list:

  • lifo: uring LIFO multiplexed structure

The return value is index of the element in the ring

Valid XHTML 1.0 StrictGenerated by cmassiot on Fri Feb 2 23:57:20 2018 using MkDoc