Re: DiskArb DiskChangedCallback bug?
Re: DiskArb DiskChangedCallback bug?
- Subject: Re: DiskArb DiskChangedCallback bug?
- From: Brian Bergstrand <email@hidden>
- Date: Mon, 12 Jun 2006 14:28:09 -0500
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Jun 12, 2006, at 1:40 PM, Dan Markarian wrote:
Hi Brian,
DADiskDescriptionChangedCallback does notify you when a property of
a disk has changed, including whether it is mounted or not,
however, it does not notify you of the existence of the disk. You
must also subscribe to DADiskAppearedCallback and
DADiskDisappearedCallback. It is possible that a disk is already
mounted when we tell you of its existence.
Ok, my thinking was, the disk is inserted after I've already
registered my callback so a change from attached to mounted would be
sent. When a disk is attached, there is no mount point, but
apparently DA can see attach/mount as a single event and that's where
the confusion was.
I've switched to DADiskAppearedCallback to detect a mount and still
use Changed to detect the unmount. This now works.
Thanks.
P.S. It would be nice to see the documentation clarify this situation.
Dan
Le 12 Jun 2006 à 1:58 PM, Brian Bergstrand a écrit :
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Jun 12, 2006, at 12:49 PM, Chris Sarcone wrote:
Brian --
Nevermind. I was looking at the wrong API.
As for using DARegisterDiskDescriptionChangedCallback() for
mounts, I think that's incorrect.
DARegisterDiskDescriptionChangedCallback() is meant to track disk
that are already mounted and changing either their name or path.
I think your really want DARegisterDiskAppearedCallback().
Hmm, won't that be called when the disk appears in IOKit and not
when it's mounted? I don't really care about the former. Or will
it be called both for attach and mount? If that's the case, then I
could use the volumePath key in the Disk dictionary to determine
if it's being mounted.
Also, if ChangedCallback() is not supposed to be used, then the
documentation should be clarified:
/*!
* @constant kDADiskDescriptionWatchVolumePath
* Predefined CFArray object containing a set of disk description
keys appropriate for
* watching volume mount changes using
DARegisterDiskDescriptionChangedCallback().
*/
extern CFArrayRef kDADiskDescriptionWatchVolumePath;
I take "watching volume mount changes", to mean changing from
mounted - -> unmounted OR vise-versa. "watching volume un-mounts"
would be a better term if that is all ChangedCallback does.
Thanks for the quick response!
-- Chris
On Jun 12, 2006, at 10:42 AM, Chris Sarcone wrote:
Brian --
DARegisterDiskDescriptionChangedCallback(daSession, NULL,
kDADiskDescriptionWatchVolumePath,
DiskArbCallback_ChangeNotification, NULL);
The third argument is supposed to be a CFArrayRef of keys to
watch, not a CFDictionaryRef. You might want to try fixing that,
then retest...
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (Darwin)
iD8DBQFEjatIedHYW7bHtqIRAjrnAKDueVlFzcor+NdyG0haXVfsaWMVjwCcCqbv
hDuY/92TfgL7KQWq9/yEUqo=
=yBfx
-----END PGP SIGNATURE-----
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40apple.com
This email sent to email@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (Darwin)
iD8DBQFEjcBOedHYW7bHtqIRAsbWAJ9bA5vk1T33RTXI/FoGuX3QRoag0gCcDcBy
f+552tZHJd99hZUG3spLkMA=
=nFKb
-----END PGP SIGNATURE-----
_______________________________________________
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