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