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
4a17ca93
Commit
4a17ca93
authored
Oct 31, 2002
by
Alexander Viro
Committed by
Linus Torvalds
Oct 31, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] sr template
Ditto for sr.c
parent
1061e346
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
7 deletions
+14
-7
drivers/scsi/sr.c
drivers/scsi/sr.c
+13
-7
drivers/scsi/sr.h
drivers/scsi/sr.h
+1
-0
No files found.
drivers/scsi/sr.c
View file @
4a17ca93
...
...
@@ -177,6 +177,11 @@ int sr_media_change(struct cdrom_device_info *cdi, int slot)
}
return
retval
;
}
static
inline
struct
scsi_cd
*
scsi_cd
(
struct
gendisk
*
disk
)
{
return
container_of
(
disk
->
private_data
,
struct
scsi_cd
,
driver
);
}
/*
* rw_intr is the interrupt routine for the device driver.
...
...
@@ -190,7 +195,7 @@ static void rw_intr(struct scsi_cmnd * SCpnt)
int
this_count
=
SCpnt
->
bufflen
>>
9
;
int
good_sectors
=
(
result
==
0
?
this_count
:
0
);
int
block_sectors
=
0
;
struct
scsi_cd
*
cd
=
SCpnt
->
request
->
rq_disk
->
private_data
;
struct
scsi_cd
*
cd
=
scsi_cd
(
SCpnt
->
request
->
rq_disk
)
;
#ifdef DEBUG
printk
(
"sr.c done: %x %p
\n
"
,
result
,
SCpnt
->
request
->
bh
->
b_data
);
...
...
@@ -243,7 +248,7 @@ static void rw_intr(struct scsi_cmnd * SCpnt)
static
int
sr_init_command
(
struct
scsi_cmnd
*
SCpnt
)
{
int
block
=
0
,
this_count
,
s_size
,
timeout
=
SR_TIMEOUT
;
struct
scsi_cd
*
cd
=
SCpnt
->
request
->
rq_disk
->
private_data
;
struct
scsi_cd
*
cd
=
scsi_cd
(
SCpnt
->
request
->
rq_disk
)
;
SCSI_LOG_HLQUEUE
(
1
,
printk
(
"Doing sr request, dev = %s, block = %d
\n
"
,
cd
->
disk
->
disk_name
,
block
));
...
...
@@ -395,26 +400,26 @@ static int sr_init_command(struct scsi_cmnd * SCpnt)
static
int
sr_block_open
(
struct
inode
*
inode
,
struct
file
*
file
)
{
struct
scsi_cd
*
cd
=
inode
->
i_bdev
->
bd_disk
->
private_data
;
struct
scsi_cd
*
cd
=
scsi_cd
(
inode
->
i_bdev
->
bd_disk
)
;
return
cdrom_open
(
&
cd
->
cdi
,
inode
,
file
);
}
static
int
sr_block_release
(
struct
inode
*
inode
,
struct
file
*
file
)
{
struct
scsi_cd
*
cd
=
inode
->
i_bdev
->
bd_disk
->
private_data
;
struct
scsi_cd
*
cd
=
scsi_cd
(
inode
->
i_bdev
->
bd_disk
)
;
return
cdrom_release
(
&
cd
->
cdi
,
file
);
}
static
int
sr_block_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
unsigned
cmd
,
unsigned
long
arg
)
{
struct
scsi_cd
*
cd
=
inode
->
i_bdev
->
bd_disk
->
private_data
;
struct
scsi_cd
*
cd
=
scsi_cd
(
inode
->
i_bdev
->
bd_disk
)
;
return
cdrom_ioctl
(
&
cd
->
cdi
,
inode
,
cmd
,
arg
);
}
static
int
sr_block_media_changed
(
struct
gendisk
*
disk
)
{
struct
scsi_cd
*
cd
=
disk
->
private_data
;
struct
scsi_cd
*
cd
=
scsi_cd
(
disk
)
;
return
cdrom_media_changed
(
&
cd
->
cdi
);
}
...
...
@@ -766,6 +771,7 @@ static int sr_init_one(struct scsi_cd *cd, int first_minor)
strcpy
(
disk
->
disk_name
,
cd
->
cdi
.
name
);
disk
->
fops
=
&
sr_bdops
;
disk
->
flags
=
GENHD_FL_CD
;
cd
->
driver
=
&
sr_template
;
cd
->
disk
=
disk
;
cd
->
capacity
=
0x1fffff
;
cd
->
device
->
sector_size
=
2048
;
/* A guess, just in case */
...
...
@@ -798,7 +804,7 @@ static int sr_init_one(struct scsi_cd *cd, int first_minor)
disk
->
driverfs_dev
=
&
cd
->
device
->
sdev_driverfs_dev
;
register_cdrom
(
&
cd
->
cdi
);
set_capacity
(
disk
,
cd
->
capacity
);
disk
->
private_data
=
cd
;
disk
->
private_data
=
&
cd
->
driver
;
disk
->
queue
=
&
cd
->
device
->
request_queue
;
add_disk
(
disk
);
...
...
drivers/scsi/sr.h
View file @
4a17ca93
...
...
@@ -25,6 +25,7 @@
#define IOCTL_TIMEOUT 30*HZ
typedef
struct
scsi_cd
{
struct
Scsi_Device_Template
*
driver
;
unsigned
capacity
;
/* size in blocks */
Scsi_Device
*
device
;
unsigned
int
vendor
;
/* vendor code, see sr_vendor.c */
...
...
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