On Dec 31, 2010, at 1:38 PM, Ken Thomases wrote:

> Why does that matter?  The question is, under what circumstances does it end 
> up in CDROM_Verify()?  What is the right behavior of CDROM_Verify() and how 
> would that be implemented on Mac OS X?

I should add that this patch seem correct to me.  It couldn't hurt to get 
Charles Davis's input, of course.

CDROM_Verify() is called when CDROM_DeviceIoControl() gets a 
IOCTL_*_CHECK_VERIFY request.  CDROM_DeviceIoControl() is only called (from 
NtDeviceIoControlFile()) for the appropriate type of device and that's further 
verified (on Mac OS X) by the call to get_parent_device().

MSDN documents that the purpose of IOCTL_*_CHECK_VERIFY is to check if the 
media has changed.  The Linux and FreeBSD implementations basically just check 
if there's media in the drive.  On Mac OS X, the BSD device file just plain 
doesn't exist unless and until there's media mounted.  There's no permanent BSD 
device file for the drive itself.  So, if CDROM_Verify() is called, which 
requires that the BSD device file is opened and thus is present, that by itself 
implies that there's media in the drive.  Therefore, CDROM_Verify() should just 
return success.

Which is basically what Loïc said.  :)

-Ken



Reply via email to