summaryrefslogtreecommitdiffstats
path: root/fs/autofs/autofs_i.h
diff options
context:
space:
mode:
authorIan Kent <raven@themaw.net>2023-09-22 12:12:08 +0800
committerChristian Brauner <brauner@kernel.org>2023-09-22 10:14:54 +0200
commitbc69fdde0ae1aff595590d802b6ef39114f2b260 (patch)
tree33187c6dccc7d642544c10b2dccce5694161f525 /fs/autofs/autofs_i.h
parentce9ecca0238b140b88f43859b211c9fdfd8e5b70 (diff)
downloadlinux-bc69fdde0ae1aff595590d802b6ef39114f2b260.tar.gz
linux-bc69fdde0ae1aff595590d802b6ef39114f2b260.tar.bz2
linux-bc69fdde0ae1aff595590d802b6ef39114f2b260.zip
autofs: refactor autofs_prepare_pipe()
Refactor autofs_prepare_pipe() by seperating out a check function to be used later. Signed-off-by: Ian Kent <raven@themaw.net> Reviewed-by: Bill O'Donnell <bodonnel@redhat.com> Message-Id: <20230922041215.13675-2-raven@themaw.net> Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'fs/autofs/autofs_i.h')
-rw-r--r--fs/autofs/autofs_i.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/autofs/autofs_i.h b/fs/autofs/autofs_i.h
index d5a44fa88acf..c24d32be7937 100644
--- a/fs/autofs/autofs_i.h
+++ b/fs/autofs/autofs_i.h
@@ -209,12 +209,20 @@ int autofs_fill_super(struct super_block *, void *, int);
struct autofs_info *autofs_new_ino(struct autofs_sb_info *);
void autofs_clean_ino(struct autofs_info *);
-static inline int autofs_prepare_pipe(struct file *pipe)
+static inline int autofs_check_pipe(struct file *pipe)
{
if (!(pipe->f_mode & FMODE_CAN_WRITE))
return -EINVAL;
if (!S_ISFIFO(file_inode(pipe)->i_mode))
return -EINVAL;
+ return 0;
+}
+
+static inline int autofs_prepare_pipe(struct file *pipe)
+{
+ int ret = autofs_check_pipe(pipe);
+ if (ret < 0)
+ return ret;
/* We want a packet pipe */
pipe->f_flags |= O_DIRECT;
/* We don't expect -EAGAIN */