aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ring_buffer.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/ring_buffer.h')
-rw-r--r--include/linux/ring_buffer.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index e1b7b2173885..f0aa486d131c 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -68,9 +68,38 @@ ring_buffer_event_time_delta(struct ring_buffer_event *event)
68 return event->time_delta; 68 return event->time_delta;
69} 69}
70 70
71/*
72 * ring_buffer_event_discard can discard any event in the ring buffer.
73 * it is up to the caller to protect against a reader from
74 * consuming it or a writer from wrapping and replacing it.
75 *
76 * No external protection is needed if this is called before
77 * the event is commited. But in that case it would be better to
78 * use ring_buffer_discard_commit.
79 *
80 * Note, if an event that has not been committed is discarded
81 * with ring_buffer_event_discard, it must still be committed.
82 */
71void ring_buffer_event_discard(struct ring_buffer_event *event); 83void ring_buffer_event_discard(struct ring_buffer_event *event);
72 84
73/* 85/*
86 * ring_buffer_discard_commit will remove an event that has not
87 * ben committed yet. If this is used, then ring_buffer_unlock_commit
88 * must not be called on the discarded event. This function
89 * will try to remove the event from the ring buffer completely
90 * if another event has not been written after it.
91 *
92 * Example use:
93 *
94 * if (some_condition)
95 * ring_buffer_discard_commit(buffer, event);
96 * else
97 * ring_buffer_unlock_commit(buffer, event);
98 */
99void ring_buffer_discard_commit(struct ring_buffer *buffer,
100 struct ring_buffer_event *event);
101
102/*
74 * size is in bytes for each per CPU buffer. 103 * size is in bytes for each per CPU buffer.
75 */ 104 */
76struct ring_buffer * 105struct ring_buffer *