Issue with DiskArbitration unmount approval callback - it is called multiple times
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Hello darwin-devs! I'm developing an application which should do some actions with removable disks before it's unmount. I've found out that this could be done with DiskArbitration unmount approval callback. I use the following test code: 1. Registering approval callback <...> //create approval session DAApprovalSessionRef session = DAApprovalSessionCreate(kCFAllocatorDefault); //register unmount callback DARegisterDiskUnmountApprovalCallback(session, kDADiskDescriptionMatchVolumeMountable, unmountApprovalCallback, NULL); // context DAApprovalSessionScheduleWithRunLoop(session, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); CFRunLoopRun(); 2. Callback function itself - just log it was called and return success. DADissenterRef unmountApprovalCallback(DADiskRef disk, void *context) { //Just log and return success - this should allow unmounting <> NSLog(@"unmountApprovalCallback called"); DADissenterRef dissenter = DADissenterCreate(kCFAllocatorDefault, kDAReturnSuccess, CFSTR("unmount allowed")); return dissenter; } Unmount callback is called, the application returns success and I thought that it will never be called again for this drive. But my tests show different: callback is called multiple times and it seems that system ignores returned value (e.g. Finder shows "Force Eject"). Additionally, in case of Network Volume Finder logs the following: e.g. "Feb 17 16:14:04 macaca /System/Library/CoreServices/Finder.app/Contents/MacOS/Finder[215]: NetworkNode::ejectCallBack returned -47" Summarizing the problem: Why is callback called several times? Why system ignores my successful return code? Should I do something additionally to this? Thanks in advance for your replies! -- With regards, Vera Tkachenko _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
Vera Tkachenko