ADC Home > Reference Library > Technical Notes > Legacy Documents > Hardware & Drivers >

Legacy Documentclose button

Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.

Current information on this Reference Library topic can be found here:

CD-ROM Q&As

CONTENTS

This Technical Note contains a collection of archived Q&As relating to a specific topic--questions sent the Developer Support Center (DSC) along with answers from the DSC engineers. Current Q&As can be found on the Macintosh Technical Q&As web site.

[Oct 19 1993]






CD-ROM drivers and Photo CD or Foreign File Access

I'm writing a CD-ROM driver. Is there a developer's kit that explains how to use the Foreign File Access extensions for mounting ISO 9660, High Sierra, and audio CDs?

___

A CD-ROM driver doesn't have to worry about using Foreign File Access and all its file system translators. That stuff all happens at the file system level, via the toExtFS hook. The only thing a driver need do is to post a mount event for an inserted disk.

Foreign File Access is designed to be media-independent. It doesn't make any calls to the driver except the standard Read and Write calls. The Audio CD Access file system translator does assume that the volume in question is a CD-ROM drive, and issues a ReadTOC call to the driver. If the ReadTOC call fails, then Audio CD Access knows it isn't an audio CD. Neither the High Sierra File Access nor the ISO 9660 File Access file system translator assumes anything about the drive in question. You can build an ISO 9660 conforming floppy, and it will be correctly handled.

Photo CD Access requires special knowledge about the format of Photo CDs. If the CD is a multisession CD, then Photo CD Access uses some new driver calls, documented in the Macintosh Technical Note "CD-ROM Driver Calls," to access the additional sessions. Single-session Photo CD discs are supported on all existing Apple CD-ROM drives.

So, the big picture when writing a CD-ROM driver is: Don't worry about Foreign File Access. It just does reads and writes. Support the ReadTOC driver call, since Audio CD Access assumes that call exists. If you want to support Photo CD, look at the new driver calls and call Kodak at 1-800-242-2424, ext. 53, for more information. Get the AppleCD SC Developer's Guide and Apple CD-ROM Handbook, both published by Addison-Wesley. The first has the original driver calls documented; the second has information about how to press CD-ROMs.

Back to top

Original AppleCD SC can't read Photo CD discs

Date Written: 10/7/92

Last reviewed: 6/14/93

I read that Photo CD discs can be read by the AppleCD SC Plus and the AppleCD 150. Does this mean a plain vanilla AppleCD SC can't read them? Is this a hardware limitation, or will there be a software fix?

___

Apple erroneously reported that the original AppleCD SC could not read single-session Photo CD discs. This turns out not to be the case; all of Apple's CD-ROM drives can read single-session Photo CD discs.

Two levels of support are available for Kodak Photo CDs: the ability to read the first session on the Photo CD itself, and the ability to deal with more than just the initial session of a multisession CD. The AppleCD 300i is the first CD-ROM player from Apple to support multisession Photo CDs. For details about both support levels, check the Tech Info Library on AppleLink.

Back to top

Reading audio data off an audio CD

Date Written: 6/5/92

Last reviewed: 6/14/93

Is it possible to read data from an audio CD? I have tried to read an amount of data from a track with FSRead. FSRead returned an error status of noErr, but no bytes have been read in. Am I doing something wrong?

___

The AppleCD 300 can read data from an audio CD, but the AppleCD SC, the AppleCD SC Plus, and the AppleCD 150 cannot. The files you see on an audio CD are merely placeholders for the tracks on an audio CD; they contain no data (if you do a Get Info on them, you will see that they are 0 bytes long).

Back to top

CD-ROM and File Sharing

Date Written: 10/15/91

Last reviewed: 12/2/92

How do I make a single CD-ROM drive visible to users over the network? When I connect the CD-ROM drive to a machine running System 7.0 with File Sharing turned on, the CD-ROM drive doesn't show up in the volume list at startup.

___

Unless a CD is specifically mastered to be compatible with File Sharing, it won't be sharable. It doesn't work as it does for hard drives because not all CDs are in HFS format and have the appropriate directory information that File Sharing requires. The easiest way to determine whether or not the CD you have is sharable is to go to your System 7 machine that has File Sharing turned on, try selecting the disc, and then select Sharing from the File menu. It will tell you if the disc can't be shared. This may be the most likely reason why you couldn't see the CD from a remote workstation. However, if that's not the reason, it may be one that follows.

Folders from a CD-ROM disc can be shared the same way as a folder on a local hard disk. However, to be shared, the CD-ROM must be inserted before File Sharing is turned on. To switch between CD-ROMs, File Sharing must first be turned off, the new CD-ROM inserted, and File Sharing turned back on.

If you insert a CD-ROM while File Sharing is on, you can eject and insert the disc, but you can't share it. If a CD-ROM is inserted while the Macintosh is starting up (File Sharing already having been turned on), then you have to turn File Sharing off to eject it.

Back to top

File Sharing and CD-ROM discs

Date Written: 9/24/91

Last reviewed: 6/14/93

When I tried to disconnect (unmount) a CD-ROM in System 7.0, I got the message, "Can't put away. Disk is being shared." However, File Sharing status shows no volumes/folders shared. Restarting the Macintosh fixes the problem.

___

When File Sharing starts up, it takes a snapshot of the volumes available on the current desktop. All volumes (excluding floppies, which cannot be shared) are implicitly shared. This occurs even if no one is connected to your system, and you have not explicitly shared any folders/volumes via the Sharing menu.

The reason for this is that when you start File Sharing, you are making all volumes on the machine available to the owner from anywhere on the network. Therefore, your CD-ROM, and any other removable media, such as removable hard drives and optical drives, are now being shared for the owner and can't be removed or unmounted.

If you make a volume available to your system after File Sharing has been started, that volume won't be available to the owner unless you explicitly share it via the Sharing menu. Therefore, once you start File Sharing either by booting with it active, or through the Sharing Setup control panel, you can mount and unmount new volumes as often as you like until they are explicitly shared.

If you wish to remove a volume that has been implicitly shared from your desktop, turn File Sharing off, remove the volume, and then turn File Sharing back on without restarting your system.

Restarting your Macintosh works because your CD-ROM ejects at restart, File Sharing is reset, and then you reinsert the CD-ROM.

(This Q&A was stolen from AppleLink's Tech Info Library because developers ask this question frequently.)

Back to top

Using the Macintosh ISO 9660 FST with another drive

Date Written: 8/8/91

Last reviewed: 8/1/92

How can I write an extension to the CD-ROM driver, such as a 'ufob' like the ISO 9660 module, or how can I use the 9660 with some other kind of drive?

___

You can use the ISO 9660 File System Translator with any type of drive. The only requirement is that the drive contain a file system in the ISO format. The file system just doesn't care. The file system on the Macintosh looks something like this:

     Application (could be the Finder)
                   |
                   V
              File Manager
               /       \
  HFS Volume  /         \    Some Other Format Volume
             /           \
           (HFS)  External File System (FFA, AppleShare)
             |            |
             | ISO, High Sierra, Audio CD
             |   File System Translators
             |            |
             |            |
       Block Oriented Device Driver
    (CD-ROM, Hard Disk, Floppy Disk, etc.)
                   ||
                   \/
              Data on Disk

Basically, what's going on is if HFS doesn't recognize a volume it passes control on to the External File System hook, which tries to decode the volume format of the unrecognized disk. You can think of the ISO FST as a decoder for Foreign File Access that "knows" what ISO disks look like. It in turn makes calls to the low-level driver associated with the device in question. The net result is that you can use FFA with any block-oriented device. All that needs to be written is a driver.

That's the good news. Writing a Foreign File System or even an FST is an incredibly difficult procedure. Because the documentation is so poor and the mechanisms so convolved, it's so hairy that DTS is unable to support it.

Back to top

Identifying a CD-ROM in the drive queue or volume queue

Date Written: 11/17/89

Last reviewed: 8/1/92

What is a reliable way to tell which element in the drive queue or volume queue is a CD-ROM? I am trying to write a routine that prompts a user to insert specific volumes by name and ejects any that may be in the drive.

___

For a CD in High Sierra, ISO 9660, or audio-only formats, you can use PBHGetVInfo to check for the ioVFSID (file system ID).

High Sierra disks always have an FSID of 0x4242.

ISO 9660 disks always have an FSID of 0x4147.

Audio CDs always have an FSID of 0x4A48.

You should also check for a hardware locked device by checking the ioVAtrb field. The bits for this are defined on page 167 of Inside Macintosh Volume IV.

For the AppleCD SC drive, you can call the driver with a PBstatus call of 97. csParam+1 contains bits corresponding to each of the eight possible SCSI IDs. SCSI ID 0 is the rightmost bit. A bit is set if an AppleCD SC drive exists at that SCSI ID. See the AppleCD SC Developer's Guide, for further details.

Back to top

-120 (dirNFErr) on a Macintosh

Date Written: 11/17/89

Last reviewed: 12/2/92

Why do I get a -120 (dirNFErr) on a High Sierra CD-ROM, but not on an HFS CD?

___

Your program is probably saving directory IDs as a 16-bit quantity. Directory IDs are 32-bit values. On most HFS disks, this doesn't matter; you must have many, many files on a disk to get a directory ID that is a long value. Because of the implementation of our support for High Sierra and ISO 9660 CDs, the directory ID is always a long value.

Back to top

Avoiding invalid boot blocks on a CD-ROM

Date Written: 11/17/89

Last reviewed: 12/2/92

How do I make sure that my CD-ROM doesn't contain invalid boot blocks?

___

The normal way of pressing a Macintosh HFS CD-ROM is by making an image copy of a hard disk. Unfortunately, this means that the boot blocks are copied as well. The startup code for a hard disk isn't the same as for a CD-ROM (for example, a CD-ROM starts up in 2048-byte block mode, whereas hard disks start up in 512-byte block mode.)

To invalidate the boot blocks, use a volume editor to zero out the first 2 bytes on the volume.. (These contain $4C4B ("LK") if the boot blocks are present.) By zeroing out these bytes, the Macintosh will not try to use the invalid boot blocks that have been copied from the hard disk.

X-Ref:

File Manager

Back to top

Why does my CD-ROM take so long to mount?

Date Written: 11/17/89

Last reviewed: 6/14/93

Why does my CD-ROM take so long to mount?

___

Slow loading can happen in several ways. For example, slow loading happens if you (or the CD-ROM mastering company) forgot to unmount the hard disk volume before making a copy for mastering. Whenever an HFS disk is mounted, a bit is set in the volume's header, and it's cleared again when you unmount the disk or shut down the Macintosh normally. The purpose of this bit is a "crash flag"--if the Mac dies abnormally, leaving the bit set, at the next boot the Mac will recheck the integrity of the file structure and desktop of the disk, just in case something got corrupted during the crash. So if you master from a hard disk that has the bit set because you didn't unmount it, the Mac will think your CD-ROM is potentially crashed every time you load it, and will spend a lot of time rechecking everything on the CD.

Back to top

Downloadables

Acrobat gif

Acrobat version of this Note (60K)

Download


Back to top


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.