patch-1.3.39 linux/net/netlink.c

Next file: linux/net/unix/af_unix.c
Previous file: linux/net/ipv4/rarp.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.38/linux/net/netlink.c linux/net/netlink.c
@@ -11,16 +11,7 @@
  * 
  */
 
-#include <linux/config.h>
-
-#if defined(CONFIG_NETLINK) || defined(MODULE)
-#ifdef MODULE
 #include <linux/module.h>
-#include <linux/version.h>
-#else
-#define MOD_INC_USE_COUNT
-#define MOD_DEC_USE_COUNT
-#endif
 
 #include <linux/errno.h>
 #include <linux/kernel.h>
@@ -134,6 +125,7 @@
 	if(active_map&(1<<minor))
 	{
 		open_map|=(1<<minor);
+		MOD_INC_USE_COUNT;
 		return 0;
 	}
 	return -EUNATCH;
@@ -220,15 +212,11 @@
 	return ret;
 }
 
-
-#ifdef MODULE
-char kernel_version[]=UTS_RELEASE;
-
-int init_module(void)
+int init_netlink(void)
 {
 	int ct;
-	printk("Network Kernel/User communications module 0.03\n");
-	if (register_chrdev(NET_MAJOR,"netlink",&netlink_fops)) {
+
+	if(register_chrdev(NET_MAJOR,"netlink", &netlink_fops)) {
 		printk("netlink: unable to get major %d\n", NET_MAJOR);
 		return -EIO;
 	}
@@ -240,25 +228,17 @@
 	return 0;
 }
 
-void cleanup_module(void)
+#ifdef MODULE
+
+int init_module(void)
 {
-	unregister_chrdev(NET_MAJOR,"netlink");
+	printk("Network Kernel/User communications module 0.03\n");
+	return init_netlink();
 }
 
-#else
-
-void init_netlink(void)
+void cleanup_module(void)
 {
-	int ct;
-	/* Keep quiet on booting, we don't want too many messages */
-	if(register_chrdev(NET_MAJOR,"netlink", &netlink_fops))
-		printk("netlink: unable to get major %d\n", NET_MAJOR);
-	for(ct=0;ct<MAX_LINKS;ct++)
-	{
-		skb_queue_head_init(&skb_queue_rd[ct]);
-		netlink_handler[ct]=netlink_err;
-	}
+	unregister_chrdev(NET_MAJOR,"netlink");
 }
 
-#endif
 #endif

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this