svn: head/usr.sbin/burncd

Maxim Sobolev sobomax at FreeBSD.org
Sat Dec 20 17:07:20 UTC 2008


Kostik Belousov wrote:
> On Fri, Dec 19, 2008 at 12:52:12PM -0800, Maxim Sobolev wrote:
>> Should not it be better to implement this on the kernel side when the 
>> device is closed abruptly?
> The state that is kept is not accumulated on any particular filedescriptor,
> it is associated with the physical state of the device.
> 
> Therefore, I think that kernel shall not be charged with cleanup, and
> userspace calls should deal with resetting device back to the pristine
> state.

It may not be associated with any particular descriptor, still you can 
count number of opens for write compared to count of closes in the 
kernel. And it should be trivial to track when this number goes down to 
0 and clean up any leftover mess. Check dev/md/md.c for example, 
function g_md_access().

-Maxim


More information about the svn-src-all mailing list