Re: Unmount using DADiskUnmount
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Hey Rakesh, Dan On 14 Jan 2009, at 9:36 PM, Rakesh Singhal wrote: Hi all, It is a daemon application, in which I am ejecting a USB pendrive. I am using following code(code to unmount) to unmount it. Now, my callback function is not getting called. It gets called only in one case when there is no pendrive and I call DADiskUnmount. Please advice me where I am missing something or mistaking. DADiskUnmount(disk, kDADiskUnmountOptionWhole, CPCSServerSocket::SafeRemovalCallback, NULL); return true; } void CPCSServerSocket::SafeRemovalCallback( DADiskRef disk, DADissenterRef dissenter, void * context ) { printf("CPCSServerSocket::SafeRemovalCallback disk-%p dissenter-%p\n", disk, dissenter); } Thanks in advance. _______________________________________________ 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... You need to schedule the session on a run loop with DASessionScheduleWithRunLoop() and run the run loop with CFRunLoopRun(). main() { DADiskRef disk = NULL; DASessionRef session = NULL; session = DASessionCreate ( kCFAllocatorDefault ); if(session == NULL) { return false; } DASessionScheduleWithRunLoop(session, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); disk = DADiskCreateFromBSDName ( kCFAllocatorDefault, session, diskName); if(disk == NULL) return false; Regards rksinghal _______________________________________________ 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/markarian %40apple.com This email sent to markarian@apple.com This email sent to site_archiver@lists.apple.com
participants (1)
-
Dan Markarian