take2: new module infrastructure for net_proto_family
Subsystems (3)
PATCH 1/1 take2: new module infrastructure for net_proto_family
Hi David,
Please consider pulling from:
bk://kernel.bkbits.net/acme/net-2.5
It has your suggestions implemented.
Waiting for OK so that I can submit the conversion for the protocols.
- Arnaldo
You can import this changeset into BK by piping this whole message to:
'| bk receive [path to repository]' or apply the patch as usual.
===================================================================
[email protected], 2003-04-19 20:26:12-03:00, [email protected]
o net: new module infrastructure for net_proto_family
Next batch of changesets will fix the legacy protocols (IPX, LLC, etc). Tested with LLC and IPX already.
include/linux/net.h | 13 ++++++++----- net/socket.c | 19 ++++++++++++++----- 2 files changed, 22 insertions(+), 10 deletions(-)
include/linux/net.h +8 -5
@@ -127,14 +127,17 @@ int offset, size_t size, int flags); }; +struct module ; +struct net_proto_family { -int family; -int (*create)(struct socket *sock,int protocol); +int family; +int (*create)(struct socket *sock,int protocol);/* These are counters for the number of different methods of each we support */ -short authentication; -short encryption; -short encrypt_net; +short authentication; +short encryption; +short encrypt_net; +struct module *owner; };struct iovec ;
net/socket.c +14 -5
@@ -506,8 +506,13 @@void sock_release (struct socket *sock) { -if (sock->ops) +if (sock->ops) { +const int family = sock->ops->family; + sock->ops->release (sock); + sock->ops =NULL ; +module_put (net_families[family]->owner); + }if (sock->fasync_list)printk (KERN_ERR "sock_release: fasync list not empty!\n" );
@@ -1058,11 +1063,12 @@ sock->type = type; + i = -EBUSY ; +if (!try_module_get (net_families[family]->owner)) + goto out_release; +if ((i = net_families[family]->create (sock, protocol)) <0 ) - { -sock_release (sock); - goto out; - } + goto out_release; *res = sock;security_socket_post_create (sock, family, type, protocol);
@@ -1070,6 +1076,9 @@ out:net_family_read_unlock ();return i; +out_release: +sock_release (sock); + goto out; }asmlinkage long sys_socket (int family,int type,int protocol)
===================================================================
This BitKeeper patch contains the following changesets:
1.1119
## Wrapped with gzip_uu ##
M'XL( #<H3X ^U6;6_;-A#^+/Z*&_K%R6*9I-XL&0[2)$47U.B"= $VK(-! M4[0E5!8-BHYCS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B9^C'4$>XZ0[Y!+^W8J$*):JMG&G)$KW<),/-#5K@6<<QE;S(A35X/ BCPU)=;@/SH.O[WHR4_)3M9P/93Q!6M,)^0)3*('(1@H
From: Arnaldo Carvalho de Melo <[email protected]>
Date: Sat, 19 Apr 2003 20:34:08 -0300
Please consider pulling from:
bk://kernel.bkbits.net/acme/net-2.5
It has your suggestions implemented.
Pulled, thanks.
Note that, eventually we'll need to handle the struct sock side of this equation. Consider that struct sock's can exist long after the user struct socket is closed (TCP is the best example), yet they reference internals to the protocol module (via sk and skb callbacks, hash table linkage, etc.).
We can deal with this later, let's merge your stuff in first.
Em Sat, Apr 19, 2003 at 06:41:22PM -0700, David S. Miller escreveu:
Quoted 4 lines
Note that, eventually we'll need to handle the struct sock side of this equation. Consider that struct sock's can exist long after the user struct socket is closed (TCP is the best example), yet they reference internals to the protocol module (via sk and skb callbacks, hash table linkage, etc.).
humm, I'll work on this later today, tweaking sk_alloc/sk_free.
Quoted 1 line
We can deal with this later, let's merge your stuff in first.
Thanks, now to easter lunch :-)
- Arnaldo
Em Sun, Apr 20, 2003 at 01:02:18PM -0300, Arnaldo C. Melo escreveu:
Quoted 7 lines
Em Sat, Apr 19, 2003 at 06:41:22PM -0700, David S. Miller escreveu:
Quoted 4 lines
Note that, eventually we'll need to handle the struct sock side of this equation. Consider that struct sock's can exist long after the user struct socket is closed (TCP is the best example), yet they reference internals to the protocol module (via sk and skb callbacks, hash table linkage, etc.).
humm, I'll work on this later today, tweaking sk_alloc/sk_free.
as net_families is static in net/socket.c we'll need npf_get and npf_put (net proto family get/put), is the naming OK for you?
Quoted 5 lines
Quoted 1 line
We can deal with this later, let's merge your stuff in first.
Thanks, now to easter lunch :-)
- Arnaldo
From: Arnaldo Carvalho de Melo <[email protected]>
Date: Sun, 20 Apr 2003 13:10:08 -0300
Em Sun, Apr 20, 2003 at 01:02:18PM -0300, Arnaldo C. Melo escreveu:
Quoted 1 line
humm, I'll work on this later today, tweaking sk_alloc/sk_free.
as net_families is static in net/socket.c we'll need npf_get and npf_put (net proto family get/put), is the naming OK for you?
I'd prefer net_family_{get,put}().