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
eb7f5858
Commit
eb7f5858
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] sd template
Ditto for sd.c
parent
4a17ca93
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
drivers/scsi/sd.c
drivers/scsi/sd.c
+13
-6
No files found.
drivers/scsi/sd.c
View file @
eb7f5858
...
...
@@ -73,6 +73,7 @@
struct
scsi_disk
{
struct
list_head
list
;
/* list of all scsi_disks */
struct
Scsi_Device_Template
*
driver
;
/* always &sd_template */
struct
scsi_device
*
device
;
struct
gendisk
*
disk
;
sector_t
capacity
;
/* size in 512-byte sectors */
...
...
@@ -145,6 +146,11 @@ static inline void sd_devlist_remove(struct scsi_disk *sdkp)
spin_unlock
(
&
sd_devlist_lock
);
}
static
inline
struct
scsi_disk
*
scsi_disk
(
struct
gendisk
*
disk
)
{
return
container_of
(
disk
->
private_data
,
struct
scsi_disk
,
driver
);
}
/**
* sd_ioctl - process an ioctl
* @inode: only i_rdev member may be used
...
...
@@ -164,7 +170,7 @@ static int sd_ioctl(struct inode * inode, struct file * filp,
{
struct
block_device
*
bdev
=
inode
->
i_bdev
;
struct
gendisk
*
disk
=
bdev
->
bd_disk
;
struct
scsi_disk
*
sdkp
=
disk
->
private_data
;
struct
scsi_disk
*
sdkp
=
scsi_disk
(
disk
)
;
struct
scsi_device
*
sdp
=
sdkp
->
device
;
sector_t
capacity
=
sdkp
->
capacity
;
struct
Scsi_Host
*
host
;
...
...
@@ -431,7 +437,7 @@ static int sd_init_command(struct scsi_cmnd * SCpnt)
static
int
sd_open
(
struct
inode
*
inode
,
struct
file
*
filp
)
{
struct
gendisk
*
disk
=
inode
->
i_bdev
->
bd_disk
;
struct
scsi_disk
*
sdkp
=
disk
->
private_data
;
struct
scsi_disk
*
sdkp
=
scsi_disk
(
disk
)
;
struct
scsi_device
*
sdp
=
sdkp
->
device
;
int
retval
=
-
ENXIO
;
...
...
@@ -516,7 +522,7 @@ static int sd_open(struct inode *inode, struct file *filp)
static
int
sd_release
(
struct
inode
*
inode
,
struct
file
*
filp
)
{
struct
gendisk
*
disk
=
inode
->
i_bdev
->
bd_disk
;
struct
scsi_disk
*
sdkp
=
disk
->
private_data
;
struct
scsi_disk
*
sdkp
=
scsi_disk
(
disk
)
;
struct
scsi_device
*
sdp
=
sdkp
->
device
;
SCSI_LOG_HLQUEUE
(
3
,
printk
(
"sd_release: disk=%s
\n
"
,
disk
->
disk_name
));
...
...
@@ -670,7 +676,7 @@ sd_set_media_not_present(struct scsi_disk *sdkp) {
**/
static
int
check_scsidisk_media_change
(
struct
gendisk
*
disk
)
{
struct
scsi_disk
*
sdkp
=
disk
->
private_data
;
struct
scsi_disk
*
sdkp
=
scsi_disk
(
disk
)
;
struct
scsi_device
*
sdp
=
sdkp
->
device
;
int
retval
;
int
flag
=
0
;
/* <<<< what is this for?? */
...
...
@@ -1227,6 +1233,7 @@ static int sd_attach(struct scsi_device * sdp)
dsk_nr
=
sd_template
.
nr_dev
++
;
sdkp
->
device
=
sdp
;
sdkp
->
driver
=
&
sd_template
;
sdkp
->
disk
=
gd
;
sd_init_onedisk
(
sdkp
,
gd
);
...
...
@@ -1243,7 +1250,7 @@ static int sd_attach(struct scsi_device * sdp)
gd
->
flags
=
GENHD_FL_DRIVERFS
|
GENHD_FL_DEVFS
;
if
(
sdp
->
removable
)
gd
->
flags
|=
GENHD_FL_REMOVABLE
;
gd
->
private_data
=
sdkp
;
gd
->
private_data
=
&
sdkp
->
driver
;
gd
->
queue
=
&
sdkp
->
device
->
request_queue
;
sd_devlist_insert
(
sdkp
);
...
...
@@ -1266,7 +1273,7 @@ static int sd_attach(struct scsi_device * sdp)
static
int
sd_revalidate
(
struct
gendisk
*
disk
)
{
struct
scsi_disk
*
sdkp
=
disk
->
private_data
;
struct
scsi_disk
*
sdkp
=
scsi_disk
(
disk
)
;
if
(
!
sdkp
->
device
)
return
-
ENODEV
;
...
...
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