mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-20 21:51:05 +00:00
debugfs: add debugfs_lookup()
We don't always have easy access to the dentry of a file or directory we
created in debugfs. Add a helper which allows us to get a dentry we
previously created.
The motivation for this change is a problem with blktrace and the blk-mq
debugfs entries introduced in 07e4fead45
("blk-mq: create debugfs
directory tree"). Namely, in some cases, the directory that blktrace
needs to create may already exist, but in other cases, it may not. We
_could_ rely on a bunch of implied knowledge to decide whether to create
the directory or not, but it's much cleaner on our end to just look it
up.
Signed-off-by: Omar Sandoval <osandov@fb.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Jens Axboe <axboe@fb.com>
This commit is contained in:
parent
0dba1314d4
commit
a7c5437b0b
2 changed files with 44 additions and 0 deletions
|
@ -80,6 +80,8 @@ static const struct file_operations __fops = { \
|
|||
|
||||
#if defined(CONFIG_DEBUG_FS)
|
||||
|
||||
struct dentry *debugfs_lookup(const char *name, struct dentry *parent);
|
||||
|
||||
struct dentry *debugfs_create_file(const char *name, umode_t mode,
|
||||
struct dentry *parent, void *data,
|
||||
const struct file_operations *fops);
|
||||
|
@ -181,6 +183,12 @@ ssize_t debugfs_write_file_bool(struct file *file, const char __user *user_buf,
|
|||
* want to duplicate the design decision mistakes of procfs and devfs again.
|
||||
*/
|
||||
|
||||
static inline struct dentry *debugfs_lookup(const char *name,
|
||||
struct dentry *parent)
|
||||
{
|
||||
return ERR_PTR(-ENODEV);
|
||||
}
|
||||
|
||||
static inline struct dentry *debugfs_create_file(const char *name, umode_t mode,
|
||||
struct dentry *parent, void *data,
|
||||
const struct file_operations *fops)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue