#include <stdbool.h>


Go to the source code of this file.
Data Structures | |
| struct | ring_head |
| Ring buffer management data. More... | |
Functions | |
| static unsigned long | ring_get_head (struct ring_head *ring, unsigned long ring_size) |
| Get the offset of the next unused entry in the buffer. | |
| static unsigned long | ring_get_tail (struct ring_head *ring, unsigned long ring_size) |
| Get the offset of the first used entry in the buffer. | |
| static unsigned long | ring_entries_used (struct ring_head *ring, unsigned long ring_size) |
| Get the number of used entries in the buffer. | |
| static unsigned long | ring_entries_used_before_end (struct ring_head *ring, unsigned long ring_size) |
| Get the number of used entries in the buffer before it wraps. | |
| static unsigned long | ring_entries_unused (struct ring_head *ring, unsigned long ring_size) |
| Get the number of unused entries in the buffer. | |
| static unsigned long | ring_entries_unused_before_end (struct ring_head *ring, unsigned long ring_size) |
| Get the number of unused entries in the buffer before it wraps. | |
| static bool | ring_is_empty (struct ring_head *ring, unsigned long ring_size) |
| Test if the ring buffer is empty. | |
| static void | ring_insert_entries (struct ring_head *ring, unsigned long nr_entries) |
| Insert entries into a ring buffer. | |
| static void | ring_extract_entries (struct ring_head *ring, unsigned long nr_entries) |
| Extract entries from a ring buffer. | |
| static void | ring_reset (struct ring_head *ring) |
| Reset the ring buffer. | |
Definition in file ring.h.
| static unsigned long ring_entries_unused | ( | struct ring_head * | ring, | |
| unsigned long | ring_size | |||
| ) | [inline, static] |
Get the number of unused entries in the buffer.
Definition at line 187 of file ring.h.
References ring_entries_used().
Referenced by console_buf_unused().

| static unsigned long ring_entries_unused_before_end | ( | struct ring_head * | ring, | |
| unsigned long | ring_size | |||
| ) | [inline, static] |
Get the number of unused entries in the buffer before it wraps.
Definition at line 203 of file ring.h.
References ring_head::head, and ring_head::tail.
Referenced by console_buf_unused_before_end().
| static unsigned long ring_entries_used | ( | struct ring_head * | ring, | |
| unsigned long | ring_size | |||
| ) | [inline, static] |
Get the number of used entries in the buffer.
Definition at line 147 of file ring.h.
References ring_head::head, and ring_head::tail.
Referenced by console_buf_used(), and ring_entries_unused().
| static unsigned long ring_entries_used_before_end | ( | struct ring_head * | ring, | |
| unsigned long | ring_size | |||
| ) | [inline, static] |
Get the number of used entries in the buffer before it wraps.
Definition at line 164 of file ring.h.
References ring_head::head, and ring_head::tail.
| static void ring_extract_entries | ( | struct ring_head * | ring, | |
| unsigned long | nr_entries | |||
| ) | [inline, static] |
Extract entries from a ring buffer.
Adjust the buffer tail to account for entries being extracted from the buffer. Normally, this should be called after the actual buffer contents have been read; the barrier ensures that the compiler doesn't move any buffer accesses after updating the tail.
| ring | The ring buffer | |
| nr_entries | The number of entries to extract |
Definition at line 261 of file ring.h.
References barrier, and ring_head::tail.
Referenced by console_buf_extract_char().
| static unsigned long ring_get_head | ( | struct ring_head * | ring, | |
| unsigned long | ring_size | |||
| ) | [inline, static] |
Get the offset of the next unused entry in the buffer.
Note that the value returned by this function is only meaningful if there actually are any unused entries in the buffer.
Definition at line 111 of file ring.h.
References ring_head::head.
Referenced by console_buf_insert_char(), and console_drv_write().
| static unsigned long ring_get_tail | ( | struct ring_head * | ring, | |
| unsigned long | ring_size | |||
| ) | [inline, static] |
Get the offset of the first used entry in the buffer.
Note that the value returned by this function is only meaningful if there actually are any used entries in the buffer.
Definition at line 130 of file ring.h.
References ring_head::tail.
Referenced by console_buf_extract_char().
| static void ring_insert_entries | ( | struct ring_head * | ring, | |
| unsigned long | nr_entries | |||
| ) | [inline, static] |
Insert entries into a ring buffer.
Adjust the buffer head to account for entries being inserted into the buffer. Normally, this should be called after the actual buffer contents have been updated; the barrier ensures that the compiler doesn't move any buffer accesses after updating the head.
| ring | The ring buffer | |
| nr_entries | The number of entries to insert |
Definition at line 243 of file ring.h.
References barrier, and ring_head::head.
Referenced by console_buf_insert_char(), and console_drv_write().
| static bool ring_is_empty | ( | struct ring_head * | ring, | |
| unsigned long | ring_size | |||
| ) | [inline, static] |
Test if the ring buffer is empty.
| true | There are no used entries in the buffer. | |
| false | There is at least one used entry in the buffer. |
Definition at line 226 of file ring.h.
References ring_head::head, and ring_head::tail.
| static void ring_reset | ( | struct ring_head * | ring | ) | [inline, static] |
Reset the ring buffer.
This will mark the ring buffer as empty, and move both head and tail to the beginning of the buffer.
| ring | The ring buffer |
Definition at line 276 of file ring.h.
References ring_head::head, and ring_head::tail.
1.5.8