linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [2.6 patch] net/netlink/af_netlink.c: possible cleanups
@ 2004-12-15  0:46 Adrian Bunk
  2004-12-15 14:07 ` jamal
  0 siblings, 1 reply; 3+ messages in thread
From: Adrian Bunk @ 2004-12-15  0:46 UTC (permalink / raw)
  To: Alan Cox, Alexey Kuznetsov; +Cc: netdev, linux-kernel

The patch below contains the following possible cleanups:
- make the needlessly global function netlink_getsockbypid static
- remove the EXPORT_SYMBOL'ed but unused functions netlink_attach and 
  netlink_detach

Please review whether these changes are correct or whether they conflict 
with pending patches.


diffstat output:
 include/linux/netlink.h  |    3 ---
 net/netlink/af_netlink.c |   28 +---------------------------
 2 files changed, 1 insertion(+), 30 deletions(-)


Signed-off-by: Adrian Bunk <bunk@stusta.de>

--- linux-2.6.10-rc3-mm1-full/include/linux/netlink.h.old	2004-12-14 21:43:16.000000000 +0100
+++ linux-2.6.10-rc3-mm1-full/include/linux/netlink.h	2004-12-14 21:44:27.000000000 +0100
@@ -116,8 +116,6 @@
 #define NETLINK_CREDS(skb)	(&NETLINK_CB((skb)).creds)
 
 
-extern int netlink_attach(int unit, int (*function)(int,struct sk_buff *skb));
-extern void netlink_detach(int unit);
 extern int netlink_post(int unit, struct sk_buff *skb);
 extern struct sock *netlink_kernel_create(int unit, void (*input)(struct sock *sk, int len));
 extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err);
@@ -129,7 +127,6 @@
 extern int netlink_unregister_notifier(struct notifier_block *nb);
 
 /* finegrained unicast helpers: */
-struct sock *netlink_getsockbypid(struct sock *ssk, u32 pid);
 struct sock *netlink_getsockbyfilp(struct file *filp);
 int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock, long timeo);
 void netlink_detachskb(struct sock *sk, struct sk_buff *skb);
--- linux-2.6.10-rc3-mm1-full/net/netlink/af_netlink.c.old	2004-12-14 21:43:31.000000000 +0100
+++ linux-2.6.10-rc3-mm1-full/net/netlink/af_netlink.c	2004-12-14 21:44:34.000000000 +0100
@@ -546,7 +546,7 @@
 	}
 }
 
-struct sock *netlink_getsockbypid(struct sock *ssk, u32 pid)
+static struct sock *netlink_getsockbypid(struct sock *ssk, u32 pid)
 {
 	int protocol = ssk->sk_protocol;
 	struct sock *sock;
@@ -1210,30 +1210,6 @@
  *	Backward compatibility.
  */	
  
-int netlink_attach(int unit, int (*function)(int, struct sk_buff *skb))
-{
-	struct sock *sk = netlink_kernel_create(unit, NULL);
-	if (sk == NULL)
-		return -ENOBUFS;
-	nlk_sk(sk)->handler = function;
-	write_lock_bh(&nl_emu_lock);
-	netlink_kernel[unit] = sk->sk_socket;
-	write_unlock_bh(&nl_emu_lock);
-	return 0;
-}
-
-void netlink_detach(int unit)
-{
-	struct socket *sock;
-
-	write_lock_bh(&nl_emu_lock);
-	sock = netlink_kernel[unit];
-	netlink_kernel[unit] = NULL;
-	write_unlock_bh(&nl_emu_lock);
-
-	sock_release(sock);
-}
-
 int netlink_post(int unit, struct sk_buff *skb)
 {
 	struct socket *sock;
@@ -1522,7 +1498,5 @@
 EXPORT_SYMBOL(netlink_unregister_notifier);
 
 #if defined(CONFIG_NETLINK_DEV) || defined(CONFIG_NETLINK_DEV_MODULE)
-EXPORT_SYMBOL(netlink_attach);
-EXPORT_SYMBOL(netlink_detach);
 EXPORT_SYMBOL(netlink_post);
 #endif


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

* Re: [2.6 patch] net/netlink/af_netlink.c: possible cleanups
  2004-12-15  0:46 [2.6 patch] net/netlink/af_netlink.c: possible cleanups Adrian Bunk
@ 2004-12-15 14:07 ` jamal
  2004-12-28  3:08   ` David S. Miller
  0 siblings, 1 reply; 3+ messages in thread
From: jamal @ 2004-12-15 14:07 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: Alan Cox, Alexey Kuznetsov, netdev, linux-kernel


I think this should be left alone for now; what we need to do is
deprecate NETLINK_DEV incase someone is still using it.
Else we could get rid of it totaly including what Adrian is deleting
below. Any users of NETLINK_DEV? Maybe deleting the feature will get
someone whining? ;->

cheers,
jamal

On Tue, 2004-12-14 at 19:46, Adrian Bunk wrote:
> The patch below contains the following possible cleanups:
> - make the needlessly global function netlink_getsockbypid static
> - remove the EXPORT_SYMBOL'ed but unused functions netlink_attach and 
>   netlink_detach
> 
> Please review whether these changes are correct or whether they conflict 
> with pending patches.
> 
> 
> diffstat output:
>  include/linux/netlink.h  |    3 ---
>  net/netlink/af_netlink.c |   28 +---------------------------
>  2 files changed, 1 insertion(+), 30 deletions(-)
> 
> 
> Signed-off-by: Adrian Bunk <bunk@stusta.de>
> 
> --- linux-2.6.10-rc3-mm1-full/include/linux/netlink.h.old	2004-12-14 21:43:16.000000000 +0100
> +++ linux-2.6.10-rc3-mm1-full/include/linux/netlink.h	2004-12-14 21:44:27.000000000 +0100
> @@ -116,8 +116,6 @@
>  #define NETLINK_CREDS(skb)	(&NETLINK_CB((skb)).creds)
>  
> 
> -extern int netlink_attach(int unit, int (*function)(int,struct sk_buff *skb));
> -extern void netlink_detach(int unit);
>  extern int netlink_post(int unit, struct sk_buff *skb);
>  extern struct sock *netlink_kernel_create(int unit, void (*input)(struct sock *sk, int len));
>  extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err);
> @@ -129,7 +127,6 @@
>  extern int netlink_unregister_notifier(struct notifier_block *nb);
>  
>  /* finegrained unicast helpers: */
> -struct sock *netlink_getsockbypid(struct sock *ssk, u32 pid);
>  struct sock *netlink_getsockbyfilp(struct file *filp);
>  int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock, long timeo);
>  void netlink_detachskb(struct sock *sk, struct sk_buff *skb);
> --- linux-2.6.10-rc3-mm1-full/net/netlink/af_netlink.c.old	2004-12-14 21:43:31.000000000 +0100
> +++ linux-2.6.10-rc3-mm1-full/net/netlink/af_netlink.c	2004-12-14 21:44:34.000000000 +0100
> @@ -546,7 +546,7 @@
>  	}
>  }
>  
> -struct sock *netlink_getsockbypid(struct sock *ssk, u32 pid)
> +static struct sock *netlink_getsockbypid(struct sock *ssk, u32 pid)
>  {
>  	int protocol = ssk->sk_protocol;
>  	struct sock *sock;
> @@ -1210,30 +1210,6 @@
>   *	Backward compatibility.
>   */	
>   
> -int netlink_attach(int unit, int (*function)(int, struct sk_buff *skb))
> -{
> -	struct sock *sk = netlink_kernel_create(unit, NULL);
> -	if (sk == NULL)
> -		return -ENOBUFS;
> -	nlk_sk(sk)->handler = function;
> -	write_lock_bh(&nl_emu_lock);
> -	netlink_kernel[unit] = sk->sk_socket;
> -	write_unlock_bh(&nl_emu_lock);
> -	return 0;
> -}
> -
> -void netlink_detach(int unit)
> -{
> -	struct socket *sock;
> -
> -	write_lock_bh(&nl_emu_lock);
> -	sock = netlink_kernel[unit];
> -	netlink_kernel[unit] = NULL;
> -	write_unlock_bh(&nl_emu_lock);
> -
> -	sock_release(sock);
> -}
> -
>  int netlink_post(int unit, struct sk_buff *skb)
>  {
>  	struct socket *sock;
> @@ -1522,7 +1498,5 @@
>  EXPORT_SYMBOL(netlink_unregister_notifier);
>  
>  #if defined(CONFIG_NETLINK_DEV) || defined(CONFIG_NETLINK_DEV_MODULE)
> -EXPORT_SYMBOL(netlink_attach);
> -EXPORT_SYMBOL(netlink_detach);
>  EXPORT_SYMBOL(netlink_post);
>  #endif
> 
> 
> 


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

* Re: [2.6 patch] net/netlink/af_netlink.c: possible cleanups
  2004-12-15 14:07 ` jamal
@ 2004-12-28  3:08   ` David S. Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David S. Miller @ 2004-12-28  3:08 UTC (permalink / raw)
  To: hadi; +Cc: bunk, alan, kuznet, netdev, linux-kernel

On 15 Dec 2004 09:07:03 -0500
jamal <hadi@cyberus.ca> wrote:

> I think this should be left alone for now; what we need to do is
> deprecate NETLINK_DEV incase someone is still using it.
> Else we could get rid of it totaly including what Adrian is deleting
> below. Any users of NETLINK_DEV? Maybe deleting the feature will get
> someone whining? ;->

While I agree we should probably just kill NETLINK_DEV now
and don't look back, I have applied Adrian's patch for
the time being.

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

end of thread, other threads:[~2004-12-28  3:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-15  0:46 [2.6 patch] net/netlink/af_netlink.c: possible cleanups Adrian Bunk
2004-12-15 14:07 ` jamal
2004-12-28  3:08   ` 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).