Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
5e53084d
cloud-kernel
项目概览
openanolis
/
cloud-kernel
接近 2 年 前同步成功
通知
169
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
5e53084d
编写于
11月 20, 2014
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
path_init(): store the "base" pointer to file in nameidata itself
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
bd9b51e7
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
13 addition
and
14 deletion
+13
-14
fs/namei.c
fs/namei.c
+13
-14
未找到文件。
fs/namei.c
浏览文件 @
5e53084d
...
@@ -496,6 +496,7 @@ struct nameidata {
...
@@ -496,6 +496,7 @@ struct nameidata {
unsigned
seq
,
m_seq
;
unsigned
seq
,
m_seq
;
int
last_type
;
int
last_type
;
unsigned
depth
;
unsigned
depth
;
struct
file
*
base
;
char
*
saved_names
[
MAX_NESTED_LINKS
+
1
];
char
*
saved_names
[
MAX_NESTED_LINKS
+
1
];
};
};
...
@@ -1845,13 +1846,14 @@ static int link_path_walk(const char *name, struct nameidata *nd)
...
@@ -1845,13 +1846,14 @@ static int link_path_walk(const char *name, struct nameidata *nd)
}
}
static
int
path_init
(
int
dfd
,
const
char
*
name
,
unsigned
int
flags
,
static
int
path_init
(
int
dfd
,
const
char
*
name
,
unsigned
int
flags
,
struct
nameidata
*
nd
,
struct
file
**
fp
)
struct
nameidata
*
nd
)
{
{
int
retval
=
0
;
int
retval
=
0
;
nd
->
last_type
=
LAST_ROOT
;
/* if there are only slashes... */
nd
->
last_type
=
LAST_ROOT
;
/* if there are only slashes... */
nd
->
flags
=
flags
|
LOOKUP_JUMPED
;
nd
->
flags
=
flags
|
LOOKUP_JUMPED
;
nd
->
depth
=
0
;
nd
->
depth
=
0
;
nd
->
base
=
NULL
;
if
(
flags
&
LOOKUP_ROOT
)
{
if
(
flags
&
LOOKUP_ROOT
)
{
struct
dentry
*
root
=
nd
->
root
.
dentry
;
struct
dentry
*
root
=
nd
->
root
.
dentry
;
struct
inode
*
inode
=
root
->
d_inode
;
struct
inode
*
inode
=
root
->
d_inode
;
...
@@ -1921,7 +1923,7 @@ static int path_init(int dfd, const char *name, unsigned int flags,
...
@@ -1921,7 +1923,7 @@ static int path_init(int dfd, const char *name, unsigned int flags,
nd
->
path
=
f
.
file
->
f_path
;
nd
->
path
=
f
.
file
->
f_path
;
if
(
flags
&
LOOKUP_RCU
)
{
if
(
flags
&
LOOKUP_RCU
)
{
if
(
f
.
flags
&
FDPUT_FPUT
)
if
(
f
.
flags
&
FDPUT_FPUT
)
*
fp
=
f
.
file
;
nd
->
base
=
f
.
file
;
nd
->
seq
=
__read_seqcount_begin
(
&
nd
->
path
.
dentry
->
d_seq
);
nd
->
seq
=
__read_seqcount_begin
(
&
nd
->
path
.
dentry
->
d_seq
);
rcu_read_lock
();
rcu_read_lock
();
}
else
{
}
else
{
...
@@ -1954,7 +1956,6 @@ static inline int lookup_last(struct nameidata *nd, struct path *path)
...
@@ -1954,7 +1956,6 @@ static inline int lookup_last(struct nameidata *nd, struct path *path)
static
int
path_lookupat
(
int
dfd
,
const
char
*
name
,
static
int
path_lookupat
(
int
dfd
,
const
char
*
name
,
unsigned
int
flags
,
struct
nameidata
*
nd
)
unsigned
int
flags
,
struct
nameidata
*
nd
)
{
{
struct
file
*
base
=
NULL
;
struct
path
path
;
struct
path
path
;
int
err
;
int
err
;
...
@@ -1972,7 +1973,7 @@ static int path_lookupat(int dfd, const char *name,
...
@@ -1972,7 +1973,7 @@ static int path_lookupat(int dfd, const char *name,
* be handled by restarting a traditional ref-walk (which will always
* be handled by restarting a traditional ref-walk (which will always
* be able to complete).
* be able to complete).
*/
*/
err
=
path_init
(
dfd
,
name
,
flags
|
LOOKUP_PARENT
,
nd
,
&
base
);
err
=
path_init
(
dfd
,
name
,
flags
|
LOOKUP_PARENT
,
nd
);
if
(
unlikely
(
err
))
if
(
unlikely
(
err
))
goto
out
;
goto
out
;
...
@@ -2008,8 +2009,8 @@ static int path_lookupat(int dfd, const char *name,
...
@@ -2008,8 +2009,8 @@ static int path_lookupat(int dfd, const char *name,
}
}
out:
out:
if
(
base
)
if
(
nd
->
base
)
fput
(
base
);
fput
(
nd
->
base
);
if
(
nd
->
root
.
mnt
&&
!
(
nd
->
flags
&
LOOKUP_ROOT
))
{
if
(
nd
->
root
.
mnt
&&
!
(
nd
->
flags
&
LOOKUP_ROOT
))
{
path_put
(
&
nd
->
root
);
path_put
(
&
nd
->
root
);
...
@@ -2321,11 +2322,10 @@ mountpoint_last(struct nameidata *nd, struct path *path)
...
@@ -2321,11 +2322,10 @@ mountpoint_last(struct nameidata *nd, struct path *path)
static
int
static
int
path_mountpoint
(
int
dfd
,
const
char
*
name
,
struct
path
*
path
,
unsigned
int
flags
)
path_mountpoint
(
int
dfd
,
const
char
*
name
,
struct
path
*
path
,
unsigned
int
flags
)
{
{
struct
file
*
base
=
NULL
;
struct
nameidata
nd
;
struct
nameidata
nd
;
int
err
;
int
err
;
err
=
path_init
(
dfd
,
name
,
flags
|
LOOKUP_PARENT
,
&
nd
,
&
base
);
err
=
path_init
(
dfd
,
name
,
flags
|
LOOKUP_PARENT
,
&
nd
);
if
(
unlikely
(
err
))
if
(
unlikely
(
err
))
goto
out
;
goto
out
;
...
@@ -2349,8 +2349,8 @@ path_mountpoint(int dfd, const char *name, struct path *path, unsigned int flags
...
@@ -2349,8 +2349,8 @@ path_mountpoint(int dfd, const char *name, struct path *path, unsigned int flags
put_link
(
&
nd
,
&
link
,
cookie
);
put_link
(
&
nd
,
&
link
,
cookie
);
}
}
out:
out:
if
(
base
)
if
(
nd
.
base
)
fput
(
base
);
fput
(
nd
.
base
);
if
(
nd
.
root
.
mnt
&&
!
(
nd
.
flags
&
LOOKUP_ROOT
))
if
(
nd
.
root
.
mnt
&&
!
(
nd
.
flags
&
LOOKUP_ROOT
))
path_put
(
&
nd
.
root
);
path_put
(
&
nd
.
root
);
...
@@ -3205,7 +3205,6 @@ static int do_tmpfile(int dfd, struct filename *pathname,
...
@@ -3205,7 +3205,6 @@ static int do_tmpfile(int dfd, struct filename *pathname,
static
struct
file
*
path_openat
(
int
dfd
,
struct
filename
*
pathname
,
static
struct
file
*
path_openat
(
int
dfd
,
struct
filename
*
pathname
,
struct
nameidata
*
nd
,
const
struct
open_flags
*
op
,
int
flags
)
struct
nameidata
*
nd
,
const
struct
open_flags
*
op
,
int
flags
)
{
{
struct
file
*
base
=
NULL
;
struct
file
*
file
;
struct
file
*
file
;
struct
path
path
;
struct
path
path
;
int
opened
=
0
;
int
opened
=
0
;
...
@@ -3222,7 +3221,7 @@ static struct file *path_openat(int dfd, struct filename *pathname,
...
@@ -3222,7 +3221,7 @@ static struct file *path_openat(int dfd, struct filename *pathname,
goto
out
;
goto
out
;
}
}
error
=
path_init
(
dfd
,
pathname
->
name
,
flags
|
LOOKUP_PARENT
,
nd
,
&
base
);
error
=
path_init
(
dfd
,
pathname
->
name
,
flags
|
LOOKUP_PARENT
,
nd
);
if
(
unlikely
(
error
))
if
(
unlikely
(
error
))
goto
out
;
goto
out
;
...
@@ -3255,8 +3254,8 @@ static struct file *path_openat(int dfd, struct filename *pathname,
...
@@ -3255,8 +3254,8 @@ static struct file *path_openat(int dfd, struct filename *pathname,
out:
out:
if
(
nd
->
root
.
mnt
&&
!
(
nd
->
flags
&
LOOKUP_ROOT
))
if
(
nd
->
root
.
mnt
&&
!
(
nd
->
flags
&
LOOKUP_ROOT
))
path_put
(
&
nd
->
root
);
path_put
(
&
nd
->
root
);
if
(
base
)
if
(
nd
->
base
)
fput
(
base
);
fput
(
nd
->
base
);
if
(
!
(
opened
&
FILE_OPENED
))
{
if
(
!
(
opened
&
FILE_OPENED
))
{
BUG_ON
(
!
error
);
BUG_ON
(
!
error
);
put_filp
(
file
);
put_filp
(
file
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录