Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Aug 2012 09:49:07 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        Hans Petter Selasky <hselasky@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r239178 - in head/sys: kern sys
Message-ID:  <201208130949.07399.jhb@freebsd.org>
In-Reply-To: <201208101502.q7AF2ofC046316@svn.freebsd.org>
References:  <201208101502.q7AF2ofC046316@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Friday, August 10, 2012 11:02:50 am Hans Petter Selasky wrote:
> Author: hselasky
> Date: Fri Aug 10 15:02:49 2012
> New Revision: 239178
> URL: http://svn.freebsd.org/changeset/base/239178
> 
> Log:
>   Add new device method to free the automatically
>   allocated softc structure which is returned by
>   device_get_softc(). This method can be used to
>   easily implement softc refcounting. This can be
>   desirable when the softc has memory references
>   which are controlled by userspace handles for
>   example.

Why do you need a new method?  If you want to manage your own softc, you are 
free to do so by using a size of 0 in your driver_t.  You can then use 
device_set_softc() to set the softc during your attach routine.  New-bus
won't free it during detach leaving you to free it instead.  That is what you 
should have done here instead of polluting device_if.m.  Note that 
DF_EXTERNALSOFTC is an internal flag to explicitly handle this case, but 
you've now made it possible for a device to try to do special free logic but
haven't made DF_EXTERNALSOFTC visible to that driver.  This is why I think 
new-bus already let you do what you wanted (via device_set_softc()) and think 
you should just do that and back this out.

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201208130949.07399.jhb>