Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
a4af9b48
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
160
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看板
提交
a4af9b48
编写于
3月 02, 2008
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[PATCH] switch floppy
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
47844fad
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
26 addition
and
25 deletion
+26
-25
drivers/block/floppy.c
drivers/block/floppy.c
+26
-25
未找到文件。
drivers/block/floppy.c
浏览文件 @
a4af9b48
...
...
@@ -3450,14 +3450,14 @@ static int fd_getgeo(struct block_device *bdev, struct hd_geometry *geo)
return
0
;
}
static
int
fd_ioctl
(
struct
inode
*
inode
,
struct
file
*
filp
,
unsigned
int
cmd
,
static
int
fd_ioctl
(
struct
block_device
*
bdev
,
fmode_t
mode
,
unsigned
int
cmd
,
unsigned
long
param
)
{
#define FD_IOCTL_ALLOWED (
(filp) && (filp)->f_
mode & (FMODE_WRITE|FMODE_WRITE_IOCTL))
#define FD_IOCTL_ALLOWED (mode & (FMODE_WRITE|FMODE_WRITE_IOCTL))
#define OUT(c,x) case c: outparam = (const char *) (x); break
#define IN(c,x,tag) case c: *(x) = inparam. tag ; return 0
int
drive
=
(
long
)
inode
->
i_
bdev
->
bd_disk
->
private_data
;
int
drive
=
(
long
)
bdev
->
bd_disk
->
private_data
;
int
type
=
ITYPE
(
UDRS
->
fd_device
);
int
i
;
int
ret
;
...
...
@@ -3516,11 +3516,11 @@ static int fd_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
current_type
[
drive
]
=
NULL
;
floppy_sizes
[
drive
]
=
MAX_DISK_SIZE
<<
1
;
UDRS
->
keep_data
=
0
;
return
invalidate_drive
(
inode
->
i_
bdev
);
return
invalidate_drive
(
bdev
);
case
FDSETPRM
:
case
FDDEFPRM
:
return
set_geometry
(
cmd
,
&
inparam
.
g
,
drive
,
type
,
inode
->
i_
bdev
);
drive
,
type
,
bdev
);
case
FDGETPRM
:
ECALL
(
get_floppy_geometry
(
drive
,
type
,
(
struct
floppy_struct
**
)
...
...
@@ -3551,7 +3551,7 @@ static int fd_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
case
FDFMTEND
:
case
FDFLUSH
:
LOCK_FDC
(
drive
,
1
);
return
invalidate_drive
(
inode
->
i_
bdev
);
return
invalidate_drive
(
bdev
);
case
FDSETEMSGTRESH
:
UDP
->
max_errors
.
reporting
=
...
...
@@ -3659,9 +3659,9 @@ static void __init config_types(void)
printk
(
"
\n
"
);
}
static
int
floppy_release
(
struct
inode
*
inode
,
struct
file
*
filp
)
static
int
floppy_release
(
struct
gendisk
*
disk
,
fmode_t
mode
)
{
int
drive
=
(
long
)
inode
->
i_bdev
->
bd_
disk
->
private_data
;
int
drive
=
(
long
)
disk
->
private_data
;
mutex_lock
(
&
open_lock
);
if
(
UDRS
->
fd_ref
<
0
)
...
...
@@ -3682,17 +3682,17 @@ static int floppy_release(struct inode *inode, struct file *filp)
* /dev/PS0 etc), and disallows simultaneous access to the same
* drive with different device numbers.
*/
static
int
floppy_open
(
struct
inode
*
inode
,
struct
file
*
filp
)
static
int
floppy_open
(
struct
block_device
*
bdev
,
fmode_t
mode
)
{
int
drive
=
(
long
)
inode
->
i_
bdev
->
bd_disk
->
private_data
;
int
old_dev
;
int
drive
=
(
long
)
bdev
->
bd_disk
->
private_data
;
int
old_dev
,
new_dev
;
int
try
;
int
res
=
-
EBUSY
;
char
*
tmp
;
mutex_lock
(
&
open_lock
);
old_dev
=
UDRS
->
fd_device
;
if
(
opened_bdev
[
drive
]
&&
opened_bdev
[
drive
]
!=
inode
->
i_
bdev
)
if
(
opened_bdev
[
drive
]
&&
opened_bdev
[
drive
]
!=
bdev
)
goto
out2
;
if
(
!
UDRS
->
fd_ref
&&
(
UDP
->
flags
&
FD_BROKEN_DCL
))
{
...
...
@@ -3700,15 +3700,15 @@ static int floppy_open(struct inode *inode, struct file *filp)
USETF
(
FD_VERIFY
);
}
if
(
UDRS
->
fd_ref
==
-
1
||
(
UDRS
->
fd_ref
&&
(
filp
->
f_
mode
&
FMODE_EXCL
)))
if
(
UDRS
->
fd_ref
==
-
1
||
(
UDRS
->
fd_ref
&&
(
mode
&
FMODE_EXCL
)))
goto
out2
;
if
(
filp
->
f_
mode
&
FMODE_EXCL
)
if
(
mode
&
FMODE_EXCL
)
UDRS
->
fd_ref
=
-
1
;
else
UDRS
->
fd_ref
++
;
opened_bdev
[
drive
]
=
inode
->
i_
bdev
;
opened_bdev
[
drive
]
=
bdev
;
res
=
-
ENXIO
;
...
...
@@ -3743,9 +3743,10 @@ static int floppy_open(struct inode *inode, struct file *filp)
}
}
UDRS
->
fd_device
=
iminor
(
inode
);
set_capacity
(
disks
[
drive
],
floppy_sizes
[
iminor
(
inode
)]);
if
(
old_dev
!=
-
1
&&
old_dev
!=
iminor
(
inode
))
{
new_dev
=
MINOR
(
bdev
->
bd_dev
);
UDRS
->
fd_device
=
new_dev
;
set_capacity
(
disks
[
drive
],
floppy_sizes
[
new_dev
]);
if
(
old_dev
!=
-
1
&&
old_dev
!=
new_dev
)
{
if
(
buffer_drive
==
drive
)
buffer_track
=
-
1
;
}
...
...
@@ -3753,15 +3754,15 @@ static int floppy_open(struct inode *inode, struct file *filp)
if
(
UFDCS
->
rawcmd
==
1
)
UFDCS
->
rawcmd
=
2
;
if
(
!
(
filp
->
f_
mode
&
FMODE_NDELAY
))
{
if
(
filp
->
f_
mode
&
(
FMODE_READ
|
FMODE_WRITE
))
{
if
(
!
(
mode
&
FMODE_NDELAY
))
{
if
(
mode
&
(
FMODE_READ
|
FMODE_WRITE
))
{
UDRS
->
last_checked
=
0
;
check_disk_change
(
inode
->
i_
bdev
);
check_disk_change
(
bdev
);
if
(
UTESTF
(
FD_DISK_CHANGED
))
goto
out
;
}
res
=
-
EROFS
;
if
((
filp
->
f_
mode
&
FMODE_WRITE
)
&&
!
(
UTESTF
(
FD_DISK_WRITABLE
)))
if
((
mode
&
FMODE_WRITE
)
&&
!
(
UTESTF
(
FD_DISK_WRITABLE
)))
goto
out
;
}
mutex_unlock
(
&
open_lock
);
...
...
@@ -3902,9 +3903,9 @@ static int floppy_revalidate(struct gendisk *disk)
static
struct
block_device_operations
floppy_fops
=
{
.
owner
=
THIS_MODULE
,
.
__
open
=
floppy_open
,
.
__
release
=
floppy_release
,
.
__ioctl
=
fd_ioctl
,
.
open
=
floppy_open
,
.
release
=
floppy_release
,
.
locked_ioctl
=
fd_ioctl
,
.
getgeo
=
fd_getgeo
,
.
media_changed
=
check_floppy_change
,
.
revalidate_disk
=
floppy_revalidate
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录