Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xiphi1978
linux
提交
7589806e
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,发现更多精彩内容 >>
提交
7589806e
编写于
8月 09, 2009
作者:
T
Trond Myklebust
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
SUNRPC: Clean up file creation code in rpc_pipefs
Signed-off-by:
N
Trond Myklebust
<
Trond.Myklebust@netapp.com
>
上级
b5bb61da
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
77 addition
and
43 deletion
+77
-43
net/sunrpc/rpc_pipe.c
net/sunrpc/rpc_pipe.c
+77
-43
未找到文件。
net/sunrpc/rpc_pipe.c
浏览文件 @
7589806e
...
...
@@ -539,6 +539,68 @@ rpc_get_inode(struct super_block *sb, umode_t mode)
return
inode
;
}
static
int
__rpc_create_common
(
struct
inode
*
dir
,
struct
dentry
*
dentry
,
umode_t
mode
,
const
struct
file_operations
*
i_fop
,
void
*
private
)
{
struct
inode
*
inode
;
BUG_ON
(
!
d_unhashed
(
dentry
));
inode
=
rpc_get_inode
(
dir
->
i_sb
,
mode
);
if
(
!
inode
)
goto
out_err
;
inode
->
i_ino
=
iunique
(
dir
->
i_sb
,
100
);
if
(
i_fop
)
inode
->
i_fop
=
i_fop
;
if
(
private
)
rpc_inode_setowner
(
inode
,
private
);
d_add
(
dentry
,
inode
);
return
0
;
out_err:
printk
(
KERN_WARNING
"%s: %s failed to allocate inode for dentry %s
\n
"
,
__FILE__
,
__func__
,
dentry
->
d_name
.
name
);
dput
(
dentry
);
return
-
ENOMEM
;
}
static
int
__rpc_mkdir
(
struct
inode
*
dir
,
struct
dentry
*
dentry
,
umode_t
mode
,
const
struct
file_operations
*
i_fop
,
void
*
private
)
{
int
err
;
err
=
__rpc_create_common
(
dir
,
dentry
,
S_IFDIR
|
mode
,
i_fop
,
private
);
if
(
err
)
return
err
;
inc_nlink
(
dir
);
fsnotify_mkdir
(
dir
,
dentry
);
return
0
;
}
static
int
__rpc_mkpipe
(
struct
inode
*
dir
,
struct
dentry
*
dentry
,
umode_t
mode
,
const
struct
file_operations
*
i_fop
,
void
*
private
,
const
struct
rpc_pipe_ops
*
ops
,
int
flags
)
{
struct
rpc_inode
*
rpci
;
int
err
;
err
=
__rpc_create_common
(
dir
,
dentry
,
S_IFIFO
|
mode
,
i_fop
,
private
);
if
(
err
)
return
err
;
rpci
=
RPC_I
(
dentry
->
d_inode
);
rpci
->
nkern_readwriters
=
1
;
rpci
->
private
=
private
;
rpci
->
flags
=
flags
;
rpci
->
ops
=
ops
;
fsnotify_create
(
dir
,
dentry
);
return
0
;
}
/*
* FIXME: This probably has races.
*/
...
...
@@ -628,25 +690,6 @@ rpc_populate(struct dentry *parent,
return
-
ENOMEM
;
}
static
int
__rpc_mkdir
(
struct
inode
*
dir
,
struct
dentry
*
dentry
)
{
struct
inode
*
inode
;
inode
=
rpc_get_inode
(
dir
->
i_sb
,
S_IFDIR
|
S_IRUGO
|
S_IXUGO
);
if
(
!
inode
)
goto
out_err
;
inode
->
i_ino
=
iunique
(
dir
->
i_sb
,
100
);
d_instantiate
(
dentry
,
inode
);
inc_nlink
(
dir
);
fsnotify_mkdir
(
dir
,
dentry
);
return
0
;
out_err:
printk
(
KERN_WARNING
"%s: %s failed to allocate inode for dentry %s
\n
"
,
__FILE__
,
__func__
,
dentry
->
d_name
.
name
);
return
-
ENOMEM
;
}
static
int
__rpc_rmdir
(
struct
inode
*
dir
,
struct
dentry
*
dentry
)
{
...
...
@@ -717,9 +760,9 @@ rpc_mkdir(char *path, struct rpc_clnt *rpc_client)
if
(
IS_ERR
(
dentry
))
return
dentry
;
dir
=
nd
.
path
.
dentry
->
d_inode
;
if
((
error
=
__rpc_mkdir
(
dir
,
dentry
))
!=
0
)
goto
err_dput
;
RPC_I
(
dentry
->
d_inode
)
->
private
=
rpc_client
;
error
=
__rpc_mkdir
(
dir
,
dentry
,
S_IRUGO
|
S_IXUGO
,
NULL
,
rpc_client
);
if
(
error
!=
0
)
goto
out_err
;
error
=
rpc_populate
(
dentry
,
authfiles
,
RPCAUTH_info
,
RPCAUTH_EOF
);
if
(
error
)
...
...
@@ -732,8 +775,7 @@ rpc_mkdir(char *path, struct rpc_clnt *rpc_client)
err_depopulate:
rpc_depopulate
(
dentry
,
RPCAUTH_info
,
RPCAUTH_EOF
);
__rpc_rmdir
(
dir
,
dentry
);
err_dput:
dput
(
dentry
);
out_err:
printk
(
KERN_WARNING
"%s: %s() failed to create directory %s (errno = %d)
\n
"
,
__FILE__
,
__func__
,
path
,
error
);
dentry
=
ERR_PTR
(
error
);
...
...
@@ -787,9 +829,9 @@ struct dentry *rpc_mkpipe(struct dentry *parent, const char *name,
int
flags
)
{
struct
dentry
*
dentry
;
struct
inode
*
dir
,
*
inode
;
struct
rpc_inode
*
rpci
;
struct
inode
*
dir
=
parent
->
d_inode
;
umode_t
umode
=
S_IFIFO
|
S_IRUSR
|
S_IWUSR
;
int
err
;
if
(
ops
->
upcall
==
NULL
)
umode
&=
~
S_IRUGO
;
...
...
@@ -801,7 +843,7 @@ struct dentry *rpc_mkpipe(struct dentry *parent, const char *name,
return
dentry
;
dir
=
parent
->
d_inode
;
if
(
dentry
->
d_inode
)
{
rpci
=
RPC_I
(
dentry
->
d_inode
);
struct
rpc_inode
*
rpci
=
RPC_I
(
dentry
->
d_inode
);
if
(
rpci
->
private
!=
private
||
rpci
->
ops
!=
ops
||
rpci
->
flags
!=
flags
)
{
...
...
@@ -811,28 +853,20 @@ struct dentry *rpc_mkpipe(struct dentry *parent, const char *name,
rpci
->
nkern_readwriters
++
;
goto
out
;
}
inode
=
rpc_get_inode
(
dir
->
i_sb
,
umode
);
if
(
!
inode
)
goto
err_dput
;
inode
->
i_ino
=
iunique
(
dir
->
i_sb
,
100
);
inode
->
i_fop
=
&
rpc_pipe_fops
;
d_instantiate
(
dentry
,
inode
);
rpci
=
RPC_I
(
inode
);
rpci
->
private
=
private
;
rpci
->
flags
=
flags
;
rpci
->
ops
=
ops
;
rpci
->
nkern_readwriters
=
1
;
fsnotify_create
(
dir
,
dentry
);
err
=
__rpc_mkpipe
(
dir
,
dentry
,
umode
,
&
rpc_pipe_fops
,
private
,
ops
,
flags
);
if
(
err
)
goto
out_err
;
dget
(
dentry
);
out:
mutex_unlock
(
&
dir
->
i_mutex
);
return
dentry
;
err_dput:
dput
(
dentry
);
dentry
=
ERR_PTR
(
-
ENOMEM
);
out_err:
dentry
=
ERR_PTR
(
err
);
printk
(
KERN_WARNING
"%s: %s() failed to create pipe %s/%s (errno = %d)
\n
"
,
__FILE__
,
__func__
,
parent
->
d_name
.
name
,
name
,
-
ENOMEM
);
err
);
goto
out
;
}
EXPORT_SYMBOL_GPL
(
rpc_mkpipe
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录