staging: remove intel_sst driver
[linux-2.6/btrfs-unstable.git] / drivers / staging / lttng / lib / ringbuffer / iterator.h
blobf2bd50dd592764d6089f23af47ecc325f613f98d
1 #ifndef _LINUX_RING_BUFFER_ITERATOR_H
2 #define _LINUX_RING_BUFFER_ITERATOR_H
4 /*
5 * linux/ringbuffer/iterator.h
7 * (C) Copyright 2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 * Ring buffer and channel iterators.
11 * Author:
12 * Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
14 * Dual LGPL v2.1/GPL v2 license.
17 #include "../../wrapper/ringbuffer/backend.h"
18 #include "../../wrapper/ringbuffer/frontend.h"
21 * lib_ring_buffer_get_next_record advances the buffer read position to the next
22 * record. It returns either the size of the next record, -EAGAIN if there is
23 * currently no data available, or -ENODATA if no data is available and buffer
24 * is finalized.
26 extern ssize_t lib_ring_buffer_get_next_record(struct channel *chan,
27 struct lib_ring_buffer *buf);
30 * channel_get_next_record advances the buffer read position to the next record.
31 * It returns either the size of the next record, -EAGAIN if there is currently
32 * no data available, or -ENODATA if no data is available and buffer is
33 * finalized.
34 * Returns the current buffer in ret_buf.
36 extern ssize_t channel_get_next_record(struct channel *chan,
37 struct lib_ring_buffer **ret_buf);
39 /**
40 * read_current_record - copy the buffer current record into dest.
41 * @buf: ring buffer
42 * @dest: destination where the record should be copied
44 * dest should be large enough to contain the record. Returns the number of
45 * bytes copied.
47 static inline size_t read_current_record(struct lib_ring_buffer *buf, void *dest)
49 return lib_ring_buffer_read(&buf->backend, buf->iter.read_offset,
50 dest, buf->iter.payload_len);
53 extern int lib_ring_buffer_iterator_open(struct lib_ring_buffer *buf);
54 extern void lib_ring_buffer_iterator_release(struct lib_ring_buffer *buf);
55 extern int channel_iterator_open(struct channel *chan);
56 extern void channel_iterator_release(struct channel *chan);
58 extern const struct file_operations channel_payload_file_operations;
59 extern const struct file_operations lib_ring_buffer_payload_file_operations;
62 * Used internally.
64 int channel_iterator_init(struct channel *chan);
65 void channel_iterator_unregister_notifiers(struct channel *chan);
66 void channel_iterator_free(struct channel *chan);
67 void channel_iterator_reset(struct channel *chan);
68 void lib_ring_buffer_iterator_reset(struct lib_ring_buffer *buf);
70 #endif /* _LINUX_RING_BUFFER_ITERATOR_H */