From: Kuniyuki Iwashima <kuniyu@amazon.com>
To: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Willem de Bruijn <willemb@google.com>
Cc: Simon Horman <horms@kernel.org>,
Kuniyuki Iwashima <kuniyu@amazon.com>,
Kuniyuki Iwashima <kuni1840@gmail.com>,
Chuck Lever <chuck.lever@oracle.com>,
Jeff Layton <jlayton@kernel.org>,
Matthieu Baerts <matttbe@kernel.org>,
"Keith Busch" <kbusch@kernel.org>, Jens Axboe <axboe@kernel.dk>,
Christoph Hellwig <hch@lst.de>,
Wenjia Zhang <wenjia@linux.ibm.com>,
Jan Karcher <jaka@linux.ibm.com>,
Steve French <sfrench@samba.org>, <netdev@vger.kernel.org>,
<mptcp@lists.linux.dev>, <linux-nfs@vger.kernel.org>,
<linux-rdma@vger.kernel.org>, <linux-nvme@lists.infradead.org>
Subject: [PATCH v2 net-next 7/7] socket: Clean up kdoc for sock_create() and sock_create_lite().
Date: Fri, 23 May 2025 11:21:13 -0700 [thread overview]
Message-ID: <20250523182128.59346-8-kuniyu@amazon.com> (raw)
In-Reply-To: <20250523182128.59346-1-kuniyu@amazon.com>
__sock_create() is now static and the same doc exists on sock_create()
and sock_create_kern().
Also, __sock_create() says "On failure @res is set to %NULL.", but
this is always false.
In addition, the old style kdoc is a bit corrupted and we can't see the
DESCRIPTION section:
$ scripts/kernel-doc -man net/socket.c | scripts/split-man.pl /tmp/man
$ man /tmp/man/sock_create.9
Let's clean them up.
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
---
net/socket.c | 58 ++++++++++++++++++++++------------------------------
1 file changed, 25 insertions(+), 33 deletions(-)
diff --git a/net/socket.c b/net/socket.c
index 9ad352183fae..e4e9f5cc5d70 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1315,18 +1315,20 @@ static long sock_ioctl(struct file *file, unsigned cmd, unsigned long arg)
}
/**
- * sock_create_lite - creates a socket
- * @family: protocol family (AF_INET, ...)
- * @type: communication type (SOCK_STREAM, ...)
- * @protocol: protocol (0, ...)
- * @res: new socket
+ * sock_create_lite - creates a socket
*
- * Creates a new socket and assigns it to @res, passing through LSM.
- * The new socket initialization is not complete, see kernel_accept().
- * Returns 0 or an error. On failure @res is set to %NULL.
- * This function internally uses GFP_KERNEL.
+ * @family: protocol family (AF_INET, ...)
+ * @type: communication type (SOCK_STREAM, ...)
+ * @protocol: protocol (0, ...)
+ * @res: new socket
+ *
+ * Creates a new socket and assigns it to @res, passing through LSM.
+ *
+ * The new socket initialization is not complete, see kernel_accept().
+ *
+ * Context: Process context. This function internally uses GFP_KERNEL.
+ * Return: 0 or an error. On failure @res is set to %NULL.
*/
-
int sock_create_lite(int family, int type, int protocol, struct socket **res)
{
int err;
@@ -1452,21 +1454,6 @@ int sock_wake_async(struct socket_wq *wq, int how, int band)
}
EXPORT_SYMBOL(sock_wake_async);
-/**
- * __sock_create - creates a socket
- * @net: net namespace
- * @family: protocol family (AF_INET, ...)
- * @type: communication type (SOCK_STREAM, ...)
- * @protocol: protocol (0, ...)
- * @res: new socket
- * @kern: boolean for kernel space sockets
- *
- * Creates a new socket and assigns it to @res, passing through LSM.
- * Returns 0 or an error. On failure @res is set to %NULL. @kern must
- * be set to true if the socket resides in kernel space.
- * This function internally uses GFP_KERNEL.
- */
-
static int __sock_create(struct net *net, int family, int type, int protocol,
struct socket **res, int kern)
{
@@ -1583,16 +1570,21 @@ static int __sock_create(struct net *net, int family, int type, int protocol,
}
/**
- * sock_create - creates a socket
- * @family: protocol family (AF_INET, ...)
- * @type: communication type (SOCK_STREAM, ...)
- * @protocol: protocol (0, ...)
- * @res: new socket
+ * sock_create - creates a socket for userspace
+ *
+ * @family: protocol family (AF_INET, ...)
+ * @type: communication type (SOCK_STREAM, ...)
+ * @protocol: protocol (0, ...)
+ * @res: new socket
*
- * A wrapper around __sock_create().
- * Returns 0 or an error. This function internally uses GFP_KERNEL.
+ * Creates a new socket and assigns it to @res, passing through LSM.
+ *
+ * The socket is for userspace and should be exposed via a file
+ * descriptor and BPF hooks (see inet_create(), inet_release(), etc).
+ *
+ * Context: Process context. This function internally uses GFP_KERNEL.
+ * Return: 0 or an error.
*/
-
int sock_create(int family, int type, int protocol, struct socket **res)
{
return __sock_create(current->nsproxy->net_ns, family, type, protocol, res, 0);
--
2.49.0
prev parent reply other threads:[~2025-05-23 18:24 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-23 18:21 [PATCH v2 net-next 0/7] socket: Make sock_create_kern() robust against misuse Kuniyuki Iwashima
2025-05-23 18:21 ` [PATCH v2 net-next 1/7] socket: Un-export __sock_create() Kuniyuki Iwashima
2025-05-26 5:29 ` Christoph Hellwig
2025-05-26 10:06 ` David Laight
2025-05-30 2:42 ` Kuniyuki Iwashima
2025-05-23 18:21 ` [PATCH v2 net-next 2/7] socket: Rename sock_create_kern() to __sock_create_kern() Kuniyuki Iwashima
2025-05-26 5:30 ` Christoph Hellwig
2025-05-29 21:29 ` David Laight
2025-05-30 3:05 ` Kuniyuki Iwashima
2025-05-30 6:48 ` David Laight
2025-05-30 2:45 ` Kuniyuki Iwashima
2025-05-23 18:21 ` [PATCH v2 net-next 3/7] socket: Restore sock_create_kern() Kuniyuki Iwashima
2025-05-26 5:32 ` Christoph Hellwig
2025-05-30 2:53 ` Kuniyuki Iwashima
2025-06-02 5:08 ` Christoph Hellwig
2025-06-03 21:30 ` David Laight
2025-06-04 18:36 ` Kuniyuki Iwashima
2025-05-23 18:21 ` [PATCH v2 net-next 4/7] smb: client: Add missing net_passive_dec() Kuniyuki Iwashima
2025-05-23 18:21 ` [PATCH v2 net-next 5/7] socket: Remove kernel socket conversion except for net/rds/ Kuniyuki Iwashima
2025-05-26 5:33 ` Christoph Hellwig
2025-05-30 2:59 ` Kuniyuki Iwashima
2025-06-02 5:08 ` Christoph Hellwig
2025-05-23 18:21 ` [PATCH v2 net-next 6/7] socket: Replace most sock_create() calls with sock_create_kern() Kuniyuki Iwashima
2025-05-26 5:33 ` Christoph Hellwig
2025-05-26 5:35 ` Christoph Hellwig
2025-05-30 3:03 ` Kuniyuki Iwashima
2025-06-02 5:09 ` Christoph Hellwig
2025-06-02 21:52 ` Kuniyuki Iwashima
2025-06-03 4:50 ` Christoph Hellwig
2025-06-04 18:20 ` Kuniyuki Iwashima
2025-06-05 4:28 ` Christoph Hellwig
2025-05-23 18:21 ` Kuniyuki Iwashima [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250523182128.59346-8-kuniyu@amazon.com \
--to=kuniyu@amazon.com \
--cc=axboe@kernel.dk \
--cc=chuck.lever@oracle.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hch@lst.de \
--cc=horms@kernel.org \
--cc=jaka@linux.ibm.com \
--cc=jlayton@kernel.org \
--cc=kbusch@kernel.org \
--cc=kuba@kernel.org \
--cc=kuni1840@gmail.com \
--cc=linux-nfs@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-rdma@vger.kernel.org \
--cc=matttbe@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sfrench@samba.org \
--cc=wenjia@linux.ibm.com \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox