|
ring_buf
|
Functions for contiguous access to ring buffer data. More...

Functions | |
| ring_buf_size_t | ring_buf_put_claim (struct ring_buf *buf, void **space, ring_buf_size_t size) |
| Claims space for putting data into a ring buffer. | |
| int | ring_buf_put_ack (struct ring_buf *buf, ring_buf_size_t size) |
| Acknowledges space claimed for putting data into a ring buffer. | |
| ring_buf_size_t | ring_buf_get_claim (struct ring_buf *buf, void **space, ring_buf_size_t size) |
| Claims contiguous space for getting. | |
| int | ring_buf_get_ack (struct ring_buf *buf, ring_buf_size_t size) |
| Acknowledges space claimed for getting data from a ring buffer. | |
Functions for contiguous access to ring buffer data.
These functions allow for claiming and acknowledging contiguous space within the ring buffer for both putting and getting data.
| int ring_buf_get_ack | ( | struct ring_buf * | buf, |
| ring_buf_size_t | size | ||
| ) |
Acknowledges space claimed for getting data from a ring buffer.
Acknowledging a number of bytes advances the get zone.
| buf | Ring buffer address. |
| size | Number of bytes to acknowledge. |
| 0 | on successful get. |
| -EINVAL | if size exceeds previously claimed aggregate space. |
Definition at line 143 of file ring_buf.c.
| ring_buf_size_t ring_buf_get_claim | ( | struct ring_buf * | buf, |
| void ** | space, | ||
| ring_buf_size_t | size | ||
| ) |
Claims contiguous space for getting.
Advances the "get" head. One get operation starts with a claim. A successful claim expands the "get zone" by the requested number of bytes.
| buf | Ring buffer address. |
| space | Address of pointer to claimed space, or NULL to ignore. |
| size | Number of bytes to claim. |
Definition at line 127 of file ring_buf.c.
| int ring_buf_put_ack | ( | struct ring_buf * | buf, |
| ring_buf_size_t | size | ||
| ) |
Acknowledges space claimed for putting data into a ring buffer.
Acknowledging a number of bytes advances the put zone. Notice that the claim cannot span across the end of the buffer space. Buffer size less the put zone's head clamps the claim size. It cannot exceed the remaining contiguous space.
| buf | Ring buffer address. |
| size | Number of bytes to acknowledge. |
| 0 | on successful put. |
| -EINVAL | if size exceeds previously claimed aggregate space. |
Definition at line 117 of file ring_buf.c.
| ring_buf_size_t ring_buf_put_claim | ( | struct ring_buf * | buf, |
| void ** | space, | ||
| ring_buf_size_t | size | ||
| ) |
Claims space for putting data into a ring buffer.
Claims contiguous space. Advances the "put" head. One put operation starts with a claim. A successful claim expands the "put zone" by the requested number of bytes.
| buf | Ring buffer address. |
| space | Address of pointer to claimed space, or NULL to ignore. |
| size | Number of bytes to claim. |
Definition at line 101 of file ring_buf.c.