Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
linux-guf
Manage
Activity
Members
Labels
Code
Merge requests
6
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SECO Northern Europe
Kernel
linux-guf
Commits
36e9f653
Commit
36e9f653
authored
9 years ago
by
Al Viro
Browse files
Options
Downloads
Plain Diff
Merge branch 'iov_iter' into for-next
parents
a96114fa
bc917be8
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/linux/uio.h
+14
-0
14 additions, 0 deletions
include/linux/uio.h
lib/iov_iter.c
+57
-0
57 additions, 0 deletions
lib/iov_iter.c
with
71 additions
and
0 deletions
include/linux/uio.h
+
14
−
0
View file @
36e9f653
...
...
@@ -140,4 +140,18 @@ static inline void iov_iter_reexpand(struct iov_iter *i, size_t count)
size_t
csum_and_copy_to_iter
(
void
*
addr
,
size_t
bytes
,
__wsum
*
csum
,
struct
iov_iter
*
i
);
size_t
csum_and_copy_from_iter
(
void
*
addr
,
size_t
bytes
,
__wsum
*
csum
,
struct
iov_iter
*
i
);
int
import_iovec
(
int
type
,
const
struct
iovec
__user
*
uvector
,
unsigned
nr_segs
,
unsigned
fast_segs
,
struct
iovec
**
iov
,
struct
iov_iter
*
i
);
#ifdef CONFIG_COMPAT
struct
compat_iovec
;
int
compat_import_iovec
(
int
type
,
const
struct
compat_iovec
__user
*
uvector
,
unsigned
nr_segs
,
unsigned
fast_segs
,
struct
iovec
**
iov
,
struct
iov_iter
*
i
);
#endif
int
import_single_range
(
int
type
,
void
__user
*
buf
,
size_t
len
,
struct
iovec
*
iov
,
struct
iov_iter
*
i
);
#endif
This diff is collapsed.
Click to expand it.
lib/iov_iter.c
+
57
−
0
View file @
36e9f653
...
...
@@ -792,3 +792,60 @@ const void *dup_iter(struct iov_iter *new, struct iov_iter *old, gfp_t flags)
flags
);
}
EXPORT_SYMBOL
(
dup_iter
);
int
import_iovec
(
int
type
,
const
struct
iovec
__user
*
uvector
,
unsigned
nr_segs
,
unsigned
fast_segs
,
struct
iovec
**
iov
,
struct
iov_iter
*
i
)
{
ssize_t
n
;
struct
iovec
*
p
;
n
=
rw_copy_check_uvector
(
type
,
uvector
,
nr_segs
,
fast_segs
,
*
iov
,
&
p
);
if
(
n
<
0
)
{
if
(
p
!=
*
iov
)
kfree
(
p
);
*
iov
=
NULL
;
return
n
;
}
iov_iter_init
(
i
,
type
,
p
,
nr_segs
,
n
);
*
iov
=
p
==
*
iov
?
NULL
:
p
;
return
0
;
}
EXPORT_SYMBOL
(
import_iovec
);
#ifdef CONFIG_COMPAT
#include
<linux/compat.h>
int
compat_import_iovec
(
int
type
,
const
struct
compat_iovec
__user
*
uvector
,
unsigned
nr_segs
,
unsigned
fast_segs
,
struct
iovec
**
iov
,
struct
iov_iter
*
i
)
{
ssize_t
n
;
struct
iovec
*
p
;
n
=
compat_rw_copy_check_uvector
(
type
,
uvector
,
nr_segs
,
fast_segs
,
*
iov
,
&
p
);
if
(
n
<
0
)
{
if
(
p
!=
*
iov
)
kfree
(
p
);
*
iov
=
NULL
;
return
n
;
}
iov_iter_init
(
i
,
type
,
p
,
nr_segs
,
n
);
*
iov
=
p
==
*
iov
?
NULL
:
p
;
return
0
;
}
#endif
int
import_single_range
(
int
rw
,
void
__user
*
buf
,
size_t
len
,
struct
iovec
*
iov
,
struct
iov_iter
*
i
)
{
if
(
len
>
MAX_RW_COUNT
)
len
=
MAX_RW_COUNT
;
if
(
unlikely
(
!
access_ok
(
!
rw
,
buf
,
len
)))
return
-
EFAULT
;
iov
->
iov_base
=
buf
;
iov
->
iov_len
=
len
;
iov_iter_init
(
i
,
rw
,
iov
,
1
,
len
);
return
0
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment