From 2bdec0bc22ce39b307e299ee9ec19d1c58b640de Mon Sep 17 00:00:00 2001 From: Josef Bacik Date: Fri, 10 May 2024 11:52:20 -0400 Subject: Handle NO_OPEN/NO_OPENDIR support automatically (#949) If the file system doesn't provide a ->open or an ->opendir, and the kernel supports FUSE_CAP_NO_OPEN_SUPPORT or FUSE_CAP_NO_OPENDIR_SUPPORT, allow the implementation to set FUSE_CAP_NO_OPEN*_SUPPORT on conn->want in order to automatically get this behavior. Expand the documentation to be more explicit about the behavior of libfuse in the different cases WRT this capability. Signed-off-by: Josef Bacik --- lib/fuse_lowlevel.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/fuse_lowlevel.c') diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c index 5129a3b..46aef98 100644 --- a/lib/fuse_lowlevel.c +++ b/lib/fuse_lowlevel.c @@ -1351,6 +1351,8 @@ static void do_open(fuse_req_t req, fuse_ino_t nodeid, const void *inarg) if (req->se->op.open) req->se->op.open(req, nodeid, &fi); + else if (req->se->conn.want & FUSE_CAP_NO_OPEN_SUPPORT) + fuse_reply_err(req, ENOSYS); else fuse_reply_open(req, &fi); } @@ -1507,6 +1509,8 @@ static void do_opendir(fuse_req_t req, fuse_ino_t nodeid, const void *inarg) if (req->se->op.opendir) req->se->op.opendir(req, nodeid, &fi); + else if (req->se->conn.want & FUSE_CAP_NO_OPENDIR_SUPPORT) + fuse_reply_err(req, ENOSYS); else fuse_reply_open(req, &fi); } -- cgit v1.2.3