^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * internal.h - declarations internal to debugfs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (C) 2016 Nicolai Stange <nicstange@gmail.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #ifndef _DEBUGFS_INTERNAL_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #define _DEBUGFS_INTERNAL_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) struct file_operations;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) /* declared over in file.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) extern const struct file_operations debugfs_noop_file_operations;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) extern const struct file_operations debugfs_open_proxy_file_operations;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) extern const struct file_operations debugfs_full_proxy_file_operations;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) struct debugfs_fsdata {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) const struct file_operations *real_fops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) refcount_t active_users;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) struct completion active_users_drained;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) * A dentry's ->d_fsdata either points to the real fops or to a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) * dynamically allocated debugfs_fsdata instance.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) * In order to distinguish between these two cases, a real fops
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) * pointer gets its lowest bit set.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #define DEBUGFS_FSDATA_IS_REAL_FOPS_BIT BIT(0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) /* Access BITS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #define DEBUGFS_ALLOW_API BIT(0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #define DEBUGFS_ALLOW_MOUNT BIT(1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #ifdef CONFIG_DEBUG_FS_ALLOW_ALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #define DEFAULT_DEBUGFS_ALLOW_BITS (DEBUGFS_ALLOW_MOUNT | DEBUGFS_ALLOW_API)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #ifdef CONFIG_DEBUG_FS_DISALLOW_MOUNT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) #define DEFAULT_DEBUGFS_ALLOW_BITS (DEBUGFS_ALLOW_API)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) #ifdef CONFIG_DEBUG_FS_ALLOW_NONE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #define DEFAULT_DEBUGFS_ALLOW_BITS (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #endif /* _DEBUGFS_INTERNAL_H_ */