Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
066cc813
cloud-kernel
项目概览
openanolis
/
cloud-kernel
接近 2 年 前同步成功
通知
170
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看板
提交
066cc813
编写于
12月 01, 2017
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
do_mq_open(): move all work prior to dentry_open() into a helper
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
05c1b290
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
31 addition
and
46 deletion
+31
-46
ipc/mqueue.c
ipc/mqueue.c
+31
-46
未找到文件。
ipc/mqueue.c
浏览文件 @
066cc813
...
@@ -713,34 +713,44 @@ static void remove_notification(struct mqueue_inode_info *info)
...
@@ -713,34 +713,44 @@ static void remove_notification(struct mqueue_inode_info *info)
info
->
notify_user_ns
=
NULL
;
info
->
notify_user_ns
=
NULL
;
}
}
/*
static
int
prepare_open
(
struct
dentry
*
dentry
,
int
oflag
,
int
ro
,
* Invoked when creating a new queue via sys_mq_open
umode_t
mode
,
struct
filename
*
name
,
*/
static
int
do_create
(
struct
ipc_namespace
*
ipc_ns
,
struct
inode
*
dir
,
struct
path
*
path
,
int
oflag
,
umode_t
mode
,
struct
mq_attr
*
attr
)
struct
mq_attr
*
attr
)
{
return
vfs_mkobj
(
path
->
dentry
,
mode
&
~
current_umask
(),
mqueue_create_attr
,
attr
);
}
/* Opens existing queue */
static
int
do_open
(
struct
path
*
path
,
int
oflag
)
{
{
static
const
int
oflag2acc
[
O_ACCMODE
]
=
{
MAY_READ
,
MAY_WRITE
,
static
const
int
oflag2acc
[
O_ACCMODE
]
=
{
MAY_READ
,
MAY_WRITE
,
MAY_READ
|
MAY_WRITE
};
MAY_READ
|
MAY_WRITE
};
int
acc
;
int
acc
;
if
(
oflag
&
O_CREAT
)
{
if
(
d_really_is_positive
(
dentry
))
{
/* entry already exists */
audit_inode
(
name
,
dentry
,
0
);
if
(
oflag
&
O_EXCL
)
return
-
EEXIST
;
}
else
{
if
(
ro
)
return
ro
;
audit_inode_parent_hidden
(
name
,
dentry
->
d_parent
);
return
vfs_mkobj
(
dentry
,
mode
&
~
current_umask
(),
mqueue_create_attr
,
attr
);
}
}
else
{
if
(
d_really_is_negative
(
dentry
))
{
return
-
ENOENT
;
}
else
{
audit_inode
(
name
,
dentry
,
0
);
}
}
if
((
oflag
&
O_ACCMODE
)
==
(
O_RDWR
|
O_WRONLY
))
if
((
oflag
&
O_ACCMODE
)
==
(
O_RDWR
|
O_WRONLY
))
return
-
EINVAL
;
return
-
EINVAL
;
acc
=
oflag2acc
[
oflag
&
O_ACCMODE
];
acc
=
oflag2acc
[
oflag
&
O_ACCMODE
];
return
inode_permission
(
d_inode
(
path
->
dentry
),
acc
);
return
inode_permission
(
d_inode
(
dentry
),
acc
);
}
}
static
int
do_mq_open
(
const
char
__user
*
u_name
,
int
oflag
,
umode_t
mode
,
static
int
do_mq_open
(
const
char
__user
*
u_name
,
int
oflag
,
umode_t
mode
,
struct
mq_attr
*
attr
)
struct
mq_attr
*
attr
)
{
{
struct
path
path
;
struct
path
path
;
struct
file
*
filp
;
struct
filename
*
name
;
struct
filename
*
name
;
int
fd
,
error
;
int
fd
,
error
;
struct
ipc_namespace
*
ipc_ns
=
current
->
nsproxy
->
ipc_ns
;
struct
ipc_namespace
*
ipc_ns
=
current
->
nsproxy
->
ipc_ns
;
...
@@ -767,39 +777,14 @@ static int do_mq_open(const char __user *u_name, int oflag, umode_t mode,
...
@@ -767,39 +777,14 @@ static int do_mq_open(const char __user *u_name, int oflag, umode_t mode,
}
}
path
.
mnt
=
mntget
(
mnt
);
path
.
mnt
=
mntget
(
mnt
);
if
(
oflag
&
O_CREAT
)
{
error
=
prepare_open
(
path
.
dentry
,
oflag
,
ro
,
mode
,
name
,
attr
);
if
(
d_really_is_positive
(
path
.
dentry
))
{
/* entry already exists */
if
(
!
error
)
{
audit_inode
(
name
,
path
.
dentry
,
0
);
struct
file
*
file
=
dentry_open
(
&
path
,
oflag
,
current_cred
());
if
(
oflag
&
O_EXCL
)
if
(
!
IS_ERR
(
file
))
error
=
-
EEXIST
;
fd_install
(
fd
,
file
);
else
else
error
=
do_open
(
&
path
,
oflag
);
error
=
PTR_ERR
(
file
);
}
else
{
if
(
ro
)
{
error
=
ro
;
}
else
{
audit_inode_parent_hidden
(
name
,
root
);
error
=
do_create
(
ipc_ns
,
d_inode
(
root
),
&
path
,
oflag
,
mode
,
attr
);
}
}
}
else
{
if
(
d_really_is_negative
(
path
.
dentry
))
{
error
=
-
ENOENT
;
}
else
{
audit_inode
(
name
,
path
.
dentry
,
0
);
error
=
do_open
(
&
path
,
oflag
);
}
}
}
if
(
error
)
goto
out
;
filp
=
dentry_open
(
&
path
,
oflag
,
current_cred
());
if
(
!
IS_ERR
(
filp
))
fd_install
(
fd
,
filp
);
else
error
=
PTR_ERR
(
filp
);
out:
path_put
(
&
path
);
path_put
(
&
path
);
out_putfd:
out_putfd:
if
(
error
)
{
if
(
error
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录