diff options
Diffstat (limited to 'include/linux/relayfs_fs.h')
-rw-r--r-- | include/linux/relayfs_fs.h | 65 |
1 files changed, 48 insertions, 17 deletions
diff --git a/include/linux/relayfs_fs.h b/include/linux/relayfs_fs.h index fb7e80737325..7342e66247fb 100644 --- a/include/linux/relayfs_fs.h +++ b/include/linux/relayfs_fs.h | |||
@@ -65,20 +65,6 @@ struct rchan | |||
65 | }; | 65 | }; |
66 | 66 | ||
67 | /* | 67 | /* |
68 | * Relayfs inode | ||
69 | */ | ||
70 | struct relayfs_inode_info | ||
71 | { | ||
72 | struct inode vfs_inode; | ||
73 | struct rchan_buf *buf; | ||
74 | }; | ||
75 | |||
76 | static inline struct relayfs_inode_info *RELAYFS_I(struct inode *inode) | ||
77 | { | ||
78 | return container_of(inode, struct relayfs_inode_info, vfs_inode); | ||
79 | } | ||
80 | |||
81 | /* | ||
82 | * Relay channel client callbacks | 68 | * Relay channel client callbacks |
83 | */ | 69 | */ |
84 | struct rchan_callbacks | 70 | struct rchan_callbacks |
@@ -124,6 +110,46 @@ struct rchan_callbacks | |||
124 | */ | 110 | */ |
125 | void (*buf_unmapped)(struct rchan_buf *buf, | 111 | void (*buf_unmapped)(struct rchan_buf *buf, |
126 | struct file *filp); | 112 | struct file *filp); |
113 | /* | ||
114 | * create_buf_file - create file to represent a relayfs channel buffer | ||
115 | * @filename: the name of the file to create | ||
116 | * @parent: the parent of the file to create | ||
117 | * @mode: the mode of the file to create | ||
118 | * @buf: the channel buffer | ||
119 | * @is_global: outparam - set non-zero if the buffer should be global | ||
120 | * | ||
121 | * Called during relay_open(), once for each per-cpu buffer, | ||
122 | * to allow the client to create a file to be used to | ||
123 | * represent the corresponding channel buffer. If the file is | ||
124 | * created outside of relayfs, the parent must also exist in | ||
125 | * that filesystem. | ||
126 | * | ||
127 | * The callback should return the dentry of the file created | ||
128 | * to represent the relay buffer. | ||
129 | * | ||
130 | * Setting the is_global outparam to a non-zero value will | ||
131 | * cause relay_open() to create a single global buffer rather | ||
132 | * than the default set of per-cpu buffers. | ||
133 | * | ||
134 | * See Documentation/filesystems/relayfs.txt for more info. | ||
135 | */ | ||
136 | struct dentry *(*create_buf_file)(const char *filename, | ||
137 | struct dentry *parent, | ||
138 | int mode, | ||
139 | struct rchan_buf *buf, | ||
140 | int *is_global); | ||
141 | |||
142 | /* | ||
143 | * remove_buf_file - remove file representing a relayfs channel buffer | ||
144 | * @dentry: the dentry of the file to remove | ||
145 | * | ||
146 | * Called during relay_close(), once for each per-cpu buffer, | ||
147 | * to allow the client to remove a file used to represent a | ||
148 | * channel buffer. | ||
149 | * | ||
150 | * The callback should return 0 if successful, negative if not. | ||
151 | */ | ||
152 | int (*remove_buf_file)(struct dentry *dentry); | ||
127 | }; | 153 | }; |
128 | 154 | ||
129 | /* | 155 | /* |
@@ -148,6 +174,12 @@ extern size_t relay_switch_subbuf(struct rchan_buf *buf, | |||
148 | extern struct dentry *relayfs_create_dir(const char *name, | 174 | extern struct dentry *relayfs_create_dir(const char *name, |
149 | struct dentry *parent); | 175 | struct dentry *parent); |
150 | extern int relayfs_remove_dir(struct dentry *dentry); | 176 | extern int relayfs_remove_dir(struct dentry *dentry); |
177 | extern struct dentry *relayfs_create_file(const char *name, | ||
178 | struct dentry *parent, | ||
179 | int mode, | ||
180 | struct file_operations *fops, | ||
181 | void *data); | ||
182 | extern int relayfs_remove_file(struct dentry *dentry); | ||
151 | 183 | ||
152 | /** | 184 | /** |
153 | * relay_write - write data into the channel | 185 | * relay_write - write data into the channel |
@@ -247,10 +279,9 @@ static inline void subbuf_start_reserve(struct rchan_buf *buf, | |||
247 | } | 279 | } |
248 | 280 | ||
249 | /* | 281 | /* |
250 | * exported relayfs file operations, fs/relayfs/inode.c | 282 | * exported relay file operations, fs/relayfs/inode.c |
251 | */ | 283 | */ |
252 | 284 | extern struct file_operations relay_file_operations; | |
253 | extern struct file_operations relayfs_file_operations; | ||
254 | 285 | ||
255 | #endif /* _LINUX_RELAYFS_FS_H */ | 286 | #endif /* _LINUX_RELAYFS_FS_H */ |
256 | 287 | ||