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
455053c6
Commit
455053c6
authored
Oct 05, 2002
by
Alexander Viro
Committed by
Linus Torvalds
Oct 05, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] paride floppy switched to alloc_disk()
parent
f68a4824
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
16 deletions
+19
-16
drivers/block/paride/pf.c
drivers/block/paride/pf.c
+19
-16
No files found.
drivers/block/paride/pf.c
View file @
455053c6
...
@@ -264,7 +264,7 @@ struct pf_unit {
...
@@ -264,7 +264,7 @@ struct pf_unit {
int
access
;
/* count of active opens ... */
int
access
;
/* count of active opens ... */
int
present
;
/* device present ? */
int
present
;
/* device present ? */
char
name
[
PF_NAMELEN
];
/* pf0, pf1, ... */
char
name
[
PF_NAMELEN
];
/* pf0, pf1, ... */
struct
gendisk
disk
;
struct
gendisk
*
disk
;
};
};
struct
pf_unit
units
[
PF_UNITS
];
struct
pf_unit
units
[
PF_UNITS
];
...
@@ -308,7 +308,10 @@ void pf_init_units(void)
...
@@ -308,7 +308,10 @@ void pf_init_units(void)
pf_drive_count
=
0
;
pf_drive_count
=
0
;
for
(
unit
=
0
,
pf
=
units
;
unit
<
PF_UNITS
;
unit
++
,
pf
++
)
{
for
(
unit
=
0
,
pf
=
units
;
unit
<
PF_UNITS
;
unit
++
,
pf
++
)
{
struct
gendisk
*
disk
=
&
pf
->
disk
;
struct
gendisk
*
disk
=
alloc_disk
();
if
(
!
disk
)
continue
;
pf
->
disk
=
disk
;
pf
->
pi
=
&
pf
->
pia
;
pf
->
pi
=
&
pf
->
pia
;
pf
->
media_status
=
PF_NM
;
pf
->
media_status
=
PF_NM
;
pf
->
drive
=
(
*
drives
[
unit
])[
D_SLV
];
pf
->
drive
=
(
*
drives
[
unit
])[
D_SLV
];
...
@@ -355,11 +358,6 @@ static int pf_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
...
@@ -355,11 +358,6 @@ static int pf_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
struct
pf_unit
*
pf
=
units
+
unit
;
struct
pf_unit
*
pf
=
units
+
unit
;
sector_t
capacity
;
sector_t
capacity
;
if
(
unit
>=
PF_UNITS
)
return
-
EINVAL
;
if
(
!
pf
->
present
)
return
-
ENODEV
;
if
(
cmd
==
CDROMEJECT
)
{
if
(
cmd
==
CDROMEJECT
)
{
if
(
pf
->
access
==
1
)
{
if
(
pf
->
access
==
1
)
{
pf_eject
(
pf
);
pf_eject
(
pf
);
...
@@ -369,7 +367,7 @@ static int pf_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
...
@@ -369,7 +367,7 @@ static int pf_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
}
}
if
(
cmd
!=
HDIO_GETGEO
)
if
(
cmd
!=
HDIO_GETGEO
)
return
-
EINVAL
;
return
-
EINVAL
;
capacity
=
get_capacity
(
&
pf
->
disk
);
capacity
=
get_capacity
(
pf
->
disk
);
if
(
capacity
<
PF_FD_MAX
)
{
if
(
capacity
<
PF_FD_MAX
)
{
g
.
cylinders
=
capacity
/
(
PF_FD_HDS
*
PF_FD_SPT
);
g
.
cylinders
=
capacity
/
(
PF_FD_HDS
*
PF_FD_SPT
);
g
.
heads
=
PF_FD_HDS
;
g
.
heads
=
PF_FD_HDS
;
...
@@ -635,10 +633,10 @@ static void pf_get_capacity(struct pf_unit *pf)
...
@@ -635,10 +633,10 @@ static void pf_get_capacity(struct pf_unit *pf)
pf
->
media_status
=
PF_NM
;
pf
->
media_status
=
PF_NM
;
return
;
return
;
}
}
set_capacity
(
&
pf
->
disk
,
xl
(
buf
,
0
)
+
1
);
set_capacity
(
pf
->
disk
,
xl
(
buf
,
0
)
+
1
);
bs
=
xl
(
buf
,
4
);
bs
=
xl
(
buf
,
4
);
if
(
bs
!=
512
)
{
if
(
bs
!=
512
)
{
set_capacity
(
&
pf
->
disk
,
0
);
set_capacity
(
pf
->
disk
,
0
);
if
(
verbose
)
if
(
verbose
)
printk
(
"%s: Drive %d, LUN %d,"
printk
(
"%s: Drive %d, LUN %d,"
" unsupported block size %d
\n
"
,
" unsupported block size %d
\n
"
,
...
@@ -687,7 +685,7 @@ static int pf_identify(struct pf_unit *pf)
...
@@ -687,7 +685,7 @@ static int pf_identify(struct pf_unit *pf)
else
{
else
{
if
(
pf
->
media_status
==
PF_RO
)
if
(
pf
->
media_status
==
PF_RO
)
printk
(
", RO"
);
printk
(
", RO"
);
printk
(
", %ld blocks
\n
"
,
get_capacity
(
&
pf
->
disk
));
printk
(
", %ld blocks
\n
"
,
get_capacity
(
pf
->
disk
));
}
}
return
0
;
return
0
;
}
}
...
@@ -731,7 +729,7 @@ static int pf_detect(void)
...
@@ -731,7 +729,7 @@ static int pf_detect(void)
if
(
pf_drive_count
==
0
)
{
if
(
pf_drive_count
==
0
)
{
if
(
pi_init
(
pf
->
pi
,
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
pf_scratch
,
PI_PF
,
if
(
pi_init
(
pf
->
pi
,
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
pf_scratch
,
PI_PF
,
verbose
,
pf
->
name
))
{
verbose
,
pf
->
name
))
{
if
(
!
pf_probe
(
pf
))
{
if
(
!
pf_probe
(
pf
)
&&
pf
->
disk
)
{
pf
->
present
=
1
;
pf
->
present
=
1
;
k
++
;
k
++
;
}
else
}
else
...
@@ -746,7 +744,7 @@ static int pf_detect(void)
...
@@ -746,7 +744,7 @@ static int pf_detect(void)
if
(
pi_init
(
pf
->
pi
,
0
,
conf
[
D_PRT
],
conf
[
D_MOD
],
if
(
pi_init
(
pf
->
pi
,
0
,
conf
[
D_PRT
],
conf
[
D_MOD
],
conf
[
D_UNI
],
conf
[
D_PRO
],
conf
[
D_DLY
],
conf
[
D_UNI
],
conf
[
D_PRO
],
conf
[
D_DLY
],
pf_scratch
,
PI_PF
,
verbose
,
pf
->
name
))
{
pf_scratch
,
PI_PF
,
verbose
,
pf
->
name
))
{
if
(
!
pf_probe
(
pf
))
{
if
(
!
pf_probe
(
pf
)
&&
pf
->
disk
)
{
pf
->
present
=
1
;
pf
->
present
=
1
;
k
++
;
k
++
;
}
else
}
else
...
@@ -757,6 +755,8 @@ static int pf_detect(void)
...
@@ -757,6 +755,8 @@ static int pf_detect(void)
return
0
;
return
0
;
printk
(
"%s: No ATAPI disk detected
\n
"
,
name
);
printk
(
"%s: No ATAPI disk detected
\n
"
,
name
);
for
(
pf
=
units
,
unit
=
0
;
unit
<
PF_UNITS
;
pf
++
,
unit
++
)
put_disk
(
pf
->
disk
);
return
-
1
;
return
-
1
;
}
}
...
@@ -805,7 +805,7 @@ static void do_pf_request(request_queue_t * q)
...
@@ -805,7 +805,7 @@ static void do_pf_request(request_queue_t * q)
pf_count
=
pf_req
->
current_nr_sectors
;
pf_count
=
pf_req
->
current_nr_sectors
;
if
((
unit
>=
PF_UNITS
)
||
if
((
unit
>=
PF_UNITS
)
||
(
pf_block
+
pf_count
>
get_capacity
(
&
pf_current
->
disk
)))
{
(
pf_block
+
pf_count
>
get_capacity
(
pf_current
->
disk
)))
{
end_request
(
pf_req
,
0
);
end_request
(
pf_req
,
0
);
goto
repeat
;
goto
repeat
;
}
}
...
@@ -976,6 +976,8 @@ static int __init pf_init(void)
...
@@ -976,6 +976,8 @@ static int __init pf_init(void)
if
(
register_blkdev
(
MAJOR_NR
,
name
,
&
pf_fops
))
{
if
(
register_blkdev
(
MAJOR_NR
,
name
,
&
pf_fops
))
{
printk
(
"pf_init: unable to get major number %d
\n
"
,
major
);
printk
(
"pf_init: unable to get major number %d
\n
"
,
major
);
for
(
pf
=
units
,
unit
=
0
;
unit
<
PF_UNITS
;
pf
++
,
unit
++
)
put_disk
(
pf
->
disk
);
return
-
1
;
return
-
1
;
}
}
q
=
BLK_DEFAULT_QUEUE
(
MAJOR_NR
);
q
=
BLK_DEFAULT_QUEUE
(
MAJOR_NR
);
...
@@ -984,7 +986,7 @@ static int __init pf_init(void)
...
@@ -984,7 +986,7 @@ static int __init pf_init(void)
blk_queue_max_hw_segments
(
q
,
cluster
);
blk_queue_max_hw_segments
(
q
,
cluster
);
for
(
pf
=
units
,
unit
=
0
;
unit
<
PF_UNITS
;
pf
++
,
unit
++
)
{
for
(
pf
=
units
,
unit
=
0
;
unit
<
PF_UNITS
;
pf
++
,
unit
++
)
{
struct
gendisk
*
disk
=
&
pf
->
disk
;
struct
gendisk
*
disk
=
pf
->
disk
;
if
(
!
pf
->
present
)
if
(
!
pf
->
present
)
continue
;
continue
;
add_disk
(
disk
);
add_disk
(
disk
);
...
@@ -1000,7 +1002,8 @@ static void __exit pf_exit(void)
...
@@ -1000,7 +1002,8 @@ static void __exit pf_exit(void)
for
(
pf
=
units
,
unit
=
0
;
unit
<
PF_UNITS
;
pf
++
,
unit
++
)
{
for
(
pf
=
units
,
unit
=
0
;
unit
<
PF_UNITS
;
pf
++
,
unit
++
)
{
if
(
!
pf
->
present
)
if
(
!
pf
->
present
)
continue
;
continue
;
del_gendisk
(
&
pf
->
disk
);
del_gendisk
(
pf
->
disk
);
put_disk
(
pf
->
disk
);
pi_release
(
pf
->
pi
);
pi_release
(
pf
->
pi
);
}
}
}
}
...
...
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