Commit d838df2e authored by Al Viro's avatar Al Viro

vmci: propagate msghdr all way down to __qp_memcpy_from_queue()

... and switch it to memcpy_to_msg()
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 56c39fb6
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <linux/uio.h> #include <linux/uio.h>
#include <linux/wait.h> #include <linux/wait.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/skbuff.h>
#include "vmci_handle_array.h" #include "vmci_handle_array.h"
#include "vmci_queue_pair.h" #include "vmci_queue_pair.h"
...@@ -429,11 +430,11 @@ static int __qp_memcpy_from_queue(void *dest, ...@@ -429,11 +430,11 @@ static int __qp_memcpy_from_queue(void *dest,
to_copy = size - bytes_copied; to_copy = size - bytes_copied;
if (is_iovec) { if (is_iovec) {
struct iovec *iov = (struct iovec *)dest; struct msghdr *msg = dest;
int err; int err;
/* The iovec will track bytes_copied internally. */ /* The iovec will track bytes_copied internally. */
err = memcpy_toiovec(iov, (u8 *)va + page_offset, err = memcpy_to_msg(msg, (u8 *)va + page_offset,
to_copy); to_copy);
if (err != 0) { if (err != 0) {
if (kernel_if->host) if (kernel_if->host)
...@@ -3264,13 +3265,13 @@ EXPORT_SYMBOL_GPL(vmci_qpair_enquev); ...@@ -3264,13 +3265,13 @@ EXPORT_SYMBOL_GPL(vmci_qpair_enquev);
* of bytes dequeued or < 0 on error. * of bytes dequeued or < 0 on error.
*/ */
ssize_t vmci_qpair_dequev(struct vmci_qp *qpair, ssize_t vmci_qpair_dequev(struct vmci_qp *qpair,
void *iov, struct msghdr *msg,
size_t iov_size, size_t iov_size,
int buf_type) int buf_type)
{ {
ssize_t result; ssize_t result;
if (!qpair || !iov) if (!qpair)
return VMCI_ERROR_INVALID_ARGS; return VMCI_ERROR_INVALID_ARGS;
qp_lock(qpair); qp_lock(qpair);
...@@ -3279,7 +3280,7 @@ ssize_t vmci_qpair_dequev(struct vmci_qp *qpair, ...@@ -3279,7 +3280,7 @@ ssize_t vmci_qpair_dequev(struct vmci_qp *qpair,
result = qp_dequeue_locked(qpair->produce_q, result = qp_dequeue_locked(qpair->produce_q,
qpair->consume_q, qpair->consume_q,
qpair->consume_q_size, qpair->consume_q_size,
iov, iov_size, msg, iov_size,
qp_memcpy_from_queue_iov, qp_memcpy_from_queue_iov,
true); true);
...@@ -3308,13 +3309,13 @@ EXPORT_SYMBOL_GPL(vmci_qpair_dequev); ...@@ -3308,13 +3309,13 @@ EXPORT_SYMBOL_GPL(vmci_qpair_dequev);
* of bytes peeked or < 0 on error. * of bytes peeked or < 0 on error.
*/ */
ssize_t vmci_qpair_peekv(struct vmci_qp *qpair, ssize_t vmci_qpair_peekv(struct vmci_qp *qpair,
void *iov, struct msghdr *msg,
size_t iov_size, size_t iov_size,
int buf_type) int buf_type)
{ {
ssize_t result; ssize_t result;
if (!qpair || !iov) if (!qpair)
return VMCI_ERROR_INVALID_ARGS; return VMCI_ERROR_INVALID_ARGS;
qp_lock(qpair); qp_lock(qpair);
...@@ -3323,7 +3324,7 @@ ssize_t vmci_qpair_peekv(struct vmci_qp *qpair, ...@@ -3323,7 +3324,7 @@ ssize_t vmci_qpair_peekv(struct vmci_qp *qpair,
result = qp_dequeue_locked(qpair->produce_q, result = qp_dequeue_locked(qpair->produce_q,
qpair->consume_q, qpair->consume_q,
qpair->consume_q_size, qpair->consume_q_size,
iov, iov_size, msg, iov_size,
qp_memcpy_from_queue_iov, qp_memcpy_from_queue_iov,
false); false);
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#define VMCI_KERNEL_API_VERSION_2 2 #define VMCI_KERNEL_API_VERSION_2 2
#define VMCI_KERNEL_API_VERSION VMCI_KERNEL_API_VERSION_2 #define VMCI_KERNEL_API_VERSION VMCI_KERNEL_API_VERSION_2
struct msghdr;
typedef void (vmci_device_shutdown_fn) (void *device_registration, typedef void (vmci_device_shutdown_fn) (void *device_registration,
void *user_data); void *user_data);
...@@ -75,8 +76,8 @@ ssize_t vmci_qpair_peek(struct vmci_qp *qpair, void *buf, size_t buf_size, ...@@ -75,8 +76,8 @@ ssize_t vmci_qpair_peek(struct vmci_qp *qpair, void *buf, size_t buf_size,
ssize_t vmci_qpair_enquev(struct vmci_qp *qpair, ssize_t vmci_qpair_enquev(struct vmci_qp *qpair,
void *iov, size_t iov_size, int mode); void *iov, size_t iov_size, int mode);
ssize_t vmci_qpair_dequev(struct vmci_qp *qpair, ssize_t vmci_qpair_dequev(struct vmci_qp *qpair,
void *iov, size_t iov_size, int mode); struct msghdr *msg, size_t iov_size, int mode);
ssize_t vmci_qpair_peekv(struct vmci_qp *qpair, void *iov, size_t iov_size, ssize_t vmci_qpair_peekv(struct vmci_qp *qpair, struct msghdr *msg, size_t iov_size,
int mode); int mode);
#endif /* !__VMW_VMCI_API_H__ */ #endif /* !__VMW_VMCI_API_H__ */
...@@ -1840,9 +1840,9 @@ static ssize_t vmci_transport_stream_dequeue( ...@@ -1840,9 +1840,9 @@ static ssize_t vmci_transport_stream_dequeue(
int flags) int flags)
{ {
if (flags & MSG_PEEK) if (flags & MSG_PEEK)
return vmci_qpair_peekv(vmci_trans(vsk)->qpair, msg->msg_iov, len, 0); return vmci_qpair_peekv(vmci_trans(vsk)->qpair, msg, len, 0);
else else
return vmci_qpair_dequev(vmci_trans(vsk)->qpair, msg->msg_iov, len, 0); return vmci_qpair_dequev(vmci_trans(vsk)->qpair, msg, len, 0);
} }
static ssize_t vmci_transport_stream_enqueue( static ssize_t vmci_transport_stream_enqueue(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment