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
47225db5
Commit
47225db5
authored
Mar 02, 2008
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] switch amiflop
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
b564f027
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
24 deletions
+26
-24
drivers/block/amiflop.c
drivers/block/amiflop.c
+26
-24
No files found.
drivers/block/amiflop.c
View file @
47225db5
...
...
@@ -1437,10 +1437,11 @@ static int fd_getgeo(struct block_device *bdev, struct hd_geometry *geo)
return
0
;
}
static
int
fd_ioctl
(
struct
inode
*
inode
,
struct
file
*
filp
,
static
int
fd_ioctl
(
struct
block_device
*
bdev
,
fmode_t
mode
,
unsigned
int
cmd
,
unsigned
long
param
)
{
int
drive
=
iminor
(
inode
)
&
3
;
struct
amiga_floppy_struct
*
p
=
bdev
->
bd_disk
->
private_data
;
int
drive
=
p
-
unit
;
static
struct
floppy_struct
getprm
;
void
__user
*
argp
=
(
void
__user
*
)
param
;
...
...
@@ -1451,7 +1452,7 @@ static int fd_ioctl(struct inode *inode, struct file *filp,
rel_fdc
();
return
-
EBUSY
;
}
fsync_bdev
(
inode
->
i_
bdev
);
fsync_bdev
(
bdev
);
if
(
fd_motor_on
(
drive
)
==
0
)
{
rel_fdc
();
return
-
ENODEV
;
...
...
@@ -1464,12 +1465,12 @@ static int fd_ioctl(struct inode *inode, struct file *filp,
rel_fdc
();
break
;
case
FDFMTTRK
:
if
(
param
<
unit
[
drive
].
type
->
tracks
*
unit
[
drive
].
type
->
heads
)
if
(
param
<
p
->
type
->
tracks
*
p
->
type
->
heads
)
{
get_fdc
(
drive
);
if
(
fd_seek
(
drive
,
param
)
!=
0
){
memset
(
unit
[
drive
].
trackbuf
,
FD_FILL_BYTE
,
unit
[
drive
].
dtype
->
sects
*
unit
[
drive
].
type
->
sect_mult
*
512
);
memset
(
p
->
trackbuf
,
FD_FILL_BYTE
,
p
->
dtype
->
sects
*
p
->
type
->
sect_mult
*
512
);
non_int_flush_track
(
drive
);
}
floppy_off
(
drive
);
...
...
@@ -1480,14 +1481,14 @@ static int fd_ioctl(struct inode *inode, struct file *filp,
break
;
case
FDFMTEND
:
floppy_off
(
drive
);
invalidate_bdev
(
inode
->
i_
bdev
);
invalidate_bdev
(
bdev
);
break
;
case
FDGETPRM
:
memset
((
void
*
)
&
getprm
,
0
,
sizeof
(
getprm
));
getprm
.
track
=
unit
[
drive
].
type
->
tracks
;
getprm
.
head
=
unit
[
drive
].
type
->
heads
;
getprm
.
sect
=
unit
[
drive
].
dtype
->
sects
*
unit
[
drive
].
type
->
sect_mult
;
getprm
.
size
=
unit
[
drive
].
blocks
;
getprm
.
track
=
p
->
type
->
tracks
;
getprm
.
head
=
p
->
type
->
heads
;
getprm
.
sect
=
p
->
dtype
->
sects
*
p
->
type
->
sect_mult
;
getprm
.
size
=
p
->
blocks
;
if
(
copy_to_user
(
argp
,
&
getprm
,
sizeof
(
struct
floppy_struct
)))
return
-
EFAULT
;
break
;
...
...
@@ -1500,10 +1501,10 @@ static int fd_ioctl(struct inode *inode, struct file *filp,
break
;
#ifdef RAW_IOCTL
case
IOCTL_RAW_TRACK
:
if
(
copy_to_user
(
argp
,
raw_buf
,
unit
[
drive
].
type
->
read_size
))
if
(
copy_to_user
(
argp
,
raw_buf
,
p
->
type
->
read_size
))
return
-
EFAULT
;
else
return
unit
[
drive
].
type
->
read_size
;
return
p
->
type
->
read_size
;
#endif
default:
printk
(
KERN_DEBUG
"fd_ioctl: unknown cmd %d for drive %d."
,
...
...
@@ -1548,10 +1549,10 @@ static void fd_probe(int dev)
* /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
=
iminor
(
inode
)
&
3
;
int
system
=
(
iminor
(
inode
)
&
4
)
>>
2
;
int
drive
=
MINOR
(
bdev
->
bd_dev
)
&
3
;
int
system
=
(
MINOR
(
bdev
->
bd_dev
)
&
4
)
>>
2
;
int
old_dev
;
unsigned
long
flags
;
...
...
@@ -1560,9 +1561,9 @@ static int floppy_open(struct inode *inode, struct file *filp)
if
(
fd_ref
[
drive
]
&&
old_dev
!=
system
)
return
-
EBUSY
;
if
(
filp
&&
filp
->
f_
mode
&
(
FMODE_READ
|
FMODE_WRITE
))
{
check_disk_change
(
inode
->
i_
bdev
);
if
(
filp
->
f_mode
&
FMODE_WRITE
)
{
if
(
mode
&
(
FMODE_READ
|
FMODE_WRITE
))
{
check_disk_change
(
bdev
);
if
(
mode
&
FMODE_WRITE
)
{
int
wrprot
;
get_fdc
(
drive
);
...
...
@@ -1592,9 +1593,10 @@ static int floppy_open(struct inode *inode, struct file *filp)
return
0
;
}
static
int
floppy_release
(
struct
inode
*
inode
,
struct
file
*
filp
)
static
int
floppy_release
(
struct
gendisk
*
disk
,
fmode_t
mode
)
{
int
drive
=
iminor
(
inode
)
&
3
;
struct
amiga_floppy_struct
*
p
=
disk
->
private_data
;
int
drive
=
p
-
unit
;
if
(
unit
[
drive
].
dirty
==
1
)
{
del_timer
(
flush_track_timer
+
drive
);
...
...
@@ -1648,9 +1650,9 @@ static int amiga_floppy_change(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
=
amiga_floppy_change
,
};
...
...
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