Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
a4af9b48
Commit
a4af9b48
authored
Mar 02, 2008
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] switch floppy
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
47844fad
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
25 deletions
+26
-25
drivers/block/floppy.c
drivers/block/floppy.c
+26
-25
No files found.
drivers/block/floppy.c
View file @
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
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment