On Apr 28, 2010, at 6:18 PM, Charles Davis wrote:

> Besides, to use it, we'd have to call DADiskMount() directly instead of
> going through diskutil.

Huh?  Who goes through diskutil?  Who would have to call DADiskMount()?  And 
why do you think DADiskMount() is necessary to register approval callbacks?  
That's not my understanding.  One gets the DADiskRefs for the mounted disks via 
the disk-appeared callback.

> Which means we'd have to add some code to
> support DA to NTDLL. I don't know what AJ thinks of that.

There's already DiskArbitration support in mountmgr.sys, added by Alexandre.  :)

At one point he tried using an unmount approval callback to have Wine close all 
of its handles for files on the device, but DA wouldn't even ask the callbacks 
if there were files open.  I believe that has changed in Snow Leopard and we 
could revive that approach.  That way, unmounting volumes would just work 
seamlessly without the need for the user to invoke eject.exe.so.

But, anyway, there's no barrier to registering such an approval callback.


>> Among other things, if Wine uses your driver to lock the media and then 
>> crashes, is there any way for the user to recover and unlock the media?
> Just send the device file a DKIOCALLOW, and then everything will be back
> to normal.

OK, but that's not exactly something you can just tell a user to do.

>> Also, I don't know enough about the driver model to know if multiple user 
>> clients can compete or conflict for locking the media.  For example, if two 
>> processes lock the media and only one unlocks it, is it locked or unlocked?  
>> DiskArbitration avoids these pitfalls.
> It's unlocked. It's like the old handles. 10 calls to HLock() would be
> undone by a single HUnlock(). I need to fix that. Luckily, the kernel
> gave me the process that initiated the (un)lock, so I can keep track of
> that. (Then I can also force the disk unlocked when it terminates.)

OK, although I don't know if you have an easy way to actually be told when a 
process terminates, or to link the lock to the process so it's automatically 
removed on process termination.

-Ken



Reply via email to