The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 1 | /**************************************************************************** |
| 2 | **************************************************************************** |
| 3 | *** |
| 4 | *** This header was automatically generated from a Linux kernel header |
| 5 | *** of the same name, to make information necessary for userspace to |
| 6 | *** call into the kernel available to libc. It contains only constants, |
| 7 | *** structures, and macros generated from the original header, and thus, |
| 8 | *** contains no copyrightable information. |
| 9 | *** |
| 10 | **************************************************************************** |
| 11 | ****************************************************************************/ |
| 12 | #ifndef _LINUX_RELAY_H |
| 13 | #define _LINUX_RELAY_H |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame^] | 14 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 15 | #include <linux/types.h> |
| 16 | #include <linux/sched.h> |
| 17 | #include <linux/wait.h> |
| 18 | #include <linux/list.h> |
| 19 | #include <linux/fs.h> |
| 20 | #include <linux/poll.h> |
| 21 | #include <linux/kref.h> |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame^] | 22 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 23 | #define FIX_SIZE(x) ((((x) - 1) & PAGE_MASK) + PAGE_SIZE) |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame^] | 24 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 25 | #define RELAYFS_CHANNEL_VERSION 6 |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame^] | 26 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 27 | struct rchan_buf |
| 28 | { |
| 29 | void *start; |
| 30 | void *data; |
| 31 | size_t offset; |
| 32 | size_t subbufs_produced; |
| 33 | size_t subbufs_consumed; |
| 34 | struct rchan *chan; |
| 35 | wait_queue_head_t read_wait; |
| 36 | struct work_struct wake_readers; |
| 37 | struct dentry *dentry; |
| 38 | struct kref kref; |
| 39 | struct page **page_array; |
| 40 | unsigned int page_count; |
| 41 | unsigned int finalized; |
| 42 | size_t *padding; |
| 43 | size_t prev_padding; |
| 44 | size_t bytes_consumed; |
| 45 | unsigned int cpu; |
| 46 | } ____cacheline_aligned; |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame^] | 47 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 48 | struct rchan |
| 49 | { |
| 50 | u32 version; |
| 51 | size_t subbuf_size; |
| 52 | size_t n_subbufs; |
| 53 | size_t alloc_size; |
| 54 | struct rchan_callbacks *cb; |
| 55 | struct kref kref; |
| 56 | void *private_data; |
| 57 | size_t last_toobig; |
| 58 | struct rchan_buf *buf[NR_CPUS]; |
| 59 | }; |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame^] | 60 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 61 | struct rchan_callbacks |
| 62 | { |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame^] | 63 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 64 | int (*subbuf_start) (struct rchan_buf *buf, |
| 65 | void *subbuf, |
| 66 | void *prev_subbuf, |
| 67 | size_t prev_padding); |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame^] | 68 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 69 | void (*buf_mapped)(struct rchan_buf *buf, |
| 70 | struct file *filp); |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame^] | 71 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 72 | void (*buf_unmapped)(struct rchan_buf *buf, |
| 73 | struct file *filp); |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame^] | 74 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 75 | struct dentry *(*create_buf_file)(const char *filename, |
| 76 | struct dentry *parent, |
| 77 | int mode, |
| 78 | struct rchan_buf *buf, |
| 79 | int *is_global); |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame^] | 80 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 81 | int (*remove_buf_file)(struct dentry *dentry); |
| 82 | }; |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame^] | 83 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 84 | struct rchan *relay_open(const char *base_filename, |
| 85 | struct dentry *parent, |
| 86 | size_t subbuf_size, |
| 87 | size_t n_subbufs, |
| 88 | struct rchan_callbacks *cb); |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame^] | 89 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 90 | #endif |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame^] | 91 | |