From 22cc0c761ad23395a8220ce1954cfb8a64f36ff4 Mon Sep 17 00:00:00 2001 From: HereThereBeDragons Date: Thu, 27 Oct 2022 17:52:10 +0200 Subject: [PATCH] Initial patch provided by Miklos Szeredi --- include/fuse_kernel.h | 8 +++++++- include/fuse_lowlevel.h | 8 ++++++++ lib/fuse_lowlevel.c | 18 ++++++++++++++---- lib/fuse_versionscript | 1 + 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/include/fuse_kernel.h b/include/fuse_kernel.h index 09da620b5..e0666a1f7 100644 --- a/include/fuse_kernel.h +++ b/include/fuse_kernel.h @@ -336,6 +336,12 @@ */ #define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0) +/** + * notify_inval_entry flags + * FUSE_EXPIRE_ONLY + */ +#define FUSE_EXPIRE_ONLY (1 << 0) + enum fuse_opcode { FUSE_LOOKUP = 1, FUSE_FORGET = 2, /* no reply */ @@ -800,7 +806,7 @@ struct fuse_notify_inval_inode_out { struct fuse_notify_inval_entry_out { uint64_t parent; uint32_t namelen; - uint32_t padding; + uint32_t flags; }; struct fuse_notify_delete_out { diff --git a/include/fuse_lowlevel.h b/include/fuse_lowlevel.h index 53f0fcf4b..c955cc4bb 100644 --- a/include/fuse_lowlevel.h +++ b/include/fuse_lowlevel.h @@ -1675,6 +1675,14 @@ int fuse_lowlevel_notify_inval_inode(struct fuse_session *se, fuse_ino_t ino, int fuse_lowlevel_notify_inval_entry(struct fuse_session *se, fuse_ino_t parent, const char *name, size_t namelen); +enum fuse_expire_flags { + FUSE_LL_EXPIRE_ONLY = (1 << 0), +}; + +int fuse_lowlevel_notify_expire_entry(struct fuse_session *se, fuse_ino_t parent, + const char *name, size_t namelen, + enum fuse_expire_flags flags); + /** * This function behaves like fuse_lowlevel_notify_inval_entry() with * the following additional effect (at least as of Linux kernel 4.8): diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c index e82cd9e9f..7b9d71043 100644 --- a/lib/fuse_lowlevel.c +++ b/lib/fuse_lowlevel.c @@ -2161,21 +2161,24 @@ return send_notify_iov(se, FUSE_NOTIFY_INVAL_INODE, iov, 2); } -int fuse_lowlevel_notify_inval_entry(struct fuse_session *se, fuse_ino_t parent, - const char *name, size_t namelen) +int fuse_lowlevel_notify_expire_entry(struct fuse_session *se, fuse_ino_t parent, + const char *name, size_t namelen, + enum fuse_expire_flags flags) { struct fuse_notify_inval_entry_out outarg; struct iovec iov[3]; if (!se) return -EINVAL; - + if (se->conn.proto_major < 6 || se->conn.proto_minor < 12) return -ENOSYS; outarg.parent = parent; outarg.namelen = namelen; - outarg.padding = 0; + outarg.flags = 0; + if (flags & FUSE_LL_EXPIRE_ONLY) + outarg.flags |= FUSE_EXPIRE_ONLY; iov[1].iov_base = &outarg; iov[1].iov_len = sizeof(outarg); @@ -2292,6 +2295,13 @@ int fuse_lowlevel_notify_inval_entry(struct fuse_session *se, fuse_ino_t parent, return send_notify_iov(se, FUSE_NOTIFY_INVAL_ENTRY, iov, 3); } +int fuse_lowlevel_notify_inval_entry(struct fuse_session *se, fuse_ino_t parent, + const char *name, size_t namelen) +{ + return fuse_lowlevel_notify_expire_entry(se, parent, name, namelen, 0); +} + + int fuse_lowlevel_notify_delete(struct fuse_session *se, fuse_ino_t parent, fuse_ino_t child, const char *name, size_t namelen) diff --git a/lib/fuse_versionscript b/lib/fuse_versionscript index 7e50e7507..795ea4aa9 100644 --- a/lib/fuse_versionscript +++ b/lib/fuse_versionscript @@ -151,6 +151,7 @@ FUSE_3.3 { global: fuse_open_channel; + fuse_lowlevel_notify_expire_entr; } FUSE_3.2; # Local Variables: