Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci
Commits
5842e51f
Commit
5842e51f
authored
Sep 02, 2008
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] pass mode instead of file to sg_io()
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
86d434de
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
8 deletions
+7
-8
block/scsi_ioctl.c
block/scsi_ioctl.c
+7
-8
No files found.
block/scsi_ioctl.c
View file @
5842e51f
...
@@ -190,12 +190,11 @@ void blk_set_cmd_filter_defaults(struct blk_cmd_filter *filter)
...
@@ -190,12 +190,11 @@ void blk_set_cmd_filter_defaults(struct blk_cmd_filter *filter)
EXPORT_SYMBOL_GPL
(
blk_set_cmd_filter_defaults
);
EXPORT_SYMBOL_GPL
(
blk_set_cmd_filter_defaults
);
static
int
blk_fill_sghdr_rq
(
struct
request_queue
*
q
,
struct
request
*
rq
,
static
int
blk_fill_sghdr_rq
(
struct
request_queue
*
q
,
struct
request
*
rq
,
struct
sg_io_hdr
*
hdr
,
struct
file
*
fil
e
)
struct
sg_io_hdr
*
hdr
,
fmode_t
mod
e
)
{
{
if
(
copy_from_user
(
rq
->
cmd
,
hdr
->
cmdp
,
hdr
->
cmd_len
))
if
(
copy_from_user
(
rq
->
cmd
,
hdr
->
cmdp
,
hdr
->
cmd_len
))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
blk_verify_command
(
&
q
->
cmd_filter
,
rq
->
cmd
,
if
(
blk_verify_command
(
&
q
->
cmd_filter
,
rq
->
cmd
,
mode
&
FMODE_WRITE
))
file
->
f_mode
&
FMODE_WRITE
))
return
-
EPERM
;
return
-
EPERM
;
/*
/*
...
@@ -260,8 +259,8 @@ static int blk_complete_sghdr_rq(struct request *rq, struct sg_io_hdr *hdr,
...
@@ -260,8 +259,8 @@ static int blk_complete_sghdr_rq(struct request *rq, struct sg_io_hdr *hdr,
return
r
;
return
r
;
}
}
static
int
sg_io
(
struct
file
*
file
,
struct
request_queue
*
q
,
static
int
sg_io
(
struct
request_queue
*
q
,
struct
gendisk
*
bd_disk
,
struct
gendisk
*
bd_disk
,
struct
sg_io_hdr
*
hdr
)
struct
sg_io_hdr
*
hdr
,
fmode_t
mode
)
{
{
unsigned
long
start_time
;
unsigned
long
start_time
;
int
writing
=
0
,
ret
=
0
;
int
writing
=
0
,
ret
=
0
;
...
@@ -293,7 +292,7 @@ static int sg_io(struct file *file, struct request_queue *q,
...
@@ -293,7 +292,7 @@ static int sg_io(struct file *file, struct request_queue *q,
if
(
!
rq
)
if
(
!
rq
)
return
-
ENOMEM
;
return
-
ENOMEM
;
if
(
blk_fill_sghdr_rq
(
q
,
rq
,
hdr
,
fil
e
))
{
if
(
blk_fill_sghdr_rq
(
q
,
rq
,
hdr
,
mod
e
))
{
blk_put_request
(
rq
);
blk_put_request
(
rq
);
return
-
EFAULT
;
return
-
EFAULT
;
}
}
...
@@ -565,7 +564,7 @@ int scsi_cmd_ioctl(struct file *file, struct request_queue *q,
...
@@ -565,7 +564,7 @@ int scsi_cmd_ioctl(struct file *file, struct request_queue *q,
err
=
-
EFAULT
;
err
=
-
EFAULT
;
if
(
copy_from_user
(
&
hdr
,
arg
,
sizeof
(
hdr
)))
if
(
copy_from_user
(
&
hdr
,
arg
,
sizeof
(
hdr
)))
break
;
break
;
err
=
sg_io
(
file
,
q
,
bd_disk
,
&
hdr
);
err
=
sg_io
(
q
,
bd_disk
,
&
hdr
,
file
?
file
->
f_mode
:
0
);
if
(
err
==
-
EFAULT
)
if
(
err
==
-
EFAULT
)
break
;
break
;
...
@@ -613,7 +612,7 @@ int scsi_cmd_ioctl(struct file *file, struct request_queue *q,
...
@@ -613,7 +612,7 @@ int scsi_cmd_ioctl(struct file *file, struct request_queue *q,
hdr
.
cmdp
=
((
struct
cdrom_generic_command
__user
*
)
arg
)
->
cmd
;
hdr
.
cmdp
=
((
struct
cdrom_generic_command
__user
*
)
arg
)
->
cmd
;
hdr
.
cmd_len
=
sizeof
(
cgc
.
cmd
);
hdr
.
cmd_len
=
sizeof
(
cgc
.
cmd
);
err
=
sg_io
(
file
,
q
,
bd_disk
,
&
hdr
);
err
=
sg_io
(
q
,
bd_disk
,
&
hdr
,
file
?
file
->
f_mode
:
0
);
if
(
err
==
-
EFAULT
)
if
(
err
==
-
EFAULT
)
break
;
break
;
...
...
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