Re: disktool unmount
Re: disktool unmount
- Subject: Re: disktool unmount
- From: "Rakesh Singhal" <email@hidden>
- Date: Wed, 17 Dec 2008 21:13:55 +0530
I used the following code for unmounting:
funUnmount(char* DrivePath)
{
DADiskRef disk = NULL;
DASessionRef session = NULL;
session = DASessionCreate ( kCFAllocatorDefault );
if(session == NULL)
{
printf("session NULL\n");
return 0;
}
disk = DADiskCreateFromBSDName ( kCFAllocatorDefault, session, DrivePath);
if(disk == NULL)
{
printf("disk NULL\n");
return 0;
}
printf("disk session %p ref %p\n", session, disk);
// Eject the whole disk with all the volumes
DADiskRef whole;
unsigned flags;
whole = DADiskCopyWholeDisk( disk );
if(whole)
{
DADiskUnmount( whole, kDADiskUnmountOptionWhole,
SafeRemovalCallback, ( void * ) ( flags & (1 << 1) ) );
}
else
{
printf("Failed to get whole disk !\n");
}
}
I tried to use DADiskUnmount() API with disk also instead of whole. I
defined SafeRemovalCallback function also and it was called also but
my pendrive was still mounted.
Regards
On Wed, Dec 17, 2008 at 9:03 PM, Jean-Daniel Dupas
<email@hidden> wrote:
> Try to use the Disk Arbitration Framework:
>
> http://developer.apple.com/documentation/Darwin/Reference/DiscArbitrationFramework/index.html
>
> Le 17 déc. 08 à 16:24, Rakesh Singhal a écrit :
>
>> ya i was trying on Leopard only. I need something that can work on
>> both (Tiger and Leopard). I have path to volume (/Volume/MyPenDrive)
>> and I want to unmount it.
>>
>> please suggest me.
>>
>> On Wed, Dec 17, 2008 at 8:14 PM, Philip Aker <email@hidden> wrote:
>>>
>>> On 2008-12-17, at 04:52:40, Rakesh Singhal wrote:
>>>
>>>> Hi all
>>>>
>>>> I am trying to unmount a pendrive using "disktool -u
>>>> /Volume/MyPenDrive" but It gives the following message and does not
>>>> unmount:
>>>>
>>>> /Volume/MyPenDrive will be unmounted...
>>>> ***Notifications Complete fro type 1
>>>>
>>>> I am not getting what is this :(
>>>>
>>>> please suggest to unmount any drive from program.
>>>
>>> What OS version are you using? <x-man-page://disktool> on Leopard shows
>>> that
>>> it's been deprecated since 2004.
>>>
>>>
>>>
>>> Philip Aker
>>> echo email@hidden@nl | tr a-z@. p-za-o.@
>>>
>>> Democracy: Two wolves and a sheep voting on lunch.
>>>
>>>
>> _______________________________________________
>> 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:
This email sent to email@hidden