freebsd-dev/sys/cddl
Hans Petter Selasky 07da61a6cc Streamline use of cdevpriv and correct some corner cases.
1) It is not useful to call "devfs_clear_cdevpriv()" from
"d_close" callbacks, hence for example read, write, ioctl and
so on might be sleeping at the time of "d_close" being called
and then then freed private data can still be accessed.
Examples: dtrace, linux_compat, ksyms (all fixed by this patch)

2) In sys/dev/drm* there are some cases in which memory will
be freed twice, if open fails, first by code in the open
routine, secondly by the cdevpriv destructor. Move registration
of the cdevpriv to the end of the drm open routines.

3) devfs_clear_cdevpriv() is not called if the "d_open" callback
registered cdevpriv data and the "d_open" callback function
returned an error. Fix this.

Discussed with:	phk
MFC after:	2 weeks
2012-08-15 16:19:39 +00:00
..
boot/zfs Introduce "feature flags" for ZFS pools (bump SPA version to 5000). 2012-06-11 11:35:22 +00:00
compat/opensolaris Fix found places where uio_resid is truncated to int. 2012-02-21 01:05:12 +00:00
contrib/opensolaris Streamline use of cdevpriv and correct some corner cases. 2012-08-15 16:19:39 +00:00
dev Change UL to ULL since time is 32 bits. 2012-07-17 14:36:40 +00:00