Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Mar 2003 01:49:20 -0600
From:      Sean Kelly <smkelly@zombie.org>
To:        "M. Warner Losh" <imp@bsdimp.com>
Cc:        hackers@freebsd.org
Subject:   Re: Smarter kernel modules?
Message-ID:  <20030306074919.GA3045@edgemaster.zombie.org>
In-Reply-To: <20030305.215901.36360277.imp@bsdimp.com>
References:  <20030305.215901.36360277.imp@bsdimp.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030306074919.GA3045>