From owner-freebsd-hackers Wed Apr 30 01:35:50 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id BAA15952 for hackers-outgoing; Wed, 30 Apr 1997 01:35:50 -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 BAA15947 for ; Wed, 30 Apr 1997 01:35:47 -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 JAA06009; Wed, 30 Apr 1997 09:34:58 +0100 (BST) Date: Wed, 30 Apr 1997 09:34:57 +0100 (BST) From: Doug Rabson To: Michael Smith cc: bde@zeta.org.au, hackers@freebsd.org Subject: Re: Unloading LKMs (was Re: A Desparate Plea for Help...) In-Reply-To: <199704300744.RAA27463@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: > > 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. > > Ok. Do you have infrastructure for cleaning up devsw entries automagically? > eg. a hook the module can call to say "these *devsw entries are mine" > so that you can back the module out when you unload it? What I have at the moment is some handy macros in isa_device.h which spit out all the code and SYSINIT declarations to register the device at load/boot time and clean up at unload time. For 95% of drivers, this will be enough. Since the module gets called at unload time, any weird drivers can implement their own module event handler to do their own special stuff. -- Doug Rabson Mail: dfr@nlsystems.com Nonlinear Systems Ltd. Phone: +44 181 951 1891