From owner-cvs-all Sat Oct 10 17:26:45 1998 Return-Path: Received: (from daemon@localhost) by hub.freebsd.org (8.8.8/8.8.8) id RAA20065 for cvs-all-outgoing; Sat, 10 Oct 1998 17:26:45 -0700 (PDT) (envelope-from owner-cvs-all) Received: from spinner.netplex.com.au (spinner.netplex.com.au [202.12.86.3]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id RAA20049; Sat, 10 Oct 1998 17:26:36 -0700 (PDT) (envelope-from peter@netplex.com.au) Received: from spinner.netplex.com.au (localhost [127.0.0.1]) by spinner.netplex.com.au (8.9.1/8.9.1/Spinner) with ESMTP id HAA17811; Sun, 11 Oct 1998 07:58:38 +0800 (WST) (envelope-from peter@spinner.netplex.com.au) Message-Id: <199810102358.HAA17811@spinner.netplex.com.au> X-Mailer: exmh version 2.0.2 2/24/98 To: "Robert V. Baron" cc: cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG Subject: Re: cvs commit: src/sys/sys kernel.h In-reply-to: Your message of "10 Oct 1998 15:06:31 -0400." Date: Sun, 11 Oct 1998 07:58:37 +0800 From: Peter Wemm Sender: owner-cvs-all@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk "Robert V. Baron" wrote: > Happy to see that LKD's are being worked on. There is a structural > problem in lkm design. Maybe we can do it right on lkd's. The > problem is that there is a concept of a module. Then there is the > idea that there are services made available. So it is easy to imagine > that a block of code -- a module, would make serveral services > available say vfs, dev, maybe even inodes. So I would argue that the > private data of a module, should be a linked list if it has to be > explicit at all. Then when you call lkmdispatch(), you pass the > module pointer and the service you wish to initialize. You do this as > many times as necessary to setup the module. (You do not pass the > service as the private data of the module). To make things a bit more > concrete, look at coda/coda_fbsd.c and see what had to happen to tuck > Coda in as an lkm. As far as I understand things, The Grand Plan is that all major kernel components will be grouped as "modules" of some sort or other. This just means that source components will have their own module glue code and will be registered during startup via SYSINIT, a lot like the present routines for registering devsw[] devices etc. The beauty of this arrangement is that you can take a group of kernel .o files and link them as a kld object (.ko - basically "cc -shared -o foo.ko file1.o file2.o file3.o") and the exact same binaries and code will work Just Fine either linked into the static kernel or as preloadable objects from /boot/loader or even after the event via kldload(8). Obviously there will be some gotchas if you try and load somthing post-boot that really needs to be run early and as part of (say) the ISA device probe sequence, but making this kind of thing work isn't out of the question. In answer to your comments.. You'd just create a control structure and do a DEVICE_MODULE() declaration to have your device registered, something like a VFS_MODULE() declaration for the VFS and so on. The rest of the kernel code will probably be something like this one day too. The Alpha port is already based on this design and some ISA drivers have already been converted. Cheers, -Peter