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
Kirill Smelkov
linux
Commits
3f028def
Commit
3f028def
authored
Sep 21, 2002
by
Alexander Viro
Committed by
Linus Torvalds
Sep 21, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] gendisk for ataflop
ataflop.c switched to use of gendisks
parent
b7264cd3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
28 deletions
+34
-28
drivers/block/amiflop.c
drivers/block/amiflop.c
+2
-2
drivers/block/ataflop.c
drivers/block/ataflop.c
+32
-26
No files found.
drivers/block/amiflop.c
View file @
3f028def
...
@@ -1747,8 +1747,8 @@ static int __init fd_probe_drives(void)
...
@@ -1747,8 +1747,8 @@ static int __init fd_probe_drives(void)
disk
->
first_minor
=
drive
;
disk
->
first_minor
=
drive
;
disk
->
minor_shift
=
0
;
disk
->
minor_shift
=
0
;
disk
->
fops
=
&
floppy_fops
;
disk
->
fops
=
&
floppy_fops
;
sprintf
(
names
[
drive
],
"fd%d"
);
sprintf
(
names
[
drive
],
"fd%d"
,
drive
);
disk
->
name
=
names
[
drive
];
disk
->
major_
name
=
names
[
drive
];
set_capacity
(
disk
,
880
*
2
);
set_capacity
(
disk
,
880
*
2
);
add_disk
(
disk
);
add_disk
(
disk
);
}
}
...
...
drivers/block/ataflop.c
View file @
3f028def
...
@@ -222,8 +222,6 @@ static struct atari_disk_type user_params[FD_MAX_UNITS];
...
@@ -222,8 +222,6 @@ static struct atari_disk_type user_params[FD_MAX_UNITS];
*/
*/
static
struct
atari_disk_type
default_params
[
FD_MAX_UNITS
];
static
struct
atari_disk_type
default_params
[
FD_MAX_UNITS
];
static
int
floppy_sizes
[
256
];
/* current info on each unit */
/* current info on each unit */
static
struct
atari_floppy_struct
{
static
struct
atari_floppy_struct
{
int
connected
;
/* !=0 : drive is connected */
int
connected
;
/* !=0 : drive is connected */
...
@@ -237,6 +235,8 @@ static struct atari_floppy_struct {
...
@@ -237,6 +235,8 @@ static struct atari_floppy_struct {
unsigned
int
wpstat
;
/* current state of WP signal (for
unsigned
int
wpstat
;
/* current state of WP signal (for
disk change detection) */
disk change detection) */
int
flags
;
/* flags */
int
flags
;
/* flags */
struct
gendisk
disk
;
char
name
[
4
];
}
unit
[
FD_MAX_UNITS
];
}
unit
[
FD_MAX_UNITS
];
#define UD unit[drive]
#define UD unit[drive]
...
@@ -1094,7 +1094,8 @@ static void fd_rwsec_done1(int status)
...
@@ -1094,7 +1094,8 @@ static void fd_rwsec_done1(int status)
if
(
SUDT
[
-
1
].
blocks
>
ReqBlock
)
{
if
(
SUDT
[
-
1
].
blocks
>
ReqBlock
)
{
/* try another disk type */
/* try another disk type */
SUDT
--
;
SUDT
--
;
floppy_sizes
[
SelectedDrive
]
=
SUDT
->
blocks
>>
1
;
set_capacity
(
&
unit
[
SelectedDrive
].
disk
,
SUDT
->
blocks
);
}
else
}
else
Probing
=
0
;
Probing
=
0
;
}
}
...
@@ -1108,7 +1109,8 @@ static void fd_rwsec_done1(int status)
...
@@ -1108,7 +1109,8 @@ static void fd_rwsec_done1(int status)
/* record not found, but not probing. Maybe stretch wrong ? Restart probing */
/* record not found, but not probing. Maybe stretch wrong ? Restart probing */
if
(
SUD
.
autoprobe
)
{
if
(
SUD
.
autoprobe
)
{
SUDT
=
disk_type
+
StartDiskType
[
DriveType
];
SUDT
=
disk_type
+
StartDiskType
[
DriveType
];
floppy_sizes
[
SelectedDrive
]
=
SUDT
->
blocks
>>
1
;
set_capacity
(
&
unit
[
SelectedDrive
].
disk
,
SUDT
->
blocks
);
Probing
=
1
;
Probing
=
1
;
}
}
}
}
...
@@ -1469,7 +1471,7 @@ static void redo_fd_request(void)
...
@@ -1469,7 +1471,7 @@ static void redo_fd_request(void)
if
(
!
UDT
)
{
if
(
!
UDT
)
{
Probing
=
1
;
Probing
=
1
;
UDT
=
disk_type
+
StartDiskType
[
DriveType
];
UDT
=
disk_type
+
StartDiskType
[
DriveType
];
floppy_sizes
[
drive
]
=
UDT
->
blocks
>>
1
;
set_capacity
(
&
unit
[
drive
].
disk
,
UDT
->
blocks
)
;
UD
.
autoprobe
=
1
;
UD
.
autoprobe
=
1
;
}
}
}
}
...
@@ -1487,7 +1489,7 @@ static void redo_fd_request(void)
...
@@ -1487,7 +1489,7 @@ static void redo_fd_request(void)
}
}
type
=
minor2disktype
[
type
].
index
;
type
=
minor2disktype
[
type
].
index
;
UDT
=
&
disk_type
[
type
];
UDT
=
&
disk_type
[
type
];
floppy_sizes
[
drive
]
=
UDT
->
blocks
>>
1
;
set_capacity
(
&
unit
[
drive
].
disk
,
UDT
->
blocks
)
;
UD
.
autoprobe
=
0
;
UD
.
autoprobe
=
0
;
}
}
...
@@ -1547,7 +1549,6 @@ static int fd_ioctl(struct inode *inode, struct file *filp,
...
@@ -1547,7 +1549,6 @@ static int fd_ioctl(struct inode *inode, struct file *filp,
drive
&=
3
;
drive
&=
3
;
switch
(
cmd
)
{
switch
(
cmd
)
{
case
FDGETPRM
:
case
FDGETPRM
:
case
BLKGETSIZE
:
if
(
type
)
{
if
(
type
)
{
if
(
--
type
>=
NUM_DISK_MINORS
)
if
(
--
type
>=
NUM_DISK_MINORS
)
return
-
ENODEV
;
return
-
ENODEV
;
...
@@ -1565,9 +1566,6 @@ static int fd_ioctl(struct inode *inode, struct file *filp,
...
@@ -1565,9 +1566,6 @@ static int fd_ioctl(struct inode *inode, struct file *filp,
else
else
dtp
=
UDT
;
dtp
=
UDT
;
}
}
if
(
cmd
==
BLKGETSIZE
)
return
put_user
(
dtp
->
blocks
,
(
unsigned
long
*
)
param
);
memset
((
void
*
)
&
getprm
,
0
,
sizeof
(
getprm
));
memset
((
void
*
)
&
getprm
,
0
,
sizeof
(
getprm
));
getprm
.
size
=
dtp
->
blocks
;
getprm
.
size
=
dtp
->
blocks
;
getprm
.
sect
=
dtp
->
spt
;
getprm
.
sect
=
dtp
->
spt
;
...
@@ -1638,7 +1636,7 @@ static int fd_ioctl(struct inode *inode, struct file *filp,
...
@@ -1638,7 +1636,7 @@ static int fd_ioctl(struct inode *inode, struct file *filp,
printk
(
KERN_INFO
"floppy%d: setting %s %p!
\n
"
,
printk
(
KERN_INFO
"floppy%d: setting %s %p!
\n
"
,
drive
,
dtp
->
name
,
dtp
);
drive
,
dtp
->
name
,
dtp
);
UDT
=
dtp
;
UDT
=
dtp
;
floppy_sizes
[
drive
]
=
UDT
->
blocks
>>
1
;
set_capacity
(
&
unit
[
drive
].
disk
,
UDT
->
blocks
)
;
if
(
cmd
==
FDDEFPRM
)
{
if
(
cmd
==
FDDEFPRM
)
{
/* save settings as permanent default type */
/* save settings as permanent default type */
...
@@ -1684,7 +1682,7 @@ static int fd_ioctl(struct inode *inode, struct file *filp,
...
@@ -1684,7 +1682,7 @@ static int fd_ioctl(struct inode *inode, struct file *filp,
}
}
UDT
=
dtp
;
UDT
=
dtp
;
floppy_sizes
[
drive
]
=
UDT
->
blocks
>>
1
;
set_capacity
(
&
unit
[
drive
].
disk
,
UDT
->
blocks
)
;
return
0
;
return
0
;
case
FDMSGON
:
case
FDMSGON
:
...
@@ -1707,7 +1705,7 @@ static int fd_ioctl(struct inode *inode, struct file *filp,
...
@@ -1707,7 +1705,7 @@ static int fd_ioctl(struct inode *inode, struct file *filp,
UDT
=
NULL
;
UDT
=
NULL
;
/* MSch: invalidate default_params */
/* MSch: invalidate default_params */
default_params
[
drive
].
blocks
=
0
;
default_params
[
drive
].
blocks
=
0
;
floppy_sizes
[
drive
]
=
MAX_DISK_SIZE
;
set_capacity
(
&
unit
[
drive
].
disk
,
MAX_DISK_SIZE
*
2
)
;
case
FDFMTEND
:
case
FDFMTEND
:
case
FDFLUSH
:
case
FDFLUSH
:
/* invalidate the buffer track to force a reread */
/* invalidate the buffer track to force a reread */
...
@@ -1861,11 +1859,6 @@ static int floppy_open( struct inode *inode, struct file *filp )
...
@@ -1861,11 +1859,6 @@ static int floppy_open( struct inode *inode, struct file *filp )
int
drive
,
type
;
int
drive
,
type
;
int
old_dev
;
int
old_dev
;
if
(
!
filp
)
{
DPRINT
((
"Weird, open called with filp=0
\n
"
));
return
-
EIO
;
}
drive
=
minor
(
inode
->
i_rdev
)
&
3
;
drive
=
minor
(
inode
->
i_rdev
)
&
3
;
type
=
minor
(
inode
->
i_rdev
)
>>
2
;
type
=
minor
(
inode
->
i_rdev
)
>>
2
;
DPRINT
((
"fd_open: type=%d
\n
"
,
type
));
DPRINT
((
"fd_open: type=%d
\n
"
,
type
));
...
@@ -1930,6 +1923,15 @@ static struct block_device_operations floppy_fops = {
...
@@ -1930,6 +1923,15 @@ static struct block_device_operations floppy_fops = {
revalidate:
floppy_revalidate
,
revalidate:
floppy_revalidate
,
};
};
static
struct
gendisk
*
floppy_find
(
int
minor
)
{
int
drive
=
minor
&
3
;
int
type
=
minor
>>
2
;
if
(
drive
>=
FD_MAX_UNITS
||
type
>
NUM_DISK_MINORS
)
return
NULL
;
return
&
unit
[
drive
].
disk
;
}
int
__init
atari_floppy_init
(
void
)
int
__init
atari_floppy_init
(
void
)
{
{
int
i
;
int
i
;
...
@@ -1972,17 +1974,17 @@ int __init atari_floppy_init (void)
...
@@ -1972,17 +1974,17 @@ int __init atari_floppy_init (void)
for
(
i
=
0
;
i
<
FD_MAX_UNITS
;
i
++
)
{
for
(
i
=
0
;
i
<
FD_MAX_UNITS
;
i
++
)
{
unit
[
i
].
track
=
-
1
;
unit
[
i
].
track
=
-
1
;
unit
[
i
].
flags
=
0
;
unit
[
i
].
flags
=
0
;
unit
[
i
].
disk
.
major
=
MAJOR_NR
;
unit
[
i
].
disk
.
first_minor
=
i
;
sprintf
(
unit
[
i
].
name
,
"fd%d"
,
i
);
unit
[
i
].
disk
.
major_name
=
names
[
drive
];
unit
[
i
].
disk
.
fops
=
&
floppy_fops
;
set_capacity
(
&
unit
[
i
].
disk
,
MAX_DISK_SIZE
*
2
);
add_disk
(
&
unit
[
i
].
disk
);
}
}
for
(
i
=
0
;
i
<
256
;
i
++
)
if
((
i
>>
2
)
>
0
&&
(
i
>>
2
)
<=
NUM_DISK_MINORS
)
{
int
type
=
minor2disktype
[(
i
>>
2
)
-
1
].
index
;
floppy_sizes
[
i
]
=
disk_type
[
type
].
blocks
>>
1
;
}
else
floppy_sizes
[
i
]
=
MAX_DISK_SIZE
;
blk_size
[
MAJOR_NR
]
=
floppy_sizes
;
blk_init_queue
(
BLK_DEFAULT_QUEUE
(
MAJOR_NR
),
do_fd_request
,
&
ataflop_lock
);
blk_init_queue
(
BLK_DEFAULT_QUEUE
(
MAJOR_NR
),
do_fd_request
,
&
ataflop_lock
);
blk_set_probe
(
MAJOR_NR
,
floppy_find
);
printk
(
KERN_INFO
"Atari floppy driver: max. %cD, %strack buffering
\n
"
,
printk
(
KERN_INFO
"Atari floppy driver: max. %cD, %strack buffering
\n
"
,
DriveType
==
0
?
'D'
:
DriveType
==
1
?
'H'
:
'E'
,
DriveType
==
0
?
'D'
:
DriveType
==
1
?
'H'
:
'E'
,
...
@@ -2034,7 +2036,11 @@ int init_module (void)
...
@@ -2034,7 +2036,11 @@ int init_module (void)
void
cleanup_module
(
void
)
void
cleanup_module
(
void
)
{
{
int
i
;
for
(
i
=
0
;
i
<
FD_MAX_UNITS
;
i
++
)
del_gendisk
(
&
unit
[
i
].
disk
);
unregister_blkdev
(
MAJOR_NR
,
"fd"
);
unregister_blkdev
(
MAJOR_NR
,
"fd"
);
blk_set_probe
(
MAJOR_NR
,
NULL
);
blk_cleanup_queue
(
BLK_DEFAULT_QUEUE
(
MAJOR_NR
));
blk_cleanup_queue
(
BLK_DEFAULT_QUEUE
(
MAJOR_NR
));
del_timer_sync
(
&
fd_timer
);
del_timer_sync
(
&
fd_timer
);
...
...
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