Merge LTTng commit 5c0552665e4d152e97edc995650711d4f6ac418d
[lttng-ust.git] / libringbuffer / vfs.h
1 #ifndef _LINUX_RING_BUFFER_VFS_H
2 #define _LINUX_RING_BUFFER_VFS_H
3
4 /*
5 * linux/ringbuffer/vfs.h
6 *
7 * (C) Copyright 2005-2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 *
9 * Wait-free ring buffer VFS file operations.
10 *
11 * Author:
12 * Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 *
14 * Dual LGPL v2.1/GPL v2 license.
15 */
16
17 /* VFS API */
18
19 extern const struct file_operations lib_ring_buffer_file_operations;
20
21 /*
22 * Internal file operations.
23 */
24
25 int lib_ring_buffer_open(struct inode *inode, struct file *file);
26 int lib_ring_buffer_release(struct inode *inode, struct file *file);
27 unsigned int lib_ring_buffer_poll(struct file *filp, poll_table *wait);
28 ssize_t lib_ring_buffer_splice_read(struct file *in, loff_t *ppos,
29 struct pipe_inode_info *pipe, size_t len,
30 unsigned int flags);
31 int lib_ring_buffer_mmap(struct file *filp, struct vm_area_struct *vma);
32
33 /* Ring Buffer ioctl() and ioctl numbers */
34 long lib_ring_buffer_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
35 #ifdef CONFIG_COMPAT
36 long lib_ring_buffer_compat_ioctl(struct file *filp, unsigned int cmd,
37 unsigned long arg);
38 #endif
39
40 /*
41 * Use RING_BUFFER_GET_NEXT_SUBBUF / RING_BUFFER_PUT_NEXT_SUBBUF to read and
42 * consume sub-buffers sequentially.
43 *
44 * Reading sub-buffers without consuming them can be performed with:
45 *
46 * RING_BUFFER_SNAPSHOT
47 * RING_BUFFER_SNAPSHOT_GET_CONSUMED
48 * RING_BUFFER_SNAPSHOT_GET_PRODUCED
49 *
50 * to get the offset range to consume, and then by passing each sub-buffer
51 * offset to RING_BUFFER_GET_SUBBUF, read the sub-buffer, and then release it
52 * with RING_BUFFER_PUT_SUBBUF.
53 *
54 * Note that the "snapshot" API can be used to read the sub-buffer in reverse
55 * order, which is useful for flight recorder snapshots.
56 */
57
58 /* Get a snapshot of the current ring buffer producer and consumer positions */
59 #define RING_BUFFER_SNAPSHOT _IO(0xF6, 0x00)
60 /* Get the consumer position (iteration start) */
61 #define RING_BUFFER_SNAPSHOT_GET_CONSUMED _IOR(0xF6, 0x01, unsigned long)
62 /* Get the producer position (iteration end) */
63 #define RING_BUFFER_SNAPSHOT_GET_PRODUCED _IOR(0xF6, 0x02, unsigned long)
64 /* Get exclusive read access to the specified sub-buffer position */
65 #define RING_BUFFER_GET_SUBBUF _IOW(0xF6, 0x03, unsigned long)
66 /* Release exclusive sub-buffer access */
67 #define RING_BUFFER_PUT_SUBBUF _IO(0xF6, 0x04)
68
69 /* Get exclusive read access to the next sub-buffer that can be read. */
70 #define RING_BUFFER_GET_NEXT_SUBBUF _IO(0xF6, 0x05)
71 /* Release exclusive sub-buffer access, move consumer forward. */
72 #define RING_BUFFER_PUT_NEXT_SUBBUF _IO(0xF6, 0x06)
73 /* returns the size of the current sub-buffer, without padding (for mmap). */
74 #define RING_BUFFER_GET_SUBBUF_SIZE _IOR(0xF6, 0x07, unsigned long)
75 /* returns the size of the current sub-buffer, with padding (for splice). */
76 #define RING_BUFFER_GET_PADDED_SUBBUF_SIZE _IOR(0xF6, 0x08, unsigned long)
77 /* returns the maximum size for sub-buffers. */
78 #define RING_BUFFER_GET_MAX_SUBBUF_SIZE _IOR(0xF6, 0x09, unsigned long)
79 /* returns the length to mmap. */
80 #define RING_BUFFER_GET_MMAP_LEN _IOR(0xF6, 0x0A, unsigned long)
81 /* returns the offset of the subbuffer belonging to the mmap reader. */
82 #define RING_BUFFER_GET_MMAP_READ_OFFSET _IOR(0xF6, 0x0B, unsigned long)
83 /* flush the current sub-buffer */
84 #define RING_BUFFER_FLUSH _IO(0xF6, 0x0C)
85
86 #endif /* _LINUX_RING_BUFFER_VFS_H */
This page took 0.032791 seconds and 4 git commands to generate.