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

Functions | |
| ring_buf_size_t | ring_buf_put (struct ring_buf *buf, const void *data, ring_buf_size_t size) |
| Puts non-contiguous bytes into the ring buffer. | |
| ring_buf_size_t | ring_buf_get (struct ring_buf *buf, void *data, ring_buf_size_t size) |
| Gets data from a ring buffer. | |
| int | ring_buf_put_all (struct ring_buf *buf, const void *data, ring_buf_size_t size) |
| Puts all or none. | |
| int | ring_buf_get_all (struct ring_buf *buf, void *data, ring_buf_size_t size) |
| Gets all or none. | |
Functions for discontiguous access to ring buffer data.
These functions allow for putting and getting data that may span across the end of the ring buffer, handling wrap-around as necessary.
| ring_buf_size_t ring_buf_get | ( | struct ring_buf * | buf, |
| void * | data, | ||
| ring_buf_size_t | size | ||
| ) |
Gets data from a ring buffer.
Copies discontinuous data.
| buf | Ring buffer. |
| data | Address of copied data, or NULL to ignore. |
| size | Number of bytes to get. |
Definition at line 166 of file ring_buf.c.
| int ring_buf_get_all | ( | struct ring_buf * | buf, |
| void * | data, | ||
| ring_buf_size_t | size | ||
| ) |
Gets all or none.
Gets all the requested data from the ring buffer or gets nothing. Returns an error if there is insufficient data.
| buf | Ring buffer. |
| data | Address of copied data. |
| size | Number of bytes to get. |
| 0 | on success |
| -EAGAIN | if insufficient data is available. |
Definition at line 191 of file ring_buf.c.
| ring_buf_size_t ring_buf_put | ( | struct ring_buf * | buf, |
| const void * | data, | ||
| ring_buf_size_t | size | ||
| ) |
Puts non-contiguous bytes into the ring buffer.
The return value may be less than the given size if the buffer runs out of free space.
| buf | Ring buffer. |
| data | Address of bytes to put. |
| size | Number of bytes to put. |
Definition at line 153 of file ring_buf.c.
| int ring_buf_put_all | ( | struct ring_buf * | buf, |
| const void * | data, | ||
| ring_buf_size_t | size | ||
| ) |
Puts all or none.
Puts all the given data into the ring buffer or puts nothing. Returns an error if there is insufficient space.
| buf | Ring buffer. |
| data | Address of bytes to put. |
| size | Number of bytes to put. |
-EMSGSIZE if the data will not fit. Definition at line 181 of file ring_buf.c.