[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <169527981274.27328.17552761781465494402.stgit@donald.themaw.net>
Date: Thu, 21 Sep 2023 15:03:33 +0800
From: Ian Kent <raven@...maw.net>
To: Al Viro <viro@...IV.linux.org.uk>,
Christian Brauner <brauner@...nel.org>
Cc: autofs mailing list <autofs@...r.kernel.org>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
Kernel Mailing List <linux-kernel@...r.kernel.org>,
Bill O'Donnell <billodo@...hat.com>,
Miklos Szeredi <miklos@...redi.hu>,
David Howells <dhowells@...hat.com>
Subject: [PATCH 1/8] 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@...maw.net>
---
fs/autofs/autofs_i.h | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
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 */
Powered by blists - more mailing lists