Commit b8e2df1f authored by Al Viro's avatar Al Viro

ncpfs: switch to sock_sendmsg()

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 2cebcc78
...@@ -40,19 +40,12 @@ static int _recv(struct socket *sock, void *buf, int size, unsigned flags) ...@@ -40,19 +40,12 @@ static int _recv(struct socket *sock, void *buf, int size, unsigned flags)
return kernel_recvmsg(sock, &msg, &iov, 1, size, flags); return kernel_recvmsg(sock, &msg, &iov, 1, size, flags);
} }
static inline int do_send(struct socket *sock, struct kvec *vec, int count,
int len, unsigned flags)
{
struct msghdr msg = { .msg_flags = flags };
return kernel_sendmsg(sock, &msg, vec, count, len);
}
static int _send(struct socket *sock, const void *buff, int len) static int _send(struct socket *sock, const void *buff, int len)
{ {
struct kvec vec; struct msghdr msg = { .msg_flags = 0 };
vec.iov_base = (void *) buff; struct kvec vec = {.iov_base = (void *)buff, .iov_len = len};
vec.iov_len = len; iov_iter_kvec(&msg.msg_iter, WRITE | ITER_KVEC, &vec, 1, len);
return do_send(sock, &vec, 1, len, 0); return sock_sendmsg(sock, &msg);
} }
struct ncp_request_reply { struct ncp_request_reply {
...@@ -345,18 +338,17 @@ static void __ncp_next_request(struct ncp_server *server) ...@@ -345,18 +338,17 @@ static void __ncp_next_request(struct ncp_server *server)
static void info_server(struct ncp_server *server, unsigned int id, const void * data, size_t len) static void info_server(struct ncp_server *server, unsigned int id, const void * data, size_t len)
{ {
if (server->info_sock) { if (server->info_sock) {
struct kvec iov[2]; struct msghdr msg = { .msg_flags = MSG_NOSIGNAL };
__be32 hdr[2]; __be32 hdr[2] = {cpu_to_be32(len + 8), cpu_to_be32(id)};
struct kvec iov[2] = {
hdr[0] = cpu_to_be32(len + 8); {.iov_base = hdr, .iov_len = 8},
hdr[1] = cpu_to_be32(id); {.iov_base = (void *)data, .iov_len = len},
};
iov[0].iov_base = hdr; iov_iter_kvec(&msg.msg_iter, ITER_KVEC | WRITE,
iov[0].iov_len = 8; iov, 2, len + 8);
iov[1].iov_base = (void *) data;
iov[1].iov_len = len;
do_send(server->info_sock, iov, 2, len + 8, MSG_NOSIGNAL); sock_sendmsg(server->info_sock, &msg);
} }
} }
......
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