Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
e0a01249
K
kernel_linux
项目概览
OpenHarmony
/
kernel_linux
上一次同步 3 年多
通知
13
Star
8
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kernel_linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
e0a01249
编写于
6月 27, 2011
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
switch vfs_path_lookup() to struct path
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
ed75e95d
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
26 addition
and
28 deletion
+26
-28
fs/namei.c
fs/namei.c
+11
-5
fs/nfs/cache_lib.c
fs/nfs/cache_lib.c
+4
-5
fs/nfs/super.c
fs/nfs/super.c
+5
-11
include/linux/namei.h
include/linux/namei.h
+1
-1
net/sunrpc/clnt.c
net/sunrpc/clnt.c
+5
-6
未找到文件。
fs/namei.c
浏览文件 @
e0a01249
...
...
@@ -1575,16 +1575,22 @@ int kern_path(const char *name, unsigned int flags, struct path *path)
* @mnt: pointer to vfs mount of the base directory
* @name: pointer to file name
* @flags: lookup flags
* @
nd: pointer to nameidata
* @
path: pointer to struct path to fill
*/
int
vfs_path_lookup
(
struct
dentry
*
dentry
,
struct
vfsmount
*
mnt
,
const
char
*
name
,
unsigned
int
flags
,
struct
nameidata
*
nd
)
struct
path
*
path
)
{
nd
->
root
.
dentry
=
dentry
;
nd
->
root
.
mnt
=
mnt
;
struct
nameidata
nd
;
int
err
;
nd
.
root
.
dentry
=
dentry
;
nd
.
root
.
mnt
=
mnt
;
BUG_ON
(
flags
&
LOOKUP_PARENT
);
/* the first argument of do_path_lookup() is ignored with LOOKUP_ROOT */
return
do_path_lookup
(
AT_FDCWD
,
name
,
flags
|
LOOKUP_ROOT
,
nd
);
err
=
do_path_lookup
(
AT_FDCWD
,
name
,
flags
|
LOOKUP_ROOT
,
&
nd
);
if
(
!
err
)
*
path
=
nd
.
path
;
return
err
;
}
static
struct
dentry
*
__lookup_hash
(
struct
qstr
*
name
,
...
...
fs/nfs/cache_lib.c
浏览文件 @
e0a01249
...
...
@@ -113,19 +113,18 @@ int nfs_cache_wait_for_upcall(struct nfs_cache_defer_req *dreq)
int
nfs_cache_register
(
struct
cache_detail
*
cd
)
{
struct
nameidata
nd
;
struct
vfsmount
*
mnt
;
struct
path
path
;
int
ret
;
mnt
=
rpc_get_mount
();
if
(
IS_ERR
(
mnt
))
return
PTR_ERR
(
mnt
);
ret
=
vfs_path_lookup
(
mnt
->
mnt_root
,
mnt
,
"/cache"
,
0
,
&
nd
);
ret
=
vfs_path_lookup
(
mnt
->
mnt_root
,
mnt
,
"/cache"
,
0
,
&
path
);
if
(
ret
)
goto
err
;
ret
=
sunrpc_cache_register_pipefs
(
nd
.
path
.
dentry
,
cd
->
name
,
0600
,
cd
);
path_put
(
&
nd
.
path
);
ret
=
sunrpc_cache_register_pipefs
(
path
.
dentry
,
cd
->
name
,
0600
,
cd
);
path_put
(
&
path
);
if
(
!
ret
)
return
ret
;
err:
...
...
fs/nfs/super.c
浏览文件 @
e0a01249
...
...
@@ -2773,16 +2773,12 @@ static void nfs_referral_loop_unprotect(void)
static
struct
dentry
*
nfs_follow_remote_path
(
struct
vfsmount
*
root_mnt
,
const
char
*
export_path
)
{
struct
nameidata
*
nd
=
NULL
;
struct
mnt_namespace
*
ns_private
;
struct
super_block
*
s
;
struct
dentry
*
dentry
;
struct
path
path
;
int
ret
;
nd
=
kmalloc
(
sizeof
(
*
nd
),
GFP_KERNEL
);
if
(
nd
==
NULL
)
return
ERR_PTR
(
-
ENOMEM
);
ns_private
=
create_mnt_ns
(
root_mnt
);
ret
=
PTR_ERR
(
ns_private
);
if
(
IS_ERR
(
ns_private
))
...
...
@@ -2793,7 +2789,7 @@ static struct dentry *nfs_follow_remote_path(struct vfsmount *root_mnt,
goto
out_put_mnt_ns
;
ret
=
vfs_path_lookup
(
root_mnt
->
mnt_root
,
root_mnt
,
export_path
,
LOOKUP_FOLLOW
,
nd
);
export_path
,
LOOKUP_FOLLOW
,
&
path
);
nfs_referral_loop_unprotect
();
put_mnt_ns
(
ns_private
);
...
...
@@ -2801,12 +2797,11 @@ static struct dentry *nfs_follow_remote_path(struct vfsmount *root_mnt,
if
(
ret
!=
0
)
goto
out_err
;
s
=
nd
->
path
.
mnt
->
mnt_sb
;
s
=
path
.
mnt
->
mnt_sb
;
atomic_inc
(
&
s
->
s_active
);
dentry
=
dget
(
nd
->
path
.
dentry
);
dentry
=
dget
(
path
.
dentry
);
path_put
(
&
nd
->
path
);
kfree
(
nd
);
path_put
(
&
path
);
down_write
(
&
s
->
s_umount
);
return
dentry
;
out_put_mnt_ns:
...
...
@@ -2814,7 +2809,6 @@ static struct dentry *nfs_follow_remote_path(struct vfsmount *root_mnt,
out_mntput:
mntput
(
root_mnt
);
out_err:
kfree
(
nd
);
return
ERR_PTR
(
ret
);
}
...
...
include/linux/namei.h
浏览文件 @
e0a01249
...
...
@@ -78,7 +78,7 @@ extern struct dentry *kern_path_create(int, const char *, struct path *, int);
extern
struct
dentry
*
user_path_create
(
int
,
const
char
__user
*
,
struct
path
*
,
int
);
extern
int
kern_path_parent
(
const
char
*
,
struct
nameidata
*
);
extern
int
vfs_path_lookup
(
struct
dentry
*
,
struct
vfsmount
*
,
const
char
*
,
unsigned
int
,
struct
nameidata
*
);
const
char
*
,
unsigned
int
,
struct
path
*
);
extern
struct
file
*
lookup_instantiate_filp
(
struct
nameidata
*
nd
,
struct
dentry
*
dentry
,
int
(
*
open
)(
struct
inode
*
,
struct
file
*
));
...
...
net/sunrpc/clnt.c
浏览文件 @
e0a01249
...
...
@@ -97,8 +97,7 @@ static int
rpc_setup_pipedir
(
struct
rpc_clnt
*
clnt
,
char
*
dir_name
)
{
static
uint32_t
clntid
;
struct
nameidata
nd
;
struct
path
path
;
struct
path
path
,
dir
;
char
name
[
15
];
struct
qstr
q
=
{
.
name
=
name
,
...
...
@@ -113,7 +112,7 @@ rpc_setup_pipedir(struct rpc_clnt *clnt, char *dir_name)
path
.
mnt
=
rpc_get_mount
();
if
(
IS_ERR
(
path
.
mnt
))
return
PTR_ERR
(
path
.
mnt
);
error
=
vfs_path_lookup
(
path
.
mnt
->
mnt_root
,
path
.
mnt
,
dir_name
,
0
,
&
nd
);
error
=
vfs_path_lookup
(
path
.
mnt
->
mnt_root
,
path
.
mnt
,
dir_name
,
0
,
&
dir
);
if
(
error
)
goto
err
;
...
...
@@ -121,7 +120,7 @@ rpc_setup_pipedir(struct rpc_clnt *clnt, char *dir_name)
q
.
len
=
snprintf
(
name
,
sizeof
(
name
),
"clnt%x"
,
(
unsigned
int
)
clntid
++
);
name
[
sizeof
(
name
)
-
1
]
=
'\0'
;
q
.
hash
=
full_name_hash
(
q
.
name
,
q
.
len
);
path
.
dentry
=
rpc_create_client_dir
(
nd
.
path
.
dentry
,
&
q
,
clnt
);
path
.
dentry
=
rpc_create_client_dir
(
dir
.
dentry
,
&
q
,
clnt
);
if
(
!
IS_ERR
(
path
.
dentry
))
break
;
error
=
PTR_ERR
(
path
.
dentry
);
...
...
@@ -132,11 +131,11 @@ rpc_setup_pipedir(struct rpc_clnt *clnt, char *dir_name)
goto
err_path_put
;
}
}
path_put
(
&
nd
.
path
);
path_put
(
&
dir
);
clnt
->
cl_path
=
path
;
return
0
;
err_path_put:
path_put
(
&
nd
.
path
);
path_put
(
&
dir
);
err:
rpc_put_mount
();
return
error
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录