Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xiphi1978
linux
提交
cfeaa4a3
L
linux
项目概览
xiphi1978
/
linux
通知
2
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,发现更多精彩内容 >>
提交
cfeaa4a3
编写于
8月 09, 2009
作者:
T
Trond Myklebust
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
SUNRPC: Clean up rpc_lookup_create
Signed-off-by:
N
Trond Myklebust
<
Trond.Myklebust@netapp.com
>
上级
810d90bc
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
59 addition
and
41 deletion
+59
-41
net/sunrpc/rpc_pipe.c
net/sunrpc/rpc_pipe.c
+59
-41
未找到文件。
net/sunrpc/rpc_pipe.c
浏览文件 @
cfeaa4a3
...
...
@@ -624,6 +624,57 @@ static int __rpc_rmpipe(struct inode *dir, struct dentry *dentry)
return
__rpc_unlink
(
dir
,
dentry
);
}
static
struct
dentry
*
__rpc_lookup_create
(
struct
dentry
*
parent
,
struct
qstr
*
name
)
{
struct
dentry
*
dentry
;
dentry
=
d_lookup
(
parent
,
name
);
if
(
!
dentry
)
{
dentry
=
d_alloc
(
parent
,
name
);
if
(
!
dentry
)
{
dentry
=
ERR_PTR
(
-
ENOMEM
);
goto
out_err
;
}
}
if
(
!
dentry
->
d_inode
)
dentry
->
d_op
=
&
rpc_dentry_operations
;
out_err:
return
dentry
;
}
static
struct
dentry
*
__rpc_lookup_create_exclusive
(
struct
dentry
*
parent
,
struct
qstr
*
name
)
{
struct
dentry
*
dentry
;
dentry
=
__rpc_lookup_create
(
parent
,
name
);
if
(
dentry
->
d_inode
==
NULL
)
return
dentry
;
dput
(
dentry
);
return
ERR_PTR
(
-
EEXIST
);
}
static
struct
dentry
*
rpc_lookup_negative
(
const
char
*
path
,
struct
nameidata
*
nd
)
{
struct
inode
*
dir
;
struct
dentry
*
dentry
;
int
error
;
error
=
rpc_lookup_parent
(
path
,
nd
);
if
(
error
!=
0
)
return
ERR_PTR
(
error
);
dir
=
nd
->
path
.
dentry
->
d_inode
;
mutex_lock_nested
(
&
dir
->
i_mutex
,
I_MUTEX_PARENT
);
dentry
=
__rpc_lookup_create_exclusive
(
nd
->
path
.
dentry
,
&
nd
->
last
);
if
(
IS_ERR
(
dentry
))
{
mutex_unlock
(
&
dir
->
i_mutex
);
rpc_release_path
(
nd
);
}
return
dentry
;
}
/*
* FIXME: This probably has races.
*/
...
...
@@ -723,44 +774,6 @@ __rpc_rmdir(struct inode *dir, struct dentry *dentry)
return
error
;
}
static
struct
dentry
*
rpc_lookup_create
(
struct
dentry
*
parent
,
const
char
*
name
,
int
len
,
int
exclusive
)
{
struct
inode
*
dir
=
parent
->
d_inode
;
struct
dentry
*
dentry
;
mutex_lock_nested
(
&
dir
->
i_mutex
,
I_MUTEX_PARENT
);
dentry
=
lookup_one_len
(
name
,
parent
,
len
);
if
(
IS_ERR
(
dentry
))
goto
out_err
;
if
(
!
dentry
->
d_inode
)
dentry
->
d_op
=
&
rpc_dentry_operations
;
else
if
(
exclusive
)
{
dput
(
dentry
);
dentry
=
ERR_PTR
(
-
EEXIST
);
goto
out_err
;
}
return
dentry
;
out_err:
mutex_unlock
(
&
dir
->
i_mutex
);
return
dentry
;
}
static
struct
dentry
*
rpc_lookup_negative
(
char
*
path
,
struct
nameidata
*
nd
)
{
struct
dentry
*
dentry
;
int
error
;
if
((
error
=
rpc_lookup_parent
(
path
,
nd
))
!=
0
)
return
ERR_PTR
(
error
);
dentry
=
rpc_lookup_create
(
nd
->
path
.
dentry
,
nd
->
last
.
name
,
nd
->
last
.
len
,
1
);
if
(
IS_ERR
(
dentry
))
rpc_release_path
(
nd
);
return
dentry
;
}
/**
* rpc_mkdir - Create a new directory in rpc_pipefs
* @path: path from the rpc_pipefs root to the new directory
...
...
@@ -854,6 +867,7 @@ struct dentry *rpc_mkpipe(struct dentry *parent, const char *name,
struct
dentry
*
dentry
;
struct
inode
*
dir
=
parent
->
d_inode
;
umode_t
umode
=
S_IFIFO
|
S_IRUSR
|
S_IWUSR
;
struct
qstr
q
;
int
err
;
if
(
ops
->
upcall
==
NULL
)
...
...
@@ -861,10 +875,14 @@ struct dentry *rpc_mkpipe(struct dentry *parent, const char *name,
if
(
ops
->
downcall
==
NULL
)
umode
&=
~
S_IWUGO
;
dentry
=
rpc_lookup_create
(
parent
,
name
,
strlen
(
name
),
0
);
q
.
name
=
name
;
q
.
len
=
strlen
(
name
);
q
.
hash
=
full_name_hash
(
q
.
name
,
q
.
len
),
mutex_lock_nested
(
&
dir
->
i_mutex
,
I_MUTEX_PARENT
);
dentry
=
__rpc_lookup_create
(
parent
,
&
q
);
if
(
IS_ERR
(
dentry
))
return
dentry
;
dir
=
parent
->
d_inode
;
goto
out
;
if
(
dentry
->
d_inode
)
{
struct
rpc_inode
*
rpci
=
RPC_I
(
dentry
->
d_inode
);
if
(
rpci
->
private
!=
private
||
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录