Re: getfsstat from disk arbitration callback
Re: getfsstat from disk arbitration callback
- Subject: Re: getfsstat from disk arbitration callback
- From: Ameen <email@hidden>
- Date: Wed, 18 Jul 2007 01:18:40 +0530
>>It is common for a disk image to be unmounted at the time of the
DADiskAppearedCallback, that is, have no
kDADiskDescriptionVolumePathKey, but immediately be mounted a moment
later.
ok!
DARegisterDiskMountApprovalCallback and
DARegisterDiskUnmountApprovalCallback are good, except that
DARegisterDiskMountApprovalCallback gets invoked twice for a disk
image. But still they solve my problem.
pasting the CFDictionaryRef for DARegisterDiskMountApprovalCallback;
this callback gets invoked twice with my test disk image.
<CFDictionary 0x3024e0 [0xa080b1c0]>{type = mutable, count = 30,
capacity = 47, pairs = (
0 : <CFString 0x301ce0 [0xa080b1c0]>{contents = "DAMediaBlockSize"}
= <CFNumber 0x3020c0 [0xa080b1c0]>{value = +512, type =
kCFNumberSInt64Type}
1 : <CFString 0x301d00 [0xa080b1c0]>{contents = "DAMediaBSDName"} =
<CFString 0x3020d0 [0xa080b1c0]>{contents = "disk1s2"}
3 : <CFString 0x301d20 [0xa080b1c0]>{contents = "DADeviceUnit"} =
<CFNumber 0x3004f0 [0xa080b1c0]>{value = +0, type = kCFNumberSInt32Type}
6 : <CFString 0x301d40 [0xa080b1c0]>{contents = "DADevicePath"} =
<CFString 0x3020f0 [0xa080b1c0]>{contents = "IOService:/IOResources/
IOHDIXController/IOHDIXHDDriveOutKernel/
IODiskImageBlockStorageDeviceOutKernel"}
7 : <CFString 0x301d60 [0xa080b1c0]>{contents = "DAVolumeMountable"}
= <CFBoolean 0xa080b88c [0xa080b1c0]>{value = true}
8 : <CFString 0x301d80 [0xa080b1c0]>{contents = "DABusPath"} =
<CFString 0x302160 [0xa080b1c0]>{contents = "IODeviceTree:/"}
9 : <CFString 0x301da0 [0xa080b1c0]>{contents = "DADeviceModel"} =
<CFString 0x302180 [0xa080b1c0]>{contents = "Disk Image"}
10 : <CFString 0x301dc0 [0xa080b1c0]>{contents = "DAMediaEjectable"}
= <CFBoolean 0xa080b88c [0xa080b1c0]>{value = true}
11 : <CFString 0x301de0 [0xa080b1c0]>{contents = "DAMediaBSDMajor"}
= <CFNumber 0x3021a0 [0xa080b1c0]>{value = +14, type =
kCFNumberSInt64Type}
12 : <CFString 0x301e00 [0xa080b1c0]>{contents = "DAMediaContent"} =
<CFString 0x3021b0 [0xa080b1c0]>{contents = "Apple_HFS"}
13 : <CFString 0x301e20 [0xa080b1c0]>{contents = "DAMediaPath"} =
<CFString 0x3021d0 [0xa080b1c0]>{contents = "IOService:/IOResources/
IOHDIXController/IOHDIXHDDriveOutKernel/
IODiskImageBlockStorageDeviceOutKernel/IOBlockStorageDriver/Apple
UDIF read-only Media/IOApplePartitionScheme/disk image@2"}
22 : <CFString 0x301e40 [0xa080b1c0]>{contents = "DAVolumeNetwork"}
= <CFBoolean 0xa080b884 [0xa080b1c0]>{value = false}
24 : <CFString 0x301e60 [0xa080b1c0]>{contents = "DAMediaSize"} =
<CFNumber 0x3022a0 [0xa080b1c0]>{value = +128360448, type =
kCFNumberSInt64Type}
26 : <CFString 0x301e80 [0xa080b1c0]>{contents = "DAMediaWhole"} =
<CFBoolean 0xa080b884 [0xa080b1c0]>{value = false}
27 : <CFString 0x301ea0 [0xa080b1c0]>{contents = "DAMediaWritable"}
= <CFBoolean 0xa080b884 [0xa080b1c0]>{value = false}
37 : <CFString 0x301ee0 [0xa080b1c0]>{contents = "DAVolumeName"} =
<CFString 0x3022f0 [0xa080b1c0]>{contents = "Google Earth"}
42 : <CFString 0x301f00 [0xa080b1c0]>{contents = "DAMediaRemovable"}
= <CFBoolean 0xa080b88c [0xa080b1c0]>{value = true}
43 : <CFString 0x301f20 [0xa080b1c0]>{contents = "DADeviceVendor"} =
<CFString 0x302310 [0xa080b1c0]>{contents = "Apple"}
44 : <CFString 0x301f40 [0xa080b1c0]>{contents = "DAAppearanceTime"}
= <CFNumber 0x302320 [0xa080b1c0]>{value =
+206393944.99375599622726440430, type = kCFNumberFloat64Type}
45 : <CFString 0x301f60 [0xa080b1c0]>{contents = "DAMediaName"} =
<CFString 0x302330 [0xa080b1c0]>{contents = "disk image"}
46 : <CFString 0x301f80 [0xa080b1c0]>{contents = "DAMediaLeaf"} =
<CFBoolean 0xa080b88c [0xa080b1c0]>{value = true}
47 : <CFString 0x301fa0 [0xa080b1c0]>{contents = "DAMediaBSDMinor"}
= <CFNumber 0x302350 [0xa080b1c0]>{value = +11, type =
kCFNumberSInt32Type}
48 : <CFString 0x301fc0 [0xa080b1c0]>{contents = "DAMediaKind"} =
<CFString 0x302360 [0xa080b1c0]>{contents = "IOMedia"}
51 : <CFString 0x301fe0 [0xa080b1c0]>{contents = "DAVolumeUUID"} =
<CFUUID 0x302510> A956A586-8F22-393B-848E-F033D50DD896
52 : <CFString 0x302000 [0xa080b1c0]>{contents = "DADeviceProtocol"}
= <CFString 0x302380 [0xa080b1c0]>{contents = "Virtual Interface"}
56 : <CFString 0x302020 [0xa080b1c0]>{contents = "DABusName"} =
<CFString 0x3023a0 [0xa080b1c0]>{contents = "/"}
57 : <CFString 0x302040 [0xa080b1c0]>{contents = "DAVolumeKind"} =
<CFString 0x3023b0 [0xa080b1c0]>{contents = "hfs"}
58 : <CFString 0x302060 [0xa080b1c0]>{contents = "DADeviceRevision"}
= <CFString 0x3023c0 [0xa080b1c0]>{contents = "10.4.9v114.9"}
63 : <CFString 0x302080 [0xa080b1c0]>{contents = "DAMediaIcon"} =
<CFDictionary 0x302470 [0xa080b1c0]>{type = mutable, count = 2,
capacity = 4, pairs = (
2 : <CFString 0x3023e0 [0xa080b1c0]>{contents =
"IOBundleResourceFile"} = <CFString 0x302420 [0xa080b1c0]>{contents =
"Removable.icns"}
3 : <CFString 0x302400 [0xa080b1c0]>{contents =
"CFBundleIdentifier"} = <CFString 0x302440 [0xa080b1c0]>{contents =
"com.apple.iokit.IOStorageFamily"}
)}
64 : <CFString 0x3020a0 [0xa080b1c0]>{contents = "DAMediaBSDUnit"} =
<CFNumber 0x3024d0 [0xa080b1c0]>{value = +1, type = kCFNumberSInt32Type}
)}
<CFDictionary 0x302d80 [0xa080b1c0]>{type = mutable, count = 30,
capacity = 47, pairs = (
0 : <CFString 0x301c10 [0xa080b1c0]>{contents = "DAMediaBlockSize"}
= <CFNumber 0x302980 [0xa080b1c0]>{value = +512, type =
kCFNumberSInt64Type}
1 : <CFString 0x3025c0 [0xa080b1c0]>{contents = "DAMediaBSDName"} =
<CFString 0x302990 [0xa080b1c0]>{contents = "disk1s2"}
3 : <CFString 0x3025e0 [0xa080b1c0]>{contents = "DADeviceUnit"} =
<CFNumber 0x3004f0 [0xa080b1c0]>{value = +0, type = kCFNumberSInt32Type}
6 : <CFString 0x302600 [0xa080b1c0]>{contents = "DADevicePath"} =
<CFString 0x3029b0 [0xa080b1c0]>{contents = "IOService:/IOResources/
IOHDIXController/IOHDIXHDDriveOutKernel/
IODiskImageBlockStorageDeviceOutKernel"}
7 : <CFString 0x302620 [0xa080b1c0]>{contents = "DAVolumeMountable"}
= <CFBoolean 0xa080b88c [0xa080b1c0]>{value = true}
8 : <CFString 0x302640 [0xa080b1c0]>{contents = "DABusPath"} =
<CFString 0x302a20 [0xa080b1c0]>{contents = "IODeviceTree:/"}
9 : <CFString 0x302660 [0xa080b1c0]>{contents = "DADeviceModel"} =
<CFString 0x302a40 [0xa080b1c0]>{contents = "Disk Image"}
10 : <CFString 0x302680 [0xa080b1c0]>{contents = "DAMediaEjectable"}
= <CFBoolean 0xa080b88c [0xa080b1c0]>{value = true}
11 : <CFString 0x3026a0 [0xa080b1c0]>{contents = "DAMediaBSDMajor"}
= <CFNumber 0x302a60 [0xa080b1c0]>{value = +14, type =
kCFNumberSInt64Type}
12 : <CFString 0x3026c0 [0xa080b1c0]>{contents = "DAMediaContent"} =
<CFString 0x302a70 [0xa080b1c0]>{contents = "Apple_HFS"}
13 : <CFString 0x3026e0 [0xa080b1c0]>{contents = "DAMediaPath"} =
<CFString 0x302a90 [0xa080b1c0]>{contents = "IOService:/IOResources/
IOHDIXController/IOHDIXHDDriveOutKernel/
IODiskImageBlockStorageDeviceOutKernel/IOBlockStorageDriver/Apple
UDIF read-only Media/IOApplePartitionScheme/disk image@2"}
22 : <CFString 0x302700 [0xa080b1c0]>{contents = "DAVolumeNetwork"}
= <CFBoolean 0xa080b884 [0xa080b1c0]>{value = false}
24 : <CFString 0x302720 [0xa080b1c0]>{contents = "DAMediaSize"} =
<CFNumber 0x302b60 [0xa080b1c0]>{value = +128360448, type =
kCFNumberSInt64Type}
26 : <CFString 0x302740 [0xa080b1c0]>{contents = "DAMediaWhole"} =
<CFBoolean 0xa080b884 [0xa080b1c0]>{value = false}
27 : <CFString 0x302760 [0xa080b1c0]>{contents = "DAMediaWritable"}
= <CFBoolean 0xa080b884 [0xa080b1c0]>{value = false}
37 : <CFString 0x3027a0 [0xa080b1c0]>{contents = "DAVolumeName"} =
<CFString 0x302bb0 [0xa080b1c0]>{contents = "Google Earth"}
42 : <CFString 0x3027c0 [0xa080b1c0]>{contents = "DAMediaRemovable"}
= <CFBoolean 0xa080b88c [0xa080b1c0]>{value = true}
43 : <CFString 0x3027e0 [0xa080b1c0]>{contents = "DADeviceVendor"} =
<CFString 0x302bd0 [0xa080b1c0]>{contents = "Apple"}
44 : <CFString 0x302800 [0xa080b1c0]>{contents = "DAAppearanceTime"}
= <CFNumber 0x302be0 [0xa080b1c0]>{value =
+206393944.99375599622726440430, type = kCFNumberFloat64Type}
45 : <CFString 0x302820 [0xa080b1c0]>{contents = "DAMediaName"} =
<CFString 0x302c00 [0xa080b1c0]>{contents = "disk image"}
46 : <CFString 0x302840 [0xa080b1c0]>{contents = "DAMediaLeaf"} =
<CFBoolean 0xa080b88c [0xa080b1c0]>{value = true}
47 : <CFString 0x302860 [0xa080b1c0]>{contents = "DAMediaBSDMinor"}
= <CFNumber 0x302350 [0xa080b1c0]>{value = +11, type =
kCFNumberSInt32Type}
48 : <CFString 0x302880 [0xa080b1c0]>{contents = "DAMediaKind"} =
<CFString 0x302c20 [0xa080b1c0]>{contents = "IOMedia"}
51 : <CFString 0x3028a0 [0xa080b1c0]>{contents = "DAVolumeUUID"} =
<CFUUID 0x302510> A956A586-8F22-393B-848E-F033D50DD896
52 : <CFString 0x3028c0 [0xa080b1c0]>{contents = "DADeviceProtocol"}
= <CFString 0x302c40 [0xa080b1c0]>{contents = "Virtual Interface"}
56 : <CFString 0x3028e0 [0xa080b1c0]>{contents = "DABusName"} =
<CFString 0x302bf0 [0xa080b1c0]>{contents = "/"}
57 : <CFString 0x302900 [0xa080b1c0]>{contents = "DAVolumeKind"} =
<CFString 0x302c60 [0xa080b1c0]>{contents = "hfs"}
58 : <CFString 0x302920 [0xa080b1c0]>{contents = "DADeviceRevision"}
= <CFString 0x302c70 [0xa080b1c0]>{contents = "10.4.9v114.9"}
63 : <CFString 0x302940 [0xa080b1c0]>{contents = "DAMediaIcon"} =
<CFDictionary 0x302d20 [0xa080b1c0]>{type = mutable, count = 2,
capacity = 4, pairs = (
2 : <CFString 0x302c90 [0xa080b1c0]>{contents =
"IOBundleResourceFile"} = <CFString 0x302cd0 [0xa080b1c0]>{contents =
"Removable.icns"}
3 : <CFString 0x302cb0 [0xa080b1c0]>{contents =
"CFBundleIdentifier"} = <CFString 0x302cf0 [0xa080b1c0]>{contents =
"com.apple.iokit.IOStorageFamily"}
)}
64 : <CFString 0x302960 [0xa080b1c0]>{contents = "DAMediaBSDUnit"} =
<CFNumber 0x3024d0 [0xa080b1c0]>{value = +1, type = kCFNumberSInt32Type}
)}
thanks,
Ameen.
UnMountApprovalCallback is good. MountApprovalCallback gets invoked
twice for each disk image mount.
On Jul 17, 2007, at 11:27 PM, Dan Markarian wrote:
Hey Ameen,
I believe DADiskAppearedCallback is the correct callback, however,
you cannot assume that the volume is already mounted. Do you see
kDADiskDescriptionVolumePathKey? Is your test case a disk image?
It is common for a disk image to be unmounted at the time of the
DADiskAppearedCallback, that is, have no
kDADiskDescriptionVolumePathKey, but immediately be mounted a
moment later. We notify you about that mount through
DADiskDescriptionChangedCallback.
Dan
On 17 Jul 2007, at 12:58 PM, Dominic Giampaolo wrote:
using getfsstat() to get the list of mounted devices in the file
system. Usign disk arbitration framework to register for volume
mount/unmount callbacks.
You are using the wrong DiskArb callback -- the DiskAppeared
callback happens when the *disk* appears, not the volumes
that are on the disk. Adding the call to sleep() makes your
code wait long enough for the volumes to mount.
It will work better if you register for a MountApproval
callback:
DARegisterDiskMountApprovalCallback(session, NULL,
volume_mounted_callback, NULL);
--dominic
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Filesystem-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40apple.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Filesystem-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden