summaryrefslogtreecommitdiff
path: root/fs/debugfs/internal.h
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2025-01-12 08:06:47 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-01-15 13:14:35 +0100
commit41a0ecc0997cd40d913cce18867efd1c34c64e28 (patch)
tree0a9088ced5b9527f605971695ae5b4638ae96cba /fs/debugfs/internal.h
parentbacaaf833e964933c36ee571d8c0e9a87fae1a3e (diff)
debugfs: get rid of dynamically allocation proxy_ops
All it takes is having full_proxy_open() collect the information about available methods and store it in debugfs_fsdata. Wrappers are called only after full_proxy_open() has succeeded calling debugfs_get_file(), so they are guaranteed to have ->d_fsdata already pointing to debugfs_fsdata. As the result, they can check if method is absent and bugger off early, without any atomic operations, etc. - same effect as what we'd have from NULL method. Which makes the entire proxy_fops contents unconditional, making it completely pointless - we can just put those methods (unconditionally) into debugfs_full_proxy_file_operations and forget about dynamic allocation, replace_fops, etc. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Reviewed-by: Christian Brauner <brauner@kernel.org> Link: https://lore.kernel.org/r/20250112080705.141166-3-viro@zeniv.linux.org.uk Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/debugfs/internal.h')
-rw-r--r--fs/debugfs/internal.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/debugfs/internal.h b/fs/debugfs/internal.h
index a644e44a0ee4..011ef8b1a99a 100644
--- a/fs/debugfs/internal.h
+++ b/fs/debugfs/internal.h
@@ -39,9 +39,18 @@ struct debugfs_fsdata {
/* protect cancellations */
struct mutex cancellations_mtx;
struct list_head cancellations;
+ unsigned int methods;
};
};
+enum {
+ HAS_READ = 1,
+ HAS_WRITE = 2,
+ HAS_LSEEK = 4,
+ HAS_POLL = 8,
+ HAS_IOCTL = 16
+};
+
/*
* A dentry's ->d_fsdata either points to the real fops or to a
* dynamically allocated debugfs_fsdata instance.