[1295] in linux-net channel archive
ppp with MODVERSIONS
daemon@ATHENA.MIT.EDU (bj0rn@blox.se)
Tue Oct 31 18:50:30 1995
From: bj0rn@blox.se
To: linux-net@vger.rutgers.edu
Date: Tue, 31 Oct 1995 13:45:28 +0100 (MET)
Cc: linux-kernel@vger.rutgers.edu, torvalds@cs.helsinki.fi (Linus Torvalds),
longyear@netcom.com, callahan@maths.ox.ac.uk
Hi all!
I'm trying to find some Linux-time again, and I saw some small problems
with ppp and CONFIG_MODVERSIONS. OK. the documentation is a bit scanty,
but I suggest the following patch to "linux/drivers/net".
When one wants to explicitly export symbols using the "register_symtab"
kernel function, one has to tell "genksyms" about the export as well,
otherwise the magic version extensions won't be created.
This is done by adding a couple of lines to the Makefile, as shown below.
In the ppp.c file, I have just cleaned up a bit around the symbol table
declaration, and also added the export to the module_init function
since that seems consistent...
Note that the symbol table will be removed automatically when the module
gets unloaded (see: linux/kernel/module.c)
That's it, so far
Bjorn <bj0rn@blox.se>
--- linux/drivers/net/Makefile.org Tue Oct 31 11:50:42 1995
+++ linux/drivers/net/Makefile Tue Oct 31 12:17:51 1995
@@ -131,11 +131,13 @@
ifeq ($(CONFIG_PPP),y)
L_OBJS += ppp.o
+SYMTAB_OBJS += ppp.o
CONFIG_SLHC_BUILTIN = y
else
ifeq ($(CONFIG_PPP),m)
CONFIG_SLHC_MODULE = y
M_OBJS += ppp.o
+ SYMTAB_OBJS += ppp.o
endif
endif
@@ -369,6 +371,7 @@
endif
include $(TOPDIR)/Rules.make
+include $(TOPDIR)/versions.mk
clean:
rm -f core *.o *.a *.s
--- linux/drivers/net/ppp.c.org Tue Oct 31 11:44:08 1995
+++ linux/drivers/net/ppp.c Tue Oct 31 12:28:00 1995
@@ -6,7 +6,7 @@
* Dynamic PPP devices by Jim Freeman <jfree@caldera.com>.
* ppp_tty_receive ``noisy-raise-bug'' fixed by Ove Ewerlid <ewerlid@syscon.uu.se>
*
- * ==FILEVERSION 6==
+ * ==FILEVERSION 7==
*
* NOTE TO MAINTAINERS:
* If you modify this file at all, increment the number above.
@@ -542,6 +542,14 @@
ppp->sc_rc_state = NULL;
}
+static struct symbol_table ppp_syms = {
+#include <linux/symtab_begin.h>
+ X(ppp_register_compressor),
+ X(ppp_unregister_compressor),
+ X(ppp_crc16_table),
+#include <linux/symtab_end.h>
+};
+
/* called at boot/load time for each ppp device defined in the kernel */
#ifndef MODULE
@@ -552,16 +560,6 @@
int answer = 0;
if (first_time) {
- static struct symbol_table ppp_syms = {
-#include <linux/symtab_begin.h>
-#define Y(sym) { (void *) &sym, SYMBOL_NAME_STR (sym) }
- Y(ppp_register_compressor),
- Y(ppp_unregister_compressor),
- Y(ppp_crc16_table),
-#undef Y
-#include <linux/symtab_end.h>
- };
-
first_time = 0;
answer = ppp_first_time();
if (answer == 0)
@@ -3541,6 +3539,8 @@
if (status != 0)
printk (KERN_INFO
"PPP: ppp_init() failure %d\n", status);
+ else
+ (void) register_symtab (&ppp_syms);
return (status);
}
@@ -3595,10 +3595,6 @@
else
printk (KERN_INFO
"PPP: ppp line discipline successfully unregistered\n");
-/*
- * Remove the symbol definitions
- */
- (void) register_symtab ((struct symbol_table *) 0);
/*
* De-register the devices so that there is no problem with them
*/