read_code(): go through vfs_read() instead of calling the method directly

... and don't skip on sanity checks.  It's *not* a hot path, TYVM
(a couple of calls per a.out execve(), for pity sake) and headers of
random a.out binary are not to be trusted.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
untangling process_vm_..., part 1

we want to massage it to use of iov_iter.  This one is an equivalent
transformation - just introduce a local variable mirroring
lvec + *lvec_current.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
untangling process_vm_..., part 2

move iov to caller's stack frame; the value we assign to it on the
next call of process_vm_rw_pages() is equal to the value it had
when the last time we were leaving process_vm_rw_pages().

drop lvec argument of process_vm_rw_pages() - it's not used anymore.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
untangling process_vm_..., part 3

lift iov one more level out - from process_vm_rw_single_vec to
process_vm_rw_core().  Same story as with the previous commit.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
untangling process_vm_..., part 4

instead of passing vector size (by value) and index (by reference),
pass the number of elements remaining.  That's all we care about
in these functions by that point.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
process_vm_access: switch to iov_iter

instead of keeping its pieces in separate variables and passing
pointers to all of them...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
process_vm_access: switch to copy_page_to_iter/iov_iter_copy_from_user

... rather than open-coding those.  As a side benefit, we get much saner
loop calling those; we can just feed entire pages, instead of the "copy
would span the iovec boundary, let's do it in two loop iterations" mess.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
process_vm_access: take get_user_pages/put_pages one level up

... and trim the fuck out of process_vm_rw_pages() argument list.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
process_vm_rw_pages(): pass accurate amount of bytes

... makes passing the amount of pages unnecessary

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
process_vm_access: don't bother with returning the amounts of bytes copied

we can calculate that in the caller just fine, TYVM

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
process_vm_access: tidy up a bit

saner variable names, update linuxdoc comments, etc.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
take iov_iter stuff to mm/iov_iter.c

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
ocfs2: don't open-code kernel_sendmsg()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
lustre: switch to kernel_sendmsg()

(casts are due to misannotations in lustre; it uses iovec where kvec would be
correct type; too much noise to properly annotate right now).

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
constify blk_rq_map_user_iov() and friends

sg_iovec array passed to it can be const

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
drbd: don't open-code kernel_recvmsg()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
ocfs2: don't open-code kernel_recvmsg()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
lustre: don't open-code kernel_recvmsg()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
kill the 4th argument of __generic_file_aio_write()

It's always equal to &iocb->ki_pos, where iocb is the value of the 1st
argument.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
kill the 5th argument of generic_file_buffered_write()

same story - it's &iocb->ki_pos in all cases

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>