[PATCH] non modular PPP compressors for v2.2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Somewhere in 2.3.99 bsd_comp was allowed in non-modular kernels
due to the relaxed copyright.  But in 2.2.x you can't have
bsd_comp (or ppp_deflate) if you have module support disabled.

With this patch you get both compressors built in if PPP is
built in (modular behaviour is unchanged)  Patch is against
2.2.16 but applies to 17pre11 with minor offset.

Paul.

diff -ur /mnt/2.2/2216/linux/drivers/net/Config.in linux/drivers/net/Config.in
--- /mnt/2.2/2216/linux/drivers/net/Config.in	Wed Jun 28 13:35:54 2000
+++ linux/drivers/net/Config.in	Tue Jul 11 14:33:03 2000
@@ -221,8 +221,8 @@
 fi
 
 tristate 'PPP (point-to-point) support' CONFIG_PPP
-if [ ! "$CONFIG_PPP" = "n" ]; then
-  comment 'CCP compressors for PPP are only built as modules.'
+if [ "$CONFIG_PPP" = "y" ]; then
+  comment 'CCP compressors for PPP will also be built in.'
 fi
 
 tristate 'SLIP (serial line) support' CONFIG_SLIP
diff -ur /mnt/2.2/2216/linux/drivers/net/Makefile linux/drivers/net/Makefile
--- /mnt/2.2/2216/linux/drivers/net/Makefile	Wed Jun 28 13:35:54 2000
+++ linux/drivers/net/Makefile	Tue Jul 11 13:39:20 2000
@@ -22,6 +22,8 @@
 CONFIG_8390_MODULE  :=
 CONFIG_SLHC_BUILTIN :=
 CONFIG_SLHC_MODULE  :=
+CONFIG_BSDCOMP_BUILTIN :=
+CONFIG_BSDCOMP_MODULE  :=
 CONFIG_PPPDEF_BUILTIN :=
 CONFIG_PPPDEF_MODULE  :=
 CONFIG_7990_BUILTIN :=
@@ -35,12 +37,14 @@
 
 ifeq ($(CONFIG_ISDN),y)
   ifeq ($(CONFIG_ISDN_PPP),y)
+    CONFIG_BSDCOMP_BUILTIN = y
     CONFIG_SLHC_BUILTIN = y
     CONFIG_PPPDEF_BUILTIN = y
   endif
 else
   ifeq ($(CONFIG_ISDN),m)
     ifeq ($(CONFIG_ISDN_PPP),y)
+      CONFIG_BSDCOMP_MODULE = y
       CONFIG_SLHC_MODULE = y
       CONFIG_PPPDEF_MODULE = y
     endif
@@ -311,19 +315,17 @@
   endif
 endif
 
-# bsd_comp.o is *always* a module, for some documented reason
-# (licensing).
 ifeq ($(CONFIG_PPP),y)
 LX_OBJS += ppp.o
-M_OBJS += bsd_comp.o
+CONFIG_BSDCOMP_BUILTIN = y
 CONFIG_SLHC_BUILTIN = y
 CONFIG_PPPDEF_BUILTIN = y
 else
   ifeq ($(CONFIG_PPP),m)
+  CONFIG_BSDCOMP_MODULE = y
   CONFIG_SLHC_MODULE = y
   CONFIG_PPPDEF_MODULE = y
   MX_OBJS += ppp.o
-  M_OBJS += bsd_comp.o
   endif
 endif
 
@@ -1014,6 +1016,16 @@
   endif
 endif
 
+# If anything built-in uses bsd_comp, then build it into the kernel also.
+# If not, but a module uses it, build as a module.
+ifdef CONFIG_BSDCOMP_BUILTIN
+LX_OBJS += bsd_comp.o
+else
+  ifdef CONFIG_BSDCOMP_MODULE
+  MX_OBJS += bsd_comp.o
+  endif
+endif
+
 # If anything built-in uses slhc, then build it into the kernel also.
 # If not, but a module uses it, build as a module.
 ifdef CONFIG_SLHC_BUILTIN
@@ -1026,10 +1038,8 @@
 
 # if anything built-in uses ppp_deflate, then build it into the kernel also.
 # If not, but a module uses it, build as a module.
-# ... NO!!!  ppp_deflate.o does not work as resident;
-# it works only as a module!
 ifdef CONFIG_PPPDEF_BUILTIN
-MX_OBJS += ppp_deflate.o
+LX_OBJS += ppp_deflate.o
 else
   ifdef CONFIG_PPPDEF_MODULE
   MX_OBJS += ppp_deflate.o
diff -ur /mnt/2.2/2216/linux/drivers/net/bsd_comp.c linux/drivers/net/bsd_comp.c
--- /mnt/2.2/2216/linux/drivers/net/bsd_comp.c	Mon Aug  9 05:04:00 1999
+++ linux/drivers/net/bsd_comp.c	Tue Jul 11 14:20:39 2000
@@ -1,3 +1,11 @@
+/*
+ * Update: The Berkeley copyright was changed, and the change
+ * is retroactive to all "true" BSD software (ie everything
+ * from UCB as opposed to other peoples code that just carried
+ * the same license). The new copyright doesn't clash with the
+ * GPL, so the module-only restriction has been removed..
+ */
+
 /* Because this code is derived from the 4.3BSD compress source:
  *
  * Copyright (c) 1985, 1986 The Regents of the University of California.
@@ -53,12 +61,9 @@
  * From: bsd_comp.c,v 1.3 1994/12/08 01:59:58 paulus Exp
  */
 
-#ifndef MODULE
-#error This file must be compiled as a module.
-#endif
-
 #include <linux/module.h>
 #include <linux/kernel.h>
+#include <linux/init.h>
 #include <linux/sched.h>
 #include <linux/types.h>
 #include <linux/fcntl.h>
@@ -1173,12 +1178,7 @@
     bsd_comp_stats		/* decomp_stat */
 };
 
-/*************************************************************
- * Module support routines
- *************************************************************/
-
-int
-init_module(void)
+__initfunc(int bsd_comp_install(void))
 {
 	int answer = ppp_register_compressor (&ppp_bsd_compress);
 	if (answer == 0)
@@ -1186,8 +1186,18 @@
 	return answer;
 }
 
+#ifdef MODULE
+
+int
+init_module(void)
+{
+	return bsd_comp_install();
+}
+
 void
 cleanup_module(void)
 {
 	ppp_unregister_compressor (&ppp_bsd_compress);
 }
+
+#endif /* MODULE */
diff -ur /mnt/2.2/2216/linux/drivers/net/ppp.c linux/drivers/net/ppp.c
--- /mnt/2.2/2216/linux/drivers/net/ppp.c	Thu May 11 16:42:39 2000
+++ linux/drivers/net/ppp.c	Tue Jul 11 14:00:23 2000
@@ -49,6 +49,7 @@
 
 #include <linux/config.h>
 #include <linux/module.h>
+#include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/types.h>
@@ -94,8 +95,8 @@
  * Local functions
  */
 
+int ppp_register_compressor (struct compressor *cp);
 #ifdef CONFIG_MODULES
-static int ppp_register_compressor (struct compressor *cp);
 static void ppp_unregister_compressor (struct compressor *cp);
 #endif
 
@@ -317,6 +318,10 @@
 
 
 #ifndef MODULE
+
+extern int bsd_comp_install(void);
+extern int ppp_deflate_install(void);
+
 /*
  * Called at boot time if the PPP driver is compiled into the kernel.
  */
@@ -328,7 +333,11 @@
 
 	if (first_time) {
 		first_time = 0;
-		answer	   = ppp_first_time();
+		answer = ppp_first_time();
+		if (answer == 0) {
+			bsd_comp_install();
+			ppp_deflate_install();
+		}
 	}
 	if (answer == 0)
 		answer = -ENODEV;
@@ -3041,8 +3050,10 @@
 	return (struct compressor *) 0;
 }
 
-#ifdef CONFIG_MODULES
-static int ppp_register_compressor (struct compressor *cp)
+/* 
+ * If PPP is built-in then so are compressors, so __initfunc is okay here.
+ */
+__initfunc(int ppp_register_compressor (struct compressor *cp))
 {
 	struct compressor_link *new;
 	unsigned long flags;
@@ -3070,6 +3081,7 @@
 	return 0;
 }
 
+#ifdef CONFIG_MODULES
 static void ppp_unregister_compressor (struct compressor *cp)
 {
 	struct compressor_link *prev = (struct compressor_link *) 0;
diff -ur /mnt/2.2/2216/linux/drivers/net/ppp_deflate.c linux/drivers/net/ppp_deflate.c
--- /mnt/2.2/2216/linux/drivers/net/ppp_deflate.c	Mon Aug  9 05:04:01 1999
+++ linux/drivers/net/ppp_deflate.c	Tue Jul 11 14:20:29 2000
@@ -33,6 +33,7 @@
 
 #include <linux/module.h>
 #include <linux/kernel.h>
+#include <linux/init.h>
 #include <linux/sched.h>
 #include <linux/types.h>
 #include <linux/fcntl.h>
@@ -656,13 +657,7 @@
 	z_comp_stats,		/* decomp_stat */
 };
 
-#ifdef MODULE
-/*************************************************************
- * Module support routines
- *************************************************************/
-
-int
-init_module(void)
+__initfunc(int ppp_deflate_install(void))
 {  
         int answer = ppp_register_compressor (&ppp_deflate);
         if (answer == 0)
@@ -670,6 +665,14 @@
 			"PPP Deflate Compression module registered\n");
 	ppp_register_compressor(&ppp_deflate_draft);
         return answer;
+}
+
+#ifdef MODULE
+
+int
+init_module(void)
+{
+	return ppp_deflate_install();
 }
      
 void



__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.rutgers.edu


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux