ADC Home > Reference Library > Technical Q&As > Legacy Documents > Mac OS 9 & Earlier >

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.

Determining if a Drive is a Network Volume


Q: If I have a physical drive ID, how can I determine if that drive is a network volume? I'm not sure where to look, and I need to know if the information is dependable and not subject to change.

A: Under the current Macintosh file system, there is no completely dependable way to determine if a volume originates over a network or is implemented on a local disk. This is the result of the way external file systems are implemented -- a third party can build a network file system in a variety of ways.

You can, however, easily determine if a volume utilizes the AFP (Appleshare) file system, which in most cases, is adequate. To make this determination, compare the drive-queue entry's driver refnum to the Appleshare client's refnum.

The following sample code enumerates the drive queue and displays the relevant information:

main()
{
      QHdrPtr        DrvQHdr =  GetDrvQHdr();
    DrvQElPtr    dqeP;
    short        afpRefNum = 0;
    OSErr        ErrNo;
// Get the Driver refNum for AFP
    ErrNo    = OpenDriver("\p.AFPTranslator",&afpRefNum);
// Scan each drive in the Drive Table
    dqeP = (DrvQElPtr)DrvQHdr->qHead;
    do {
// is it an AFP volume or SCSI device
        if(dqeP->dQRefNum == afpRefNum) printf("AFP      ");
    } while (dqeP =(DrvQElPtr) dqeP->qLink);
}

For other third-party file systems, such as DECNET and NFS, you have to determine the name of their driver, and then compare it to the Appleshare client's refnum.

[May 01 1995]


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.