summaryrefslogtreecommitdiffstats
path: root/fs/pipe.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2018-07-11 14:19:04 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2018-07-12 10:02:57 -0400
commitc9c554f21490bbc96cc554f80024d27d09670480 (patch)
treef680bcb2253cf658a7a925d0eb20f2dff71c1f1f /fs/pipe.c
parent6b4e8085c0004382b985a5c005c685073630e746 (diff)
downloadlinux-c9c554f21490bbc96cc554f80024d27d09670480.tar.bz2
alloc_file(): switch to passing O_... flags instead of FMODE_... mode
... so that it could set both ->f_flags and ->f_mode, without callers having to set ->f_flags manually. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/pipe.c')
-rw-r--r--fs/pipe.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/pipe.c b/fs/pipe.c
index 9405e455f5b1..1909422e5a78 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -760,16 +760,17 @@ int create_pipe_files(struct file **res, int flags)
d_instantiate(path.dentry, inode);
- f = alloc_file(&path, FMODE_WRITE, &pipefifo_fops);
+ f = alloc_file(&path, O_WRONLY | (flags & (O_NONBLOCK | O_DIRECT)),
+ &pipefifo_fops);
if (IS_ERR(f)) {
err = PTR_ERR(f);
goto err_dentry;
}
- f->f_flags = O_WRONLY | (flags & (O_NONBLOCK | O_DIRECT));
f->private_data = inode->i_pipe;
- res[0] = alloc_file(&path, FMODE_READ, &pipefifo_fops);
+ res[0] = alloc_file(&path, O_RDONLY | (flags & O_NONBLOCK),
+ &pipefifo_fops);
if (IS_ERR(res[0])) {
put_pipe_info(inode, inode->i_pipe);
fput(f);
@@ -778,7 +779,6 @@ int create_pipe_files(struct file **res, int flags)
path_get(&path);
res[0]->private_data = inode->i_pipe;
- res[0]->f_flags = O_RDONLY | (flags & O_NONBLOCK);
res[1] = f;
return 0;