Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
77b3da6e
Commit
77b3da6e
authored
Jan 25, 2015
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new primitive: debugfs_create_automount()
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
5233e311
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
0 deletions
+53
-0
fs/debugfs/inode.c
fs/debugfs/inode.c
+48
-0
include/linux/debugfs.h
include/linux/debugfs.h
+5
-0
No files found.
fs/debugfs/inode.c
View file @
77b3da6e
...
...
@@ -175,6 +175,18 @@ static const struct super_operations debugfs_super_operations = {
.
show_options
=
debugfs_show_options
,
};
static
struct
vfsmount
*
debugfs_automount
(
struct
path
*
path
)
{
struct
vfsmount
*
(
*
f
)(
void
*
);
f
=
(
struct
vfsmount
*
(
*
)(
void
*
))
path
->
dentry
->
d_fsdata
;
return
f
(
path
->
dentry
->
d_inode
->
i_private
);
}
static
const
struct
dentry_operations
debugfs_dops
=
{
.
d_delete
=
always_delete_dentry
,
.
d_automount
=
debugfs_automount
,
};
static
int
debug_fill_super
(
struct
super_block
*
sb
,
void
*
data
,
int
silent
)
{
static
struct
tree_descr
debug_files
[]
=
{{
""
}};
...
...
@@ -199,6 +211,7 @@ static int debug_fill_super(struct super_block *sb, void *data, int silent)
goto
fail
;
sb
->
s_op
=
&
debugfs_super_operations
;
sb
->
s_d_op
=
&
debugfs_dops
;
debugfs_apply_options
(
sb
);
...
...
@@ -367,6 +380,41 @@ struct dentry *debugfs_create_dir(const char *name, struct dentry *parent)
}
EXPORT_SYMBOL_GPL
(
debugfs_create_dir
);
/**
* debugfs_create_automount - create automount point in the debugfs filesystem
* @name: a pointer to a string containing the name of the file to create.
* @parent: a pointer to the parent dentry for this file. This should be a
* directory dentry if set. If this parameter is NULL, then the
* file will be created in the root of the debugfs filesystem.
* @f: function to be called when pathname resolution steps on that one.
* @data: opaque argument to pass to f().
*
* @f should return what ->d_automount() would.
*/
struct
dentry
*
debugfs_create_automount
(
const
char
*
name
,
struct
dentry
*
parent
,
struct
vfsmount
*
(
*
f
)(
void
*
),
void
*
data
)
{
struct
dentry
*
dentry
=
start_creating
(
name
,
parent
);
struct
inode
*
inode
;
if
(
IS_ERR
(
dentry
))
return
NULL
;
inode
=
debugfs_get_inode
(
dentry
->
d_sb
);
if
(
unlikely
(
!
inode
))
return
failed_creating
(
dentry
);
inode
->
i_mode
=
S_IFDIR
|
S_IRWXU
|
S_IRUGO
|
S_IXUGO
;
inode
->
i_flags
|=
S_AUTOMOUNT
;
inode
->
i_private
=
data
;
dentry
->
d_fsdata
=
(
void
*
)
f
;
d_instantiate
(
dentry
,
inode
);
return
end_creating
(
dentry
);
}
EXPORT_SYMBOL
(
debugfs_create_automount
);
/**
* debugfs_create_symlink- create a symbolic link in the debugfs filesystem
* @name: a pointer to a string containing the name of the symbolic link to
...
...
include/linux/debugfs.h
View file @
77b3da6e
...
...
@@ -56,6 +56,11 @@ struct dentry *debugfs_create_dir(const char *name, struct dentry *parent);
struct
dentry
*
debugfs_create_symlink
(
const
char
*
name
,
struct
dentry
*
parent
,
const
char
*
dest
);
struct
dentry
*
debugfs_create_automount
(
const
char
*
name
,
struct
dentry
*
parent
,
struct
vfsmount
*
(
*
f
)(
void
*
),
void
*
data
);
void
debugfs_remove
(
struct
dentry
*
dentry
);
void
debugfs_remove_recursive
(
struct
dentry
*
dentry
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment