xref: /linux/fs/debugfs/internal.h (revision 7d39bc50c47b3f8ed0e1a9d671ecb9ec02f10a2d)
19fd4dcecSNicolai Stange /*
29fd4dcecSNicolai Stange  *  internal.h - declarations internal to debugfs
39fd4dcecSNicolai Stange  *
49fd4dcecSNicolai Stange  *  Copyright (C) 2016 Nicolai Stange <nicstange@gmail.com>
59fd4dcecSNicolai Stange  *
69fd4dcecSNicolai Stange  *	This program is free software; you can redistribute it and/or
79fd4dcecSNicolai Stange  *	modify it under the terms of the GNU General Public License version
89fd4dcecSNicolai Stange  *	2 as published by the Free Software Foundation.
99fd4dcecSNicolai Stange  *
109fd4dcecSNicolai Stange  */
119fd4dcecSNicolai Stange 
129fd4dcecSNicolai Stange #ifndef _DEBUGFS_INTERNAL_H_
139fd4dcecSNicolai Stange #define _DEBUGFS_INTERNAL_H_
149fd4dcecSNicolai Stange 
159fd4dcecSNicolai Stange struct file_operations;
169fd4dcecSNicolai Stange 
179fd4dcecSNicolai Stange /* declared over in file.c */
189fd4dcecSNicolai Stange extern const struct file_operations debugfs_noop_file_operations;
199fd4dcecSNicolai Stange extern const struct file_operations debugfs_open_proxy_file_operations;
2049d200deSNicolai Stange extern const struct file_operations debugfs_full_proxy_file_operations;
219fd4dcecSNicolai Stange 
227c8d4698SNicolai Stange struct debugfs_fsdata {
237c8d4698SNicolai Stange 	const struct file_operations *real_fops;
24e9117a5aSNicolai Stange 	refcount_t active_users;
25e9117a5aSNicolai Stange 	struct completion active_users_drained;
267c8d4698SNicolai Stange };
277c8d4698SNicolai Stange 
28*7d39bc50SNicolai Stange /*
29*7d39bc50SNicolai Stange  * A dentry's ->d_fsdata either points to the real fops or to a
30*7d39bc50SNicolai Stange  * dynamically allocated debugfs_fsdata instance.
31*7d39bc50SNicolai Stange  * In order to distinguish between these two cases, a real fops
32*7d39bc50SNicolai Stange  * pointer gets its lowest bit set.
33*7d39bc50SNicolai Stange  */
34*7d39bc50SNicolai Stange #define DEBUGFS_FSDATA_IS_REAL_FOPS_BIT BIT(0)
35*7d39bc50SNicolai Stange 
369fd4dcecSNicolai Stange #endif /* _DEBUGFS_INTERNAL_H_ */
37