All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@oss.sgi.com
Subject: [PATCH][NET] Assign inet transport sockets to the right module
Date: Mon, 15 Nov 2004 04:19:34 -0200	[thread overview]
Message-ID: <41984A76.70406@conectiva.com.br> (raw)

[-- 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,


             reply	other threads:[~2004-11-15  6:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-15  6:19 Arnaldo Carvalho de Melo [this message]
2004-11-15 23:14 ` [PATCH][NET] Assign inet transport sockets to the right module David S. Miller
2004-11-16  0:32   ` Arnaldo Carvalho de Melo
2004-11-18  0:05 ` David S. Miller

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=41984A76.70406@conectiva.com.br \
    --to=acme@conectiva.com.br \
    --cc=davem@davemloft.net \
    --cc=netdev@oss.sgi.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.