From 4ec109d1c447bbf5be05854e32d8683bb1df5a80 Mon Sep 17 00:00:00 2001 From: Horst Birthelmer Date: Wed, 20 Nov 2024 16:14:43 +0100 Subject: support FUSE_TMPFILE in the low level API Note that name hashes and using paths as parameters makes it very hard to support anonymous files in the high level API. Known Issues: - tests have to bail out when O_TMPFILE is not supported. This will always be the case with high level passthrough implementations. - test_create_and_link_tmpfile has to be skipped due to unidentified problems with github runner --- lib/fuse_lowlevel.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'lib/fuse_lowlevel.c') diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c index 9cc96e9..b233e55 100644 --- a/lib/fuse_lowlevel.c +++ b/lib/fuse_lowlevel.c @@ -1361,6 +1361,24 @@ static void do_link(fuse_req_t req, fuse_ino_t nodeid, const void *inarg) fuse_reply_err(req, ENOSYS); } +static void do_tmpfile(fuse_req_t req, fuse_ino_t nodeid, const void *inarg) +{ + struct fuse_create_in *arg = (struct fuse_create_in *) inarg; + + if (req->se->op.tmpfile) { + struct fuse_file_info fi; + + memset(&fi, 0, sizeof(fi)); + fi.flags = arg->flags; + + if (req->se->conn.proto_minor >= 12) + req->ctx.umask = arg->umask; + + req->se->op.tmpfile(req, nodeid, arg->mode, &fi); + } else + fuse_reply_err(req, ENOSYS); +} + static void do_create(fuse_req_t req, fuse_ino_t nodeid, const void *inarg) { struct fuse_create_in *arg = (struct fuse_create_in *) inarg; @@ -2678,6 +2696,7 @@ static struct { [FUSE_SETLKW] = { do_setlkw, "SETLKW" }, [FUSE_ACCESS] = { do_access, "ACCESS" }, [FUSE_CREATE] = { do_create, "CREATE" }, + [FUSE_TMPFILE] = { do_tmpfile, "TMPFILE" }, [FUSE_INTERRUPT] = { do_interrupt, "INTERRUPT" }, [FUSE_BMAP] = { do_bmap, "BMAP" }, [FUSE_IOCTL] = { do_ioctl, "IOCTL" }, -- cgit v1.2.3