diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-03-21 02:07:59 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-04-09 14:12:59 -0400 |
commit | fc7478a2bfa9abd19657d2bbc9ae24185a41e21b (patch) | |
tree | 3db04ffa77f2050b3c10fa9fdcb1798ba0ce4f71 | |
parent | 599a0ac14e065b7c08471ef2e75a504b7dec9267 (diff) |
pipe: switch wait_for_partner() and wake_up_partner() to pipe_inode_info
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/pipe.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -986,21 +986,21 @@ SYSCALL_DEFINE1(pipe, int __user *, fildes) | |||
986 | return sys_pipe2(fildes, 0); | 986 | return sys_pipe2(fildes, 0); |
987 | } | 987 | } |
988 | 988 | ||
989 | static int wait_for_partner(struct inode* inode, unsigned int *cnt) | 989 | static int wait_for_partner(struct pipe_inode_info *pipe, unsigned int *cnt) |
990 | { | 990 | { |
991 | int cur = *cnt; | 991 | int cur = *cnt; |
992 | 992 | ||
993 | while (cur == *cnt) { | 993 | while (cur == *cnt) { |
994 | pipe_wait(inode->i_pipe); | 994 | pipe_wait(pipe); |
995 | if (signal_pending(current)) | 995 | if (signal_pending(current)) |
996 | break; | 996 | break; |
997 | } | 997 | } |
998 | return cur == *cnt ? -ERESTARTSYS : 0; | 998 | return cur == *cnt ? -ERESTARTSYS : 0; |
999 | } | 999 | } |
1000 | 1000 | ||
1001 | static void wake_up_partner(struct inode* inode) | 1001 | static void wake_up_partner(struct pipe_inode_info *pipe) |
1002 | { | 1002 | { |
1003 | wake_up_interruptible(&inode->i_pipe->wait); | 1003 | wake_up_interruptible(&pipe->wait); |
1004 | } | 1004 | } |
1005 | 1005 | ||
1006 | static int fifo_open(struct inode *inode, struct file *filp) | 1006 | static int fifo_open(struct inode *inode, struct file *filp) |
@@ -1032,7 +1032,7 @@ static int fifo_open(struct inode *inode, struct file *filp) | |||
1032 | */ | 1032 | */ |
1033 | pipe->r_counter++; | 1033 | pipe->r_counter++; |
1034 | if (pipe->readers++ == 0) | 1034 | if (pipe->readers++ == 0) |
1035 | wake_up_partner(inode); | 1035 | wake_up_partner(pipe); |
1036 | 1036 | ||
1037 | if (!is_pipe && !pipe->writers) { | 1037 | if (!is_pipe && !pipe->writers) { |
1038 | if ((filp->f_flags & O_NONBLOCK)) { | 1038 | if ((filp->f_flags & O_NONBLOCK)) { |
@@ -1040,7 +1040,7 @@ static int fifo_open(struct inode *inode, struct file *filp) | |||
1040 | * seen a writer */ | 1040 | * seen a writer */ |
1041 | filp->f_version = pipe->w_counter; | 1041 | filp->f_version = pipe->w_counter; |
1042 | } else { | 1042 | } else { |
1043 | if (wait_for_partner(inode, &pipe->w_counter)) | 1043 | if (wait_for_partner(pipe, &pipe->w_counter)) |
1044 | goto err_rd; | 1044 | goto err_rd; |
1045 | } | 1045 | } |
1046 | } | 1046 | } |
@@ -1058,10 +1058,10 @@ static int fifo_open(struct inode *inode, struct file *filp) | |||
1058 | 1058 | ||
1059 | pipe->w_counter++; | 1059 | pipe->w_counter++; |
1060 | if (!pipe->writers++) | 1060 | if (!pipe->writers++) |
1061 | wake_up_partner(inode); | 1061 | wake_up_partner(pipe); |
1062 | 1062 | ||
1063 | if (!is_pipe && !pipe->readers) { | 1063 | if (!is_pipe && !pipe->readers) { |
1064 | if (wait_for_partner(inode, &pipe->r_counter)) | 1064 | if (wait_for_partner(pipe, &pipe->r_counter)) |
1065 | goto err_wr; | 1065 | goto err_wr; |
1066 | } | 1066 | } |
1067 | break; | 1067 | break; |
@@ -1079,7 +1079,7 @@ static int fifo_open(struct inode *inode, struct file *filp) | |||
1079 | pipe->r_counter++; | 1079 | pipe->r_counter++; |
1080 | pipe->w_counter++; | 1080 | pipe->w_counter++; |
1081 | if (pipe->readers == 1 || pipe->writers == 1) | 1081 | if (pipe->readers == 1 || pipe->writers == 1) |
1082 | wake_up_partner(inode); | 1082 | wake_up_partner(pipe); |
1083 | break; | 1083 | break; |
1084 | 1084 | ||
1085 | default: | 1085 | default: |