Subject: Re: if_delete * if_alloc
To: Matthias Drochner <>
From: Matt Thomas <>
List: tech-kern
Date: 07/09/1997 20:28:18
At 09:57 PM 7/9/97 +0200, Matthias Drochner wrote:
>> But the driver should be able to veto/delay of freeing of the
>> softc because there may be outstanding references to it
>> that the driver load/unload doesn't know about.  When asked
>> to unload, the driver will say no.  When ready, the driver
>> will inidicate that it can be deleted.  the unload code (from a
>> clean stack) will then free the softc and unload the driver.
>Yes, this would be ok from the driver LKM point of view.
>If I understand it correctly, it would boil down to a
>function which is called by the driver at unload time
>(let's call it detach function) and which tells if a given
>ifnet can be freed. The (userland) unload program has
>to retry in necessary.

No it doesn't.  The struct device of the driver should have a
pointer to the internal kernel structure describing the lkm.
The iffree should call device_release(struct device *) (ie. the
softc) which can decrement a reference count, free the softc,
and if 0, free the lkm.  It would not be a half open lkm since
all the forward pointers to the lkm should be cut.

Matt Thomas               Internet:
3am Software Foundry      WWW URL:
Nashua, NH                Disclaimer: I disavow all knowledge of this message