lkml.org 
[lkml]   [2013]   [Sep]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCHv3 13/16] staging: usbip: Wrap kernel_sendmsg()/recvmsg()
On Sat, Sep 28, 2013 at 07:42:50PM +0200, Dominik Paulus wrote:
> @@ -352,34 +352,29 @@ int usbip_recv(struct socket *sock, void *buf, int size)
>
> usbip_dbg_xmit("enter\n");
>
> - if (!sock || !buf || !size) {
> - pr_err("invalid arg, sock %p buff %p size %d\n", sock, buf,
> + if (!ud || !buf || !size) {
> + pr_err("invalid arg, ud %p buff %p size %d\n", ud, buf,
> size);

"size" can fit on the first line now.

pr_err("invalid arg, ud %p buff %p size %d\n", ud, buf, size);

> return -EINVAL;
> }
>
> - do {
> - sock->sk->sk_allocation = GFP_NOIO;
> - iov.iov_base = buf;
> - iov.iov_len = size;
> - msg.msg_name = NULL;
> - msg.msg_namelen = 0;
> - msg.msg_control = NULL;
> - msg.msg_controllen = 0;
> - msg.msg_namelen = 0;
> - msg.msg_flags = MSG_NOSIGNAL;
> -
> - result = kernel_recvmsg(sock, &msg, &iov, 1, size, MSG_WAITALL);
> - if (result <= 0) {
> - pr_debug("receive sock %p buf %p size %u ret %d total %d\n",
> - sock, buf, size, result, total);
> - goto err;
> - }
> -
> - size -= result;
> - buf += result;
> - total += result;
> - } while (size > 0);
> + ud->tcp_socket->sk->sk_allocation = GFP_NOIO;
> + iov.iov_base = buf;
> + iov.iov_len = size;
> + msg.msg_name = NULL;
> + msg.msg_namelen = 0;
> + msg.msg_control = NULL;
> + msg.msg_controllen = 0;
> + msg.msg_namelen = 0;
> + msg.msg_flags = MSG_NOSIGNAL;
> +
> + result = usbip_recvmsg(ud, &msg, &iov, 1, size, MSG_WAITALL);
> +

Don't put a blank line here.

> + if (result < 0) {
> + pr_debug("receive sock %p buf %p size %u ret %d total %d\n",
> + ud->tcp_socket, buf, size, result, total);
> + return result;
> + }
>

regards,
dan carpenter


\
 
 \ /
  Last update: 2013-09-30 15:01    [W:0.177 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site