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
b7264cd3
Commit
b7264cd3
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 amiflop
amiflop.c switched to use of gendisks
parent
8e273c4e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
20 deletions
+33
-20
drivers/block/amiflop.c
drivers/block/amiflop.c
+32
-20
include/linux/amifd.h
include/linux/amifd.h
+1
-0
No files found.
drivers/block/amiflop.c
View file @
b7264cd3
...
@@ -142,10 +142,6 @@ static struct fd_drive_type drive_types[] = {
...
@@ -142,10 +142,6 @@ static struct fd_drive_type drive_types[] = {
};
};
static
int
num_dr_types
=
sizeof
(
drive_types
)
/
sizeof
(
drive_types
[
0
]);
static
int
num_dr_types
=
sizeof
(
drive_types
)
/
sizeof
(
drive_types
[
0
]);
/* defaults for 3 1/2" HD-Disks */
static
int
floppy_sizes
[
256
]
=
{
880
,
880
,
880
,
880
,
720
,
720
,
720
,
720
,};
/* hardsector size assumed to be 512 */
static
int
amiga_read
(
int
),
dos_read
(
int
);
static
int
amiga_read
(
int
),
dos_read
(
int
);
static
void
amiga_write
(
int
),
dos_write
(
int
);
static
void
amiga_write
(
int
),
dos_write
(
int
);
static
struct
fd_data_type
data_types
[]
=
{
static
struct
fd_data_type
data_types
[]
=
{
...
@@ -155,6 +151,7 @@ static struct fd_data_type data_types[] = {
...
@@ -155,6 +151,7 @@ static struct fd_data_type data_types[] = {
/* current info on each unit */
/* current info on each unit */
static
struct
amiga_floppy_struct
unit
[
FD_MAX_UNITS
];
static
struct
amiga_floppy_struct
unit
[
FD_MAX_UNITS
];
static
char
names
[
FD_MAX_UNITS
][
4
];
static
struct
timer_list
flush_track_timer
[
FD_MAX_UNITS
];
static
struct
timer_list
flush_track_timer
[
FD_MAX_UNITS
];
static
struct
timer_list
post_write_timer
;
static
struct
timer_list
post_write_timer
;
...
@@ -1539,12 +1536,6 @@ static int fd_ioctl(struct inode *inode, struct file *filp,
...
@@ -1539,12 +1536,6 @@ static int fd_ioctl(struct inode *inode, struct file *filp,
sizeof
(
struct
floppy_struct
)))
sizeof
(
struct
floppy_struct
)))
return
-
EFAULT
;
return
-
EFAULT
;
break
;
break
;
case
BLKGETSIZE
:
return
put_user
(
unit
[
drive
].
blocks
,(
unsigned
long
*
)
param
);
break
;
case
BLKGETSIZE64
:
return
put_user
((
u64
)
unit
[
drive
].
blocks
<<
9
,
(
u64
*
)
param
);
break
;
case
FDSETPRM
:
case
FDSETPRM
:
case
FDDEFPRM
:
case
FDDEFPRM
:
return
-
EINVAL
;
return
-
EINVAL
;
...
@@ -1653,7 +1644,7 @@ static int floppy_open(struct inode *inode, struct file *filp)
...
@@ -1653,7 +1644,7 @@ static int floppy_open(struct inode *inode, struct file *filp)
unit
[
drive
].
dtype
=&
data_types
[
system
];
unit
[
drive
].
dtype
=&
data_types
[
system
];
unit
[
drive
].
blocks
=
unit
[
drive
].
type
->
heads
*
unit
[
drive
].
type
->
tracks
*
unit
[
drive
].
blocks
=
unit
[
drive
].
type
->
heads
*
unit
[
drive
].
type
->
tracks
*
data_types
[
system
].
sects
*
unit
[
drive
].
type
->
sect_mult
;
data_types
[
system
].
sects
*
unit
[
drive
].
type
->
sect_mult
;
floppy_sizes
[
minor
(
inode
->
i_rdev
)]
=
unit
[
drive
].
blocks
>>
1
;
set_capacity
(
&
unit
[
drive
].
disk
,
unit
[
drive
].
blocks
)
;
printk
(
KERN_INFO
"fd%d: accessing %s-disk with %s-layout
\n
"
,
drive
,
printk
(
KERN_INFO
"fd%d: accessing %s-disk with %s-layout
\n
"
,
drive
,
unit
[
drive
].
type
->
name
,
data_types
[
system
].
name
);
unit
[
drive
].
type
->
name
,
data_types
[
system
].
name
);
...
@@ -1720,11 +1711,11 @@ static int amiga_floppy_change(kdev_t dev)
...
@@ -1720,11 +1711,11 @@ static int amiga_floppy_change(kdev_t dev)
}
}
static
struct
block_device_operations
floppy_fops
=
{
static
struct
block_device_operations
floppy_fops
=
{
owner:
THIS_MODULE
,
.
owner
=
THIS_MODULE
,
open:
floppy_open
,
.
open
=
floppy_open
,
release:
floppy_release
,
.
release
=
floppy_release
,
ioctl:
fd_ioctl
,
.
ioctl
=
fd_ioctl
,
check_media_change:
amiga_floppy_change
,
.
check_media_change
=
amiga_floppy_change
,
};
};
void
__init
amiga_floppy_setup
(
char
*
str
,
int
*
ints
)
void
__init
amiga_floppy_setup
(
char
*
str
,
int
*
ints
)
...
@@ -1743,6 +1734,7 @@ static int __init fd_probe_drives(void)
...
@@ -1743,6 +1734,7 @@ static int __init fd_probe_drives(void)
for
(
drive
=
0
;
drive
<
FD_MAX_UNITS
;
drive
++
)
{
for
(
drive
=
0
;
drive
<
FD_MAX_UNITS
;
drive
++
)
{
fd_probe
(
drive
);
fd_probe
(
drive
);
if
(
unit
[
drive
].
type
->
code
!=
FD_NODRIVE
)
{
if
(
unit
[
drive
].
type
->
code
!=
FD_NODRIVE
)
{
struct
gendisk
*
disk
=
&
unit
[
drive
].
disk
;
drives
++
;
drives
++
;
if
((
unit
[
drive
].
trackbuf
=
kmalloc
(
FLOPPY_MAX_SECTORS
*
512
,
GFP_KERNEL
))
==
NULL
)
{
if
((
unit
[
drive
].
trackbuf
=
kmalloc
(
FLOPPY_MAX_SECTORS
*
512
,
GFP_KERNEL
))
==
NULL
)
{
printk
(
"no mem for "
);
printk
(
"no mem for "
);
...
@@ -1751,6 +1743,14 @@ static int __init fd_probe_drives(void)
...
@@ -1751,6 +1743,14 @@ static int __init fd_probe_drives(void)
nomem
=
1
;
nomem
=
1
;
}
}
printk
(
"fd%d "
,
drive
);
printk
(
"fd%d "
,
drive
);
disk
->
major
=
MAJOR_NR
;
disk
->
first_minor
=
drive
;
disk
->
minor_shift
=
0
;
disk
->
fops
=
&
floppy_fops
;
sprintf
(
names
[
drive
],
"fd%d"
);
disk
->
name
=
names
[
drive
];
set_capacity
(
disk
,
880
*
2
);
add_disk
(
disk
);
}
}
}
}
if
((
drives
>
0
)
||
(
nomem
==
0
))
{
if
((
drives
>
0
)
||
(
nomem
==
0
))
{
...
@@ -1762,6 +1762,14 @@ static int __init fd_probe_drives(void)
...
@@ -1762,6 +1762,14 @@ static int __init fd_probe_drives(void)
printk
(
"
\n
"
);
printk
(
"
\n
"
);
return
-
ENOMEM
;
return
-
ENOMEM
;
}
}
static
struct
gendisk
*
floppy_find
(
int
minor
)
{
int
drive
=
minor
&
3
;
if
(
unit
[
drive
].
type
->
code
==
FD_NODRIVE
)
return
NULL
;
return
&
unit
[
drive
].
disk
;
}
int
__init
amiga_floppy_init
(
void
)
int
__init
amiga_floppy_init
(
void
)
{
{
...
@@ -1805,7 +1813,9 @@ int __init amiga_floppy_init(void)
...
@@ -1805,7 +1813,9 @@ int __init amiga_floppy_init(void)
unregister_blkdev
(
MAJOR_NR
,
"fd"
);
unregister_blkdev
(
MAJOR_NR
,
"fd"
);
return
-
EBUSY
;
return
-
EBUSY
;
}
}
blk_set_probe
(
MAJOR_NR
,
floppy_find
);
if
(
fd_probe_drives
()
<
1
)
{
/* No usable drives */
if
(
fd_probe_drives
()
<
1
)
{
/* No usable drives */
blk_set_probe
(
MAJOR_NR
,
NULL
);
free_irq
(
IRQ_AMIGA_CIAA_TB
,
NULL
);
free_irq
(
IRQ_AMIGA_CIAA_TB
,
NULL
);
free_irq
(
IRQ_AMIGA_DSKBLK
,
NULL
);
free_irq
(
IRQ_AMIGA_DSKBLK
,
NULL
);
amiga_chip_free
(
raw_buf
);
amiga_chip_free
(
raw_buf
);
...
@@ -1838,8 +1848,6 @@ int __init amiga_floppy_init(void)
...
@@ -1838,8 +1848,6 @@ int __init amiga_floppy_init(void)
post_write_timer
.
function
=
post_write
;
post_write_timer
.
function
=
post_write
;
blk_init_queue
(
BLK_DEFAULT_QUEUE
(
MAJOR_NR
),
do_fd_request
,
&
amiflop_lock
);
blk_init_queue
(
BLK_DEFAULT_QUEUE
(
MAJOR_NR
),
do_fd_request
,
&
amiflop_lock
);
blk_size
[
MAJOR_NR
]
=
floppy_sizes
;
for
(
i
=
0
;
i
<
128
;
i
++
)
for
(
i
=
0
;
i
<
128
;
i
++
)
mfmdecode
[
i
]
=
255
;
mfmdecode
[
i
]
=
255
;
for
(
i
=
0
;
i
<
16
;
i
++
)
for
(
i
=
0
;
i
<
16
;
i
++
)
...
@@ -1867,9 +1875,13 @@ void cleanup_module(void)
...
@@ -1867,9 +1875,13 @@ void cleanup_module(void)
{
{
int
i
;
int
i
;
for
(
i
=
0
;
i
<
FD_MAX_UNITS
;
i
++
)
for
(
i
=
0
;
i
<
FD_MAX_UNITS
;
i
++
)
{
if
(
unit
[
i
].
type
->
code
!=
FD_NODRIVE
)
if
(
unit
[
i
].
type
->
code
!=
FD_NODRIVE
)
{
del_gendisk
(
&
unit
[
i
].
disk
);
kfree
(
unit
[
i
].
trackbuf
);
kfree
(
unit
[
i
].
trackbuf
);
}
}
blk_set_probe
(
MAJOR_NR
,
NULL
);
free_irq
(
IRQ_AMIGA_CIAA_TB
,
NULL
);
free_irq
(
IRQ_AMIGA_CIAA_TB
,
NULL
);
free_irq
(
IRQ_AMIGA_DSKBLK
,
NULL
);
free_irq
(
IRQ_AMIGA_DSKBLK
,
NULL
);
custom
.
dmacon
=
DMAF_DISK
;
/* disable DMA */
custom
.
dmacon
=
DMAF_DISK
;
/* disable DMA */
...
...
include/linux/amifd.h
View file @
b7264cd3
...
@@ -55,6 +55,7 @@ struct amiga_floppy_struct {
...
@@ -55,6 +55,7 @@ struct amiga_floppy_struct {
int
busy
;
/* true when drive is active */
int
busy
;
/* true when drive is active */
int
dirty
;
/* true when trackbuf is not on disk */
int
dirty
;
/* true when trackbuf is not on disk */
int
status
;
/* current error code for unit */
int
status
;
/* current error code for unit */
struct
gendisk
disk
;
};
};
#endif
#endif
...
...
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