blob: b9567541b7378683c15e066dbb6416bde11a928f [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>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License version
9 * 2 as published by the Free Software Foundation.
10 *
11 */
12
13#ifndef _DEBUGFS_INTERNAL_H_
14#define _DEBUGFS_INTERNAL_H_
15
16struct file_operations;
Nicolai Stange9fd4dce2016-03-22 14:11:13 +010017
18/* declared over in file.c */
19extern const struct file_operations debugfs_noop_file_operations;
20extern const struct file_operations debugfs_open_proxy_file_operations;
Nicolai Stange49d200d2016-03-22 14:11:14 +010021extern const struct file_operations debugfs_full_proxy_file_operations;
Nicolai Stange9fd4dce2016-03-22 14:11:13 +010022
Nicolai Stange7c8d4692017-10-31 00:15:47 +010023struct debugfs_fsdata {
24 const struct file_operations *real_fops;
Nicolai Stangee9117a52017-10-31 00:15:48 +010025 refcount_t active_users;
26 struct completion active_users_drained;
Nicolai Stange7c8d4692017-10-31 00:15:47 +010027};
28
Nicolai Stange7d39bc52017-10-31 00:15:54 +010029/*
30 * A dentry's ->d_fsdata either points to the real fops or to a
31 * dynamically allocated debugfs_fsdata instance.
32 * In order to distinguish between these two cases, a real fops
33 * pointer gets its lowest bit set.
34 */
35#define DEBUGFS_FSDATA_IS_REAL_FOPS_BIT BIT(0)
36
Nicolai Stange9fd4dce2016-03-22 14:11:13 +010037#endif /* _DEBUGFS_INTERNAL_H_ */