Date: Wed, 05 Mar 2003 21:59:01 -0700 (MST) From: "M. Warner Losh" <imp@bsdimp.com> To: hackers@freebsd.org, smkelly@zombie.org Subject: Re: Smarter kernel modules? Message-ID: <20030305.215901.36360277.imp@bsdimp.com>
next in thread | raw e-mail | index | archive | help
Here's a simple patch. However, it is a total suck-ass kludge (and
that's being generous). The ABI isn't THE ABI, but rather a
collection of ABIs. These ABIs change slowly and there is a certain
range that work together. Historically, we've been really bad about
bumping version numbers when things change in modules. Also, there's
no built-in versioning in the module names, which makes it harder to
have multiple versions around. As such, the version numbers are set
to 1 and never change.
Warner
Index: sys/module.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/module.h,v
retrieving revision 1.20
diff -u -r1.20 module.h
--- sys/module.h 18 Mar 2002 07:45:30 -0000 1.20
+++ sys/module.h 6 Mar 2003 04:51:04 -0000
@@ -95,7 +95,10 @@
#include <sys/linker_set.h>
+extern char __version_5_1;
+
#define MODULE_METADATA(uniquifier, type, data, cval) \
+ static char *_mod_version_depend##uniquifier = &__version_5_1; \
static struct mod_metadata _mod_metadata##uniquifier = { \
MDT_STRUCT_VERSION, \
type, \
Index: kern/kern_module.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/kern_module.c,v
retrieving revision 1.41
diff -u -r1.41 kern_module.c
--- kern/kern_module.c 19 Feb 2003 05:47:25 -0000 1.41
+++ kern/kern_module.c 6 Mar 2003 04:51:04 -0000
@@ -42,6 +42,12 @@
static MALLOC_DEFINE(M_MODULE, "module", "module data structures");
+/*
+ * Define the version. Change the symbol name when things get too
+ * incompatible. version_5_1 means the 'ABI compatible with FreeBSD 5.1'
+ */
+char __version_5_1 = 1;
+
typedef TAILQ_HEAD(, module) modulelist_t;
struct module {
TAILQ_ENTRY(module) link; /* chain together all modules */
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030305.215901.36360277.imp>
