Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DADiskEject and Resource Busy errors



Hi Dan,

Thanks for your reply.

Are you certain that the unmount was in fact successful?  What does lsof show with respect to that device node or that mount point? 

I assume the unmount is successful because the dissenter is NULL in the unmount callback (the docs say "A dissenter object on failure or NULL on success" .  I haven't checked using lsof, but if I have a Finder window open in the background I see the volumes disappear.

The code snippet below issues the DADiskEject() even if the unmount is not successful for example.

I left out some of the error handling code; an exception is thrown in the error handling block  so that the program flow never reaches the call to DADiskEject if dissenter is not NULL.  If you're curious to see the code in its entirety it is on http://svn.sourceforge.net/viewcvs.cgi/macaudiox/trunk/Controllers/MediaController.m?view=markup

Stephen

I'm using the DiskArbitration framework for unmounting and ejecting removable CD media.  I have run into a peculiar issue where sometimes CDs unmount successfully, but fail to eject.  My code looks like:

Unmount the disc in preparation for ejection:

DADiskUnmount(disk, kDADiskUnmountOptionWhole, unmountCallback, context);

If the unmount was successful, request the eject in unmountCallback:

if(NULL != dissenter) {
DAReturn status = DADissenterGetStatus(dissenter);
// Error handling omitted
}

DADiskEject(disk, kDADiskEjectOptionDefault, ejectCallback, context);

And finally, the code that produces the error message:

if(NULL != dissenter) {
DAReturn status = DADissenterGetStatus(dissenter);
// Error occurs here
}

The strange thing is, maybe 50% or more of the time the disc will unmount but fail to eject with an error code 16 (Resource Busy).  I assume since the disc successfully unmounted that no resources should be in use.  I don't see any other DA* APIs that will do what I want.

Have I missed something in my usage of the framework?

Stephen
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-dev/email@hidden

This email sent to email@hidden

References: 
 >DADiskEject and Resource Busy errors (From: "Stephen F. Booth" <email@hidden>)
 >Re: DADiskEject and Resource Busy errors (From: Dan Markarian <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.