diff options
Diffstat (limited to 'fs/pipe.c')
-rw-r--r-- | fs/pipe.c | 51 |
1 files changed, 8 insertions, 43 deletions
@@ -777,45 +777,10 @@ pipe_rdwr_open(struct inode *inode, struct file *filp) | |||
777 | /* | 777 | /* |
778 | * The file_operations structs are not static because they | 778 | * The file_operations structs are not static because they |
779 | * are also used in linux/fs/fifo.c to do operations on FIFOs. | 779 | * are also used in linux/fs/fifo.c to do operations on FIFOs. |
780 | * | ||
781 | * Pipes reuse fifos' file_operations structs. | ||
780 | */ | 782 | */ |
781 | const struct file_operations read_fifo_fops = { | 783 | const struct file_operations read_pipefifo_fops = { |
782 | .llseek = no_llseek, | ||
783 | .read = do_sync_read, | ||
784 | .aio_read = pipe_read, | ||
785 | .write = bad_pipe_w, | ||
786 | .poll = pipe_poll, | ||
787 | .unlocked_ioctl = pipe_ioctl, | ||
788 | .open = pipe_read_open, | ||
789 | .release = pipe_read_release, | ||
790 | .fasync = pipe_read_fasync, | ||
791 | }; | ||
792 | |||
793 | const struct file_operations write_fifo_fops = { | ||
794 | .llseek = no_llseek, | ||
795 | .read = bad_pipe_r, | ||
796 | .write = do_sync_write, | ||
797 | .aio_write = pipe_write, | ||
798 | .poll = pipe_poll, | ||
799 | .unlocked_ioctl = pipe_ioctl, | ||
800 | .open = pipe_write_open, | ||
801 | .release = pipe_write_release, | ||
802 | .fasync = pipe_write_fasync, | ||
803 | }; | ||
804 | |||
805 | const struct file_operations rdwr_fifo_fops = { | ||
806 | .llseek = no_llseek, | ||
807 | .read = do_sync_read, | ||
808 | .aio_read = pipe_read, | ||
809 | .write = do_sync_write, | ||
810 | .aio_write = pipe_write, | ||
811 | .poll = pipe_poll, | ||
812 | .unlocked_ioctl = pipe_ioctl, | ||
813 | .open = pipe_rdwr_open, | ||
814 | .release = pipe_rdwr_release, | ||
815 | .fasync = pipe_rdwr_fasync, | ||
816 | }; | ||
817 | |||
818 | static const struct file_operations read_pipe_fops = { | ||
819 | .llseek = no_llseek, | 784 | .llseek = no_llseek, |
820 | .read = do_sync_read, | 785 | .read = do_sync_read, |
821 | .aio_read = pipe_read, | 786 | .aio_read = pipe_read, |
@@ -827,7 +792,7 @@ static const struct file_operations read_pipe_fops = { | |||
827 | .fasync = pipe_read_fasync, | 792 | .fasync = pipe_read_fasync, |
828 | }; | 793 | }; |
829 | 794 | ||
830 | static const struct file_operations write_pipe_fops = { | 795 | const struct file_operations write_pipefifo_fops = { |
831 | .llseek = no_llseek, | 796 | .llseek = no_llseek, |
832 | .read = bad_pipe_r, | 797 | .read = bad_pipe_r, |
833 | .write = do_sync_write, | 798 | .write = do_sync_write, |
@@ -839,7 +804,7 @@ static const struct file_operations write_pipe_fops = { | |||
839 | .fasync = pipe_write_fasync, | 804 | .fasync = pipe_write_fasync, |
840 | }; | 805 | }; |
841 | 806 | ||
842 | static const struct file_operations rdwr_pipe_fops = { | 807 | const struct file_operations rdwr_pipefifo_fops = { |
843 | .llseek = no_llseek, | 808 | .llseek = no_llseek, |
844 | .read = do_sync_read, | 809 | .read = do_sync_read, |
845 | .aio_read = pipe_read, | 810 | .aio_read = pipe_read, |
@@ -927,7 +892,7 @@ static struct inode * get_pipe_inode(void) | |||
927 | inode->i_pipe = pipe; | 892 | inode->i_pipe = pipe; |
928 | 893 | ||
929 | pipe->readers = pipe->writers = 1; | 894 | pipe->readers = pipe->writers = 1; |
930 | inode->i_fop = &rdwr_pipe_fops; | 895 | inode->i_fop = &rdwr_pipefifo_fops; |
931 | 896 | ||
932 | /* | 897 | /* |
933 | * Mark the inode dirty from the very beginning, | 898 | * Mark the inode dirty from the very beginning, |
@@ -978,7 +943,7 @@ struct file *create_write_pipe(int flags) | |||
978 | d_instantiate(dentry, inode); | 943 | d_instantiate(dentry, inode); |
979 | 944 | ||
980 | err = -ENFILE; | 945 | err = -ENFILE; |
981 | f = alloc_file(pipe_mnt, dentry, FMODE_WRITE, &write_pipe_fops); | 946 | f = alloc_file(pipe_mnt, dentry, FMODE_WRITE, &write_pipefifo_fops); |
982 | if (!f) | 947 | if (!f) |
983 | goto err_dentry; | 948 | goto err_dentry; |
984 | f->f_mapping = inode->i_mapping; | 949 | f->f_mapping = inode->i_mapping; |
@@ -1020,7 +985,7 @@ struct file *create_read_pipe(struct file *wrf, int flags) | |||
1020 | 985 | ||
1021 | f->f_pos = 0; | 986 | f->f_pos = 0; |
1022 | f->f_flags = O_RDONLY | (flags & O_NONBLOCK); | 987 | f->f_flags = O_RDONLY | (flags & O_NONBLOCK); |
1023 | f->f_op = &read_pipe_fops; | 988 | f->f_op = &read_pipefifo_fops; |
1024 | f->f_mode = FMODE_READ; | 989 | f->f_mode = FMODE_READ; |
1025 | f->f_version = 0; | 990 | f->f_version = 0; |
1026 | 991 | ||