Linux Audio

Check our new training course

Loading...
v6.13.7
 1/* SPDX-License-Identifier: GPL-2.0 */
 2/*
 3 *  internal.h - declarations internal to debugfs
 4 *
 5 *  Copyright (C) 2016 Nicolai Stange <nicstange@gmail.com>
 6 */
 7
 8#ifndef _DEBUGFS_INTERNAL_H_
 9#define _DEBUGFS_INTERNAL_H_
10#include <linux/list.h>
11
12struct file_operations;
13
14/* declared over in file.c */
15extern const struct file_operations debugfs_noop_file_operations;
16extern const struct file_operations debugfs_open_proxy_file_operations;
17extern const struct file_operations debugfs_full_proxy_file_operations;
18extern const struct file_operations debugfs_full_short_proxy_file_operations;
19
20struct debugfs_fsdata {
21	const struct file_operations *real_fops;
22	const struct debugfs_short_fops *short_fops;
23	union {
24		/* automount_fn is used when real_fops is NULL */
25		debugfs_automount_t automount;
26		struct {
27			refcount_t active_users;
28			struct completion active_users_drained;
29
30			/* protect cancellations */
31			struct mutex cancellations_mtx;
32			struct list_head cancellations;
33		};
34	};
35};
36
37/*
38 * A dentry's ->d_fsdata either points to the real fops or to a
39 * dynamically allocated debugfs_fsdata instance.
40 * In order to distinguish between these two cases, a real fops
41 * pointer gets its lowest bit set.
42 */
43#define DEBUGFS_FSDATA_IS_REAL_FOPS_BIT BIT(0)
44
45/* Access BITS */
46#define DEBUGFS_ALLOW_API	BIT(0)
47#define DEBUGFS_ALLOW_MOUNT	BIT(1)
48
49#ifdef CONFIG_DEBUG_FS_ALLOW_ALL
50#define DEFAULT_DEBUGFS_ALLOW_BITS (DEBUGFS_ALLOW_MOUNT | DEBUGFS_ALLOW_API)
51#endif
52#ifdef CONFIG_DEBUG_FS_DISALLOW_MOUNT
53#define DEFAULT_DEBUGFS_ALLOW_BITS (DEBUGFS_ALLOW_API)
54#endif
55#ifdef CONFIG_DEBUG_FS_ALLOW_NONE
56#define DEFAULT_DEBUGFS_ALLOW_BITS (0)
57#endif
58
59#endif /* _DEBUGFS_INTERNAL_H_ */
v6.9.4
 1/* SPDX-License-Identifier: GPL-2.0 */
 2/*
 3 *  internal.h - declarations internal to debugfs
 4 *
 5 *  Copyright (C) 2016 Nicolai Stange <nicstange@gmail.com>
 6 */
 7
 8#ifndef _DEBUGFS_INTERNAL_H_
 9#define _DEBUGFS_INTERNAL_H_
10#include <linux/list.h>
11
12struct file_operations;
13
14/* declared over in file.c */
15extern const struct file_operations debugfs_noop_file_operations;
16extern const struct file_operations debugfs_open_proxy_file_operations;
17extern const struct file_operations debugfs_full_proxy_file_operations;
 
18
19struct debugfs_fsdata {
20	const struct file_operations *real_fops;
 
21	union {
22		/* automount_fn is used when real_fops is NULL */
23		debugfs_automount_t automount;
24		struct {
25			refcount_t active_users;
26			struct completion active_users_drained;
27
28			/* protect cancellations */
29			struct mutex cancellations_mtx;
30			struct list_head cancellations;
31		};
32	};
33};
34
35/*
36 * A dentry's ->d_fsdata either points to the real fops or to a
37 * dynamically allocated debugfs_fsdata instance.
38 * In order to distinguish between these two cases, a real fops
39 * pointer gets its lowest bit set.
40 */
41#define DEBUGFS_FSDATA_IS_REAL_FOPS_BIT BIT(0)
42
43/* Access BITS */
44#define DEBUGFS_ALLOW_API	BIT(0)
45#define DEBUGFS_ALLOW_MOUNT	BIT(1)
46
47#ifdef CONFIG_DEBUG_FS_ALLOW_ALL
48#define DEFAULT_DEBUGFS_ALLOW_BITS (DEBUGFS_ALLOW_MOUNT | DEBUGFS_ALLOW_API)
49#endif
50#ifdef CONFIG_DEBUG_FS_DISALLOW_MOUNT
51#define DEFAULT_DEBUGFS_ALLOW_BITS (DEBUGFS_ALLOW_API)
52#endif
53#ifdef CONFIG_DEBUG_FS_ALLOW_NONE
54#define DEFAULT_DEBUGFS_ALLOW_BITS (0)
55#endif
56
57#endif /* _DEBUGFS_INTERNAL_H_ */