From owner-freebsd-hackers Wed Apr 30 00:23:40 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id AAA11346 for hackers-outgoing; Wed, 30 Apr 1997 00:23:40 -0700 (PDT) Received: from nlsystems.com (nlsys.demon.co.uk [158.152.125.33]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id AAA11341 for ; Wed, 30 Apr 1997 00:23:36 -0700 (PDT) Received: from herring.nlsystems.com (herring.nlsystems.com [10.0.0.2]) by nlsystems.com (8.8.5/8.8.5) with SMTP id IAA03093; Wed, 30 Apr 1997 08:19:12 +0100 (BST) Date: Wed, 30 Apr 1997 08:19:12 +0100 (BST) From: Doug Rabson To: Michael Smith cc: Bruce Evans , hackers@freebsd.org Subject: Re: Unloading LKMs (was Re: A Desparate Plea for Help...) In-Reply-To: <199704300332.NAA25320@genesis.atrad.adelaide.edu.au> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk On Wed, 30 Apr 1997, Michael Smith wrote: > Still, I take your point about the cdevsw not being updated. I can't see > a clean way of doing this, either. > > Doug R., how do you approach this in your New Module Structure? (No, I > haven't had time to read it yet 8( 8( 8( ) I run all the sysinits in an object file which is loaded by the kernel linker. This would sort out calling qcam_drvinit when the driver is loaded. The probe and attach is handled by some new code in isa.c which understands drivers appearing and disappearing and which can create new isa_devices as requested by the user who is loading the driver. For unloading, the driver registers itself as a module. This involves supplying an event callback in a similar way to the LKM system. When the user attempts to unload the driver, the module gets an UNLOAD event which it can use to clean up *devsw, devfs, interrupts etc. If it can't for some reason, it can veto the unload by returning EBUSY. The important point is that there is *no difference* between the dynamic and statically loaded version of a driver. I can go into a /sys/compile/FOO directory and construct loadable modules from the same object files. -- Doug Rabson Mail: dfr@nlsystems.com Nonlinear Systems Ltd. Phone: +44 181 951 1891