debugfs: defer debugfs_fsdata allocation to first usage
[linux-2.6-block.git] / fs / debugfs / internal.h
CommitLineData
9fd4dcec
NS
1/*
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
15struct file_operations;
9fd4dcec
NS
16
17/* declared over in file.c */
18extern const struct file_operations debugfs_noop_file_operations;
19extern const struct file_operations debugfs_open_proxy_file_operations;
49d200de 20extern const struct file_operations debugfs_full_proxy_file_operations;
9fd4dcec 21
7c8d4698
NS
22struct debugfs_fsdata {
23 const struct file_operations *real_fops;
e9117a5a
NS
24 refcount_t active_users;
25 struct completion active_users_drained;
7c8d4698
NS
26};
27
7d39bc50
NS
28/*
29 * A dentry's ->d_fsdata either points to the real fops or to a
30 * dynamically allocated debugfs_fsdata instance.
31 * In order to distinguish between these two cases, a real fops
32 * pointer gets its lowest bit set.
33 */
34#define DEBUGFS_FSDATA_IS_REAL_FOPS_BIT BIT(0)
35
9fd4dcec 36#endif /* _DEBUGFS_INTERNAL_H_ */