Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Apr 2011 15:22:43 +0200
From:      Bartosz Fabianowski <freebsd@chillt.de>
To:        John Baldwin <jhb@freebsd.org>
Cc:        Kostik Belousov <kostikbel@gmail.com>, freebsd-hackers@freebsd.org, Hans Petter Selasky <hselasky@c2i.net>
Subject:   Re: Is there some implicit locking of device methods?
Message-ID:  <4DB818A3.1020104@chillt.de>
In-Reply-To: <201104271019.31844.jhb@freebsd.org>
References:  <4DB695DB.1080505@chillt.de> <20110426124403.GQ48734@deviant.kiev.zoral.com.ua> <4DB76085.4000402@chillt.de> <201104271019.31844.jhb@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
> Err, if you use cdevpriv you shouldn't even have a d_close method.  All your
> d_close logic should be in the cdevpriv destructor

I see. There is no documentation for any of this, so I just implemented 
it in the way I *thought* it should work:

.d_close = drv_close,

int drv_close(...) {
   devfs_clear_cdevpriv();
}

static void cdevpriv_dtr(void *data) {
   free(data, M_USBDEV);
}

If I understand you correctly, I can leave out the drv_close() method. 
When close() is called, devfs_clear_cdevpriv() will be executed 
implcitly for me and my dstructor will run - right?

- Bartosz



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