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
db5ea6e9
Commit
db5ea6e9
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 acorn floppy
acorn floppy switched to use of gendisk
parent
5594d5a3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
22 deletions
+26
-22
drivers/acorn/block/fd1772.c
drivers/acorn/block/fd1772.c
+26
-22
No files found.
drivers/acorn/block/fd1772.c
View file @
db5ea6e9
...
@@ -203,7 +203,8 @@ static struct archy_disk_type {
...
@@ -203,7 +203,8 @@ static struct archy_disk_type {
*/
*/
#define MAX_DISK_SIZE 720
#define MAX_DISK_SIZE 720
static
int
floppy_sizes
[
256
];
static
struct
gendisk
disks
[
FD_MAX_UNIT
];
static
char
names
[
FD_MAX_UNIT
][
4
];
/* current info on each unit */
/* current info on each unit */
static
struct
archy_floppy_struct
{
static
struct
archy_floppy_struct
{
...
@@ -962,16 +963,16 @@ static void fd_rwsec_done(int status)
...
@@ -962,16 +963,16 @@ static void fd_rwsec_done(int status)
if
(
unit
[
SelectedDrive
].
disktype
>
disk_type
)
{
if
(
unit
[
SelectedDrive
].
disktype
>
disk_type
)
{
/* try another disk type */
/* try another disk type */
unit
[
SelectedDrive
].
disktype
--
;
unit
[
SelectedDrive
].
disktype
--
;
floppy_sizes
[
SelectedDrive
]
set_capacity
(
&
disks
[
SelectedDrive
],
=
unit
[
SelectedDrive
].
disktype
->
blocks
>>
1
;
unit
[
SelectedDrive
].
disktype
->
blocks
)
;
}
else
}
else
Probing
=
0
;
Probing
=
0
;
}
else
{
}
else
{
/* record not found, but not probing. Maybe stretch wrong ? Restart probing */
/* record not found, but not probing. Maybe stretch wrong ? Restart probing */
if
(
unit
[
SelectedDrive
].
autoprobe
)
{
if
(
unit
[
SelectedDrive
].
autoprobe
)
{
unit
[
SelectedDrive
].
disktype
=
disk_type
+
NUM_DISK_TYPES
-
1
;
unit
[
SelectedDrive
].
disktype
=
disk_type
+
NUM_DISK_TYPES
-
1
;
floppy_sizes
[
SelectedDrive
]
set_capacity
(
&
disks
[
SelectedDrive
],
=
unit
[
SelectedDrive
].
disktype
->
blocks
>>
1
;
unit
[
SelectedDrive
].
disktype
->
blocks
)
;
Probing
=
1
;
Probing
=
1
;
}
}
}
}
...
@@ -1243,7 +1244,7 @@ static void redo_fd_request(void)
...
@@ -1243,7 +1244,7 @@ static void redo_fd_request(void)
if
(
!
floppy
->
disktype
)
{
if
(
!
floppy
->
disktype
)
{
Probing
=
1
;
Probing
=
1
;
floppy
->
disktype
=
disk_type
+
NUM_DISK_TYPES
-
1
;
floppy
->
disktype
=
disk_type
+
NUM_DISK_TYPES
-
1
;
floppy_sizes
[
drive
]
=
floppy
->
disktype
->
blocks
>>
1
;
set_capacity
(
&
disks
[
drive
],
floppy
->
disktype
->
blocks
)
;
floppy
->
autoprobe
=
1
;
floppy
->
autoprobe
=
1
;
}
}
}
else
{
}
else
{
...
@@ -1255,7 +1256,7 @@ static void redo_fd_request(void)
...
@@ -1255,7 +1256,7 @@ static void redo_fd_request(void)
goto
repeat
;
goto
repeat
;
}
}
floppy
->
disktype
=
&
disk_type
[
type
];
floppy
->
disktype
=
&
disk_type
[
type
];
floppy_sizes
[
drive
]
=
disk_type
[
type
].
blocks
>>
1
;
set_capacity
(
&
disks
[
drive
],
floppy
->
disktype
->
blocks
)
;
floppy
->
autoprobe
=
0
;
floppy
->
autoprobe
=
0
;
}
}
...
@@ -1474,14 +1475,9 @@ static void config_types(void)
...
@@ -1474,14 +1475,9 @@ static void config_types(void)
static
int
floppy_open
(
struct
inode
*
inode
,
struct
file
*
filp
)
static
int
floppy_open
(
struct
inode
*
inode
,
struct
file
*
filp
)
{
{
int
drive
;
int
drive
=
minor
(
inode
->
i_rdev
)
&
3
;
int
old_dev
;
int
old_dev
;
if
(
!
filp
)
{
DPRINT
((
"Weird, open called with filp=0
\n
"
));
return
-
EIO
;
}
drive
=
minor
(
inode
->
i_rdev
)
&
3
;
if
((
minor
(
inode
->
i_rdev
)
>>
2
)
>
NUM_DISK_TYPES
)
if
((
minor
(
inode
->
i_rdev
)
>>
2
)
>
NUM_DISK_TYPES
)
return
-
ENXIO
;
return
-
ENXIO
;
...
@@ -1543,6 +1539,13 @@ static struct block_device_operations floppy_fops =
...
@@ -1543,6 +1539,13 @@ static struct block_device_operations floppy_fops =
.
revalidate
=
floppy_revalidate
,
.
revalidate
=
floppy_revalidate
,
};
};
static
struct
gendisk
*
floppy_find
(
int
minor
)
{
int
drive
=
minor
&
3
;
if
((
minor
>>
2
)
>
NUM_DISK_TYPES
||
minor
>=
FD_MAX_UNITS
)
return
NULL
;
return
&
disks
[
drive
];
}
int
fd1772_init
(
void
)
int
fd1772_init
(
void
)
{
{
...
@@ -1580,19 +1583,20 @@ int fd1772_init(void)
...
@@ -1580,19 +1583,20 @@ int fd1772_init(void)
out of some special memory... */
out of some special memory... */
DMABuffer
=
(
char
*
)
kmalloc
(
2048
);
/* Copes with pretty large sectors */
DMABuffer
=
(
char
*
)
kmalloc
(
2048
);
/* Copes with pretty large sectors */
#endif
#endif
blk_init_queue
(
BLK_DEFAULT_QUEUE
(
MAJOR_NR
),
do_fd_request
);
for
(
i
=
0
;
i
<
FD_MAX_UNITS
;
i
++
)
{
for
(
i
=
0
;
i
<
FD_MAX_UNITS
;
i
++
)
{
unit
[
i
].
track
=
-
1
;
unit
[
i
].
track
=
-
1
;
disks
[
i
].
major
=
MAJOR_NR
;
disks
[
i
].
first_minor
=
0
;
disks
[
i
].
fops
=
&
floppy_fops
;
sprintf
(
names
[
i
],
"fd%d"
,
i
);
disks
[
i
].
major_name
=
names
[
i
];
set_capacity
(
&
disks
[
i
],
MAX_DISK_SIZE
*
2
);
}
}
blk_set_probe
(
MAJOR_NR
,
floppy_find
);
for
(
i
=
0
;
i
<
256
;
i
++
)
for
(
i
=
0
;
i
<
FD_MAX_UNITS
;
i
++
)
if
((
i
>>
2
)
>
0
&&
(
i
>>
2
)
<=
NUM_DISK_TYPES
)
add_disk
(
disks
+
i
);
floppy_sizes
[
i
]
=
disk_type
[(
i
>>
2
)
-
1
].
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
);
config_types
();
config_types
();
...
...
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