patch-2.4.0-test10 linux/net/unix/af_unix.c

Next file: linux/net/unix/sysctl_net_unix.c
Previous file: linux/net/sunrpc/svcsock.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test9/linux/net/unix/af_unix.c linux/net/unix/af_unix.c
@@ -8,7 +8,7 @@
  *		as published by the Free Software Foundation; either version
  *		2 of the License, or (at your option) any later version.
  *
- * Version:	$Id: af_unix.c,v 1.105 2000/08/16 10:58:22 davem Exp $
+ * Version:	$Id: af_unix.c,v 1.107 2000/10/19 01:05:36 davem Exp $
  *
  * Fixes:
  *		Linus Torvalds	:	Assorted bug cures.
@@ -46,6 +46,7 @@
  *		Artur Skawina   :	Hash function optimizations
  *	     Alexey Kuznetsov   :	Full scale SMP. Lot of bugs are introduced 8)
  *	      Malcolm Beattie   :	Set peercred for socketpair
+ *	     Michal Ostrowski   :       Module initialization cleanup.
  *
  *
  * Known differences from reference BSD that was tested:
@@ -1845,16 +1846,12 @@
 	unix_create
 };
 
-#ifdef MODULE
 #ifdef CONFIG_SYSCTL
 extern void unix_sysctl_register(void);
 extern void unix_sysctl_unregister(void);
 #endif
 
-int init_module(void)
-#else
-void __init unix_proto_init(struct net_proto *pro)
-#endif
+static int __init af_unix_init(void)
 {
 	struct sk_buff *dummy_skb;
 	
@@ -1862,28 +1859,21 @@
 	if (sizeof(struct unix_skb_parms) > sizeof(dummy_skb->cb))
 	{
 		printk(KERN_CRIT "unix_proto_init: panic\n");
-#ifdef MODULE
 		return -1;
-#else
-		return;
-#endif
 	}
 	sock_register(&unix_family_ops);
 #ifdef CONFIG_PROC_FS
 	create_proc_read_entry("net/unix", 0, 0, unix_read_proc, NULL);
 #endif
 
-#ifdef MODULE
 #ifdef CONFIG_SYSCTL
 	unix_sysctl_register();
 #endif
 
 	return 0;
-#endif
 }
 
-#ifdef MODULE
-void cleanup_module(void)
+static void __exit af_unix_exit(void)
 {
 	sock_unregister(PF_UNIX);
 #ifdef CONFIG_SYSCTL
@@ -1893,7 +1883,9 @@
 	remove_proc_entry("net/unix", 0);
 #endif
 }
-#endif
+
+module_init(af_unix_init);
+module_exit(af_unix_exit);
 
 /*
  * Local variables:

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)