18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * internal.h - declarations internal to debugfs 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 2016 Nicolai Stange <nicstange@gmail.com> 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#ifndef _DEBUGFS_INTERNAL_H_ 98c2ecf20Sopenharmony_ci#define _DEBUGFS_INTERNAL_H_ 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_cistruct file_operations; 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci/* declared over in file.c */ 148c2ecf20Sopenharmony_ciextern const struct file_operations debugfs_noop_file_operations; 158c2ecf20Sopenharmony_ciextern const struct file_operations debugfs_open_proxy_file_operations; 168c2ecf20Sopenharmony_ciextern const struct file_operations debugfs_full_proxy_file_operations; 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_cistruct debugfs_fsdata { 198c2ecf20Sopenharmony_ci const struct file_operations *real_fops; 208c2ecf20Sopenharmony_ci union { 218c2ecf20Sopenharmony_ci /* automount_fn is used when real_fops is NULL */ 228c2ecf20Sopenharmony_ci debugfs_automount_t automount; 238c2ecf20Sopenharmony_ci struct { 248c2ecf20Sopenharmony_ci refcount_t active_users; 258c2ecf20Sopenharmony_ci struct completion active_users_drained; 268c2ecf20Sopenharmony_ci }; 278c2ecf20Sopenharmony_ci }; 288c2ecf20Sopenharmony_ci}; 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci/* 318c2ecf20Sopenharmony_ci * A dentry's ->d_fsdata either points to the real fops or to a 328c2ecf20Sopenharmony_ci * dynamically allocated debugfs_fsdata instance. 338c2ecf20Sopenharmony_ci * In order to distinguish between these two cases, a real fops 348c2ecf20Sopenharmony_ci * pointer gets its lowest bit set. 358c2ecf20Sopenharmony_ci */ 368c2ecf20Sopenharmony_ci#define DEBUGFS_FSDATA_IS_REAL_FOPS_BIT BIT(0) 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci/* Access BITS */ 398c2ecf20Sopenharmony_ci#define DEBUGFS_ALLOW_API BIT(0) 408c2ecf20Sopenharmony_ci#define DEBUGFS_ALLOW_MOUNT BIT(1) 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci#ifdef CONFIG_DEBUG_FS_ALLOW_ALL 438c2ecf20Sopenharmony_ci#define DEFAULT_DEBUGFS_ALLOW_BITS (DEBUGFS_ALLOW_MOUNT | DEBUGFS_ALLOW_API) 448c2ecf20Sopenharmony_ci#endif 458c2ecf20Sopenharmony_ci#ifdef CONFIG_DEBUG_FS_DISALLOW_MOUNT 468c2ecf20Sopenharmony_ci#define DEFAULT_DEBUGFS_ALLOW_BITS (DEBUGFS_ALLOW_API) 478c2ecf20Sopenharmony_ci#endif 488c2ecf20Sopenharmony_ci#ifdef CONFIG_DEBUG_FS_ALLOW_NONE 498c2ecf20Sopenharmony_ci#define DEFAULT_DEBUGFS_ALLOW_BITS (0) 508c2ecf20Sopenharmony_ci#endif 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci#endif /* _DEBUGFS_INTERNAL_H_ */ 53