From owner-freebsd-hackers Wed Mar 5 20:59:21 2003 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E86FF37B401 for ; Wed, 5 Mar 2003 20:59:19 -0800 (PST) Received: from harmony.village.org (rover.bsdimp.com [204.144.255.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1056F43FA3 for ; Wed, 5 Mar 2003 20:59:19 -0800 (PST) (envelope-from imp@bsdimp.com) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.12.8/8.12.3) with ESMTP id h264xHA7034571; Wed, 5 Mar 2003 21:59:17 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Wed, 05 Mar 2003 21:59:01 -0700 (MST) Message-Id: <20030305.215901.36360277.imp@bsdimp.com> To: hackers@freebsd.org, smkelly@zombie.org Subject: Re: Smarter kernel modules? From: "M. Warner Losh" X-Mailer: Mew version 2.1 on Emacs 21.2 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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 +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