From owner-freebsd-hackers Wed Mar 5 23:49:25 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 B591337B401 for ; Wed, 5 Mar 2003 23:49:23 -0800 (PST) Received: from edgemaster.zombie.org (edgemaster.creighton.edu [147.134.112.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id D505D43FBD for ; Wed, 5 Mar 2003 23:49:20 -0800 (PST) (envelope-from smkelly@zombie.org) Received: by edgemaster.zombie.org (Postfix, from userid 1001) id 2DE8239839; Thu, 6 Mar 2003 01:49:20 -0600 (CST) Date: Thu, 6 Mar 2003 01:49:20 -0600 From: Sean Kelly To: "M. Warner Losh" Cc: hackers@freebsd.org Subject: Re: Smarter kernel modules? Message-ID: <20030306074919.GA3045@edgemaster.zombie.org> References: <20030305.215901.36360277.imp@bsdimp.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="SUOF0GtieIMvvwua" Content-Disposition: inline In-Reply-To: <20030305.215901.36360277.imp@bsdimp.com> User-Agent: Mutt/1.5.3i 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 --SUOF0GtieIMvvwua Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Mar 05, 2003 at 09:59:01PM -0700, M. Warner Losh wrote: > 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. My kernel coding skills are severely limited, so please adjust any pointing and laughing as appropriate. =2E.. > +/* > + * 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 =3D 1; =2E.. Wouldn't it make more sense to have a symbol name that doesn't change across versions? Something like '_module_version' perhaps. Then the value of the symbol is the version which the module corresponds to. This would let you use something like kern.osreldate or a per-subsystem version index. This would also save you from having to search through files that say "_version_5_1" and instead just define '_module_version' using a #define in one of your headers. config.h: #define API_VERSION 500100 mymodule.c: long _module_version =3D API_VERSION; Another benefit(?) is that if _module_version is missing, you can decide that you don't care about versioning and just load the module. This could be useful for third-party modules that don't want to lock them down to a specific kernel/API/subsystem version. Not recommended, but optional. --=20 Sean Kelly | PGP KeyID: D2E5E296 smkelly@zombie.org | http://www.zombie.org --SUOF0GtieIMvvwua Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQE+Zv1/Pm7A9NLl4pYRAnBvAKDAhmp1Pl+ZMAwxIbXZyu6V+D4zEQCeNVcT po8VitUBRd0QgiVX6joCTb4= =dael -----END PGP SIGNATURE----- --SUOF0GtieIMvvwua-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message