| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
On May 26, 2005, at 3:41 PM, Arshad Tayyeb wrote:
Hi Larry,
Thanks for trying your code out.
I am definitely ejecting them with the eject key; they are unmounted as far as everything else is concerned. And if I run the process again, it works fine.
And it only has this problem on Tiger.
I have some sample code which demonstrates this problem, if anyone cares to try:
http://www.snarshad.com/~arshad/tocreader.sit
(if you want to just look at the source file, it's http:// www.snarshad.com/~arshad/tocreader.c - it's a modified version of Apple's AudioCDSample.c)
It has the source code, makefile, and compiled binary; I'm curious if other people's Tiger systems exhibit this problem, maybe it's just me.
Thanks,
-Arshad
On May 26, 2005, at 6:32 PM, Laurence Harris wrote:
On 5/26/05 4:50 PM, Arshad Tayyeb didst favor us with:
I have an application that needs to find any mounted CDs and get their TOCs. It pretty much works under Panther, but in Tiger I get the following problem:
When calling FSGetVolumeInfo and iterating over the volumes, the
first time I call it, it works fine. It returns me the volRef
numbers -100, -101 (for the 2 drives I always have mounted), and -112
(for example) for the currently mounted CD.
Then I eject the CD, and load a different CD, and run that code again
(during the same run of the program).
The I get -100, -101, and -112 *again*! And -112 is no longer a valid ref number.
I have code that iterates over the volumes using FSGetVolumeInfo and I'm not
seeing this. Even if I insert a CD I just ejected, it mounts with the next
vRefNum. How are you ejecting these disks? Are you doing it programmatically
and not unmounting them?
Larry
If I quit the program and re-launch it correctly identifies -113 as the new CD's volume reference.
This problem is not limited to CDs - it also occurs when mounting/ dismounting iPods, for example.
My guess is that once I call FSGetVolumeInfo, it caches the volumes for the lifespan of the current process.
Is this a bug in Tiger? And can anyone think of any way around it? Is there any way to flush the File Manager's cache of volume information?
Thanks, -Arshad
Here's the code I'm using (approximately):
while (1) /* bug occurs when the code runs more than once during the process' lifetime */ { char x[1024]; gets(x); /* this makes it prompt me, if I hit enter it will re-scan for volumes */ findalltocs(); printf("Reading....\n"); result = noErr;
short ref = GetDefaultAudioCDRefNum(); printf("ref : %d\n", ref);
for (volumeIndex = 1; result == noErr || result != nsvErr; volumeIndex++) { FSVolumeRefNum actualVolume; HFSUniStr255 volumeName; FSVolumeInfo volumeInfo;
bzero((void *) &volumeInfo, sizeof(volumeInfo));
result = FSGetVolumeInfo(kFSInvalidVolumeRefNum, volumeIndex, &actualVolume, kFSVolInfoFSInfo, &volumeInfo, &volumeName, NULL);
printf("Vol %d %d\n", volumeIndex, actualVolume); /* actual volume is the volume ref */ ... } }
_______________________________________________ Do not post admin requests to the list. They will be ignored. Carbon-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/carbon-dev/email@hidden
This email sent to email@hidden
_______________________________________________ Do not post admin requests to the list. They will be ignored. Carbon-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/carbon-dev/email@hidden
| References: | |
| >Re: FSGetVolumeInfo does not get updated volume info on mounts/dismounts (Tiger) (From: Laurence Harris <email@hidden>) | |
| >Re: FSGetVolumeInfo does not get updated volume info on mounts/dismounts (Tiger) (From: Arshad Tayyeb <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.