netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Document the kernel_recvmsg() function
@ 2010-12-10 10:04 Martin Lucina
  2010-12-10 17:28 ` Randy Dunlap
  2010-12-10 19:13 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Martin Lucina @ 2010-12-10 10:04 UTC (permalink / raw)
  To: netdev; +Cc: Martin Sustrik, David S. Miller

[Updated and sent to the netdev mailing list, Eric thx for the pointer]

Hi,

so, today we spent all day figuring out how the kernel_sendmsg() function
*actually* works. This patch adds some documentation to help the next poor
sod.

-mato

>From 1a977fc0b9544c53761ba3c4c26ca1aac2018663 Mon Sep 17 00:00:00 2001
From: Martin Lucina <mato@kotelna.sk>
Date: Thu, 9 Dec 2010 17:11:18 +0100
Subject: [PATCH] Document the kernel_recvmsg() function

Signed-off-by: Martin Lucina <mato@kotelna.sk>
---
 net/socket.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/net/socket.c b/net/socket.c
index 3ca2fd9..088fb3f 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -732,6 +732,21 @@ static int sock_recvmsg_nosec(struct socket *sock, struct msghdr *msg,
 	return ret;
 }
 
+/**
+ * kernel_recvmsg - Receive a message from a socket (kernel space)
+ * @sock:       The socket to receive the message from
+ * @msg:        Received message
+ * @vec:        Input s/g array for message data
+ * @num:        Size of input s/g array
+ * @size:       Number of bytes to read
+ * @flags:      Message flags (MSG_DONTWAIT, etc...)
+ *
+ * On return the msg structure contains the scatter/gather array passed in the
+ * vec argument. The array is modified so that it consists of the unfilled
+ * portion of the original array.
+ *
+ * The returned value is the total number of bytes received, or an error.
+ */
 int kernel_recvmsg(struct socket *sock, struct msghdr *msg,
 		   struct kvec *vec, size_t num, size_t size, int flags)
 {
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Document the kernel_recvmsg() function
  2010-12-10 10:04 [PATCH] Document the kernel_recvmsg() function Martin Lucina
@ 2010-12-10 17:28 ` Randy Dunlap
  2010-12-10 17:35   ` Martin Lucina
  2010-12-10 19:13 ` David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Randy Dunlap @ 2010-12-10 17:28 UTC (permalink / raw)
  To: Martin Lucina; +Cc: netdev, Martin Sustrik, David S. Miller

On Fri, 10 Dec 2010 11:04:05 +0100 Martin Lucina wrote:

> [Updated and sent to the netdev mailing list, Eric thx for the pointer]
> 
> Hi,
> 
> so, today we spent all day figuring out how the kernel_sendmsg() function

                                                  ^^^^^^^^^^^^^^

Maybe you could document that one also??  Thanks.


> *actually* works. This patch adds some documentation to help the next poor
> sod.
> 
> -mato
> 
> From 1a977fc0b9544c53761ba3c4c26ca1aac2018663 Mon Sep 17 00:00:00 2001
> From: Martin Lucina <mato@kotelna.sk>
> Date: Thu, 9 Dec 2010 17:11:18 +0100
> Subject: [PATCH] Document the kernel_recvmsg() function
> 
> Signed-off-by: Martin Lucina <mato@kotelna.sk>
> ---
>  net/socket.c |   15 +++++++++++++++
>  1 files changed, 15 insertions(+), 0 deletions(-)
> 
> diff --git a/net/socket.c b/net/socket.c
> index 3ca2fd9..088fb3f 100644
> --- a/net/socket.c
> +++ b/net/socket.c
> @@ -732,6 +732,21 @@ static int sock_recvmsg_nosec(struct socket *sock, struct msghdr *msg,
>  	return ret;
>  }
>  
> +/**
> + * kernel_recvmsg - Receive a message from a socket (kernel space)
> + * @sock:       The socket to receive the message from
> + * @msg:        Received message
> + * @vec:        Input s/g array for message data
> + * @num:        Size of input s/g array
> + * @size:       Number of bytes to read
> + * @flags:      Message flags (MSG_DONTWAIT, etc...)
> + *
> + * On return the msg structure contains the scatter/gather array passed in the
> + * vec argument. The array is modified so that it consists of the unfilled
> + * portion of the original array.
> + *
> + * The returned value is the total number of bytes received, or an error.
> + */
>  int kernel_recvmsg(struct socket *sock, struct msghdr *msg,
>  		   struct kvec *vec, size_t num, size_t size, int flags)
>  {
> -- 


---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Document the kernel_recvmsg() function
  2010-12-10 17:28 ` Randy Dunlap
@ 2010-12-10 17:35   ` Martin Lucina
  0 siblings, 0 replies; 4+ messages in thread
From: Martin Lucina @ 2010-12-10 17:35 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: netdev, Martin Sustrik, David S. Miller

rdunlap@xenotime.net said:
> On Fri, 10 Dec 2010 11:04:05 +0100 Martin Lucina wrote:
> 
> > [Updated and sent to the netdev mailing list, Eric thx for the pointer]
> > 
> > Hi,
> > 
> > so, today we spent all day figuring out how the kernel_sendmsg() function
> 
>                                                   ^^^^^^^^^^^^^^
> 
> Maybe you could document that one also??  Thanks.

Sorry, that was a typo. But yes, we'll get to kernel_sendmsg(), as soon as
we can actually test that properly...

In any case, kernel_recvmsg() appears to be the more evil of the two, since
it was not obvious at all that it modifies the pointers passed in to kvec.

-mato

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Document the kernel_recvmsg() function
  2010-12-10 10:04 [PATCH] Document the kernel_recvmsg() function Martin Lucina
  2010-12-10 17:28 ` Randy Dunlap
@ 2010-12-10 19:13 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2010-12-10 19:13 UTC (permalink / raw)
  To: mato; +Cc: netdev, sustrik

From: Martin Lucina <mato@kotelna.sk>
Date: Fri, 10 Dec 2010 11:04:05 +0100

> Subject: [PATCH] Document the kernel_recvmsg() function
> 
> Signed-off-by: Martin Lucina <mato@kotelna.sk>

Applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-12-10 19:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-10 10:04 [PATCH] Document the kernel_recvmsg() function Martin Lucina
2010-12-10 17:28 ` Randy Dunlap
2010-12-10 17:35   ` Martin Lucina
2010-12-10 19:13 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).