/* This reads the next event in the ring buffer and increments the iterator.  */
struct ring_buffer_event* ring_buffer_read(struct ring_buffer_iter *iter, u64 *ts)
/* This reads the next event in the ring buffer and increments the iterator.  */
struct ring_buffer_event* ring_buffer_read(struct ring_buffer_iter *iter, u64 *ts)
{
	struct ring_buffer_event *event;
	struct ring_buffer_per_cpu *cpu_buffer = iter->cpu_buffer;
	unsigned long flags;
	spin_lock_irqsave(&cpu_buffer->reader_lock, flags);
 again:
	event = rb_iter_peek(iter, ts);
	if (!event)
		goto out;
	if (event->type_len == RINGBUF_TYPE_PADDING)
		goto again;
	rb_advance_iter(iter);
 out:
	spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);
	return event;
}