Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  *  internal.h - declarations internal to debugfs
0004  *
0005  *  Copyright (C) 2016 Nicolai Stange <nicstange@gmail.com>
0006  */
0007 
0008 #ifndef _DEBUGFS_INTERNAL_H_
0009 #define _DEBUGFS_INTERNAL_H_
0010 
0011 struct file_operations;
0012 
0013 /* declared over in file.c */
0014 extern const struct file_operations debugfs_noop_file_operations;
0015 extern const struct file_operations debugfs_open_proxy_file_operations;
0016 extern const struct file_operations debugfs_full_proxy_file_operations;
0017 
0018 struct debugfs_fsdata {
0019     const struct file_operations *real_fops;
0020     refcount_t active_users;
0021     struct completion active_users_drained;
0022 };
0023 
0024 /*
0025  * A dentry's ->d_fsdata either points to the real fops or to a
0026  * dynamically allocated debugfs_fsdata instance.
0027  * In order to distinguish between these two cases, a real fops
0028  * pointer gets its lowest bit set.
0029  */
0030 #define DEBUGFS_FSDATA_IS_REAL_FOPS_BIT BIT(0)
0031 
0032 /* Access BITS */
0033 #define DEBUGFS_ALLOW_API   BIT(0)
0034 #define DEBUGFS_ALLOW_MOUNT BIT(1)
0035 
0036 #ifdef CONFIG_DEBUG_FS_ALLOW_ALL
0037 #define DEFAULT_DEBUGFS_ALLOW_BITS (DEBUGFS_ALLOW_MOUNT | DEBUGFS_ALLOW_API)
0038 #endif
0039 #ifdef CONFIG_DEBUG_FS_DISALLOW_MOUNT
0040 #define DEFAULT_DEBUGFS_ALLOW_BITS (DEBUGFS_ALLOW_API)
0041 #endif
0042 #ifdef CONFIG_DEBUG_FS_ALLOW_NONE
0043 #define DEFAULT_DEBUGFS_ALLOW_BITS (0)
0044 #endif
0045 
0046 #endif /* _DEBUGFS_INTERNAL_H_ */