Subject: Re: Question about modules
To: None <hselasky@c2i.net>
From: Julio M. Merino Vidal <jmmv84@gmail.com>
List: tech-kern
Date: 08/28/2005 17:17:10
On 8/28/05, Hans Petter Selasky <hselasky@c2i.net> wrote:
> Hi,
>=20
> On FreeBSD they use the "__section__" attribute to do linking magic. But =
on
> NetBSD I am completely lost :-)
>=20
> 1) What is the logic behind linking modules?
>=20
> # pwd
> /usr/src/sys/lkm/vfs/adosfs
>=20
> # ls
> CVS             Makefile        lkminit_vfs.c
>                                 ^^^ is there some
>                        magic hidden in this filename?
>=20
> From where is the following function called:
>=20
> adosfs_lkmentry

I guess this is because the structure defined by the MOD_VFS
macro, whose name is _module.  See sys/lkm.h.

After the structure is defined with a known name, the kernel
can access it, get the vfs operations structure and call the
vfs_init function from there.

> Is this function also called when the module is
> in the kernel ?

If "this function" means vfs_init, then yes, it is called during
system startup as a result of the VFS_ATTACH macro.

> 2) Where is PSEUDO_SET defined?

Dunno; is that something FreeBSD specific?  The comment in
net/net_osdep.h that includes PSEUDO_SET in it may be of
help.

--=20
Julio M. Merino Vidal <jmmv84@gmail.com>
http://www.livejournal.com/users/jmmv/
The NetBSD Project - http://www.NetBSD.org/