blob: 49ba8dde85effbccf77d8013ed3f1e0da6391a88 [file] [log] [blame]
Nicolai Stange9fd4dce2016-03-22 14:11:13 +01001/*
2 * internal.h - declarations internal to debugfs
3 *
4 * Copyright (C) 2016 Nicolai Stange <nicstange@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License version
8 * 2 as published by the Free Software Foundation.
9 *
10 */
11
12#ifndef _DEBUGFS_INTERNAL_H_
13#define _DEBUGFS_INTERNAL_H_
14
Nicolai Stanged1b20632017-10-31 00:15:48 +010015#include <linux/refcount.h>
16
Nicolai Stange9fd4dce2016-03-22 14:11:13 +010017struct file_operations;
Nicolai Stange9fd4dce2016-03-22 14:11:13 +010018
19/* declared over in file.c */
20extern const struct file_operations debugfs_noop_file_operations;
21extern const struct file_operations debugfs_open_proxy_file_operations;
Nicolai Stange49d200d2016-03-22 14:11:14 +010022extern const struct file_operations debugfs_full_proxy_file_operations;
Nicolai Stange9fd4dce2016-03-22 14:11:13 +010023
Nicolai Stangec492dd32017-10-31 00:15:47 +010024struct debugfs_fsdata {
25 const struct file_operations *real_fops;
Nicolai Stanged1b20632017-10-31 00:15:48 +010026 refcount_t active_users;
27 struct completion active_users_drained;
Nicolai Stangec492dd32017-10-31 00:15:47 +010028};
29
Nicolai Stange5455f7b2017-10-31 00:15:54 +010030/*
31 * A dentry's ->d_fsdata either points to the real fops or to a
32 * dynamically allocated debugfs_fsdata instance.
33 * In order to distinguish between these two cases, a real fops
34 * pointer gets its lowest bit set.
35 */
36#define DEBUGFS_FSDATA_IS_REAL_FOPS_BIT BIT(0)
37
Nicolai Stange9fd4dce2016-03-22 14:11:13 +010038#endif /* _DEBUGFS_INTERNAL_H_ */