public inbox for [email protected]
 help / color / mirror / Atom feed
From: Moinak Bhattacharyya <[email protected]>
To: Miklos Szeredi <[email protected]>,
	[email protected], [email protected],
	[email protected], Amir Goldstein <[email protected]>,
	Bernd Schubert <[email protected]>
Subject: [PATCH] fuse: return -EOPNOTSUPP directly from backing_open and backing_close when PASSTHROUGH not supported
Date: Sat, 22 Feb 2025 16:28:38 -0600	[thread overview]
Message-ID: <[email protected]> (raw)

Instead of having individual early returns in the ioctl functions, 
create static inline functions that return -EOPNOTSUPP when passthrough 
is not enabled. This will help potentially adding uring_cmd support to 
opening backing files.
---
  fs/fuse/dev.c    |  6 ------
  fs/fuse/fuse_i.h | 13 +++++++++++--
  2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 5b5f789b37eb..da1f4e8ed3ea 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -2435,9 +2435,6 @@ static long fuse_dev_ioctl_backing_open(struct 
file *file,
         if (!fud)
                 return -EPERM;

-       if (!IS_ENABLED(CONFIG_FUSE_PASSTHROUGH))
-               return -EOPNOTSUPP;
-
         if (copy_from_user(&map, argp, sizeof(map)))
                 return -EFAULT;

@@ -2452,9 +2449,6 @@ static long fuse_dev_ioctl_backing_close(struct 
file *file, __u32 __user *argp)
         if (!fud)
                 return -EPERM;

-       if (!IS_ENABLED(CONFIG_FUSE_PASSTHROUGH))
-               return -EOPNOTSUPP;
-
         if (get_user(backing_id, argp))
                 return -EFAULT;

diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index fee96fe7887b..5cb7ab17ad17 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -1485,6 +1485,8 @@ static inline struct fuse_backing 
*fuse_inode_backing_set(struct fuse_inode *fi,
  #ifdef CONFIG_FUSE_PASSTHROUGH
  struct fuse_backing *fuse_backing_get(struct fuse_backing *fb);
  void fuse_backing_put(struct fuse_backing *fb);
+int fuse_backing_open(struct fuse_conn *fc, struct fuse_backing_map *map);
+int fuse_backing_close(struct fuse_conn *fc, int backing_id);
  #else

  static inline struct fuse_backing *fuse_backing_get(struct 
fuse_backing *fb)
@@ -1495,12 +1497,19 @@ static inline struct fuse_backing 
*fuse_backing_get(struct fuse_backing *fb)
  static inline void fuse_backing_put(struct fuse_backing *fb)
  {
  }
+
+static inline int fuse_backing_open(struct fuse_conn *fc, struct 
fuse_backing_map *map)
+{
+       return -EOPNOTSUPP;
+}
+static inline int fuse_backing_close(struct fuse_conn *fc, int backing_id)
+{
+       return -EOPNOTSUPP;
+}
  #endif

  void fuse_backing_files_init(struct fuse_conn *fc);
  void fuse_backing_files_free(struct fuse_conn *fc);
-int fuse_backing_open(struct fuse_conn *fc, struct fuse_backing_map *map);
-int fuse_backing_close(struct fuse_conn *fc, int backing_id);

  struct fuse_backing *fuse_passthrough_open(struct file *file,
                                            struct inode *inode,
--
2.39.5 (Apple Git-154)

                 reply	other threads:[~2025-02-22 22:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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 \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /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