blob: f0d73d86cc1a8a7d725a3a8cd7d2b52fda5168f9 [file] [log] [blame]
Greg Kroah-Hartman3bce94f2017-11-07 16:59:23 +01001// SPDX-License-Identifier: GPL-2.0
Nicolai Stange9fd4dce2016-03-22 14:11:13 +01002/*
3 * internal.h - declarations internal to debugfs
4 *
5 * Copyright (C) 2016 Nicolai Stange <nicstange@gmail.com>
Nicolai Stange9fd4dce2016-03-22 14:11:13 +01006 */
7
8#ifndef _DEBUGFS_INTERNAL_H_
9#define _DEBUGFS_INTERNAL_H_
10
11struct file_operations;
Nicolai Stange9fd4dce2016-03-22 14:11:13 +010012
13/* declared over in file.c */
14extern const struct file_operations debugfs_noop_file_operations;
15extern const struct file_operations debugfs_open_proxy_file_operations;
Nicolai Stange49d200d2016-03-22 14:11:14 +010016extern const struct file_operations debugfs_full_proxy_file_operations;
Nicolai Stange9fd4dce2016-03-22 14:11:13 +010017
Nicolai Stange7c8d4692017-10-31 00:15:47 +010018struct debugfs_fsdata {
19 const struct file_operations *real_fops;
Nicolai Stangee9117a52017-10-31 00:15:48 +010020 refcount_t active_users;
21 struct completion active_users_drained;
Nicolai Stange7c8d4692017-10-31 00:15:47 +010022};
23
Nicolai Stange7d39bc52017-10-31 00:15:54 +010024/*
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
Nicolai Stange9fd4dce2016-03-22 14:11:13 +010032#endif /* _DEBUGFS_INTERNAL_H_ */