Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
af4a5372
K
kernel_linux
项目概览
OpenHarmony
/
kernel_linux
上一次同步 4 年多
通知
15
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看板
提交
af4a5372
编写于
12月 01, 2017
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
move dentry_open() calls up into do_mq_open()
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
eecec19d
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
20 addition
and
24 deletion
+20
-24
ipc/mqueue.c
ipc/mqueue.c
+20
-24
未找到文件。
ipc/mqueue.c
浏览文件 @
af4a5372
...
...
@@ -727,17 +727,16 @@ static int mq_attr_ok(struct ipc_namespace *ipc_ns, struct mq_attr *attr)
/*
* Invoked when creating a new queue via sys_mq_open
*/
static
struct
file
*
do_create
(
struct
ipc_namespace
*
ipc_ns
,
struct
inode
*
dir
,
static
int
do_create
(
struct
ipc_namespace
*
ipc_ns
,
struct
inode
*
dir
,
struct
path
*
path
,
int
oflag
,
umode_t
mode
,
struct
mq_attr
*
attr
)
{
const
struct
cred
*
cred
=
current_cred
();
int
ret
;
if
(
attr
)
{
ret
=
mq_attr_ok
(
ipc_ns
,
attr
);
if
(
ret
)
return
ERR_PTR
(
ret
)
;
return
ret
;
}
else
{
struct
mq_attr
def_attr
;
...
...
@@ -747,28 +746,23 @@ static struct file *do_create(struct ipc_namespace *ipc_ns, struct inode *dir,
ipc_ns
->
mq_msgsize_default
);
ret
=
mq_attr_ok
(
ipc_ns
,
&
def_attr
);
if
(
ret
)
return
ERR_PTR
(
ret
)
;
return
ret
;
}
ret
=
vfs_mkobj
(
path
->
dentry
,
mode
&
~
current_umask
(),
ret
urn
vfs_mkobj
(
path
->
dentry
,
mode
&
~
current_umask
(),
mqueue_create_attr
,
attr
);
if
(
ret
)
return
ERR_PTR
(
ret
);
return
dentry_open
(
path
,
oflag
,
cred
);
}
/* Opens existing queue */
static
struct
file
*
do_open
(
struct
path
*
path
,
int
oflag
)
static
int
do_open
(
struct
path
*
path
,
int
oflag
)
{
static
const
int
oflag2acc
[
O_ACCMODE
]
=
{
MAY_READ
,
MAY_WRITE
,
MAY_READ
|
MAY_WRITE
};
int
acc
;
if
((
oflag
&
O_ACCMODE
)
==
(
O_RDWR
|
O_WRONLY
))
return
ERR_PTR
(
-
EINVAL
)
;
return
-
EINVAL
;
acc
=
oflag2acc
[
oflag
&
O_ACCMODE
];
if
(
inode_permission
(
d_inode
(
path
->
dentry
),
acc
))
return
ERR_PTR
(
-
EACCES
);
return
dentry_open
(
path
,
oflag
,
current_cred
());
return
inode_permission
(
d_inode
(
path
->
dentry
),
acc
);
}
static
int
do_mq_open
(
const
char
__user
*
u_name
,
int
oflag
,
umode_t
mode
,
...
...
@@ -805,28 +799,30 @@ static int do_mq_open(const char __user *u_name, int oflag, umode_t mode,
if
(
oflag
&
O_CREAT
)
{
if
(
d_really_is_positive
(
path
.
dentry
))
{
/* entry already exists */
audit_inode
(
name
,
path
.
dentry
,
0
);
if
(
oflag
&
O_EXCL
)
{
if
(
oflag
&
O_EXCL
)
error
=
-
EEXIST
;
goto
out
;
}
filp
=
do_open
(
&
path
,
oflag
);
else
error
=
do_open
(
&
path
,
oflag
);
}
else
{
if
(
ro
)
{
error
=
ro
;
goto
out
;
}
}
else
{
audit_inode_parent_hidden
(
name
,
root
);
filp
=
do_create
(
ipc_ns
,
d_inode
(
root
),
&
path
,
error
=
do_create
(
ipc_ns
,
d_inode
(
root
),
&
path
,
oflag
,
mode
,
attr
);
}
}
}
else
{
if
(
d_really_is_negative
(
path
.
dentry
))
{
error
=
-
ENOENT
;
goto
out
;
}
}
else
{
audit_inode
(
name
,
path
.
dentry
,
0
);
filp
=
do_open
(
&
path
,
oflag
);
error
=
do_open
(
&
path
,
oflag
);
}
}
if
(
error
)
goto
out
;
filp
=
dentry_open
(
&
path
,
oflag
,
current_cred
());
if
(
!
IS_ERR
(
filp
))
fd_install
(
fd
,
filp
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录