diff options
Diffstat (limited to 'fs/proc/inode.c')
-rw-r--r-- | fs/proc/inode.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/fs/proc/inode.c b/fs/proc/inode.c index 5f8d215b3fd0..dbe43a50caf2 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c | |||
@@ -200,7 +200,8 @@ static loff_t proc_reg_llseek(struct file *file, loff_t offset, int whence) | |||
200 | struct proc_dir_entry *pde = PDE(file_inode(file)); | 200 | struct proc_dir_entry *pde = PDE(file_inode(file)); |
201 | loff_t rv = -EINVAL; | 201 | loff_t rv = -EINVAL; |
202 | if (use_pde(pde)) { | 202 | if (use_pde(pde)) { |
203 | loff_t (*llseek)(struct file *, loff_t, int); | 203 | typeof_member(struct file_operations, llseek) llseek; |
204 | |||
204 | llseek = pde->proc_fops->llseek; | 205 | llseek = pde->proc_fops->llseek; |
205 | if (!llseek) | 206 | if (!llseek) |
206 | llseek = default_llseek; | 207 | llseek = default_llseek; |
@@ -212,10 +213,11 @@ static loff_t proc_reg_llseek(struct file *file, loff_t offset, int whence) | |||
212 | 213 | ||
213 | static ssize_t proc_reg_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) | 214 | static ssize_t proc_reg_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) |
214 | { | 215 | { |
215 | ssize_t (*read)(struct file *, char __user *, size_t, loff_t *); | ||
216 | struct proc_dir_entry *pde = PDE(file_inode(file)); | 216 | struct proc_dir_entry *pde = PDE(file_inode(file)); |
217 | ssize_t rv = -EIO; | 217 | ssize_t rv = -EIO; |
218 | if (use_pde(pde)) { | 218 | if (use_pde(pde)) { |
219 | typeof_member(struct file_operations, read) read; | ||
220 | |||
219 | read = pde->proc_fops->read; | 221 | read = pde->proc_fops->read; |
220 | if (read) | 222 | if (read) |
221 | rv = read(file, buf, count, ppos); | 223 | rv = read(file, buf, count, ppos); |
@@ -226,10 +228,11 @@ static ssize_t proc_reg_read(struct file *file, char __user *buf, size_t count, | |||
226 | 228 | ||
227 | static ssize_t proc_reg_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) | 229 | static ssize_t proc_reg_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) |
228 | { | 230 | { |
229 | ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *); | ||
230 | struct proc_dir_entry *pde = PDE(file_inode(file)); | 231 | struct proc_dir_entry *pde = PDE(file_inode(file)); |
231 | ssize_t rv = -EIO; | 232 | ssize_t rv = -EIO; |
232 | if (use_pde(pde)) { | 233 | if (use_pde(pde)) { |
234 | typeof_member(struct file_operations, write) write; | ||
235 | |||
233 | write = pde->proc_fops->write; | 236 | write = pde->proc_fops->write; |
234 | if (write) | 237 | if (write) |
235 | rv = write(file, buf, count, ppos); | 238 | rv = write(file, buf, count, ppos); |
@@ -242,8 +245,9 @@ static __poll_t proc_reg_poll(struct file *file, struct poll_table_struct *pts) | |||
242 | { | 245 | { |
243 | struct proc_dir_entry *pde = PDE(file_inode(file)); | 246 | struct proc_dir_entry *pde = PDE(file_inode(file)); |
244 | __poll_t rv = DEFAULT_POLLMASK; | 247 | __poll_t rv = DEFAULT_POLLMASK; |
245 | __poll_t (*poll)(struct file *, struct poll_table_struct *); | ||
246 | if (use_pde(pde)) { | 248 | if (use_pde(pde)) { |
249 | typeof_member(struct file_operations, poll) poll; | ||
250 | |||
247 | poll = pde->proc_fops->poll; | 251 | poll = pde->proc_fops->poll; |
248 | if (poll) | 252 | if (poll) |
249 | rv = poll(file, pts); | 253 | rv = poll(file, pts); |
@@ -256,8 +260,9 @@ static long proc_reg_unlocked_ioctl(struct file *file, unsigned int cmd, unsigne | |||
256 | { | 260 | { |
257 | struct proc_dir_entry *pde = PDE(file_inode(file)); | 261 | struct proc_dir_entry *pde = PDE(file_inode(file)); |
258 | long rv = -ENOTTY; | 262 | long rv = -ENOTTY; |
259 | long (*ioctl)(struct file *, unsigned int, unsigned long); | ||
260 | if (use_pde(pde)) { | 263 | if (use_pde(pde)) { |
264 | typeof_member(struct file_operations, unlocked_ioctl) ioctl; | ||
265 | |||
261 | ioctl = pde->proc_fops->unlocked_ioctl; | 266 | ioctl = pde->proc_fops->unlocked_ioctl; |
262 | if (ioctl) | 267 | if (ioctl) |
263 | rv = ioctl(file, cmd, arg); | 268 | rv = ioctl(file, cmd, arg); |
@@ -271,8 +276,9 @@ static long proc_reg_compat_ioctl(struct file *file, unsigned int cmd, unsigned | |||
271 | { | 276 | { |
272 | struct proc_dir_entry *pde = PDE(file_inode(file)); | 277 | struct proc_dir_entry *pde = PDE(file_inode(file)); |
273 | long rv = -ENOTTY; | 278 | long rv = -ENOTTY; |
274 | long (*compat_ioctl)(struct file *, unsigned int, unsigned long); | ||
275 | if (use_pde(pde)) { | 279 | if (use_pde(pde)) { |
280 | typeof_member(struct file_operations, compat_ioctl) compat_ioctl; | ||
281 | |||
276 | compat_ioctl = pde->proc_fops->compat_ioctl; | 282 | compat_ioctl = pde->proc_fops->compat_ioctl; |
277 | if (compat_ioctl) | 283 | if (compat_ioctl) |
278 | rv = compat_ioctl(file, cmd, arg); | 284 | rv = compat_ioctl(file, cmd, arg); |
@@ -286,8 +292,9 @@ static int proc_reg_mmap(struct file *file, struct vm_area_struct *vma) | |||
286 | { | 292 | { |
287 | struct proc_dir_entry *pde = PDE(file_inode(file)); | 293 | struct proc_dir_entry *pde = PDE(file_inode(file)); |
288 | int rv = -EIO; | 294 | int rv = -EIO; |
289 | int (*mmap)(struct file *, struct vm_area_struct *); | ||
290 | if (use_pde(pde)) { | 295 | if (use_pde(pde)) { |
296 | typeof_member(struct file_operations, mmap) mmap; | ||
297 | |||
291 | mmap = pde->proc_fops->mmap; | 298 | mmap = pde->proc_fops->mmap; |
292 | if (mmap) | 299 | if (mmap) |
293 | rv = mmap(file, vma); | 300 | rv = mmap(file, vma); |
@@ -305,7 +312,7 @@ proc_reg_get_unmapped_area(struct file *file, unsigned long orig_addr, | |||
305 | unsigned long rv = -EIO; | 312 | unsigned long rv = -EIO; |
306 | 313 | ||
307 | if (use_pde(pde)) { | 314 | if (use_pde(pde)) { |
308 | typeof(proc_reg_get_unmapped_area) *get_area; | 315 | typeof_member(struct file_operations, get_unmapped_area) get_area; |
309 | 316 | ||
310 | get_area = pde->proc_fops->get_unmapped_area; | 317 | get_area = pde->proc_fops->get_unmapped_area; |
311 | #ifdef CONFIG_MMU | 318 | #ifdef CONFIG_MMU |
@@ -326,8 +333,8 @@ static int proc_reg_open(struct inode *inode, struct file *file) | |||
326 | { | 333 | { |
327 | struct proc_dir_entry *pde = PDE(inode); | 334 | struct proc_dir_entry *pde = PDE(inode); |
328 | int rv = 0; | 335 | int rv = 0; |
329 | int (*open)(struct inode *, struct file *); | 336 | typeof_member(struct file_operations, open) open; |
330 | int (*release)(struct inode *, struct file *); | 337 | typeof_member(struct file_operations, release) release; |
331 | struct pde_opener *pdeo; | 338 | struct pde_opener *pdeo; |
332 | 339 | ||
333 | /* | 340 | /* |