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
c70f6d91
Commit
c70f6d91
authored
Jun 21, 2004
by
Christoph Hellwig
Committed by
James Bottomley
Jun 21, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] avoid obsolete APIs in sr
Signed-off-by:
James Bottomley
<
James.Bottomley@SteelEye.com
>
parent
86d7520d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
37 deletions
+48
-37
drivers/scsi/sr.c
drivers/scsi/sr.c
+13
-10
drivers/scsi/sr.h
drivers/scsi/sr.h
+4
-2
drivers/scsi/sr_ioctl.c
drivers/scsi/sr_ioctl.c
+20
-16
drivers/scsi/sr_vendor.c
drivers/scsi/sr_vendor.c
+11
-9
No files found.
drivers/scsi/sr.c
View file @
c70f6d91
...
...
@@ -46,11 +46,14 @@
#include <linux/blkdev.h>
#include <asm/uaccess.h>
#include
"scsi.h"
#include <scsi/scsi_
host
.h>
#include
<scsi/scsi.h>
#include <scsi/scsi_
dbg
.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_driver.h>
#include <scsi/scsi_eh.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_ioctl.h>
/* For the door lock/unlock commands */
#include <scsi/scsi_request.h>
#include "scsi_logging.h"
#include "sr.h"
...
...
@@ -282,7 +285,7 @@ static void rw_intr(struct scsi_cmnd * SCpnt)
* user, but make sure that it's not treated as a
* hard error.
*/
print_sense
(
"sr"
,
SCpnt
);
scsi_
print_sense
(
"sr"
,
SCpnt
);
SCpnt
->
result
=
0
;
SCpnt
->
sense_buffer
[
0
]
=
0x0
;
good_bytes
=
this_count
;
...
...
@@ -335,11 +338,11 @@ static int sr_init_command(struct scsi_cmnd * SCpnt)
memcpy
(
SCpnt
->
cmnd
,
rq
->
cmd
,
sizeof
(
SCpnt
->
cmnd
));
if
(
!
rq
->
data_len
)
SCpnt
->
sc_data_direction
=
SCSI_DAT
A_NONE
;
SCpnt
->
sc_data_direction
=
DM
A_NONE
;
else
if
(
rq_data_dir
(
rq
)
==
WRITE
)
SCpnt
->
sc_data_direction
=
SCSI_DATA_WRIT
E
;
SCpnt
->
sc_data_direction
=
DMA_TO_DEVIC
E
;
else
SCpnt
->
sc_data_direction
=
SCSI_DATA_READ
;
SCpnt
->
sc_data_direction
=
DMA_FROM_DEVICE
;
this_count
=
rq
->
data_len
;
if
(
rq
->
timeout
)
...
...
@@ -375,10 +378,10 @@ static int sr_init_command(struct scsi_cmnd * SCpnt)
if
(
!
cd
->
device
->
writeable
)
return
0
;
SCpnt
->
cmnd
[
0
]
=
WRITE_10
;
SCpnt
->
sc_data_direction
=
SCSI_DATA_WRIT
E
;
SCpnt
->
sc_data_direction
=
DMA_TO_DEVIC
E
;
}
else
if
(
rq_data_dir
(
SCpnt
->
request
)
==
READ
)
{
SCpnt
->
cmnd
[
0
]
=
READ_10
;
SCpnt
->
sc_data_direction
=
SCSI_DATA_READ
;
SCpnt
->
sc_data_direction
=
DMA_FROM_DEVICE
;
}
else
{
blk_dump_rq_flags
(
SCpnt
->
request
,
"Unknown sr command"
);
return
0
;
...
...
@@ -674,7 +677,7 @@ static void get_sectorsize(struct scsi_cd *cd)
memset
(
buffer
,
0
,
8
);
/* Do the command and wait.. */
SRpnt
->
sr_data_direction
=
SCSI_DATA_READ
;
SRpnt
->
sr_data_direction
=
DMA_FROM_DEVICE
;
scsi_wait_req
(
SRpnt
,
(
void
*
)
cmd
,
(
void
*
)
buffer
,
8
,
SR_TIMEOUT
,
MAX_RETRIES
);
...
...
drivers/scsi/sr.h
View file @
c70f6d91
...
...
@@ -17,18 +17,20 @@
#ifndef _SR_H
#define _SR_H
#include "scsi.h"
#include <linux/genhd.h>
#include <linux/kref.h>
struct
scsi_device
;
/* The CDROM is fairly slow, so we need a little extra time */
/* In fact, it is very slow if it has to spin up first */
#define IOCTL_TIMEOUT 30*HZ
typedef
struct
scsi_cd
{
struct
scsi_driver
*
driver
;
unsigned
capacity
;
/* size in blocks */
Scsi_D
evice
*
device
;
struct
scsi_d
evice
*
device
;
unsigned
int
vendor
;
/* vendor code, see sr_vendor.c */
unsigned
long
ms_offset
;
/* for reading multisession-CD's */
unsigned
needs_sector_size
:
1
;
/* needs to get sector size */
...
...
drivers/scsi/sr_ioctl.c
View file @
c70f6d91
...
...
@@ -10,9 +10,13 @@
#include <asm/io.h>
#include <asm/uaccess.h>
#include "scsi.h"
#include <scsi/scsi.h>
#include <scsi/scsi_dbg.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_eh.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_ioctl.h>
#include <scsi/scsi_request.h>
#include "sr.h"
...
...
@@ -65,7 +69,7 @@ static int sr_fake_playtrkind(struct cdrom_device_info *cdi, struct cdrom_ti *ti
cgc
.
cmd
[
6
]
=
trk1_te
.
cdte_addr
.
msf
.
minute
;
cgc
.
cmd
[
7
]
=
trk1_te
.
cdte_addr
.
msf
.
second
;
cgc
.
cmd
[
8
]
=
trk1_te
.
cdte_addr
.
msf
.
frame
;
cgc
.
data_direction
=
SCSI_DAT
A_NONE
;
cgc
.
data_direction
=
DM
A_NONE
;
cgc
.
timeout
=
IOCTL_TIMEOUT
;
return
sr_do_ioctl
(
cdi
->
handle
,
&
cgc
);
}
...
...
@@ -138,7 +142,7 @@ int sr_do_ioctl(Scsi_CD *cd, struct packet_command *cgc)
if
(
!
cgc
->
quiet
)
printk
(
KERN_INFO
"%s: CDROM not ready. Make sure there is a disc in the drive.
\n
"
,
cd
->
cdi
.
name
);
#ifdef DEBUG
print_req_sense
(
"sr"
,
SRpnt
);
scsi_
print_req_sense
(
"sr"
,
SRpnt
);
#endif
err
=
-
ENOMEDIUM
;
break
;
...
...
@@ -149,14 +153,14 @@ int sr_do_ioctl(Scsi_CD *cd, struct packet_command *cgc)
/* sense: Invalid command operation code */
err
=
-
EDRIVE_CANT_DO_THIS
;
#ifdef DEBUG
print_command
(
cgc
->
cmd
);
print_req_sense
(
"sr"
,
SRpnt
);
__scsi_
print_command
(
cgc
->
cmd
);
scsi_
print_req_sense
(
"sr"
,
SRpnt
);
#endif
break
;
default:
printk
(
KERN_ERR
"%s: CDROM (ioctl) error, command: "
,
cd
->
cdi
.
name
);
print_command
(
cgc
->
cmd
);
print_req_sense
(
"sr"
,
SRpnt
);
__scsi_
print_command
(
cgc
->
cmd
);
scsi_
print_req_sense
(
"sr"
,
SRpnt
);
err
=
-
EIO
;
}
}
...
...
@@ -183,7 +187,7 @@ static int test_unit_ready(Scsi_CD *cd)
memset
(
&
cgc
,
0
,
sizeof
(
struct
packet_command
));
cgc
.
cmd
[
0
]
=
GPCMD_TEST_UNIT_READY
;
cgc
.
quiet
=
1
;
cgc
.
data_direction
=
SCSI_DAT
A_NONE
;
cgc
.
data_direction
=
DM
A_NONE
;
cgc
.
timeout
=
IOCTL_TIMEOUT
;
return
sr_do_ioctl
(
cd
,
&
cgc
);
}
...
...
@@ -196,7 +200,7 @@ int sr_tray_move(struct cdrom_device_info *cdi, int pos)
memset
(
&
cgc
,
0
,
sizeof
(
struct
packet_command
));
cgc
.
cmd
[
0
]
=
GPCMD_START_STOP_UNIT
;
cgc
.
cmd
[
4
]
=
(
pos
==
0
)
?
0x03
/* close */
:
0x02
/* eject */
;
cgc
.
data_direction
=
SCSI_DAT
A_NONE
;
cgc
.
data_direction
=
DM
A_NONE
;
cgc
.
timeout
=
IOCTL_TIMEOUT
;
return
sr_do_ioctl
(
cd
,
&
cgc
);
}
...
...
@@ -280,7 +284,7 @@ int sr_get_mcn(struct cdrom_device_info *cdi, struct cdrom_mcn *mcn)
cgc
.
cmd
[
8
]
=
24
;
cgc
.
buffer
=
buffer
;
cgc
.
buflen
=
24
;
cgc
.
data_direction
=
SCSI_DATA_READ
;
cgc
.
data_direction
=
DMA_FROM_DEVICE
;
cgc
.
timeout
=
IOCTL_TIMEOUT
;
result
=
sr_do_ioctl
(
cd
,
&
cgc
);
...
...
@@ -310,7 +314,7 @@ int sr_select_speed(struct cdrom_device_info *cdi, int speed)
cgc
.
cmd
[
0
]
=
GPCMD_SET_SPEED
;
/* SET CD SPEED */
cgc
.
cmd
[
2
]
=
(
speed
>>
8
)
&
0xff
;
/* MSB for speed (in kbytes/sec) */
cgc
.
cmd
[
3
]
=
speed
&
0xff
;
/* LSB */
cgc
.
data_direction
=
SCSI_DAT
A_NONE
;
cgc
.
data_direction
=
DM
A_NONE
;
cgc
.
timeout
=
IOCTL_TIMEOUT
;
if
(
sr_do_ioctl
(
cd
,
&
cgc
))
...
...
@@ -347,7 +351,7 @@ int sr_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, void *arg)
cgc
.
buffer
=
buffer
;
cgc
.
buflen
=
12
;
cgc
.
quiet
=
1
;
cgc
.
data_direction
=
SCSI_DATA_READ
;
cgc
.
data_direction
=
DMA_FROM_DEVICE
;
result
=
sr_do_ioctl
(
cd
,
&
cgc
);
...
...
@@ -367,7 +371,7 @@ int sr_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, void *arg)
cgc
.
cmd
[
8
]
=
12
;
/* LSB of length */
cgc
.
buffer
=
buffer
;
cgc
.
buflen
=
12
;
cgc
.
data_direction
=
SCSI_DATA_READ
;
cgc
.
data_direction
=
DMA_FROM_DEVICE
;
result
=
sr_do_ioctl
(
cd
,
&
cgc
);
...
...
@@ -393,7 +397,7 @@ int sr_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, void *arg)
cgc
.
cmd
[
5
]
=
ti
->
cdti_ind0
;
cgc
.
cmd
[
7
]
=
ti
->
cdti_trk1
;
cgc
.
cmd
[
8
]
=
ti
->
cdti_ind1
;
cgc
.
data_direction
=
SCSI_DAT
A_NONE
;
cgc
.
data_direction
=
DM
A_NONE
;
result
=
sr_do_ioctl
(
cd
,
&
cgc
);
if
(
result
==
-
EDRIVE_CANT_DO_THIS
)
...
...
@@ -462,7 +466,7 @@ static int sr_read_cd(Scsi_CD *cd, unsigned char *dest, int lba, int format, int
}
cgc
.
buffer
=
dest
;
cgc
.
buflen
=
blksize
;
cgc
.
data_direction
=
SCSI_DATA_READ
;
cgc
.
data_direction
=
DMA_FROM_DEVICE
;
cgc
.
timeout
=
IOCTL_TIMEOUT
;
return
sr_do_ioctl
(
cd
,
&
cgc
);
}
...
...
@@ -503,7 +507,7 @@ static int sr_read_sector(Scsi_CD *cd, int lba, int blksize, unsigned char *dest
cgc
.
cmd
[
8
]
=
1
;
cgc
.
buffer
=
dest
;
cgc
.
buflen
=
blksize
;
cgc
.
data_direction
=
SCSI_DATA_READ
;
cgc
.
data_direction
=
DMA_FROM_DEVICE
;
cgc
.
timeout
=
IOCTL_TIMEOUT
;
rc
=
sr_do_ioctl
(
cd
,
&
cgc
);
...
...
drivers/scsi/sr_vendor.c
View file @
c70f6d91
...
...
@@ -35,16 +35,18 @@
*/
#include <linux/config.h>
#include <linux/cdrom.h>
#include <linux/errno.h>
#include <linux/string.h>
#include <linux/bcd.h>
#include <linux/blkdev.h>
#include "scsi.h"
#include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_ioctl.h>
#include <linux/cdrom.h>
#include "sr.h"
#if 0
...
...
@@ -135,7 +137,7 @@ int sr_set_blocklength(Scsi_CD *cd, int blocklength)
modesel
->
block_length_lo
=
blocklength
&
0xff
;
cgc
.
buffer
=
buffer
;
cgc
.
buflen
=
sizeof
(
*
modesel
);
cgc
.
data_direction
=
SCSI_DATA_WRIT
E
;
cgc
.
data_direction
=
DMA_TO_DEVIC
E
;
cgc
.
timeout
=
VENDOR_TIMEOUT
;
if
(
0
==
(
rc
=
sr_do_ioctl
(
cd
,
&
cgc
)))
{
cd
->
device
->
sector_size
=
blocklength
;
...
...
@@ -182,7 +184,7 @@ int sr_cd_check(struct cdrom_device_info *cdi)
cgc
.
buffer
=
buffer
;
cgc
.
buflen
=
12
;
cgc
.
quiet
=
1
;
cgc
.
data_direction
=
SCSI_DATA_READ
;
cgc
.
data_direction
=
DMA_FROM_DEVICE
;
cgc
.
timeout
=
VENDOR_TIMEOUT
;
rc
=
sr_do_ioctl
(
cd
,
&
cgc
);
if
(
rc
!=
0
)
...
...
@@ -210,7 +212,7 @@ int sr_cd_check(struct cdrom_device_info *cdi)
cgc
.
buffer
=
buffer
;
cgc
.
buflen
=
0x16
;
cgc
.
quiet
=
1
;
cgc
.
data_direction
=
SCSI_DATA_READ
;
cgc
.
data_direction
=
DMA_FROM_DEVICE
;
cgc
.
timeout
=
VENDOR_TIMEOUT
;
rc
=
sr_do_ioctl
(
cd
,
&
cgc
);
if
(
rc
!=
0
)
...
...
@@ -239,7 +241,7 @@ int sr_cd_check(struct cdrom_device_info *cdi)
cgc
.
buffer
=
buffer
;
cgc
.
buflen
=
4
;
cgc
.
quiet
=
1
;
cgc
.
data_direction
=
SCSI_DATA_READ
;
cgc
.
data_direction
=
DMA_FROM_DEVICE
;
cgc
.
timeout
=
VENDOR_TIMEOUT
;
rc
=
sr_do_ioctl
(
cd
,
&
cgc
);
if
(
rc
==
-
EINVAL
)
{
...
...
@@ -268,7 +270,7 @@ int sr_cd_check(struct cdrom_device_info *cdi)
cgc
.
buffer
=
buffer
;
cgc
.
buflen
=
0x04
;
cgc
.
quiet
=
1
;
cgc
.
data_direction
=
SCSI_DATA_READ
;
cgc
.
data_direction
=
DMA_FROM_DEVICE
;
cgc
.
timeout
=
VENDOR_TIMEOUT
;
rc
=
sr_do_ioctl
(
cd
,
&
cgc
);
if
(
rc
!=
0
)
{
...
...
@@ -286,7 +288,7 @@ int sr_cd_check(struct cdrom_device_info *cdi)
cgc
.
buffer
=
buffer
;
cgc
.
buflen
=
12
;
cgc
.
quiet
=
1
;
cgc
.
data_direction
=
SCSI_DATA_READ
;
cgc
.
data_direction
=
DMA_FROM_DEVICE
;
cgc
.
timeout
=
VENDOR_TIMEOUT
;
rc
=
sr_do_ioctl
(
cd
,
&
cgc
);
if
(
rc
!=
0
)
{
...
...
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