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
ea5af87d
Commit
ea5af87d
authored
May 24, 2022
by
Jens Axboe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
io_uring: convert rsrc_update to io_cmd_type
Signed-off-by:
Jens Axboe
<
axboe@kernel.dk
>
parent
c1ee5595
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
16 deletions
+19
-16
io_uring/io_uring.c
io_uring/io_uring.c
+19
-16
No files found.
io_uring/io_uring.c
View file @
ea5af87d
...
...
@@ -979,7 +979,6 @@ struct io_kiocb {
*/
struct
file
*
file
;
struct
io_cmd_data
cmd
;
struct
io_rsrc_update
rsrc_update
;
struct
io_xattr
xattr
;
struct
io_uring_cmd
uring_cmd
;
};
...
...
@@ -7800,23 +7799,26 @@ static int io_async_cancel(struct io_kiocb *req, unsigned int issue_flags)
static
int
io_files_update_prep
(
struct
io_kiocb
*
req
,
const
struct
io_uring_sqe
*
sqe
)
{
struct
io_rsrc_update
*
up
=
io_kiocb_to_cmd
(
req
);
if
(
unlikely
(
req
->
flags
&
(
REQ_F_FIXED_FILE
|
REQ_F_BUFFER_SELECT
)))
return
-
EINVAL
;
if
(
sqe
->
rw_flags
||
sqe
->
splice_fd_in
)
return
-
EINVAL
;
req
->
rsrc_update
.
offset
=
READ_ONCE
(
sqe
->
off
);
req
->
rsrc_update
.
nr_args
=
READ_ONCE
(
sqe
->
len
);
if
(
!
req
->
rsrc_update
.
nr_args
)
up
->
offset
=
READ_ONCE
(
sqe
->
off
);
up
->
nr_args
=
READ_ONCE
(
sqe
->
len
);
if
(
!
up
->
nr_args
)
return
-
EINVAL
;
req
->
rsrc_update
.
arg
=
READ_ONCE
(
sqe
->
addr
);
up
->
arg
=
READ_ONCE
(
sqe
->
addr
);
return
0
;
}
static
int
io_files_update_with_index_alloc
(
struct
io_kiocb
*
req
,
unsigned
int
issue_flags
)
{
__s32
__user
*
fds
=
u64_to_user_ptr
(
req
->
rsrc_update
.
arg
);
struct
io_rsrc_update
*
up
=
io_kiocb_to_cmd
(
req
);
__s32
__user
*
fds
=
u64_to_user_ptr
(
up
->
arg
);
unsigned
int
done
;
struct
file
*
file
;
int
ret
,
fd
;
...
...
@@ -7824,7 +7826,7 @@ static int io_files_update_with_index_alloc(struct io_kiocb *req,
if
(
!
req
->
ctx
->
file_data
)
return
-
ENXIO
;
for
(
done
=
0
;
done
<
req
->
rsrc_update
.
nr_args
;
done
++
)
{
for
(
done
=
0
;
done
<
up
->
nr_args
;
done
++
)
{
if
(
copy_from_user
(
&
fd
,
&
fds
[
done
],
sizeof
(
fd
)))
{
ret
=
-
EFAULT
;
break
;
...
...
@@ -7853,23 +7855,24 @@ static int io_files_update_with_index_alloc(struct io_kiocb *req,
static
int
io_files_update
(
struct
io_kiocb
*
req
,
unsigned
int
issue_flags
)
{
struct
io_rsrc_update
*
up
=
io_kiocb_to_cmd
(
req
);
struct
io_ring_ctx
*
ctx
=
req
->
ctx
;
struct
io_uring_rsrc_update2
up
;
struct
io_uring_rsrc_update2
up
2
;
int
ret
;
up
.
offset
=
req
->
rsrc_update
.
offset
;
up
.
data
=
req
->
rsrc_update
.
arg
;
up
.
nr
=
0
;
up
.
tags
=
0
;
up
.
resv
=
0
;
up
.
resv2
=
0
;
up
2
.
offset
=
up
->
offset
;
up
2
.
data
=
up
->
arg
;
up
2
.
nr
=
0
;
up
2
.
tags
=
0
;
up
2
.
resv
=
0
;
up
2
.
resv2
=
0
;
if
(
req
->
rsrc_update
.
offset
==
IORING_FILE_INDEX_ALLOC
)
{
if
(
up
->
offset
==
IORING_FILE_INDEX_ALLOC
)
{
ret
=
io_files_update_with_index_alloc
(
req
,
issue_flags
);
}
else
{
io_ring_submit_lock
(
ctx
,
issue_flags
);
ret
=
__io_register_rsrc_update
(
ctx
,
IORING_RSRC_FILE
,
&
up
,
req
->
rsrc_update
.
nr_args
);
&
up2
,
up
->
nr_args
);
io_ring_submit_unlock
(
ctx
,
issue_flags
);
}
...
...
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