Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
0338e291
K
Kernel
项目概览
openeuler
/
Kernel
大约 1 年 前同步成功
通知
5
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0338e291
编写于
3月 02, 2008
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[PATCH] switch sd
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
3e3c9c6f
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
17 addition
and
24 deletion
+17
-24
drivers/scsi/sd.c
drivers/scsi/sd.c
+17
-24
未找到文件。
drivers/scsi/sd.c
浏览文件 @
0338e291
...
...
@@ -609,17 +609,15 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq)
* In the latter case @inode and @filp carry an abridged amount
* of information as noted above.
**/
static
int
sd_open
(
struct
inode
*
inode
,
struct
file
*
filp
)
static
int
sd_open
(
struct
block_device
*
bdev
,
fmode_t
mode
)
{
struct
gendisk
*
disk
=
inode
->
i_bdev
->
bd_disk
;
struct
scsi_disk
*
sdkp
;
struct
scsi_disk
*
sdkp
=
scsi_disk_get
(
bdev
->
bd_disk
);
struct
scsi_device
*
sdev
;
int
retval
;
if
(
!
(
sdkp
=
scsi_disk_get
(
disk
))
)
if
(
!
sdkp
)
return
-
ENXIO
;
SCSI_LOG_HLQUEUE
(
3
,
sd_printk
(
KERN_INFO
,
sdkp
,
"sd_open
\n
"
));
sdev
=
sdkp
->
device
;
...
...
@@ -633,14 +631,13 @@ static int sd_open(struct inode *inode, struct file *filp)
goto
error_out
;
if
(
sdev
->
removable
||
sdkp
->
write_prot
)
check_disk_change
(
inode
->
i_
bdev
);
check_disk_change
(
bdev
);
/*
* If the drive is empty, just let the open fail.
*/
retval
=
-
ENOMEDIUM
;
if
(
sdev
->
removable
&&
!
sdkp
->
media_present
&&
!
(
filp
->
f_mode
&
FMODE_NDELAY
))
if
(
sdev
->
removable
&&
!
sdkp
->
media_present
&&
!
(
mode
&
FMODE_NDELAY
))
goto
error_out
;
/*
...
...
@@ -648,7 +645,7 @@ static int sd_open(struct inode *inode, struct file *filp)
* if the user expects to be able to write to the thing.
*/
retval
=
-
EROFS
;
if
(
sdkp
->
write_prot
&&
(
filp
->
f_
mode
&
FMODE_WRITE
))
if
(
sdkp
->
write_prot
&&
(
mode
&
FMODE_WRITE
))
goto
error_out
;
/*
...
...
@@ -684,9 +681,8 @@ static int sd_open(struct inode *inode, struct file *filp)
* Note: may block (uninterruptible) if error recovery is underway
* on this disk.
**/
static
int
sd_release
(
struct
inode
*
inode
,
struct
file
*
filp
)
static
int
sd_release
(
struct
gendisk
*
disk
,
fmode_t
mode
)
{
struct
gendisk
*
disk
=
inode
->
i_bdev
->
bd_disk
;
struct
scsi_disk
*
sdkp
=
scsi_disk
(
disk
);
struct
scsi_device
*
sdev
=
sdkp
->
device
;
...
...
@@ -743,10 +739,9 @@ static int sd_getgeo(struct block_device *bdev, struct hd_geometry *geo)
* Note: most ioctls are forward onto the block subsystem or further
* down in the scsi subsystem.
**/
static
int
sd_ioctl
(
struct
inode
*
inode
,
struct
file
*
filp
,
static
int
sd_ioctl
(
struct
block_device
*
bdev
,
fmode_t
mode
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
struct
block_device
*
bdev
=
inode
->
i_bdev
;
struct
gendisk
*
disk
=
bdev
->
bd_disk
;
struct
scsi_device
*
sdp
=
scsi_disk
(
disk
)
->
device
;
void
__user
*
p
=
(
void
__user
*
)
arg
;
...
...
@@ -762,7 +757,7 @@ static int sd_ioctl(struct inode * inode, struct file * filp,
* access to the device is prohibited.
*/
error
=
scsi_nonblockable_ioctl
(
sdp
,
cmd
,
p
,
filp
?
filp
->
f_flags
&
O_NDELAY
:
0
);
(
mode
&
FMODE_NDELAY_NOW
)
!=
0
);
if
(
!
scsi_block_when_processing_errors
(
sdp
)
||
!
error
)
return
error
;
...
...
@@ -776,8 +771,7 @@ static int sd_ioctl(struct inode * inode, struct file * filp,
case
SCSI_IOCTL_GET_BUS_NUMBER
:
return
scsi_ioctl
(
sdp
,
cmd
,
p
);
default:
error
=
scsi_cmd_ioctl
(
disk
->
queue
,
disk
,
filp
?
filp
->
f_mode
:
0
,
cmd
,
p
);
error
=
scsi_cmd_ioctl
(
disk
->
queue
,
disk
,
mode
,
cmd
,
p
);
if
(
error
!=
-
ENOTTY
)
return
error
;
}
...
...
@@ -930,11 +924,10 @@ static void sd_rescan(struct device *dev)
* This gets directly called from VFS. When the ioctl
* is not recognized we go back to the other translation paths.
*/
static
long
sd_compat_ioctl
(
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
)
static
int
sd_compat_ioctl
(
struct
block_device
*
bdev
,
fmode_t
mode
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
struct
block_device
*
bdev
=
file
->
f_path
.
dentry
->
d_inode
->
i_bdev
;
struct
gendisk
*
disk
=
bdev
->
bd_disk
;
struct
scsi_device
*
sdev
=
scsi_disk
(
disk
)
->
device
;
struct
scsi_device
*
sdev
=
scsi_disk
(
bdev
->
bd_disk
)
->
device
;
/*
* If we are in the middle of error recovery, don't let anyone
...
...
@@ -962,12 +955,12 @@ static long sd_compat_ioctl(struct file *file, unsigned int cmd, unsigned long a
static
struct
block_device_operations
sd_fops
=
{
.
owner
=
THIS_MODULE
,
.
__
open
=
sd_open
,
.
__
release
=
sd_release
,
.
__ioctl
=
sd_ioctl
,
.
open
=
sd_open
,
.
release
=
sd_release
,
.
locked_ioctl
=
sd_ioctl
,
.
getgeo
=
sd_getgeo
,
#ifdef CONFIG_COMPAT
.
__
compat_ioctl
=
sd_compat_ioctl
,
.
compat_ioctl
=
sd_compat_ioctl
,
#endif
.
media_changed
=
sd_media_changed
,
.
revalidate_disk
=
sd_revalidate_disk
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录