2 * debugfs.h - a tiny little debug file system
4 * Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com>
5 * Copyright (C) 2004 IBM Inc.
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.
11 * debugfs is for people to use instead of /proc or /sys.
12 * See Documentation/DocBook/filesystems for more details.
19 #include <linux/seq_file.h>
21 #include <linux/types.h>
22 #include <linux/compiler.h>
25 struct file_operations;
29 struct debugfs_blob_wrapper {
34 struct debugfs_reg32 {
39 struct debugfs_regset32 {
40 const struct debugfs_reg32 *regs;
45 extern struct dentry *arch_debugfs_dir;
47 extern struct srcu_struct debugfs_srcu;
49 #include <linux/err.h>
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)
55 return ERR_PTR(-ENODEV);
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,
63 return ERR_PTR(-ENODEV);
66 static inline struct dentry *debugfs_create_dir(const char *name,
67 struct dentry *parent)
69 return ERR_PTR(-ENODEV);
72 static inline struct dentry *debugfs_create_symlink(const char *name,
73 struct dentry *parent,
76 return ERR_PTR(-ENODEV);
79 static inline struct dentry *debugfs_create_automount(const char *name,
80 struct dentry *parent,
81 struct vfsmount *(*f)(void *),
84 return ERR_PTR(-ENODEV);
87 static inline void debugfs_remove(struct dentry *dentry)
90 static inline void debugfs_remove_recursive(struct dentry *dentry)
93 static inline int debugfs_use_file_start(const struct dentry *dentry,
95 __acquires(&debugfs_srcu)
100 static inline void debugfs_use_file_finish(int srcu_idx)
101 __releases(&debugfs_srcu)
104 #define DEFINE_DEBUGFS_ATTRIBUTE(__fops, __get, __set, __fmt) \
105 static const struct file_operations __fops = { 0 }
107 static inline struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry,
108 struct dentry *new_dir, char *new_name)
110 return ERR_PTR(-ENODEV);
113 static inline struct dentry *debugfs_create_u8(const char *name, umode_t mode,
114 struct dentry *parent,
117 return ERR_PTR(-ENODEV);
120 static inline struct dentry *debugfs_create_u16(const char *name, umode_t mode,
121 struct dentry *parent,
124 return ERR_PTR(-ENODEV);
127 static inline struct dentry *debugfs_create_u32(const char *name, umode_t mode,
128 struct dentry *parent,
131 return ERR_PTR(-ENODEV);
134 static inline struct dentry *debugfs_create_u64(const char *name, umode_t mode,
135 struct dentry *parent,
138 return ERR_PTR(-ENODEV);
141 static inline struct dentry *debugfs_create_x8(const char *name, umode_t mode,
142 struct dentry *parent,
145 return ERR_PTR(-ENODEV);
148 static inline struct dentry *debugfs_create_x16(const char *name, umode_t mode,
149 struct dentry *parent,
152 return ERR_PTR(-ENODEV);
155 static inline struct dentry *debugfs_create_x32(const char *name, umode_t mode,
156 struct dentry *parent,
159 return ERR_PTR(-ENODEV);
162 static inline struct dentry *debugfs_create_x64(const char *name, umode_t mode,
163 struct dentry *parent,
166 return ERR_PTR(-ENODEV);
169 static inline struct dentry *debugfs_create_size_t(const char *name, umode_t mode,
170 struct dentry *parent,
173 return ERR_PTR(-ENODEV);
176 static inline struct dentry *debugfs_create_atomic_t(const char *name, umode_t mode,
177 struct dentry *parent, atomic_t *value)
179 return ERR_PTR(-ENODEV);
182 static inline struct dentry *debugfs_create_bool(const char *name, umode_t mode,
183 struct dentry *parent,
186 return ERR_PTR(-ENODEV);
189 static inline struct dentry *debugfs_create_blob(const char *name, umode_t mode,
190 struct dentry *parent,
191 struct debugfs_blob_wrapper *blob)
193 return ERR_PTR(-ENODEV);
196 static inline struct dentry *debugfs_create_regset32(const char *name,
197 umode_t mode, struct dentry *parent,
198 struct debugfs_regset32 *regset)
200 return ERR_PTR(-ENODEV);
203 static inline void debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs,
204 int nregs, void __iomem *base, char *prefix)
208 static inline bool debugfs_initialized(void)
213 static inline struct dentry *debugfs_create_u32_array(const char *name, umode_t mode,
214 struct dentry *parent,
215 u32 *array, u32 elements)
217 return ERR_PTR(-ENODEV);
220 static inline struct dentry *debugfs_create_devm_seqfile(struct device *dev,
222 struct dentry *parent,
223 int (*read_fn)(struct seq_file *s,
226 return ERR_PTR(-ENODEV);
229 static inline ssize_t debugfs_read_file_bool(struct file *file,
230 char __user *user_buf,
231 size_t count, loff_t *ppos)
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)