summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorMateusz Guzik <mjguzik@gmail.com>2025-03-13 15:27:44 +0100
committerChristian Brauner <brauner@kernel.org>2025-03-18 15:34:27 +0100
commit611851010c74046c0bc2b0461b72a6fae81c16d0 (patch)
treeb4a32bcc4345c6a9f01047fbb4e121e2e30ff1d2 /include/linux
parentf381640e1bd4f2de7ccafbfe8703d33c3718aad9 (diff)
fs: dedup handling of struct filename init and refcounts bumps
No functional changes. Signed-off-by: Mateusz Guzik <mjguzik@gmail.com> Link: https://lore.kernel.org/r/20250313142744.1323281-1-mjguzik@gmail.com Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/fs.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 9ab789cd1531..ae1fce54eb60 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2859,6 +2859,12 @@ static inline struct filename *getname_maybe_null(const char __user *name, int f
}
extern void putname(struct filename *name);
+static inline struct filename *refname(struct filename *name)
+{
+ atomic_inc(&name->refcnt);
+ return name;
+}
+
extern int finish_open(struct file *file, struct dentry *dentry,
int (*open)(struct inode *, struct file *));
extern int finish_no_open(struct file *file, struct dentry *dentry);