Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
bb214884
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
bb214884
编写于
3月 02, 2008
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[PATCH] switch loop
ioctl doesn't need BKL here Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
a4af9b48
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
27 addition
and
25 deletion
+27
-25
drivers/block/loop.c
drivers/block/loop.c
+27
-25
未找到文件。
drivers/block/loop.c
浏览文件 @
bb214884
...
...
@@ -652,8 +652,8 @@ static void do_loop_switch(struct loop_device *lo, struct switch_request *p)
* This can only work if the loop device is used read-only, and if the
* new backing store is the same size and type as the old backing store.
*/
static
int
loop_change_fd
(
struct
loop_device
*
lo
,
struct
file
*
lo_file
,
struct
block_device
*
bdev
,
unsigned
int
arg
)
static
int
loop_change_fd
(
struct
loop_device
*
lo
,
struct
block_device
*
bdev
,
unsigned
int
arg
)
{
struct
file
*
file
,
*
old_file
;
struct
inode
*
inode
;
...
...
@@ -712,7 +712,7 @@ static inline int is_loop_device(struct file *file)
return
i
&&
S_ISBLK
(
i
->
i_mode
)
&&
MAJOR
(
i
->
i_rdev
)
==
LOOP_MAJOR
;
}
static
int
loop_set_fd
(
struct
loop_device
*
lo
,
struct
file
*
lo_fil
e
,
static
int
loop_set_fd
(
struct
loop_device
*
lo
,
fmode_t
mod
e
,
struct
block_device
*
bdev
,
unsigned
int
arg
)
{
struct
file
*
file
,
*
f
;
...
...
@@ -740,7 +740,7 @@ static int loop_set_fd(struct loop_device *lo, struct file *lo_file,
while
(
is_loop_device
(
f
))
{
struct
loop_device
*
l
;
if
(
f
->
f_mapping
->
host
->
i_
rdev
==
lo_file
->
f_mapping
->
host
->
i_r
dev
)
if
(
f
->
f_mapping
->
host
->
i_
bdev
==
b
dev
)
goto
out_putf
;
l
=
f
->
f_mapping
->
host
->
i_bdev
->
bd_disk
->
private_data
;
...
...
@@ -786,7 +786,7 @@ static int loop_set_fd(struct loop_device *lo, struct file *lo_file,
goto
out_putf
;
}
if
(
!
(
lo_file
->
f_
mode
&
FMODE_WRITE
))
if
(
!
(
mode
&
FMODE_WRITE
))
lo_flags
|=
LO_FLAGS_READ_ONLY
;
set_device_ro
(
bdev
,
(
lo_flags
&
LO_FLAGS_READ_ONLY
)
!=
0
);
...
...
@@ -918,9 +918,11 @@ static int loop_clr_fd(struct loop_device *lo, struct block_device *bdev)
memset
(
lo
->
lo_encrypt_key
,
0
,
LO_KEY_SIZE
);
memset
(
lo
->
lo_crypt_name
,
0
,
LO_NAME_SIZE
);
memset
(
lo
->
lo_file_name
,
0
,
LO_NAME_SIZE
);
invalidate_bdev
(
bdev
);
if
(
bdev
)
invalidate_bdev
(
bdev
);
set_capacity
(
lo
->
lo_disk
,
0
);
bd_set_size
(
bdev
,
0
);
if
(
bdev
)
bd_set_size
(
bdev
,
0
);
mapping_set_gfp_mask
(
filp
->
f_mapping
,
gfp
);
lo
->
lo_state
=
Lo_unbound
;
fput
(
filp
);
...
...
@@ -1137,22 +1139,22 @@ loop_get_status64(struct loop_device *lo, struct loop_info64 __user *arg) {
return
err
;
}
static
int
lo_ioctl
(
struct
inode
*
inode
,
struct
file
*
fil
e
,
static
int
lo_ioctl
(
struct
block_device
*
bdev
,
fmode_t
mod
e
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
struct
loop_device
*
lo
=
inode
->
i_
bdev
->
bd_disk
->
private_data
;
struct
loop_device
*
lo
=
bdev
->
bd_disk
->
private_data
;
int
err
;
mutex_lock
(
&
lo
->
lo_ctl_mutex
);
switch
(
cmd
)
{
case
LOOP_SET_FD
:
err
=
loop_set_fd
(
lo
,
file
,
inode
->
i_
bdev
,
arg
);
err
=
loop_set_fd
(
lo
,
mode
,
bdev
,
arg
);
break
;
case
LOOP_CHANGE_FD
:
err
=
loop_change_fd
(
lo
,
file
,
inode
->
i_
bdev
,
arg
);
err
=
loop_change_fd
(
lo
,
bdev
,
arg
);
break
;
case
LOOP_CLR_FD
:
err
=
loop_clr_fd
(
lo
,
inode
->
i_
bdev
);
err
=
loop_clr_fd
(
lo
,
bdev
);
break
;
case
LOOP_SET_STATUS
:
err
=
loop_set_status_old
(
lo
,
(
struct
loop_info
__user
*
)
arg
);
...
...
@@ -1292,10 +1294,10 @@ loop_get_status_compat(struct loop_device *lo,
return
err
;
}
static
long
lo_compat_ioctl
(
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
)
static
int
lo_compat_ioctl
(
struct
block_device
*
bdev
,
fmode_t
mode
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
struct
inode
*
inode
=
file
->
f_path
.
dentry
->
d_inode
;
struct
loop_device
*
lo
=
inode
->
i_bdev
->
bd_disk
->
private_data
;
struct
loop_device
*
lo
=
bdev
->
bd_disk
->
private_data
;
int
err
;
switch
(
cmd
)
{
...
...
@@ -1317,7 +1319,7 @@ static long lo_compat_ioctl(struct file *file, unsigned int cmd, unsigned long a
arg
=
(
unsigned
long
)
compat_ptr
(
arg
);
case
LOOP_SET_FD
:
case
LOOP_CHANGE_FD
:
err
=
lo_ioctl
(
inode
,
fil
e
,
cmd
,
arg
);
err
=
lo_ioctl
(
bdev
,
mod
e
,
cmd
,
arg
);
break
;
default:
err
=
-
ENOIOCTLCMD
;
...
...
@@ -1327,9 +1329,9 @@ static long lo_compat_ioctl(struct file *file, unsigned int cmd, unsigned long a
}
#endif
static
int
lo_open
(
struct
inode
*
inode
,
struct
file
*
fil
e
)
static
int
lo_open
(
struct
block_device
*
bdev
,
fmode_t
mod
e
)
{
struct
loop_device
*
lo
=
inode
->
i_
bdev
->
bd_disk
->
private_data
;
struct
loop_device
*
lo
=
bdev
->
bd_disk
->
private_data
;
mutex_lock
(
&
lo
->
lo_ctl_mutex
);
lo
->
lo_refcnt
++
;
...
...
@@ -1338,15 +1340,15 @@ static int lo_open(struct inode *inode, struct file *file)
return
0
;
}
static
int
lo_release
(
struct
inode
*
inode
,
struct
file
*
fil
e
)
static
int
lo_release
(
struct
gendisk
*
disk
,
fmode_t
mod
e
)
{
struct
loop_device
*
lo
=
inode
->
i_bdev
->
bd_
disk
->
private_data
;
struct
loop_device
*
lo
=
disk
->
private_data
;
mutex_lock
(
&
lo
->
lo_ctl_mutex
);
--
lo
->
lo_refcnt
;
if
((
lo
->
lo_flags
&
LO_FLAGS_AUTOCLEAR
)
&&
!
lo
->
lo_refcnt
)
loop_clr_fd
(
lo
,
inode
->
i_bdev
);
loop_clr_fd
(
lo
,
NULL
);
mutex_unlock
(
&
lo
->
lo_ctl_mutex
);
...
...
@@ -1355,11 +1357,11 @@ static int lo_release(struct inode *inode, struct file *file)
static
struct
block_device_operations
lo_fops
=
{
.
owner
=
THIS_MODULE
,
.
__
open
=
lo_open
,
.
__
release
=
lo_release
,
.
__
ioctl
=
lo_ioctl
,
.
open
=
lo_open
,
.
release
=
lo_release
,
.
ioctl
=
lo_ioctl
,
#ifdef CONFIG_COMPAT
.
__
compat_ioctl
=
lo_compat_ioctl
,
.
compat_ioctl
=
lo_compat_ioctl
,
#endif
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录