OSDN Git Service

Check in released NDK version r4.
[android-x86/prebuilt.git] / ndk / android-ndk-r4 / darwin / platforms / android-5 / arch-x86 / usr / include / linux / relay.h
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
14
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>
22
23 #define FIX_SIZE(x) ((((x) - 1) & PAGE_MASK) + PAGE_SIZE)
24
25 #define RELAYFS_CHANNEL_VERSION 6
26
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;
47
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 };
60
61 struct rchan_callbacks
62 {
63
64  int (*subbuf_start) (struct rchan_buf *buf,
65  void *subbuf,
66  void *prev_subbuf,
67  size_t prev_padding);
68
69  void (*buf_mapped)(struct rchan_buf *buf,
70  struct file *filp);
71
72  void (*buf_unmapped)(struct rchan_buf *buf,
73  struct file *filp);
74
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);
80
81  int (*remove_buf_file)(struct dentry *dentry);
82 };
83
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);
89
90 #endif
91