ADC Home > Reference Library > Reference > Darwin > Disk Arbitration Framework Reference

 


DiskArbitration.h

Includes:

Overview



Functions

DADiskClaim
Claims the specified disk object for exclusive use.
DADiskEject
Ejects the specified disk object.
DADiskGetOptions
Obtains the options for the specified disk.
DADiskIsClaimed
Reports whether or not the disk is claimed.
DADiskMount
Mounts the volume at the specified disk object.
DADiskMountWithArguments
Mounts the volume at the specified disk object, with the specified mount options.
DADiskRename
Renames the volume at the specified disk object.
DADiskSetOptions
Sets the options for the specified disk.
DADiskUnclaim
Unclaims the specified disk object.
DADiskUnmount
Unmounts the volume at the specified disk object.
DARegisterDiskAppearedCallback
Registers a callback function to be called whenever a disk has appeared.
DARegisterDiskDescriptionChangedCallback
Registers a callback function to be called whenever a disk description has changed.
DARegisterDiskDisappearedCallback
Registers a callback function to be called whenever a disk has disappeared.
DARegisterDiskEjectApprovalCallback
Registers a callback function to be called whenever a volume is to be ejected.
DARegisterDiskMountApprovalCallback
Registers a callback function to be called whenever a volume is to be mounted.
DARegisterDiskPeekCallback
Registers a callback function to be called whenever a disk has been probed.
DARegisterDiskUnmountApprovalCallback
Registers a callback function to be called whenever a volume is to be unmounted.
DAUnregisterApprovalCallback
Unregisters a registered callback function.
DAUnregisterCallback
Unregisters a registered callback function.

DADiskClaim


Claims the specified disk object for exclusive use.

extern void DADiskClaim(
    DADiskRef disk, 
    DADiskClaimOptions options, 
    DADiskClaimReleaseCallback release, 
    void *releaseContext, 
    DADiskClaimCallback callback, 
    void *callbackContext );  
Parameters
disk
The disk object.
options
The claim options.
release
The callback function to call when the claim is to be released.
releaseContext
The user-defined context parameter to pass to the callback function.
callback
The callback function to call once the claim completes.
callbackContext
The user-defined context parameter to pass to the callback function.


DADiskEject


Ejects the specified disk object.

extern void DADiskEject(
    DADiskRef disk, 
    DADiskEjectOptions options, 
    DADiskEjectCallback callback, 
    void *context );  
Parameters
disk
The disk object.
options
The eject options.
callback
The callback function to call once the ejection completes.
context
The user-defined context parameter to pass to the callback function.


DADiskGetOptions


Obtains the options for the specified disk.

extern DADiskOptions DADiskGetOptions(
    DADiskRef disk );  
Parameters
disk
The disk object for which to obtain the options.
Return Value

The options.


DADiskIsClaimed


Reports whether or not the disk is claimed.

extern Boolean DADiskIsClaimed(
    DADiskRef disk );  
Parameters
disk
The disk object.
Return Value

TRUE if the disk is claimed, otherwise FALSE.


DADiskMount


Mounts the volume at the specified disk object.

extern void DADiskMount(
    DADiskRef disk, 
    CFURLRef path, 
    DADiskMountOptions options, 
    DADiskMountCallback callback, 
    void *context );  
Parameters
disk
The disk object.
path
The mount path. Pass NULL for a "standard" mount path.
options
The mount options.
callback
The callback function to call once the mount completes.
context
The user-defined context parameter to pass to the callback function.


DADiskMountWithArguments


Mounts the volume at the specified disk object, with the specified mount options.

extern void DADiskMountWithArguments(
    DADiskRef disk, 
    CFURLRef path, 
    DADiskMountOptions options, 
    DADiskMountCallback callback, 
    void *context, 
    CFStringRef arguments[] );  
Parameters
disk
The disk object.
path
The mount path. Pass NULL for a "standard" mount path.
options
The mount options.
callback
The callback function to call once the mount completes.
context
The user-defined context parameter to pass to the callback function.
arguments
The null-terminated list of mount options to pass to /sbin/mount -o.


DADiskRename


Renames the volume at the specified disk object.

extern void DADiskRename(
    DADiskRef disk, 
    CFStringRef name, 
    DADiskRenameOptions options, 
    DADiskRenameCallback callback, 
    void *context );  
Parameters
disk
The disk object.
options
The rename options.
callback
The callback function to call once the rename completes.
context
The user-defined context parameter to pass to the callback function.


DADiskSetOptions


Sets the options for the specified disk.

extern DAReturn DADiskSetOptions(
    DADiskRef disk,
    DADiskOptions options,
    Boolean value );  
Parameters
disk
The disk object for which to set the options.
options
The options to set or clear.
value
Pass TRUE to set options; otherwise pass FALSE to clear options.
Return Value

A result code.


DADiskUnclaim


Unclaims the specified disk object.

extern void DADiskUnclaim(
    DADiskRef disk );  
Parameters
disk
The disk object.


DADiskUnmount


Unmounts the volume at the specified disk object.

extern void DADiskUnmount(
    DADiskRef disk, 
    DADiskUnmountOptions options, 
    DADiskUnmountCallback callback, 
    void *context );  
Parameters
disk
The disk object.
options
The unmount options.
callback
The callback function to call once the unmount completes.
context
The user-defined context parameter to pass to the callback function.


DARegisterDiskAppearedCallback


Registers a callback function to be called whenever a disk has appeared.

extern void DARegisterDiskAppearedCallback(
    DASessionRef session, 
    CFDictionaryRef match, 
    DADiskAppearedCallback callback, 
    void *context );  
Parameters
session
The session object.
match
The disk description keys to match. Pass NULL for all disk objects.
callback
The callback function to call when a disk has appeared.
context
The user-defined context parameter to pass to the callback function.


DARegisterDiskDescriptionChangedCallback


Registers a callback function to be called whenever a disk description has changed.

extern void DARegisterDiskDescriptionChangedCallback(
    DASessionRef session, 
    CFDictionaryRef match, 
    CFArrayRef watch, 
    DADiskDescriptionChangedCallback callback, 
    void *context );  
Parameters
session
The session object.
match
The disk description keys to match. Pass NULL for all disk objects.
watch
The disk description keys to watch. Pass NULL for all keys.
callback
The callback function to call when a watched key changes.
context
The user-defined context parameter to pass to the callback function.


DARegisterDiskDisappearedCallback


Registers a callback function to be called whenever a disk has disappeared.

extern void DARegisterDiskDisappearedCallback(
    DASessionRef session, 
    CFDictionaryRef match, 
    DADiskDisappearedCallback callback, 
    void *context );  
Parameters
session
The session object.
match
The disk description keys to match. Pass NULL for all disk objects.
callback
The callback function to call when a disk has disappeared.
context
The user-defined context parameter to pass to the callback function.


DARegisterDiskEjectApprovalCallback


Registers a callback function to be called whenever a volume is to be ejected.

extern void DARegisterDiskEjectApprovalCallback(
    DAApprovalSessionRef session, 
    CFDictionaryRef match, 
    DADiskEjectApprovalCallback callback, 
    void *context );  
Parameters
session
The approval session object.
match
The disk description keys to match. Pass NULL for all disk objects.
callback
The callback function to call when a volume is to be ejected.
context
The user-defined context parameter to pass to the callback function.


DARegisterDiskMountApprovalCallback


Registers a callback function to be called whenever a volume is to be mounted.

extern void DARegisterDiskMountApprovalCallback(
    DAApprovalSessionRef session, 
    CFDictionaryRef match, 
    DADiskMountApprovalCallback callback, 
    void *context );  
Parameters
session
The approval session object.
match
The disk description keys to match. Pass NULL for all disk objects.
callback
The callback function to call when a volume is to be mounted.
context
The user-defined context parameter to pass to the callback function.


DARegisterDiskPeekCallback


Registers a callback function to be called whenever a disk has been probed.

extern void DARegisterDiskPeekCallback(
    DASessionRef session, 
    CFDictionaryRef match, 
    CFIndex order, 
    DADiskPeekCallback callback, 
    void *context );  
Parameters
session
The session object.
match
The disk description keys to match. Pass NULL for all disk objects.
order
The callback order, from lowest to highest. Pass 0 for the default.
callback
The callback function to call when a disk has been probed.
context
The user-defined context parameter to pass to the callback function.


DARegisterDiskUnmountApprovalCallback


Registers a callback function to be called whenever a volume is to be unmounted.

extern void DARegisterDiskUnmountApprovalCallback(
    DAApprovalSessionRef session, 
    CFDictionaryRef match, 
    DADiskUnmountApprovalCallback callback, 
    void *context );  
Parameters
session
The approval session object.
match
The disk description keys to match. Pass NULL for all disk objects.
callback
The callback function to call when a volume is to be unmounted.
context
The user-defined context parameter to pass to the callback function.


DAUnregisterApprovalCallback


Unregisters a registered callback function.

extern void DAUnregisterApprovalCallback(
    DAApprovalSessionRef session,
    void *callback,
    void *context );  
Parameters
session
The approval session object.
callback
The registered callback function.
context
The user-defined context parameter.


DAUnregisterCallback


Unregisters a registered callback function.

extern void DAUnregisterCallback(
    DASessionRef session,
    void *callback,
    void *context );  
Parameters
session
The session object.
callback
The registered callback function.
context
The user-defined context parameter.

Constants


kDADiskDescriptionMatchMediaUnformatted


extern CFDictionaryRef kDADiskDescriptionMatchMediaUnformatted;  
Discussion

Predefined CFDictionary object containing a set of disk description keys and values appropriate for matching unformatted media using DARegister*Callback().


kDADiskDescriptionMatchMediaWhole


extern CFDictionaryRef kDADiskDescriptionMatchMediaWhole;  
Discussion

Predefined CFDictionary object containing a set of disk description keys and values appropriate for matching whole media using DARegister*Callback().


kDADiskDescriptionMatchVolumeMountable


extern CFDictionaryRef kDADiskDescriptionMatchVolumeMountable;  
Discussion

Predefined CFDictionary object containing a set of disk description keys and values appropriate for matching mountable volumes using DARegister*Callback().


kDADiskDescriptionMatchVolumeUnrecognized


extern CFDictionaryRef kDADiskDescriptionMatchVolumeUnrecognized;  
Discussion

Predefined CFDictionary object containing a set of disk description keys and values appropriate for matching unrecognized volumes using DARegister*Callback().


kDADiskDescriptionWatchVolumeName


extern CFArrayRef kDADiskDescriptionWatchVolumeName;  
Discussion

Predefined CFArray object containing a set of disk description keys appropriate for watching volume name changes using DARegisterDiskDescriptionChangedCallback().


kDADiskDescriptionWatchVolumePath


extern CFArrayRef kDADiskDescriptionWatchVolumePath;  
Discussion

Predefined CFArray object containing a set of disk description keys appropriate for watching volume mount changes using DARegisterDiskDescriptionChangedCallback().

Typedefs


DADiskAppearedCallback


Type of the callback function used by DARegisterDiskAppearedCallback().

typedef void ( *DADiskAppearedCallback )(
    DADiskRef disk,
    void *context );  
Parameters
disk
A disk object.
context
The user-defined context parameter given to the registration function.


DADiskClaimCallback


Type of the callback function used by DADiskClaim().

typedef void ( *DADiskClaimCallback )(
    DADiskRef disk,
    DADissenterRef dissenter,
    void *context );  
Parameters
disk
The disk object.
dissenter
A dissenter object on failure or NULL on success.
context
The user-defined context parameter given to the claim function.


DADiskClaimReleaseCallback


Type of the callback function used by DADiskClaim().

typedef DADissenterRef ( *DADiskClaimReleaseCallback )(
    DADiskRef disk,
    void *context );  
Parameters
disk
The disk object.
context
The user-defined context parameter given to the claim function.
Return Value

A dissenter reference. Pass NULL to release claim.

Discussion

The caller of this callback receives a reference to the returned object. The caller also implicitly retains the object and is responsible for releasing it with CFRelease().


DADiskDescriptionChangedCallback


Type of the callback function used by DARegisterDiskDescriptionChangedCallback().

typedef void ( *DADiskDescriptionChangedCallback )(
    DADiskRef disk,
    CFArrayRef keys,
    void *context );  
Parameters
disk
A disk object.
keys
A list of changed keys.
context
The user-defined context parameter given to the registration function.


DADiskDisappearedCallback


Type of the callback function used by DARegisterDiskDisappearedCallback().

typedef void ( *DADiskDisappearedCallback )(
    DADiskRef disk,
    void *context );  
Parameters
disk
A disk object.
context
The user-defined context parameter given to the registration function.


DADiskEjectApprovalCallback


Type of the callback function used by DARegisterDiskEjectApprovalCallback().

typedef DADissenterRef ( *DADiskEjectApprovalCallback )(
    DADiskRef disk,
    void *context );  
Parameters
disk
A disk object.
context
The user-defined context parameter given to the registration function.
Return Value

A dissenter reference. Pass NULL to approve.

Discussion

The caller of this callback receives a reference to the returned object. The caller also implicitly retains the object and is responsible for releasing it with CFRelease().


DADiskEjectCallback


Type of the callback function used by DADiskEject().

typedef void ( *DADiskEjectCallback )(
    DADiskRef disk,
    DADissenterRef dissenter,
    void *context );  
Parameters
disk
The disk object.
dissenter
A dissenter object on failure or NULL on success.
context
The user-defined context parameter given to the eject function.


DADiskMountApprovalCallback


Type of the callback function used by DARegisterDiskMountApprovalCallback().

typedef DADissenterRef ( *DADiskMountApprovalCallback )(
    DADiskRef disk,
    void *context );  
Parameters
disk
A disk object.
context
The user-defined context parameter given to the registration function.
Return Value

A dissenter reference. Pass NULL to approve.

Discussion

The caller of this callback receives a reference to the returned object. The caller also implicitly retains the object and is responsible for releasing it with CFRelease().


DADiskMountCallback


Type of the callback function used by DADiskMount().

typedef void ( *DADiskMountCallback )(
    DADiskRef disk,
    DADissenterRef dissenter,
    void *context );  
Parameters
disk
The disk object.
dissenter
A dissenter object on failure or NULL on success.
context
The user-defined context parameter given to the mount function.


DADiskPeekCallback


Type of the callback function used by DARegisterDiskPeekCallback().

typedef void ( *DADiskPeekCallback )(
    DADiskRef disk,
    void *context );  
Parameters
disk
A disk object.
context
The user-defined context parameter given to the registration function.
Discussion

The peek callback functions are called in a specific order, from lowest order to highest order. DADiskClaim() could be used here to claim the disk object and DADiskSetOptions() could be used here to set up options on the disk object.


DADiskRenameCallback


Type of the callback function used by DADiskRename().

typedef void ( *DADiskRenameCallback )(
    DADiskRef disk,
    DADissenterRef dissenter,
    void *context );  
Parameters
disk
The disk object.
dissenter
A dissenter object on failure or NULL on success.
context
The user-defined context parameter given to the rename function.


DADiskUnmountApprovalCallback


Type of the callback function used by DARegisterDiskUnmountApprovalCallback().

typedef DADissenterRef ( *DADiskUnmountApprovalCallback )(
    DADiskRef disk,
    void *context );  
Parameters
disk
A disk object.
context
The user-defined context parameter given to the registration function.
Return Value

A dissenter reference. Pass NULL to approve.

Discussion

The caller of this callback receives a reference to the returned object. The caller also implicitly retains the object and is responsible for releasing it with CFRelease().


DADiskUnmountCallback


Type of the callback function used by DADiskUnmount().

typedef void ( *DADiskUnmountCallback )(
    DADiskRef disk,
    DADissenterRef dissenter,
    void *context );  
Parameters
disk
The disk object.
dissenter
A dissenter object on failure or NULL on success.
context
The user-defined context parameter given to the unmount function.

Enumerations


DADiskClaimOptions


Options for DADiskClaim().

enum { 
    kDADiskClaimOptionDefault = 0x00000000 
};  


DADiskEjectOptions


Options for DADiskEject().

enum { 
    kDADiskEjectOptionDefault = 0x00000000 
};  


DADiskMountOptions


Options for DADiskMount().

enum { 
    kDADiskMountOptionDefault = 0x00000000, 
    kDADiskMountOptionWhole = 0x00000001 
};  
Constants
kDADiskMountOptionWhole
Mount the volumes tied to the whole disk object.


DADiskOptions


Options for DADiskGetOptions() and DADiskSetOptions().

enum { 
    kDADiskOptionDefault = 0x00000000, 
    kDADiskOptionEjectUponLogout = 0x00000001, 
    kDADiskOptionMountAutomatic = 0x00000010, 
    kDADiskOptionMountAutomaticNoDefer = 0x00000020, 
    kDADiskOptionPrivate = 0x00000100 
};  
Constants
kDADiskOptionEjectUponLogout
Eject the disk upon logout.
kDADiskOptionMountAutomatic
Mount the disk upon appearance.
kDADiskOptionMountAutomaticNoDefer
Mount the disk upon appearance, even if no login.
kDADiskOptionPrivate
Hides the disk from callbacks.


DADiskRenameOptions


Options for DADiskRename().

enum { 
    kDADiskRenameOptionDefault = 0x00000000 
};  


DADiskUnmountOptions


Options for DADiskUnmount().

enum { 
    kDADiskUnmountOptionDefault = 0x00000000, 
    kDADiskUnmountOptionForce = 0x00080000, 
    kDADiskUnmountOptionWhole = 0x00000001 
};  
Constants
kDADiskUnmountOptionForce
Unmount the volume even if files are still active.
kDADiskUnmountOptionWhole
Unmount the volumes tied to the whole disk object.


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.
Last Updated: 2008-03-11