From: Ian Kent <raven@themaw.net>
To: Al Viro <viro@ZenIV.linux.org.uk>,
Christian Brauner <brauner@kernel.org>
Cc: autofs mailing list <autofs@vger.kernel.org>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
Kernel Mailing List <linux-kernel@vger.kernel.org>,
Bill O'Donnell <billodo@redhat.com>,
Miklos Szeredi <miklos@szeredi.hu>,
David Howells <dhowells@redhat.com>
Subject: [PATCH 1/8] autofs: refactor autofs_prepare_pipe()
Date: Thu, 21 Sep 2023 15:03:33 +0800 [thread overview]
Message-ID: <169527981274.27328.17552761781465494402.stgit@donald.themaw.net> (raw)
In-Reply-To: <169527971702.27328.16272807830250040704.stgit@donald.themaw.net>
Refactor autofs_prepare_pipe() by seperating out a check function
to be used later.
Signed-off-by: Ian Kent <raven@themaw.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 */
next prev parent reply other threads:[~2023-09-21 7:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-21 7:03 [PATCH 0/8] autofs - convert to to use mount api Ian Kent
2023-09-21 7:03 ` Ian Kent [this message]
2023-09-21 7:03 ` [PATCH 2/8] autofs: add autofs_parse_fd() Ian Kent
2023-09-21 7:03 ` [PATCH 3/8] autofs - refactor super block info init Ian Kent
2023-09-21 7:03 ` [PATCH 4/8] autofs: reformat 0pt enum declaration Ian Kent
2023-09-21 9:13 ` [PATCH 0/8] autofs - convert to to use mount api Christian Brauner
2023-09-21 12:35 ` Ian Kent
-- strict thread matches above, loose matches on Subject: below --
2023-09-22 4:12 Ian Kent
2023-09-22 4:12 ` [PATCH 1/8] autofs: refactor autofs_prepare_pipe() Ian Kent
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=169527981274.27328.17552761781465494402.stgit@donald.themaw.net \
--to=raven@themaw.net \
--cc=autofs@vger.kernel.org \
--cc=billodo@redhat.com \
--cc=brauner@kernel.org \
--cc=dhowells@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=viro@ZenIV.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).