From: Stephen Hemminger <shemminger@osdl.org>
To: David Miller <davem@davemloft.net>
Cc: Paul McKenney <paulmck@us.ibm.com>, netdev@vger.kernel.org
Cc: akpm@osdl.org
Subject: [PATCH 5/5] sock_register interface changes
Date: Wed, 09 Aug 2006 11:31:43 -0700 [thread overview]
Message-ID: <20060809183349.701469780@localhost.localdomain> (raw)
In-Reply-To: 20060809183138.332023530@localhost.localdomain
[-- Attachment #1: sock-create-api.patch --]
[-- Type: text/plain, Size: 2058 bytes --]
The sock_register() doesn't change the family, so the protocols can
define it read-only. No caller ever checks return value from sock_unregister()
---
include/linux/net.h | 4 ++--
net/socket.c | 10 ++++------
2 files changed, 6 insertions(+), 8 deletions(-)
--- net-2.6.orig/include/linux/net.h 2006-08-09 11:19:19.000000000 -0700
+++ net-2.6/include/linux/net.h 2006-08-09 11:19:24.000000000 -0700
@@ -176,8 +176,8 @@
struct kvec;
extern int sock_wake_async(struct socket *sk, int how, int band);
-extern int sock_register(struct net_proto_family *fam);
-extern int sock_unregister(int family);
+extern int sock_register(const struct net_proto_family *fam);
+extern void sock_unregister(int family);
extern int sock_create(int family, int type, int proto,
struct socket **res);
extern int sock_create_kern(int family, int type, int proto,
--- net-2.6.orig/net/socket.c 2006-08-09 11:19:22.000000000 -0700
+++ net-2.6/net/socket.c 2006-08-09 11:19:24.000000000 -0700
@@ -147,7 +147,7 @@
*/
static DEFINE_SPINLOCK(net_family_lock);
-static const struct net_proto_family *net_families[NPROTO];
+static const struct net_proto_family *net_families[NPROTO] __read_mostly;
/*
* Statistics counters of the socket lists
@@ -2070,7 +2070,7 @@
* socket interface. The value ops->family coresponds to the
* socket system call protocol family.
*/
-int sock_register(struct net_proto_family *ops)
+int sock_register(const struct net_proto_family *ops)
{
int err;
@@ -2106,10 +2106,9 @@
* a module then it needs to provide its own protection in
* the ops->create routine.
*/
-int sock_unregister(int family)
+void sock_unregister(int family)
{
- if (family < 0 || family >= NPROTO)
- return -EINVAL;
+ BUG_ON(family < 0 || family >= NPROTO);
spin_lock(&net_family_lock);
net_families[family] = NULL;
@@ -2118,7 +2117,6 @@
synchronize_rcu();
printk(KERN_INFO "NET: Unregistered protocol family %d\n", family);
- return 0;
}
static int __init sock_init(void)
--
next prev parent reply other threads:[~2006-08-09 18:41 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-09 18:31 [PATCH 0/5] net socket family patches Stephen Hemminger
2006-08-09 18:31 ` [PATCH 1/5] sock_create bad error return Stephen Hemminger
2006-08-10 3:47 ` David Miller
2006-08-10 17:06 ` Stephen Hemminger
2006-08-09 18:31 ` [PATCH 2/5] socket: code style cleanup Stephen Hemminger
2006-08-10 3:49 ` David Miller
2006-08-10 8:19 ` Andrew Morton
2006-08-10 8:55 ` David Miller
2006-08-09 18:31 ` [PATCH 3/5] net: drop unused elements from net_proto_family Stephen Hemminger
2006-08-10 3:50 ` David Miller
2006-08-09 18:31 ` [PATCH 4/5] net: socket family using RCU Stephen Hemminger
2006-08-10 4:00 ` David Miller
2006-08-10 18:36 ` Paul E. McKenney
2006-08-10 20:28 ` Stephen Hemminger
2006-08-11 0:46 ` Paul E. McKenney
2006-08-09 18:31 ` Stephen Hemminger [this message]
2006-08-10 4:03 ` [PATCH 5/5] sock_register interface changes David Miller
2006-08-10 0:06 ` [PATCH 0/5] net socket family patches David Miller
2006-08-10 5:36 ` Alexey Toptygin
2006-08-10 18:55 ` Randy.Dunlap
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=20060809183349.701469780@localhost.localdomain \
--to=shemminger@osdl.org \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=paulmck@us.ibm.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;
as well as URLs for NNTP newsgroup(s).