New SCSI Driver for Mac OS X

Charles Davis cdavis at mymail.mines.edu
Thu Apr 29 01:12:45 CDT 2010


On 4/28/10 11:08 PM, Ken Thomases wrote:
> On Apr 28, 2010, at 8:28 PM, Charles Davis wrote:
> 
>> On 4/28/10 5:48 PM, Ken Thomases wrote:
>>> 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?
>> NTDLL, when it gets a FSCTL_DISMOUNT_VOLUME.
> 
> Huh.  Weird.  I did not know that.
> 
> I can't speak for Alexandre, but I suspect he would be fine using the appropriate Mac-native framework, whether that would be DiskArbitration or CoreServices (FSUnmountVolumeSync()), over invoking a Mac-specific command via system().  (So long as it's a C API, of course. ;)
Don't know about that. The way it's implemented (and it's implemented by
a function in dlls/ntdll/directory.c called 'DIR_unmount_volume), it
invokes a command on both Mac OS X and other UNIXes/Linux. I think
whoever implemented it used diskutil(8) on Mac OS X because it was the
path of least resistance (given that it was already system(3)'ing
umount(8) on other platforms).
> 
> 
>>> But, anyway, there's no barrier to registering such an approval callback.
>> Like I said, it will work when ejection and unmount requests go through
>> DA, but not for raw umount(2) or ioctl(2) with DKIOCEJECT.
> 
> Is this something you've tested?  I have not, but I would not be at all surprised if DiskArbitration had a kernel component.
> 
> For example, if I mount a disk image via the Finder and then use umount(8) to unmount it, I get the relevant NSWorkspaceDidUnmountNotification.  NSWorkspace is built on DiskArbitration's callbacks but umount(8) is not.  It just uses the unmount(2) system call.
I just used a similar test case with a real disk, and I still got the
DidUnmount note. But...
> 
> (The above test was the quickest to hand.  I didn't take the time to write a direct DiskArbitration test case, with or without an unmount approval callback.)
When I used DiskArbitration directly, and unmounted the disk with
umount(8), it did not ask me if it was OK to unmount the disk. When I
went through DA, however, I did get asked. I tried to test the same with
DKIOCEJECT instead of unmount(2), but I couldn't open the whole media
device file (got EBUSY).

It's probably true that AppKit has indeed registered callbacks with DA.
I looked at its dependencies with otool, and DiskArbitration was one of
them. But since it delivered the note when umount(8) was used and DA
didn't, AppKit must therefore be using some other mechanism to discover
this. (I thought it might be kqueues, but I looked at its imports with
nm and couldn't find any references to kqueue(2) or kevent(2).)

Chip



More information about the wine-devel mailing list