netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][NET] Assign inet transport sockets to the right module
@ 2004-11-15  6:19 Arnaldo Carvalho de Melo
  2004-11-15 23:14 ` David S. Miller
  2004-11-18  0:05 ` David S. Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2004-11-15  6:19 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev

[-- Attachment #1: Type: text/plain, Size: 133 bytes --]

Hi David,

	Please take a look if it makes sense, if so please pull from:

bk://kernel.bkbits.net/acme/sock-2.6

Regards,

- Arnaldo

[-- Attachment #2: sk_prot_owner.patch --]
[-- Type: text/plain, Size: 4548 bytes --]

===================================================================


ChangeSet@1.2148, 2004-11-15 04:05:17-02:00, acme@conectiva.com.br
  [NET] Assign inet transport sockets to the right module
  
  This is another case where when all the protocols use sk->sk_prot
  we can remove another member from struct sock, sk->sk_owner, instead
  using the sk->sk_prot->owner, i.e. this property is not per socket
  instance, but per protocol.
  
  Signed-off-by: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
  Signed-off-by: David S. Miller <davem@davemloft.net>


 include/net/sock.h  |    2 ++
 net/ipv4/af_inet.c  |    2 +-
 net/ipv4/raw.c      |    1 +
 net/ipv4/tcp_ipv4.c |    1 +
 net/ipv4/udp.c      |    1 +
 net/ipv6/af_inet6.c |    2 +-
 net/ipv6/raw.c      |    1 +
 net/ipv6/tcp_ipv6.c |    1 +
 net/ipv6/udp.c      |    1 +
 net/sctp/socket.c   |    2 ++
 10 files changed, 12 insertions(+), 2 deletions(-)


diff -Nru a/include/net/sock.h b/include/net/sock.h
--- a/include/net/sock.h	2004-11-15 04:12:55 -02:00
+++ b/include/net/sock.h	2004-11-15 04:12:55 -02:00
@@ -556,6 +556,8 @@
 	kmem_cache_t		*slab;
 	int			slab_obj_size;
 
+	struct module		*owner;
+
 	char			name[32];
 
 	struct {
diff -Nru a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
--- a/net/ipv4/af_inet.c	2004-11-15 04:12:55 -02:00
+++ b/net/ipv4/af_inet.c	2004-11-15 04:12:55 -02:00
@@ -309,7 +309,7 @@
 	inet->id = 0;
 
 	sock_init_data(sock, sk);
-	sk_set_owner(sk, THIS_MODULE);
+	sk_set_owner(sk, sk->sk_prot->owner);
 
 	sk->sk_destruct	   = inet_sock_destruct;
 	sk->sk_family	   = PF_INET;
diff -Nru a/net/ipv4/raw.c b/net/ipv4/raw.c
--- a/net/ipv4/raw.c	2004-11-15 04:12:55 -02:00
+++ b/net/ipv4/raw.c	2004-11-15 04:12:55 -02:00
@@ -706,6 +706,7 @@
 
 struct proto raw_prot = {
 	.name =		"RAW",
+	.owner =	THIS_MODULE,
 	.close =	raw_close,
 	.connect =	ip4_datagram_connect,
 	.disconnect =	udp_disconnect,
diff -Nru a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
--- a/net/ipv4/tcp_ipv4.c	2004-11-15 04:12:55 -02:00
+++ b/net/ipv4/tcp_ipv4.c	2004-11-15 04:12:55 -02:00
@@ -2598,6 +2598,7 @@
 
 struct proto tcp_prot = {
 	.name			= "TCP",
+	.owner			= THIS_MODULE,
 	.close			= tcp_close,
 	.connect		= tcp_v4_connect,
 	.disconnect		= tcp_disconnect,
diff -Nru a/net/ipv4/udp.c b/net/ipv4/udp.c
--- a/net/ipv4/udp.c	2004-11-15 04:12:55 -02:00
+++ b/net/ipv4/udp.c	2004-11-15 04:12:55 -02:00
@@ -1306,6 +1306,7 @@
 
 struct proto udp_prot = {
  	.name =		"UDP",
+	.owner =	THIS_MODULE,
 	.close =	udp_close,
 	.connect =	ip4_datagram_connect,
 	.disconnect =	udp_disconnect,
diff -Nru a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
--- a/net/ipv6/af_inet6.c	2004-11-15 04:12:55 -02:00
+++ b/net/ipv6/af_inet6.c	2004-11-15 04:12:55 -02:00
@@ -174,7 +174,7 @@
 		goto out;
 
 	sock_init_data(sock, sk);
-	sk_set_owner(sk, THIS_MODULE);
+	sk_set_owner(sk, sk->sk_prot->owner);
 
 	rc = 0;
 	sk->sk_prot = answer_prot;
diff -Nru a/net/ipv6/raw.c b/net/ipv6/raw.c
--- a/net/ipv6/raw.c	2004-11-15 04:12:55 -02:00
+++ b/net/ipv6/raw.c	2004-11-15 04:12:55 -02:00
@@ -975,6 +975,7 @@
 
 struct proto rawv6_prot = {
 	.name =		"RAW",
+	.owner =	THIS_MODULE,
 	.close =	rawv6_close,
 	.connect =	ip6_datagram_connect,
 	.disconnect =	udp_disconnect,
diff -Nru a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
--- a/net/ipv6/tcp_ipv6.c	2004-11-15 04:12:55 -02:00
+++ b/net/ipv6/tcp_ipv6.c	2004-11-15 04:12:55 -02:00
@@ -2132,6 +2132,7 @@
 
 struct proto tcpv6_prot = {
 	.name			= "TCPv6",
+	.owner			= THIS_MODULE,
 	.close			= tcp_close,
 	.connect		= tcp_v6_connect,
 	.disconnect		= tcp_disconnect,
diff -Nru a/net/ipv6/udp.c b/net/ipv6/udp.c
--- a/net/ipv6/udp.c	2004-11-15 04:12:55 -02:00
+++ b/net/ipv6/udp.c	2004-11-15 04:12:55 -02:00
@@ -1033,6 +1033,7 @@
 
 struct proto udpv6_prot = {
 	.name =		"UDP",
+	.owner =	THIS_MODULE,
 	.close =	udpv6_close,
 	.connect =	ip6_datagram_connect,
 	.disconnect =	udp_disconnect,
diff -Nru a/net/sctp/socket.c b/net/sctp/socket.c
--- a/net/sctp/socket.c	2004-11-15 04:12:55 -02:00
+++ b/net/sctp/socket.c	2004-11-15 04:12:55 -02:00
@@ -4652,6 +4652,7 @@
 /* This proto struct describes the ULP interface for SCTP.  */
 struct proto sctp_prot = {
 	.name        =	"SCTP",
+	.owner       =	THIS_MODULE,
 	.close       =	sctp_close,
 	.connect     =	sctp_connect,
 	.disconnect  =	sctp_disconnect,
@@ -4675,6 +4676,7 @@
 #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
 struct proto sctpv6_prot = {
 	.name		= "SCTPv6",
+	.owner		= THIS_MODULE,
 	.close		= sctp_close,
 	.connect	= sctp_connect,
 	.disconnect	= sctp_disconnect,


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

end of thread, other threads:[~2004-11-18  0:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-15  6:19 [PATCH][NET] Assign inet transport sockets to the right module Arnaldo Carvalho de Melo
2004-11-15 23:14 ` David S. Miller
2004-11-16  0:32   ` Arnaldo Carvalho de Melo
2004-11-18  0:05 ` David S. 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).