Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Linux-御风守护者
linux
提交
a9885444
L
linux
项目概览
Linux-御风守护者
/
linux
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a9885444
编写于
8月 24, 2008
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[PATCH] get rid of on-stack dentry in ext2_get_parent()
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
734711ab
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
15 addition
and
20 deletion
+15
-20
fs/ext2/dir.c
fs/ext2/dir.c
+7
-7
fs/ext2/ext2.h
fs/ext2/ext2.h
+2
-2
fs/ext2/namei.c
fs/ext2/namei.c
+6
-11
未找到文件。
fs/ext2/dir.c
浏览文件 @
a9885444
...
...
@@ -354,11 +354,11 @@ ext2_readdir (struct file * filp, void * dirent, filldir_t filldir)
* (as a parameter - res_dir). Page is returned mapped and unlocked.
* Entry is guaranteed to be valid.
*/
struct
ext2_dir_entry_2
*
ext2_find_entry
(
struct
inode
*
dir
,
struct
dentry
*
dentry
,
struct
page
**
res_page
)
struct
ext2_dir_entry_2
*
ext2_find_entry
(
struct
inode
*
dir
,
struct
qstr
*
child
,
struct
page
**
res_page
)
{
const
char
*
name
=
dentry
->
d_name
.
name
;
int
namelen
=
dentry
->
d_name
.
len
;
const
char
*
name
=
child
->
name
;
int
namelen
=
child
->
len
;
unsigned
reclen
=
EXT2_DIR_REC_LEN
(
namelen
);
unsigned
long
start
,
n
;
unsigned
long
npages
=
dir_pages
(
dir
);
...
...
@@ -431,13 +431,13 @@ struct ext2_dir_entry_2 * ext2_dotdot (struct inode *dir, struct page **p)
return
de
;
}
ino_t
ext2_inode_by_name
(
struct
inode
*
dir
,
struct
dentry
*
dentry
)
ino_t
ext2_inode_by_name
(
struct
inode
*
dir
,
struct
qstr
*
child
)
{
ino_t
res
=
0
;
struct
ext2_dir_entry_2
*
de
;
struct
ext2_dir_entry_2
*
de
;
struct
page
*
page
;
de
=
ext2_find_entry
(
dir
,
dentry
,
&
page
);
de
=
ext2_find_entry
(
dir
,
child
,
&
page
);
if
(
de
)
{
res
=
le32_to_cpu
(
de
->
inode
);
ext2_put_page
(
page
);
...
...
fs/ext2/ext2.h
浏览文件 @
a9885444
...
...
@@ -105,9 +105,9 @@ extern void ext2_rsv_window_add(struct super_block *sb, struct ext2_reserve_wind
/* dir.c */
extern
int
ext2_add_link
(
struct
dentry
*
,
struct
inode
*
);
extern
ino_t
ext2_inode_by_name
(
struct
inode
*
,
struct
dentry
*
);
extern
ino_t
ext2_inode_by_name
(
struct
inode
*
,
struct
qstr
*
);
extern
int
ext2_make_empty
(
struct
inode
*
,
struct
inode
*
);
extern
struct
ext2_dir_entry_2
*
ext2_find_entry
(
struct
inode
*
,
struct
dentry
*
,
struct
page
**
);
extern
struct
ext2_dir_entry_2
*
ext2_find_entry
(
struct
inode
*
,
struct
qstr
*
,
struct
page
**
);
extern
int
ext2_delete_entry
(
struct
ext2_dir_entry_2
*
,
struct
page
*
);
extern
int
ext2_empty_dir
(
struct
inode
*
);
extern
struct
ext2_dir_entry_2
*
ext2_dotdot
(
struct
inode
*
,
struct
page
**
);
...
...
fs/ext2/namei.c
浏览文件 @
a9885444
...
...
@@ -60,7 +60,7 @@ static struct dentry *ext2_lookup(struct inode * dir, struct dentry *dentry, str
if
(
dentry
->
d_name
.
len
>
EXT2_NAME_LEN
)
return
ERR_PTR
(
-
ENAMETOOLONG
);
ino
=
ext2_inode_by_name
(
dir
,
dentry
);
ino
=
ext2_inode_by_name
(
dir
,
&
dentry
->
d_name
);
inode
=
NULL
;
if
(
ino
)
{
inode
=
ext2_iget
(
dir
->
i_sb
,
ino
);
...
...
@@ -72,13 +72,8 @@ static struct dentry *ext2_lookup(struct inode * dir, struct dentry *dentry, str
struct
dentry
*
ext2_get_parent
(
struct
dentry
*
child
)
{
unsigned
long
ino
;
struct
dentry
dotdot
;
dotdot
.
d_name
.
name
=
".."
;
dotdot
.
d_name
.
len
=
2
;
ino
=
ext2_inode_by_name
(
child
->
d_inode
,
&
dotdot
);
struct
qstr
dotdot
=
{.
name
=
".."
,
.
len
=
2
};
unsigned
long
ino
=
ext2_inode_by_name
(
child
->
d_inode
,
&
dotdot
);
if
(
!
ino
)
return
ERR_PTR
(
-
ENOENT
);
return
d_obtain_alias
(
ext2_iget
(
child
->
d_inode
->
i_sb
,
ino
));
...
...
@@ -246,7 +241,7 @@ static int ext2_unlink(struct inode * dir, struct dentry *dentry)
struct
page
*
page
;
int
err
=
-
ENOENT
;
de
=
ext2_find_entry
(
dir
,
dentry
,
&
page
);
de
=
ext2_find_entry
(
dir
,
&
dentry
->
d_name
,
&
page
);
if
(
!
de
)
goto
out
;
...
...
@@ -288,7 +283,7 @@ static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry,
struct
ext2_dir_entry_2
*
old_de
;
int
err
=
-
ENOENT
;
old_de
=
ext2_find_entry
(
old_dir
,
old_dentry
,
&
old_page
);
old_de
=
ext2_find_entry
(
old_dir
,
&
old_dentry
->
d_name
,
&
old_page
);
if
(
!
old_de
)
goto
out
;
...
...
@@ -308,7 +303,7 @@ static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry,
goto
out_dir
;
err
=
-
ENOENT
;
new_de
=
ext2_find_entry
(
new_dir
,
new_dentry
,
&
new_page
);
new_de
=
ext2_find_entry
(
new_dir
,
&
new_dentry
->
d_name
,
&
new_page
);
if
(
!
new_de
)
goto
out_dir
;
inode_inc_link_count
(
old_inode
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录