aboutsummaryrefslogtreecommitdiffstats
path: root/fs/file_table.c
diff options
context:
space:
mode:
authorAmir Goldstein <[email protected]>2025-06-07 11:53:03 +0000
committerChristian Brauner <[email protected]>2025-07-18 09:09:29 +0000
commit4e301d858af17ae2ce56886296e5458c5a08219a (patch)
tree2334373c7920868f933ae24fb06cf84ade90d5ca /fs/file_table.c
parentVFS: change old_dir and new_dir in struct renamedata to dentrys (diff)
downloadkernel-4e301d858af17ae2ce56886296e5458c5a08219a.tar.gz
kernel-4e301d858af17ae2ce56886296e5458c5a08219a.zip
fs: constify file ptr in backing_file accessor helpers
Add internal helper backing_file_set_user_path() for the only two cases that need to modify backing_file fields. Signed-off-by: Amir Goldstein <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Christian Brauner <[email protected]>
Diffstat (limited to 'fs/file_table.c')
-rw-r--r--fs/file_table.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/fs/file_table.c b/fs/file_table.c
index 138114d64307..f09d79a98111 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -52,17 +52,20 @@ struct backing_file {
};
};
-static inline struct backing_file *backing_file(struct file *f)
-{
- return container_of(f, struct backing_file, file);
-}
+#define backing_file(f) container_of(f, struct backing_file, file)
-struct path *backing_file_user_path(struct file *f)
+struct path *backing_file_user_path(const struct file *f)
{
return &backing_file(f)->user_path;
}
EXPORT_SYMBOL_GPL(backing_file_user_path);
+void backing_file_set_user_path(struct file *f, const struct path *path)
+{
+ backing_file(f)->user_path = *path;
+}
+EXPORT_SYMBOL_GPL(backing_file_set_user_path);
+
static inline void file_free(struct file *f)
{
security_file_free(f);