diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-03-21 11:16:56 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-04-09 14:13:00 -0400 |
commit | de32ec4cfeb3b3afd2abf5116068deace10e420f (patch) | |
tree | 5f9dc308ed075f8de192a2288cf9f083a9b28a5a | |
parent | 72b0d9aacb89f3759931ec440e1b535671145bb4 (diff) |
pipe: set file->private_data to ->i_pipe
simplify get_pipe_info(), while we are at it
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/coredump.c | 4 | ||||
-rw-r--r-- | fs/pipe.c | 17 |
2 files changed, 10 insertions, 11 deletions
diff --git a/fs/coredump.c b/fs/coredump.c index 288e5c9f9bbe..a987f3d39d93 100644 --- a/fs/coredump.c +++ b/fs/coredump.c | |||
@@ -409,9 +409,7 @@ static void coredump_finish(struct mm_struct *mm) | |||
409 | 409 | ||
410 | static void wait_for_dump_helpers(struct file *file) | 410 | static void wait_for_dump_helpers(struct file *file) |
411 | { | 411 | { |
412 | struct pipe_inode_info *pipe; | 412 | struct pipe_inode_info *pipe = file->private_data; |
413 | |||
414 | pipe = file_inode(file)->i_pipe; | ||
415 | 413 | ||
416 | pipe_lock(pipe); | 414 | pipe_lock(pipe); |
417 | pipe->readers++; | 415 | pipe->readers++; |
@@ -363,7 +363,7 @@ pipe_read(struct kiocb *iocb, const struct iovec *_iov, | |||
363 | unsigned long nr_segs, loff_t pos) | 363 | unsigned long nr_segs, loff_t pos) |
364 | { | 364 | { |
365 | struct file *filp = iocb->ki_filp; | 365 | struct file *filp = iocb->ki_filp; |
366 | struct pipe_inode_info *pipe = file_inode(filp)->i_pipe; | 366 | struct pipe_inode_info *pipe = filp->private_data; |
367 | int do_wakeup; | 367 | int do_wakeup; |
368 | ssize_t ret; | 368 | ssize_t ret; |
369 | struct iovec *iov = (struct iovec *)_iov; | 369 | struct iovec *iov = (struct iovec *)_iov; |
@@ -486,7 +486,7 @@ pipe_write(struct kiocb *iocb, const struct iovec *_iov, | |||
486 | unsigned long nr_segs, loff_t ppos) | 486 | unsigned long nr_segs, loff_t ppos) |
487 | { | 487 | { |
488 | struct file *filp = iocb->ki_filp; | 488 | struct file *filp = iocb->ki_filp; |
489 | struct pipe_inode_info *pipe = file_inode(filp)->i_pipe; | 489 | struct pipe_inode_info *pipe = filp->private_data; |
490 | ssize_t ret; | 490 | ssize_t ret; |
491 | int do_wakeup; | 491 | int do_wakeup; |
492 | struct iovec *iov = (struct iovec *)_iov; | 492 | struct iovec *iov = (struct iovec *)_iov; |
@@ -662,7 +662,7 @@ out: | |||
662 | 662 | ||
663 | static long pipe_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | 663 | static long pipe_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
664 | { | 664 | { |
665 | struct pipe_inode_info *pipe = file_inode(filp)->i_pipe; | 665 | struct pipe_inode_info *pipe = filp->private_data; |
666 | int count, buf, nrbufs; | 666 | int count, buf, nrbufs; |
667 | 667 | ||
668 | switch (cmd) { | 668 | switch (cmd) { |
@@ -688,7 +688,7 @@ static unsigned int | |||
688 | pipe_poll(struct file *filp, poll_table *wait) | 688 | pipe_poll(struct file *filp, poll_table *wait) |
689 | { | 689 | { |
690 | unsigned int mask; | 690 | unsigned int mask; |
691 | struct pipe_inode_info *pipe = file_inode(filp)->i_pipe; | 691 | struct pipe_inode_info *pipe = filp->private_data; |
692 | int nrbufs; | 692 | int nrbufs; |
693 | 693 | ||
694 | poll_wait(filp, &pipe->wait, wait); | 694 | poll_wait(filp, &pipe->wait, wait); |
@@ -749,7 +749,7 @@ pipe_release(struct inode *inode, struct file *file) | |||
749 | static int | 749 | static int |
750 | pipe_fasync(int fd, struct file *filp, int on) | 750 | pipe_fasync(int fd, struct file *filp, int on) |
751 | { | 751 | { |
752 | struct pipe_inode_info *pipe = file_inode(filp)->i_pipe; | 752 | struct pipe_inode_info *pipe = filp->private_data; |
753 | int retval = 0; | 753 | int retval = 0; |
754 | 754 | ||
755 | pipe_lock(pipe); | 755 | pipe_lock(pipe); |
@@ -887,12 +887,14 @@ int create_pipe_files(struct file **res, int flags) | |||
887 | goto err_dentry; | 887 | goto err_dentry; |
888 | 888 | ||
889 | f->f_flags = O_WRONLY | (flags & (O_NONBLOCK | O_DIRECT)); | 889 | f->f_flags = O_WRONLY | (flags & (O_NONBLOCK | O_DIRECT)); |
890 | f->private_data = inode->i_pipe; | ||
890 | 891 | ||
891 | res[0] = alloc_file(&path, FMODE_READ, &pipefifo_fops); | 892 | res[0] = alloc_file(&path, FMODE_READ, &pipefifo_fops); |
892 | if (IS_ERR(res[0])) | 893 | if (IS_ERR(res[0])) |
893 | goto err_file; | 894 | goto err_file; |
894 | 895 | ||
895 | path_get(&path); | 896 | path_get(&path); |
897 | res[0]->private_data = inode->i_pipe; | ||
896 | res[0]->f_flags = O_RDONLY | (flags & O_NONBLOCK); | 898 | res[0]->f_flags = O_RDONLY | (flags & O_NONBLOCK); |
897 | res[1] = f; | 899 | res[1] = f; |
898 | return 0; | 900 | return 0; |
@@ -1035,6 +1037,7 @@ static int fifo_open(struct inode *inode, struct file *filp) | |||
1035 | spin_unlock(&inode->i_lock); | 1037 | spin_unlock(&inode->i_lock); |
1036 | } | 1038 | } |
1037 | } | 1039 | } |
1040 | filp->private_data = pipe; | ||
1038 | /* OK, we have a pipe and it's pinned down */ | 1041 | /* OK, we have a pipe and it's pinned down */ |
1039 | 1042 | ||
1040 | pipe_lock(pipe); | 1043 | pipe_lock(pipe); |
@@ -1233,9 +1236,7 @@ int pipe_proc_fn(struct ctl_table *table, int write, void __user *buf, | |||
1233 | */ | 1236 | */ |
1234 | struct pipe_inode_info *get_pipe_info(struct file *file) | 1237 | struct pipe_inode_info *get_pipe_info(struct file *file) |
1235 | { | 1238 | { |
1236 | struct inode *i = file_inode(file); | 1239 | return file->f_op == &pipefifo_fops ? file->private_data : NULL; |
1237 | |||
1238 | return S_ISFIFO(i->i_mode) ? i->i_pipe : NULL; | ||
1239 | } | 1240 | } |
1240 | 1241 | ||
1241 | long pipe_fcntl(struct file *file, unsigned int cmd, unsigned long arg) | 1242 | long pipe_fcntl(struct file *file, unsigned int cmd, unsigned long arg) |