Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
77b3da6e
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
77b3da6e
编写于
1月 25, 2015
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
new primitive: debugfs_create_automount()
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
5233e311
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
53 addition
and
0 deletion
+53
-0
fs/debugfs/inode.c
fs/debugfs/inode.c
+48
-0
include/linux/debugfs.h
include/linux/debugfs.h
+5
-0
未找到文件。
fs/debugfs/inode.c
浏览文件 @
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
浏览文件 @
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
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录