1 /* SPDX-License-Identifier: GPL-2.0 */
3 * internal.h - declarations internal to debugfs
5 * Copyright (C) 2016 Nicolai Stange <nicstange@gmail.com>
8 #ifndef _DEBUGFS_INTERNAL_H_
9 #define _DEBUGFS_INTERNAL_H_
10 #include <linux/list.h>
12 struct file_operations
;
14 struct debugfs_inode_info
{
15 struct inode vfs_inode
;
18 const struct file_operations
*real_fops
;
19 const struct debugfs_short_fops
*short_fops
;
20 debugfs_automount_t automount
;
25 static inline struct debugfs_inode_info
*DEBUGFS_I(struct inode
*inode
)
27 return container_of(inode
, struct debugfs_inode_info
, vfs_inode
);
30 /* declared over in file.c */
31 extern const struct file_operations debugfs_noop_file_operations
;
32 extern const struct file_operations debugfs_open_proxy_file_operations
;
33 extern const struct file_operations debugfs_full_proxy_file_operations
;
34 extern const struct file_operations debugfs_full_short_proxy_file_operations
;
36 struct debugfs_fsdata
{
37 const struct file_operations
*real_fops
;
38 const struct debugfs_short_fops
*short_fops
;
40 refcount_t active_users
;
41 struct completion active_users_drained
;
43 /* protect cancellations */
44 struct mutex cancellations_mtx
;
45 struct list_head cancellations
;
58 #define DEBUGFS_ALLOW_API BIT(0)
59 #define DEBUGFS_ALLOW_MOUNT BIT(1)
61 #ifdef CONFIG_DEBUG_FS_ALLOW_ALL
62 #define DEFAULT_DEBUGFS_ALLOW_BITS (DEBUGFS_ALLOW_MOUNT | DEBUGFS_ALLOW_API)
64 #ifdef CONFIG_DEBUG_FS_DISALLOW_MOUNT
65 #define DEFAULT_DEBUGFS_ALLOW_BITS (DEBUGFS_ALLOW_API)
67 #ifdef CONFIG_DEBUG_FS_ALLOW_NONE
68 #define DEFAULT_DEBUGFS_ALLOW_BITS (0)
71 #endif /* _DEBUGFS_INTERNAL_H_ */