vmci_transport: switch ->enqeue_dgram, ->enqueue_stream and ->dequeue_stream to msghdr

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Al Viro 2014-11-20 04:05:34 -05:00
parent 45dcc687f7
commit 0f7db23a07
3 changed files with 13 additions and 13 deletions

View file

@ -103,14 +103,14 @@ struct vsock_transport {
int (*dgram_dequeue)(struct kiocb *kiocb, struct vsock_sock *vsk, int (*dgram_dequeue)(struct kiocb *kiocb, struct vsock_sock *vsk,
struct msghdr *msg, size_t len, int flags); struct msghdr *msg, size_t len, int flags);
int (*dgram_enqueue)(struct vsock_sock *, struct sockaddr_vm *, int (*dgram_enqueue)(struct vsock_sock *, struct sockaddr_vm *,
struct iovec *, size_t len); struct msghdr *, size_t len);
bool (*dgram_allow)(u32 cid, u32 port); bool (*dgram_allow)(u32 cid, u32 port);
/* STREAM. */ /* STREAM. */
/* TODO: stream_bind() */ /* TODO: stream_bind() */
ssize_t (*stream_dequeue)(struct vsock_sock *, struct iovec *, ssize_t (*stream_dequeue)(struct vsock_sock *, struct msghdr *,
size_t len, int flags); size_t len, int flags);
ssize_t (*stream_enqueue)(struct vsock_sock *, struct iovec *, ssize_t (*stream_enqueue)(struct vsock_sock *, struct msghdr *,
size_t len); size_t len);
s64 (*stream_has_data)(struct vsock_sock *); s64 (*stream_has_data)(struct vsock_sock *);
s64 (*stream_has_space)(struct vsock_sock *); s64 (*stream_has_space)(struct vsock_sock *);

View file

@ -1013,7 +1013,7 @@ static int vsock_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock,
goto out; goto out;
} }
err = transport->dgram_enqueue(vsk, remote_addr, msg->msg_iov, len); err = transport->dgram_enqueue(vsk, remote_addr, msg, len);
out: out:
release_sock(sk); release_sock(sk);
@ -1617,7 +1617,7 @@ static int vsock_stream_sendmsg(struct kiocb *kiocb, struct socket *sock,
*/ */
written = transport->stream_enqueue( written = transport->stream_enqueue(
vsk, msg->msg_iov, vsk, msg,
len - total_written); len - total_written);
if (written < 0) { if (written < 0) {
err = -ENOMEM; err = -ENOMEM;
@ -1739,7 +1739,7 @@ vsock_stream_recvmsg(struct kiocb *kiocb,
break; break;
read = transport->stream_dequeue( read = transport->stream_dequeue(
vsk, msg->msg_iov, vsk, msg,
len - copied, flags); len - copied, flags);
if (read < 0) { if (read < 0) {
err = -ENOMEM; err = -ENOMEM;

View file

@ -1697,7 +1697,7 @@ static int vmci_transport_dgram_bind(struct vsock_sock *vsk,
static int vmci_transport_dgram_enqueue( static int vmci_transport_dgram_enqueue(
struct vsock_sock *vsk, struct vsock_sock *vsk,
struct sockaddr_vm *remote_addr, struct sockaddr_vm *remote_addr,
struct iovec *iov, struct msghdr *msg,
size_t len) size_t len)
{ {
int err; int err;
@ -1714,7 +1714,7 @@ static int vmci_transport_dgram_enqueue(
if (!dg) if (!dg)
return -ENOMEM; return -ENOMEM;
memcpy_fromiovec(VMCI_DG_PAYLOAD(dg), iov, len); memcpy_from_msg(VMCI_DG_PAYLOAD(dg), msg, len);
dg->dst = vmci_make_handle(remote_addr->svm_cid, dg->dst = vmci_make_handle(remote_addr->svm_cid,
remote_addr->svm_port); remote_addr->svm_port);
@ -1835,22 +1835,22 @@ static int vmci_transport_connect(struct vsock_sock *vsk)
static ssize_t vmci_transport_stream_dequeue( static ssize_t vmci_transport_stream_dequeue(
struct vsock_sock *vsk, struct vsock_sock *vsk,
struct iovec *iov, struct msghdr *msg,
size_t len, size_t len,
int flags) int flags)
{ {
if (flags & MSG_PEEK) if (flags & MSG_PEEK)
return vmci_qpair_peekv(vmci_trans(vsk)->qpair, iov, len, 0); return vmci_qpair_peekv(vmci_trans(vsk)->qpair, msg->msg_iov, len, 0);
else else
return vmci_qpair_dequev(vmci_trans(vsk)->qpair, iov, len, 0); return vmci_qpair_dequev(vmci_trans(vsk)->qpair, msg->msg_iov, len, 0);
} }
static ssize_t vmci_transport_stream_enqueue( static ssize_t vmci_transport_stream_enqueue(
struct vsock_sock *vsk, struct vsock_sock *vsk,
struct iovec *iov, struct msghdr *msg,
size_t len) size_t len)
{ {
return vmci_qpair_enquev(vmci_trans(vsk)->qpair, iov, len, 0); return vmci_qpair_enquev(vmci_trans(vsk)->qpair, msg->msg_iov, len, 0);
} }
static s64 vmci_transport_stream_has_data(struct vsock_sock *vsk) static s64 vmci_transport_stream_has_data(struct vsock_sock *vsk)