Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
6987843f
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
6987843f
编写于
10月 02, 2013
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
take anon inode allocation to libfs.c
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
22a8cb82
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
46 addition
and
48 deletion
+46
-48
fs/anon_inodes.c
fs/anon_inodes.c
+2
-48
fs/libfs.c
fs/libfs.c
+43
-0
include/linux/fs.h
include/linux/fs.h
+1
-0
未找到文件。
fs/anon_inodes.c
浏览文件 @
6987843f
...
...
@@ -24,7 +24,6 @@
static
struct
vfsmount
*
anon_inode_mnt
__read_mostly
;
static
struct
inode
*
anon_inode_inode
;
static
const
struct
file_operations
anon_inode_fops
;
/*
* anon_inodefs_dname() is called from d_path().
...
...
@@ -39,51 +38,6 @@ static const struct dentry_operations anon_inodefs_dentry_operations = {
.
d_dname
=
anon_inodefs_dname
,
};
/*
* nop .set_page_dirty method so that people can use .page_mkwrite on
* anon inodes.
*/
static
int
anon_set_page_dirty
(
struct
page
*
page
)
{
return
0
;
};
static
const
struct
address_space_operations
anon_aops
=
{
.
set_page_dirty
=
anon_set_page_dirty
,
};
/*
* A single inode exists for all anon_inode files. Contrary to pipes,
* anon_inode inodes have no associated per-instance data, so we need
* only allocate one of them.
*/
static
struct
inode
*
anon_inode_mkinode
(
struct
super_block
*
s
)
{
struct
inode
*
inode
=
new_inode_pseudo
(
s
);
if
(
!
inode
)
return
ERR_PTR
(
-
ENOMEM
);
inode
->
i_ino
=
get_next_ino
();
inode
->
i_fop
=
&
anon_inode_fops
;
inode
->
i_mapping
->
a_ops
=
&
anon_aops
;
/*
* Mark the inode dirty from the very beginning,
* that way it will never be moved to the dirty
* list because mark_inode_dirty() will think
* that it already _is_ on the dirty list.
*/
inode
->
i_state
=
I_DIRTY
;
inode
->
i_mode
=
S_IRUSR
|
S_IWUSR
;
inode
->
i_uid
=
current_fsuid
();
inode
->
i_gid
=
current_fsgid
();
inode
->
i_flags
|=
S_PRIVATE
;
inode
->
i_atime
=
inode
->
i_mtime
=
inode
->
i_ctime
=
CURRENT_TIME
;
return
inode
;
}
static
struct
dentry
*
anon_inodefs_mount
(
struct
file_system_type
*
fs_type
,
int
flags
,
const
char
*
dev_name
,
void
*
data
)
{
...
...
@@ -92,7 +46,7 @@ static struct dentry *anon_inodefs_mount(struct file_system_type *fs_type,
&
anon_inodefs_dentry_operations
,
ANON_INODE_FS_MAGIC
);
if
(
!
IS_ERR
(
root
))
{
struct
super_block
*
s
=
root
->
d_sb
;
anon_inode_inode
=
a
non_inode_mk
inode
(
s
);
anon_inode_inode
=
a
lloc_anon_
inode
(
s
);
if
(
IS_ERR
(
anon_inode_inode
))
{
dput
(
root
);
deactivate_locked_super
(
s
);
...
...
@@ -134,7 +88,7 @@ struct file *anon_inode_getfile_private(const char *name,
if
(
fops
->
owner
&&
!
try_module_get
(
fops
->
owner
))
return
ERR_PTR
(
-
ENOENT
);
inode
=
a
non_inode_mk
inode
(
anon_inode_mnt
->
mnt_sb
);
inode
=
a
lloc_anon_
inode
(
anon_inode_mnt
->
mnt_sb
);
if
(
IS_ERR
(
inode
))
{
file
=
ERR_PTR
(
-
ENOMEM
);
goto
err_module
;
...
...
fs/libfs.c
浏览文件 @
6987843f
...
...
@@ -1002,3 +1002,46 @@ void kfree_put_link(struct dentry *dentry, struct nameidata *nd,
kfree
(
s
);
}
EXPORT_SYMBOL
(
kfree_put_link
);
/*
* nop .set_page_dirty method so that people can use .page_mkwrite on
* anon inodes.
*/
static
int
anon_set_page_dirty
(
struct
page
*
page
)
{
return
0
;
};
/*
* A single inode exists for all anon_inode files. Contrary to pipes,
* anon_inode inodes have no associated per-instance data, so we need
* only allocate one of them.
*/
struct
inode
*
alloc_anon_inode
(
struct
super_block
*
s
)
{
static
const
struct
address_space_operations
anon_aops
=
{
.
set_page_dirty
=
anon_set_page_dirty
,
};
struct
inode
*
inode
=
new_inode_pseudo
(
s
);
if
(
!
inode
)
return
ERR_PTR
(
-
ENOMEM
);
inode
->
i_ino
=
get_next_ino
();
inode
->
i_mapping
->
a_ops
=
&
anon_aops
;
/*
* Mark the inode dirty from the very beginning,
* that way it will never be moved to the dirty
* list because mark_inode_dirty() will think
* that it already _is_ on the dirty list.
*/
inode
->
i_state
=
I_DIRTY
;
inode
->
i_mode
=
S_IRUSR
|
S_IWUSR
;
inode
->
i_uid
=
current_fsuid
();
inode
->
i_gid
=
current_fsgid
();
inode
->
i_flags
|=
S_PRIVATE
;
inode
->
i_atime
=
inode
->
i_mtime
=
inode
->
i_ctime
=
CURRENT_TIME
;
return
inode
;
}
EXPORT_SYMBOL
(
alloc_anon_inode
);
include/linux/fs.h
浏览文件 @
6987843f
...
...
@@ -2562,6 +2562,7 @@ extern int simple_write_begin(struct file *file, struct address_space *mapping,
extern
int
simple_write_end
(
struct
file
*
file
,
struct
address_space
*
mapping
,
loff_t
pos
,
unsigned
len
,
unsigned
copied
,
struct
page
*
page
,
void
*
fsdata
);
extern
struct
inode
*
alloc_anon_inode
(
struct
super_block
*
);
extern
struct
dentry
*
simple_lookup
(
struct
inode
*
,
struct
dentry
*
,
unsigned
int
flags
);
extern
ssize_t
generic_read_dir
(
struct
file
*
,
char
__user
*
,
size_t
,
loff_t
*
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录