]> git.sesse.net Git - bcachefs-tools-debian/blob - include/linux/debugfs.h
bcache in userspace; userspace fsck
[bcachefs-tools-debian] / include / linux / debugfs.h
1 /*
2  *  debugfs.h - a tiny little debug file system
3  *
4  *  Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com>
5  *  Copyright (C) 2004 IBM Inc.
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  *  debugfs is for people to use instead of /proc or /sys.
12  *  See Documentation/DocBook/filesystems for more details.
13  */
14
15 #ifndef _DEBUGFS_H_
16 #define _DEBUGFS_H_
17
18 #include <linux/fs.h>
19 #include <linux/seq_file.h>
20
21 #include <linux/types.h>
22 #include <linux/compiler.h>
23
24 struct device;
25 struct file_operations;
26 struct vfsmount;
27 struct srcu_struct;
28
29 struct debugfs_blob_wrapper {
30         void *data;
31         unsigned long size;
32 };
33
34 struct debugfs_reg32 {
35         char *name;
36         unsigned long offset;
37 };
38
39 struct debugfs_regset32 {
40         const struct debugfs_reg32 *regs;
41         int nregs;
42         void __iomem *base;
43 };
44
45 extern struct dentry *arch_debugfs_dir;
46
47 extern struct srcu_struct debugfs_srcu;
48
49 #include <linux/err.h>
50
51 static inline struct dentry *debugfs_create_file(const char *name, umode_t mode,
52                                         struct dentry *parent, void *data,
53                                         const struct file_operations *fops)
54 {
55         return ERR_PTR(-ENODEV);
56 }
57
58 static inline struct dentry *debugfs_create_file_size(const char *name, umode_t mode,
59                                         struct dentry *parent, void *data,
60                                         const struct file_operations *fops,
61                                         loff_t file_size)
62 {
63         return ERR_PTR(-ENODEV);
64 }
65
66 static inline struct dentry *debugfs_create_dir(const char *name,
67                                                 struct dentry *parent)
68 {
69         return ERR_PTR(-ENODEV);
70 }
71
72 static inline struct dentry *debugfs_create_symlink(const char *name,
73                                                     struct dentry *parent,
74                                                     const char *dest)
75 {
76         return ERR_PTR(-ENODEV);
77 }
78
79 static inline struct dentry *debugfs_create_automount(const char *name,
80                                         struct dentry *parent,
81                                         struct vfsmount *(*f)(void *),
82                                         void *data)
83 {
84         return ERR_PTR(-ENODEV);
85 }
86
87 static inline void debugfs_remove(struct dentry *dentry)
88 { }
89
90 static inline void debugfs_remove_recursive(struct dentry *dentry)
91 { }
92
93 static inline int debugfs_use_file_start(const struct dentry *dentry,
94                                         int *srcu_idx)
95         __acquires(&debugfs_srcu)
96 {
97         return 0;
98 }
99
100 static inline void debugfs_use_file_finish(int srcu_idx)
101         __releases(&debugfs_srcu)
102 { }
103
104 #define DEFINE_DEBUGFS_ATTRIBUTE(__fops, __get, __set, __fmt)   \
105         static const struct file_operations __fops = { 0 }
106
107 static inline struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry,
108                 struct dentry *new_dir, char *new_name)
109 {
110         return ERR_PTR(-ENODEV);
111 }
112
113 static inline struct dentry *debugfs_create_u8(const char *name, umode_t mode,
114                                                struct dentry *parent,
115                                                u8 *value)
116 {
117         return ERR_PTR(-ENODEV);
118 }
119
120 static inline struct dentry *debugfs_create_u16(const char *name, umode_t mode,
121                                                 struct dentry *parent,
122                                                 u16 *value)
123 {
124         return ERR_PTR(-ENODEV);
125 }
126
127 static inline struct dentry *debugfs_create_u32(const char *name, umode_t mode,
128                                                 struct dentry *parent,
129                                                 u32 *value)
130 {
131         return ERR_PTR(-ENODEV);
132 }
133
134 static inline struct dentry *debugfs_create_u64(const char *name, umode_t mode,
135                                                 struct dentry *parent,
136                                                 u64 *value)
137 {
138         return ERR_PTR(-ENODEV);
139 }
140
141 static inline struct dentry *debugfs_create_x8(const char *name, umode_t mode,
142                                                struct dentry *parent,
143                                                u8 *value)
144 {
145         return ERR_PTR(-ENODEV);
146 }
147
148 static inline struct dentry *debugfs_create_x16(const char *name, umode_t mode,
149                                                 struct dentry *parent,
150                                                 u16 *value)
151 {
152         return ERR_PTR(-ENODEV);
153 }
154
155 static inline struct dentry *debugfs_create_x32(const char *name, umode_t mode,
156                                                 struct dentry *parent,
157                                                 u32 *value)
158 {
159         return ERR_PTR(-ENODEV);
160 }
161
162 static inline struct dentry *debugfs_create_x64(const char *name, umode_t mode,
163                                                 struct dentry *parent,
164                                                 u64 *value)
165 {
166         return ERR_PTR(-ENODEV);
167 }
168
169 static inline struct dentry *debugfs_create_size_t(const char *name, umode_t mode,
170                                      struct dentry *parent,
171                                      size_t *value)
172 {
173         return ERR_PTR(-ENODEV);
174 }
175
176 static inline struct dentry *debugfs_create_atomic_t(const char *name, umode_t mode,
177                                      struct dentry *parent, atomic_t *value)
178 {
179         return ERR_PTR(-ENODEV);
180 }
181
182 static inline struct dentry *debugfs_create_bool(const char *name, umode_t mode,
183                                                  struct dentry *parent,
184                                                  bool *value)
185 {
186         return ERR_PTR(-ENODEV);
187 }
188
189 static inline struct dentry *debugfs_create_blob(const char *name, umode_t mode,
190                                   struct dentry *parent,
191                                   struct debugfs_blob_wrapper *blob)
192 {
193         return ERR_PTR(-ENODEV);
194 }
195
196 static inline struct dentry *debugfs_create_regset32(const char *name,
197                                    umode_t mode, struct dentry *parent,
198                                    struct debugfs_regset32 *regset)
199 {
200         return ERR_PTR(-ENODEV);
201 }
202
203 static inline void debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs,
204                          int nregs, void __iomem *base, char *prefix)
205 {
206 }
207
208 static inline bool debugfs_initialized(void)
209 {
210         return false;
211 }
212
213 static inline struct dentry *debugfs_create_u32_array(const char *name, umode_t mode,
214                                         struct dentry *parent,
215                                         u32 *array, u32 elements)
216 {
217         return ERR_PTR(-ENODEV);
218 }
219
220 static inline struct dentry *debugfs_create_devm_seqfile(struct device *dev,
221                                                          const char *name,
222                                                          struct dentry *parent,
223                                            int (*read_fn)(struct seq_file *s,
224                                                           void *data))
225 {
226         return ERR_PTR(-ENODEV);
227 }
228
229 static inline ssize_t debugfs_read_file_bool(struct file *file,
230                                              char __user *user_buf,
231                                              size_t count, loff_t *ppos)
232 {
233         return -ENODEV;
234 }
235
236 static inline ssize_t debugfs_write_file_bool(struct file *file,
237                                               const char __user *user_buf,
238                                               size_t count, loff_t *ppos)
239 {
240         return -ENODEV;
241 }
242
243 #endif