Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Files /
Chapter 2 - File Manager


Summary of the File Manager

C Summary

Constants

/*Gestalt constants*/
#define gestaltFSAttr            'fs  '   /*file system attributes selector*/
#define gestaltFullExtFSDispatching 0     /*exports HFSDispatch traps*/
#define gestaltHasFSSpecCalls       1     /*supports FSSpec records*/
/*directory IDs*/
enum {
   fsRtParID            = 1,     /*directory ID of root directory's parent*/
   fsRtDirID            = 2};    /*directory ID of volume's root directory*/
/*values for requesting file read/write permissions*/
enum {
   fsCurPerm            = 0,     /*whatever permission is allowed*/
   fsRdPerm             = 1,     /*read permission*/
   fsWrPerm             = 2,     /*write permission*/
   fsRdWrPerm           = 3,     /*exclusive read/write permission*/
   fsRdWrShPerm         = 4};    /*shared read/write permission*/
/*file mark positioning modes*/
enum {
   fsAtMark             = 0,     /*at current mark}
   fsFromStart          = 1,     /*set mark relative to beginning of file*/
   fsFromLEOF           = 2,     /*set mark relative to logical end-of-file*/
   fsFromMark           = 3,     /*set mark relative to current mark*/
   rdVerify             = 64};   /*add to above for read-verify*/
/*values for ioSearchBits in PBCatSearch parameter block*/
enum {
   fsSBPartialName      = 1,        /*substring of name*/
   fsSBFullName         = 2,        /*full name*/
   fsSBFlAttrib         = 4,        /*directory flag; software lock flag*/
   fsSBNegate           = 16384};   /*reverse match status*/
/*for files only*/
enum {
   fsSBFlFndrInfo       = 8,        /*Finder file info*/
   fsSBFlLgLen          = 32,       /*logical length of data fork*/
   fsSBFlPyLen          = 64,       /*physical length of data fork*/
   fsSBFlRLgLen         = 128,      /*logical length of resource fork*/
   fsSBFlRPyLen         = 256,      /*physical length of resource fork*/
   fsSBFlCrDat          = 512,      /*file creation date*/
   fsSBFlMdDat          = 1024,     /*file modification date*/
   fsSBFlBkDat          = 2048,     /*file backup date*/
   fsSBFlXFndrInfo      = 4096,     /*more Finder file info*/
   fsSBFlParID          = 8192};    /*file's parent ID*/
/*for directories only*/
enum {
   fsSBDrUsrWds         = 8,        /*Finder directory info*/
   fsSBDrNmFls          = 16,       /*number of files in directory*/
   fsSBDrCrDat          = 512,      /*directory creation date*/
   fsSBDrMdDat          = 1024,     /*directory modification date*/
   fsSBDrBkDat          = 2048,     /*directory backup date*/
   fsSBDrFndrInfo       = 4096,     /*more Finder directory info*/
   fsSBDrParID          = 8192};    /*directory's parent ID*/
/*value of vMForeignPrivID in file attributes buffer*/
enum {fsUnixPriv        = 1};       /*A/UX privilege model*/
/*bit positions in vMAttrib field of GetVolParmsInfoBuffer*/
enum {
   bHasBlankAccessPrivileges
                        = 4,        /*volume supports inherited privileges*/
   bHasBTreeMgr         = 5,        /*reserved*/
   bHasFileIDs          = 6,        /*volume supports file ID functions*/
   bHasCatSearch        = 7,        /*volume supports PBCatSearch*/
   bHasUserGroupList    = 8,        /*volume supports AFP privileges*/
   bHasPersonalAccessPrivileges
                        = 9,        /*local file sharing is enabled*/
   bHasFolderLock       = 10,       /*volume supports locking of folders*/
   bHasShortName        = 11,       /*volume supports shorter volume name*/ 
   bHasDesktopMgr       = 12,       /*volume supports Desktop Manager*/
   bHasMoveRename       = 13,       /*volume supports _MoveRename*/
   bHasCopyFile         = 14,       /*volume supports _CopyFile*/
   bHasOpenDeny         = 15,       /*volume supports shared access modes*/
   bHasExtFSVol         = 16,       /*volume is external file system volume*/
   bNoSysDir            = 17,       /*volume has no system directory*/
   bAccessCntl          = 18,       /*volume supports AFP access control*/
   bNoBootBlks          = 19,       /*volume is not a startup volume*/
   bNoDeskItems         = 20,       /*do not place objects on the desktop*/
   bNoSwitchTo          = 25,       /*do not switch launch to applications*/
   bTrshOffLine         = 26,       /*zoom volume when it is unmounted*/
   bNoLclSync           = 27,       /*don't let Finder change mod. date*/
   bNoVNEdit            = 28,       /*lock volume name*/
   bNoMiniFndr          = 29,       /*reserved; always 1*/
   bLocalWList          = 30,       /*use shared volume handle for window */
                                    /* list*/
   bLimitFCBs           = 31};      /*limit file control blocks*/
/*media type in remote mounting information/*
enum {AppleShareMediaType
                        = 'afpm'};  /*an AppleShare volume*/
/*user authentication methods in AFP remote mounting information*/
enum {
   kNoUserAuthentication   = 1,        /*guest status; no password needed*/
   kPassword               = 2,        /*8-byte password*/
   kEncryptPassword        = 3,        /*encrypted 8-byte password*/
   kTwoWayEncryptPassword  = 6};       /*two-way random encryption; */
                                       /* authenticate both user and server*/

Data Types

File System Specification Record

struct FSSpec  {                    /*file system specification*/
      short       vRefNum;          /*volume reference number*/
      long        parID;            /*directory ID of parent directory*/
      Str63       name;             /*filename or directory name*/
};

typedef struct FSSpec FSSpec;
typedef FSSpec *FSSpecPtr;
typedef FSSpecPtr *FSSpecHandle;

File and Directory Parameter Blocks

union ParamBlockRec {
      IOParam           ioParam;
      FileParam         fileParam;
      VolumeParam       volumeParam;
      CntrlParam        cntrlParam;
      SlotDevParam      slotDevParam;
      MultiDevParam     multiDevParam;
};

typedef union ParamBlockRec ParamBlockRec;
typedef ParamBlockRec *ParmBlkPtr;
#define ParamBlockHeader \
      QElemPtr    qLink;            /*next queue entry*/\
      short       qType;            /*queue type*/\
      short       ioTrap;           /*routine trap*/\
      Ptr         ioCmdAddr;        /*routine address*/\
      ProcPtr     ioCompletion;     /*completion routine*/\
      OSErr       ioResult;         /*result code*/\
      StringPtr   ioNamePtr;        /*pointer to pathname*/\
      short       ioVRefNum;        /*volume specification*/
struct IOParam {
      ParamBlockHeader
      short       ioRefNum;         /*file reference number*/
      char        ioVersNum;        /*version number*/
      char        ioPermssn;        /*read/write permission*/
      Ptr         ioMisc;           /*miscellaneous*/
      Ptr         ioBuffer;         /*data buffer*/
      long        ioReqCount;       /*requested number of bytes*/
      long        ioActCount;       /*actual number of bytes*/
      short       ioPosMode;        /*positioning mode and newline char.*/
      long        ioPosOffset;      /*positioning offset*/
};

typedef struct IOParam IOParam;
struct FileParam {
      ParamBlockHeader
      short          ioFRefNum;        /*file reference number*/
      char           ioFVersNum;       /*file version number (unused)*/
      char           filler1;          /*reserved*/
      short          ioFDirIndex;      /*directory index*/
      unsigned char  ioFlAttrib;       /*file attributes*/
      unsigned char  ioFlVersNum;      /*file version number (unused)*/
      FInfo          ioFlFndrInfo;     /*information used by the Finder*/
      unsigned long  ioFlNum;          /*File ID*/
      unsigned short ioFlStBlk;        /*first alloc. blk. of data fork*/
      long           ioFlLgLen;        /*logical EOF of data fork*/
      long           ioFlPyLen;        /*physical EOF of data fork*/
      unsigned short ioFlRStBlk;       /*first alloc. blk. of resource fork*/
      long           ioFlRLgLen;       /*logical EOF of resource fork*/
      long           ioFlRPyLen;       /*physical EOF of resource fork*/
      unsigned long  ioFlCrDat;        /*date and time of creation*/
      unsigned long  ioFlMdDat;        /*date and time of last modification*/
};

typedef struct FileParam FileParam;
struct VolumeParam {
      ParamBlockHeader
      long           filler2;          /*reserved*/
      short          ioVolIndex;       /*volume index*/
      unsigned long  ioVCrDate;        /*date and time of initialization*/
      unsigned long  ioVLsBkUp;        /*date and time of last modification*/
      unsigned short ioVAtrb;          /*volume attributes*/
      unsigned short ioVNmFls;         /*number of files in root directory*/
      unsigned short ioVDirSt;         /*first block of directory*/
      short          ioVBlLn;          /*length of directory in blocks*/
      unsigned short ioVNmAlBlks;      /*number of allocation blocks*/
      long           ioVAlBlkSiz;      /*size of allocation blocks*/
      long           ioVClpSiz;        /*number of bytes to allocate*/
      unsigned short ioAlBlSt;         /*first block in block map*/
      unsigned long  ioVNxtFNum;       /*next unused file ID*/
      unsigned short ioVFrBlk;         /*number of unused allocation blocks*/
};

typedef struct VolumeParam VolumeParam;
union HParamBlockRec {                 /*HFS parameter block*/
      HIOParam             ioParam;
      HFileParam           fileParam;
      HVolumeParam         volumeParam;
      AccessParam          accessParam;
      ObjParam             objParam;
      CopyParam            copyParam;
      WDParam              wdParam;
      FIDParam             fidParam;
      CSParam              csParam;
      ForeignPrivParam     foreignPrivParam;
};

typedef union HParamBlockRec HParamBlockRec;
typedef HParamBlockRec *HParmBlkPtr;
struct HIOParam {
      ParamBlockHeader
      short             ioRefNum;      /*file reference number*/
      char              ioVersNum;     /*version number*/
      char              ioPermssn;     /*read/write permission*/
      Ptr               ioMisc;        /*miscellaneous*/
      Ptr               ioBuffer;      /*data buffer*/
      long              ioReqCount;    /*requested number of bytes*/
      long              ioActCount;    /*actual number of bytes*/
      short             ioPosMode;     /*positioning mode and newline char.*/
      long              ioPosOffset;   /*positioning offset*/
};

typedef struct HIOParam HIOParam;
struct HFileParam {
      ParamBlockHeader
      short             ioFRefNum;     /*file reference number*/
      char              ioFVersNum;    /*file version number (unused)*/
      char              filler1;       /*reserved*/
      short             ioFDirIndex;   /*directory index*/
      char              ioFlAttrib;    /*file attributes*/
      char              ioFlVersNum;   /*file version number (unused)*/
      FInfo             ioFlFndrInfo;  /*information used by the Finder*/
      long              ioDirID;       /*directory ID or file ID*/
      unsigned short    ioFlStBlk;     /*first alloc. blk. of data fork*/
      long              ioFlLgLen;     /*logical EOF of data fork*/
      long              ioFlPyLen;     /*physical EOF of data fork*/
      unsigned short    ioFlRStBlk;    /*first alloc. blk. of resource fork*/
      long              ioFlRLgLen;    /*logical EOF of resource fork*/
      long              ioFlRPyLen;    /*physical EOF of resource fork*/
      unsigned long     ioFlCrDat;     /*date and time of creation*/
      unsigned long     ioFlMdDat;     /*date and time of last modification*/
};

typedef struct HFileParam HFileParam;
struct HVolumeParam {
      ParamBlockHeader
      long              filler2;       /*reserved*/
      short             ioVolIndex;    /*volume index*/
      unsigned long     ioVCrDate;     /*date and time of initialization*/
      unsigned long     ioVLsMod;      /*date and time of last modification*/
      short             ioVAtrb;       /*volume attributes*/
      unsigned short    ioVNmFls;      /*number of files in root directory*/
      short             ioVBitMap;     /*first block of volume bitmap*/
      short             ioAllocPtr;    /*first block of next new file*/
      unsigned short    ioVNmAlBlks;   /*number of allocation blocks*/
      long              ioVAlBlkSiz;   /*size of allocation blocks*/
      long              ioVClpSiz;     /*default clump size*/
      short             ioAlBlSt;      /*first block in volume map*/
      long              ioVNxtCNID;    /*next unused node ID*/
      unsigned short    ioVFrBlk;      /*number of unused allocation blocks*/
      unsigned short    ioVSigWord;    /*volume signature*/
      short             ioVDrvInfo;    /*drive number*/
      short             ioVDRefNum;    /*driver reference number*/
      short             ioVFSID;       /*file-system identifier*/
      unsigned long     ioVBkUp;       /*date and time of last backup*/
      unsigned short    ioVSeqNum;     /*used internally*/
      long              ioVWrCnt;      /*volume write count*/
      long              ioVFilCnt;     /*number of files on volume*/
      long              ioVDirCnt;     /*number of directories on volume*/
      long              ioVFndrInfo[8];/*information used by the Finder*/
};

typedef struct HVolumeParam HVolumeParam;
struct AccessParam {
      ParamBlockHeader
      short             filler3;       /*reserved*/
      short             ioDenyModes;   /*access mode information*/
      short             filler4;       /*reserved*/
      char              filler5;       /*reserved*/
      char              ioACUser;      /*user access rights*/
      long              filler6;       /*reserved*/
      long              ioACOwnerID;   /*owner ID*/
      long              ioACGroupID;   /*group ID*/
      long              ioACAccess;    /*directory access rights*/
};

typedef struct AccessParam AccessParam;
struct ObjParam {
      ParamBlockHeader
      short             filler7;       /*reserved*/
      short             ioObjType;     /*function code*/
      StringPtr         ioObjNamePtr;  /*ptr to returned creator/group name*/
      long              ioObjID;       /*creator/group ID*/
      long              ioReqCount;    /*size of buffer area*/
      long              ioActCount;    /*length of data*/
};

typedef struct ObjParam ObjParam;
struct CopyParam {
      ParamBlockHeader
      short             ioDstVRefNum;  /*destination volume identifier*/
      short             filler8;       /*reserved*/
      StringPtr         ioNewName;     /*pointer to destination pathname*/
      StringPtr         ioCopyName;    /*pointer to optional name*/
      long              ioNewDirID;    /*destination directory ID*/
      long              filler14;      /*reserved*/
      long              filler15;      /*reserved*/
      long              ioDirID;       /*directory ID or file ID*/
};

typedef struct CopyParam CopyParam;
struct WDParam {
      ParamBlockHeader
      short             filler9;       /*reserved*/
      short             ioWDIndex;     /*working directory index*/
      long              ioWDProcID;    /*working directory user identifier*/
      short             ioWDVRefNum;   /*working directory's vol. ref. num.*/
      short             filler10;      /*reserved*/
      long              filler11;      /*reserved*/
      long              filler12;      /*reserved*/
      long              filler13;      /*reserved*/
      long              ioWDDirID;     /*working directory's directory ID*/
};

typedef struct WDParam WDParam;
struct FIDParam {
      ParamBlockHeader
      long              filler1;       /*reserved*/
      StringPtr         ioDestNamePtr; /*pointer to destination filename*/
      long              filler2;       /*reserved*/
      long              ioDestDirID;   /*destination parent directory ID*/
      long              filler3;       /*reserved*/
      long              filler4;       /*reserved*/
      long              ioSrcDirID;    /*source parent directory ID*/
      short             filler5;       /*reserved*/
      long              ioFileID;      /*file ID*/
};

typedef struct FIDParam FIDParam;
struct CSParam {
      ParamBlockHeader
      FSSpecPtr         ioMatchPtr;       /*pointer to array of matches*/
      long              ioReqMatchCount;  /*max number of matches to return*/
      long              ioActMatchCount;  /*actual number of matches*/
      long              ioSearchBits;     /*enable bits for matching rules*/
      CInfoPBPtr        ioSearchInfo1;    /*pointer to values and lower */
                                          /* bounds*/
      CInfoPBPtr        ioSearchInfo2;    /*pointer to masks and upper */
                                          /* bounds*/
      long              ioSearchTime;     /*maximum time to search*/
      CatPositionRec    ioCatPosition;    /*current catalog position*/
      Ptr               ioOptBuffer;      /*pointer to optional read buffer*/
      long              ioOptBufSize;     /*length of optional read buffer*/
};

typedef struct CSParam CSParam;
struct ForeignPrivParam {
      ParamBlockHeader
      long     filler1;                /*reserved*/
      long     filler2;                /*reserved*/
      Ptr      ioForeignPrivBuffer;    /*privileges data buffer*/
      long     ioForeignPrivReqCount;  /*size of buffer*/
      long     ioForeignPrivActCount;  /*amount of buffer used*/
      long     filler3;                /*reserved*/
      long     ioForeignPrivDirID;     /*parent directory ID of foreign */
                                       /* file or directory*/
      long     ioForeignPrivInfo1;     /*privileges data*/
      long     ioForeignPrivInfo2;     /*privileges data*/
      long     ioForeignPrivInfo3;     /*privileges data*/
      long     ioForeignPrivInfo4;     /*privileges data*/
};

typedef struct ForeignPrivParam ForeignPrivParam;
typedef ForeignPrivParam *ForeignPrivParamPtr;

Catalog Information Parameter Blocks

enum {hFileInfo, dirInfo};
typedef unsigned char CInfoType;
union CInfoPBRec {                  /*catalog information parameter block*/
      HFileInfo   hFileInfo;
      DirInfo     dirInfo;
};

typedef union CInfoPBRec CInfoPBRec;
typedef CInfoPBRec *CInfoPBPtr;
struct HFileInfo {
      ParamBlockHeader
      short             ioFRefNum;     /*file reference number*/
      char              ioFVersNum;    /*version number*/
      char              filler1;       /*reserved*/
      short             ioFDirIndex;   /*file index*/
      char              ioFlAttrib;    /*file attributes*/
      char              ioACUser;      /*directory access rights*/
      FInfo             ioFlFndrInfo;  /*information used by the Finder*/
      long              ioDirID;       /*directory ID or file ID*/
      unsigned short    ioFlStBlk;     /*first alloc. blk. of data fork*/
      long              ioFlLgLen;     /*logical EOF of data fork*/
      long              ioFlPyLen;     /*physical EOF of data fork*/
      unsigned short    ioFlRStBlk;    /*first alloc. blk. of resource fork*/
      long              ioFlRLgLen;    /*logical EOF of resource fork*/
      long              ioFlRPyLen;    /*physical EOF of resource fork*/
      unsigned long     ioFlCrDat;     /*date and time of creation*/
      unsigned long     ioFlMdDat;     /*date and time of last modification*/
      unsigned long     ioFlBkDat;     /*date and time of last backup*/
      FXInfo            ioFlXFndrInfo; /*additional Finder information*/
      long              ioFlParID;     /*file parent directory ID (integer)*/
      long              ioFlClpSiz;    /*file's clump size*/
};

typedef struct HFileInfo HFileInfo;
struct DirInfo {
      ParamBlockHeader
      short             ioFRefNum;     /*file reference number*/
      short             filler1;       /*reserved*/
      short             ioFDirIndex;   /*directory index*/
      char              ioFlAttrib;    /*directory attributes*/
      char              filler2;       /*reserved*/
      DInfo             ioDrUsrWds;    /*information used by the Finder*/
      long              ioDrDirID;     /*directory ID*/
      unsigned short    ioDrNmFls;     /*number of files in directory*/
      short             filler3[9];    /*reserved*/
      unsigned long     ioDrCrDat;     /*date and time of creation*/
      unsigned long     ioDrMdDat;     /*date and time of last modification*/
      unsigned long     ioDrBkDat;     /*date and time of last backup*/
      DXInfo            ioDrFndrInfo;  /*additional Finder information*/
      long              ioDrParID;     /*directory's parent directory ID*/
};

typedef struct DirInfo DirInfo;

Catalog Position Record

struct CatPositionRec {                /*catalog position record*/
      long     initialize;             /*starting point*/
      short    priv[6];                /*private data*/
};

typedef struct CatPositionRec CatPositionRec;

Catalog Move Parameter Block

struct CMovePBRec {                    /*catalog move parameter block*/
      QElemPtr          qLink;         /*next queue entry*/
      short             qType;         /*queue type*/
      short             ioTrap;        /*routine trap*/
      Ptr               ioCmdAddr;     /*routine address*/
      ProcPtr           ioCompletion;  /*completion routine*/
      OSErr             ioResult;      /*result code*/
      StringPtr         ioNamePtr;     /*pointer to pathname*/
      short             ioVRefNum;     /*volume specification*/
      long              filler1;       /*reserved*/
      StringPtr         ioNewName;     /*name of new directory*/
      long              filler2;       /*reserved*/
      long              ioNewDirID;    /*directory ID of new directory*/
      long              filler3[2];    /*reserved*/
      long              ioDirID;       /*directory ID of current directory*/
};

typedef struct CMovePBRec CMovePBRec;
typedef CMovePBRec *CMovePBPtr;

Working Directory Parameter Block

struct WDPBRec {                       /*working directory parameter block*/
      QElemPtr          qLink;         /*next queue entry*/
      short             qType;         /*queue type*/
      short             ioTrap;        /*routine trap*/
      Ptr               ioCmdAddr;     /*routine address*/
      ProcPtr           ioCompletion;  /*completion routine*/
      OSErr             ioResult;      /*result code*/
      StringPtr         ioNamePtr;     /*pointer to pathname*/
      short             ioVRefNum;     /*volume specification*/
      short             filler1;       /*reserved*/
      short             ioWDIndex;     /*working directory index*/
      long              ioWDProcID;    /*working directory user identifier*/
      short             ioWDVRefNum;   /*working directory's vol. ref. num.*/
      short             filler2[7];    /*reserved*/
      long              ioWDDirID;     /*working directory's directory ID*/
};

typedef struct WDPBRec WDPBRec;
typedef WDPBRec *WDPBPtr;

File Control Block Parameter Block

struct FCBPBRec {                      /*file control block parameter block*/
      QElemPtr          qLink;         /*next queue entry*/
      short             qType;         /*queue type*/
      short             ioTrap;        /*routine trap*/
      Ptr               ioCmdAddr;     /*routine address*/
      ProcPtr           ioCompletion;  /*completion routine*/
      OSErr             ioResult;      /*result code*/
      StringPtr         ioNamePtr;     /*pointer to pathname*/
      short             ioVRefNum;     /*volume specification*/
      short             ioRefNum;      /*file reference number*/
      short             filler;        /*reserved*/
      short             ioFCBIndx;     /*FCB index*/
      short             filler1;       /*reserved*/
      long              ioFCBFlNm;     /*file ID*/
      short             ioFCBFlags;    /*flags*/
      unsigned short    ioFCBStBlk;    /*first allocation block of file*/
      long              ioFCBEOF;      /*logical end-of-file*/
      long              ioFCBPLen;     /*physical end-of-file*/
      long              ioFCBCrPs;     /*position of the file mark*/
      short             ioFCBVRefNum;  /*volume reference number*/
      long              ioFCBClpSiz;   /*file's clump size*/
      long              ioFCBParID;    /*parent directory ID*/
};
typedef struct FCBPBRec FCBPBRec;
typedef FCBPBRec *FCBPBPtr;

Volume Attributes Buffer

struct GetVolParmsInfoBuffer {
      short             vMVersion;        /*version number*/
      long              vMAttrib;         /*volume attributes*/
      Handle            vMLocalHand;      /*reserved*/
      long              vMServerAdr;      /*network server address*/
      long              vMVolumeGrade;    /*relative speed rating*/
      short             vMForeignPrivID;  /*foreign privilege model*/
};

typedef struct GetVolParmsInfoBuffer GetVolParmsInfoBuffer;

Volume Mounting Information Records

struct VolMountInfoHeader{             /*volume mounting information*/
      short             length;        /*length of mounting information*/
      VolumeType        media;         /*type of volume*/
};

typedef struct VolMountInfoHeader VolMountInfoHeader;
typedef VolMountInfoHeader *VolMountInfoPtr;
struct AFPVolMountInfo{                /*AFP volume mounting information*/
      short       length;              /*length of mounting information*/
      VolumeType  media;               /*type of volume*/
      short       flags;               /*reserved; must be set to 0*/
      char        nbpInterval;         /*NBP retry interval*/
      char        nbpCount;            /*NBP retry count*/
      short       uamType;             /*user authentication method*/
      short       zoneNameOffset;      /*offset to zone name*/
      short       serverNameOffset;    /*offset server name*/
      short       volNameOffset;       /*offset to volume name*/
      short       userNameOffset;      /*offset to user name*/
      short       userPasswordOffset;  /*offset to user password*/
      short       volPasswordOffset;   /*offset to volume password*/
      char        AFPData[144];        /*standard AFP mounting info*/
};

typedef struct AFPVolMountInfo AFPVolMountInfo;
typedef AFPVolMountInfo *AFPVolMountInfoPtr;

Internal Data Types

Volume and File Control Blocks

struct VCB  {                          /*volume control block*/
      QElemPtr          qLink;         /*next queue entry*/
      short             qType;         /*queue type*/
      short             vcbFlags;      /*volume flags (bit 15 = 1 if dirty)*/
      unsigned short    vcbSigWord;    /*volume signature*/
      unsigned long     vcbCrDate;     /*date and time of volume creation*/
      unsigned long     vcbLsMod;      /*date and time of last modification*/
      short             vcbAtrb;       /*volume attributes*/
      unsigned short    vcbNmFls;      /*number of files in root directory*/
      short             vcbVBMSt;      /*first block of volume bitmap*/
      short             vcbAllocPtr;   /*start of next allocation search*/
      unsigned short    vcbNmAlBlks;   /*number of allocation blocks in */
                                       /* volume*/
      long              vcbAlBlkSiz;   /*size (in bytes) of allocation */
                                       /* blocks*/
      long              vcbClpSiz;     /*default clump size*/
      short             vcbAlBlSt;     /*first allocation block in volume*/
      long              vcbNxtCNID;    /*next unused catalog node ID*/
      unsigned short    vcbFreeBks;    /*number of unused allocation blocks*/
      Str27             vcbVN;         /*volume name*/
      short             vcbDrvNum;     /*drive number*/
      short             vcbDRefNum;    /*driver reference number*/
      short             vcbFSID;       /*file-system identifier*/
      short             vcbVRefNum;    /*volume reference number*/
      Ptr               vcbMAdr;       /*used internally*/
      Ptr               vcbBufAdr;     /*used internally*/
      short             vcbMLen;       /*used internally*/
      short             vcbDirIndex;   /*used internally*/
      short             vcbDirBlk;     /*used internally*/
      unsigned long     vcbVolBkUp;    /*date and time of last backup*/
      unsigned short    vcbVSeqNum;    /*volume backup sequence number*/
      long              vcbWrCnt;      /*volume write count*/
      long              vcbXTClpSiz;   /*clump size for extents overflow */
                                       /* file*/
      long              vcbCTClpSiz;   /*clump size for catalog file*/
      unsigned short    vcbNmRtDirs;   /*number of directories in root dir.*/
      long              vcbFilCnt;     /*number of files in volume*/
      long              vcbDirCnt;     /*number of directories in volume*/
      long              vcbFndrInfo[8];/*information used by the Finder*/
      unsigned short    vcbVCSize;     /*used internally*/
      unsigned short    vcbVBMCSiz;    /*used internally*/
      unsigned short    vcbCtlCSiz;    /*used internally*/
      unsigned short    vcbXTAlBlks;   /*size of extents overflow file*/
      unsigned short    vcbCTAlBlks;   /*size of catalog file*/
      short             vcbXTRef;      /*ref. num. for extents overflow */
                                       /* file*/
      short             vcbCTRef;      /*ref. num. for catalog file*/
      Ptr               vcbCtlBuf;     /*ptr. to extents and catalog caches*/
      long              vcbDirIDM;     /*directory last searched*/
      short             vcbOffsM;      /*offspring index at last search*/
};

typedef struct VCB VCB; 
struct FCB {                        /*file control block*/
      long           fcbFlNum;      /*file ID*/
      short          fcbFlags;      /*file flags*/
      short          fcbSBlk;       /*first allocation block of file*/
      long           fcbEOF;        /*logical end-of-file*/
      long           fcbPLen;       /*physical end-of-file*/
      long           fcbCrPs;       /*current file mark position*/
      Ptr            fcbVPtr;       /*pointer to volume control block*/
      Ptr            fcbBfAdr;      /*pointer to access path buffer*/
      short          fcbFlPos;      /*unused*/
      long           fcbClmpSize;   /*file clump size*/
      Ptr            fcbBTCBPtr;    /*pointer to B*-tree control block*/
      ExtDataRec     fcbExtRec;     /*first three file extents*/
      long           fcbFType;      /*file's four Finder type bytes*/
      long           fcbCatPos;     /*catalog hint for use on Close*/
      long           fcbDirID;      /*file's parent directory ID*/
      Str31          fcbCName;      /*name of file*/
};

typedef struct FCB FCB;

Drive Queue Elements

struct DrvQEl  {                    /*drive queue element*/
      QElemPtr       qLink;         /*next queue entry*/
      short          qType;         /*flag for dQDrvSz and dQDrvSz2*/
      short          dQDrive;       /*drive number*/
      short          dQRefNum;      /*driver reference number*/
      short          dQFSID;        /*file-system identifier*/
      unsigned short dQDrvSz;       /*number of logical blocks on drive*/
      unsigned short dQDrvSz2;      /*additional field for large drives*/
};

typedef struct DrvQEl DrvQEl;

High-Level File Access Routines

Reading, Writing, and Closing Files

pascal OSErr FSRead	(short refNum, long *count, Ptr buffPtr);
pascal OSErr FSWrite	(short refNum, long *count, Ptr buffPtr);
pascal OSErr FSClose	(short refNum);

Manipulating the File Mark

pascal OSErr GetFPos	(short refNum, long *filePos);
pascal OSErr SetFPos	(short refNum, short posMode, long posOff);

Manipulating the End-of-File

pascal OSErr GetEOF	(short refNum, long *logEOF);
pascal OSErr SetEOF	(short refNum, long logEOF);

Allocating File Blocks

pascal OSErr Allocate	(short refNum, long *count);
pascal OSErr AllocContig(short refNum, long *count);

Low-Level File Access Routines

Reading, Writing, and Closing Files

pascal OSErr PBRead		(ParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBReadSync		(ParmBlkPtr paramBlock);
pascal OSErr PBReadAsync	(ParmBlkPtr paramBlock);
pascal OSErr PBWrite		(ParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBWriteSync	(ParmBlkPtr paramBlock);
pascal OSErr PBWriteAsync	(ParmBlkPtr paramBlock);
pascal OSErr PBClose		(ParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBCloseSync	(ParmBlkPtr paramBlock);
pascal OSErr PBCloseAsync	(ParmBlkPtr paramBlock);

Manipulating the File Mark

pascal OSErr PBGetFPos		(ParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBGetFPosSync	(ParmBlkPtr paramBlock);
pascal OSErr PBGetFPosAsync	(ParmBlkPtr paramBlock);
pascal OSErr PBSetFPos		(ParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBSetFPosSync	(ParmBlkPtr paramBlock);
pascal OSErr PBSetFPosAsync	(ParmBlkPtr paramBlock);

Manipulating the End-of-File

pascal OSErr PBGetEOF		(ParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBGetEOFSync	(ParmBlkPtr paramBlock);
pascal OSErr PBGetEOFAsync	(ParmBlkPtr paramBlock);
pascal OSErr PBSetEOF 		(ParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBSetEOFSync 	(ParmBlkPtr paramBlock);
pascal OSErr PBSetEOFAsync	(ParmBlkPtr paramBlock);

Allocating File Blocks

pascal OSErr PBAllocate 	(ParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBAllocateSync	(ParmBlkPtr paramBlock);
pascal OSErr PBAllocateAsync	(ParmBlkPtr paramBlock);
pascal OSErr PBAllocContig	(ParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBAllocContigSync
   				(ParmBlkPtr paramBlock);
pascal OSErr PBAllocContigAsync
   				(ParmBlkPtr paramBlock);

Updating Files

pascal OSErr PBFlushFile	(ParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBFlushFileSync	(ParmBlkPtr paramBlock);
pascal OSErr PBFlushFileAsync
   				(ParmBlkPtr paramBlock);

High-Level Volume Access Routines

Unmounting Volumes

pascal OSErr UnmountVol		(StringPtr volName, short vRefNum);
pascal OSErr Eject 				(StringPtr volName, short vRefNum);

Updating Volumes

pascal OSErr FlushVol 		(StringPtr volName, short vRefNum);

Manipulating the Default Volume

pascal OSErr GetVol 		(StringPtr volName, short *vRefNum);
pascal OSErr SetVol		(StringPtr volName, short vRefNum);
pascal OSErr HGetVol		(StringPtr volName, short *vRefNum, 
				long *dirID);
pascal OSErr HSetVol		(StringPtr volName, short vRefNum, long dirID);

Obtaining Volume Information

pascal OSErr GetVInfo		(short drvNum, StringPtr volName,
				short *vRefNum, long *freeBytes);
pascal OSErr GetVRefNum		(short refNum, short *vRefNum);

Low-Level Volume Access Routines

Mounting and Unmounting Volumes

pascal OSErr PBMountVol		(ParmBlkPtr paramBlock);
pascal OSErr PBUnmountVol	(ParmBlkPtr paramBlock);
pascal OSErr PBEject		(ParmBlkPtr paramBlock);
pascal OSErr PBOffLine		(ParmBlkPtr paramBlock);

Updating Volumes

pascal OSErr PBFlushVol		(ParmBlkPtr paramBlock; Boolean async);
pascal OSErr PBFlushVolSync	(ParmBlkPtr paramBlock);
pascal OSErr PBFlushVolAsync	(ParmBlkPtr paramBlock);

Obtaining Volume Information

pascal OSErr PBHGetVInfo	(HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHGetVInfoSync	(HParmBlkPtr paramBlock);
pascal OSErr PBHGetVInfoAsync
   				(HParmBlkPtr paramBlock);
pascal OSErr PBSetVInfo		(HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBSetVInfoSync	(HParmBlkPtr paramBlock);
pascal OSErr PBSetVInfoAsync	(HParmBlkPtr paramBlock);
pascal OSErr PBHGetVolParms	(HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHGetVolParmsSync
   				(HParmBlkPtr paramBlock);
pascal OSErr PBHGetVolParmsAsync
   				(HParmBlkPtr paramBlock);

Manipulating the Default Volume

pascal OSErr PBGetVol		(ParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBGetVolSync	(ParmBlkPtr paramBlock);
pascal OSErr PBGetVolAsync	(ParmBlkPtr paramBlock);
pascal OSErr PBSetVol		(ParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBSetVolSync	(ParmBlkPtr paramBlock);
pascal OSErr PBSetVolAsync	(ParmBlkPtr paramBlock);
pascal OSErr PBHGetVol		(WDPBPtr paramBlock, Boolean async);
pascal OSErr PBHGetVolSync	(WDPBPtr paramBlock);
pascal OSErr PBHGetVolAsync	(WDPBPtr paramBlock);
pascal OSErr PBHSetVol		(WDPBPtr paramBlock, Boolean async);
pascal OSErr PBHSetVolSync	(WDPBPtr paramBlock);
pascal OSErr PBHSetVolAsync	(WDPBPtr paramBlock);

File System Specification Routines

Opening Files

pascal OSErr FSpOpenDF		(const FSSpec *spec, char permission, 
				short *refNum);
pascal OSErr FSpOpenRF		(const FSSpec *spec, char permission, 
				short *refNum);

Creating and Deleting Files and Directories

pascal OSErr FSpCreate		(const FSSpec *spec, OSType creator, 
				OSType fileType, ScriptCode scriptTag);
pascal OSErr FSpDirCreate	(const FSSpec *spec, ScriptCode scriptTag, 
				long *createdDirID);
pascal OSErr FSpDelete		(const FSSpec *spec);

Accessing Information About Files and Directories

pascal OSErr FSpGetFInfo	(const FSSpec *spec, FInfo *fndrInfo);
pascal OSErr FSpSetFInfo	(const FSSpec *spec, const FInfo *fndrInfo);
pascal OSErr FSpSetFLock	(const FSSpec *spec);
pascal OSErr FSpRstFLock	(const FSSpec *spec);
pascal OSErr FSpRename		(const FSSpec *spec, ConstStr255Param newName);

Moving Files or Directories

pascal OSErr FSpCatMove		(const FSSpec *source, const FSSpec *dest);

Exchanging the Data in Two Files

pascal OSErr FSpExchangeFiles
   				(const FSSpec *source, const FSSpec *dest);

Creating File System Specifications

pascal OSErr FSMakeFSSpec	(short vRefNum, long dirID, 
				ConstStr255Param fileName, FSSpecPtr spec);
pascal OSErr PBMakeFSSpec	(HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBMakeFSSpecSync
   				(HParmBlkPtr paramBlock);
pascal OSErr PBMakeFSSpecAsync
   				(HParmBlkPtr paramBlock);

High-Level HFS Routines

Opening Files

pascal OSErr HOpenDF 	(short vRefNum, long dirID, 
			const Str255 fileName, char permission, 
 			short *refNum);
pascal OSErr HOpenRF 	(short vRefNum, long dirID, 
 			const Str255 fileName, char permission, 
 			short *refNum);
pascal OSErr HOpen 	(short vRefNum, long dirID, 
 			const Str255 fileName, char permission, 
			short *refNum);

Creating and Deleting Files and Directories

pascal OSErr HCreate 	(short vRefNum, long dirID, 
 			const Str255 fileName, OSType creator, 
			OSType fileType);
pascal OSErr DirCreate 	(short vRefNum, long parentDirID, 
 			const Str255 directoryName, 
 			long *createdDirID);
pascal OSErr HDelete 	(short vRefNum, long dirID, 
 			const Str255 fileName);

Accessing Information About Files and Directories

pascal OSErr HGetFInfo 	(short vRefNum, long dirID, 
 			const Str255 fileName, FInfo *fndrInfo);
pascal OSErr HSetFInfo 	(short vRefNum, long dirID, 
 			const Str255 fileName, const FInfo *fndrInfo);
pascal OSErr HSetFLock 	(short vRefNum, long dirID, 
 			const Str255 fileName);
pascal OSErr HRstFLock 	(short vRefNum, long dirID, 
 			const Str255 fileName);
pascal OSErr HRename 	(short vRefNum, long dirID, 
 			const Str255 oldName, const Str255 newName);

Moving Files or Directories

pascal OSErr CatMove 	(short vRefNum, long dirID, 
 			const Str255 oldName, long newDirID, 
 			const Str255 newName);

Maintaining Working Directories

pascal OSErr OpenWD	(short vRefNum, long dirID, long procID, 
			short *wdRefNum);
pascal OSErr CloseWD	(short wdRefNum);
pascal OSErr GetWDInfo	(short wdRefNum, short *vRefNum, long *dirID, 
			long *procID);

Low-Level HFS Routines

Opening Files

pascal OSErr PBHOpenDF		(HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHOpenDFSync	(HParmBlkPtr paramBlock);
pascal OSErr PBHOpenDFAsync	(HParmBlkPtr paramBlock);
pascal OSErr PBHOpenRF		(HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHOpenRFSync	(HParmBlkPtr paramBlock);
pascal OSErr PBHOpenRFAsync	(HParmBlkPtr paramBlock);
pascal OSErr PBHOpen		(HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHOpenSync	(HParmBlkPtr paramBlock);
pascal OSErr PBHOpenAsync	(HParmBlkPtr paramBlock);

Creating and Deleting Files and Directories

pascal OSErr PBHCreate		(HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHCreateSync	(HParmBlkPtr paramBlock);
pascal OSErr PBHCreateAsync	(HParmBlkPtr paramBlock);
pascal OSErr PBDirCreate	(HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBDirCreateSync	(HParmBlkPtr paramBlock);
pascal OSErr PBDirCreateAsync
   				(HParmBlkPtr paramBlock);
pascal OSErr PBHDelete		(HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHDeleteSync	(HParmBlkPtr paramBlock);
pascal OSErr PBHDeleteAsync	(HParmBlkPtr paramBlock);

Accessing Information About Files and Directories

pascal OSErr PBGetCatInfo	(CInfoPBPtr paramBlock, Boolean async);
pascal OSErr PBGetCatInfoSync
   				(CInfoPBPtr paramBlock, Boolean async);
pascal OSErr PBGetCatInfoAsync
   				(CInfoPBPtr paramBlock);
pascal OSErr PBSetCatInfo	(CInfoPBPtr paramBlock, Boolean async);
pascal OSErr PBSetCatInfoSync
   				(CInfoPBPtr paramBlock);
pascal OSErr PBSetCatInfoAsync
   				(CInfoPBPtr paramBlock);
pascal OSErr PBHGetFInfo	(HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHGetFInfoSync	(HParmBlkPtr paramBlock);
pascal OSErr PBHGetFInfoAsync
   				(HParmBlkPtr paramBlock);
pascal OSErr PBHSetFInfo	(HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHSetFInfoSync	(HParmBlkPtr paramBlock);
pascal OSErr PBHSetFInfoAsync
   				(HParmBlkPtr paramBlock);
pascal OSErr PBHSetFLock	(HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHSetFLockSync	(HParmBlkPtr paramBlock);
pascal OSErr PBHSetFLockAsync
   				(HParmBlkPtr paramBlock);
pascal OSErr PBHRstFLock	(HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHRstFLockSync	(HParmBlkPtr paramBlock);
pascal OSErr PBHRstFLockAsync
   				(HParmBlkPtr paramBlock);
pascal OSErr PBHRename		(HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHRenameSync	(HParmBlkPtr paramBlock);
pascal OSErr PBHRenameAsync	(HParmBlkPtr paramBlock);

Moving Files or Directories

pascal OSErr PBCatMove		(CMovePBPtr paramBlock, Boolean async);
pascal OSErr PBCatMoveSync	(CMovePBPtr paramBlock);
pascal OSErr PBCatMoveAsync	(CMovePBPtr paramBlock);

Maintaining Working Directories

pascal OSErr PBOpenWD		(WDPBPtr paramBlock, Boolean async);
pascal OSErr PBOpenWDSync	(WDPBPtr paramBlock);
pascal OSErr PBOpenWDAsync	(WDPBPtr paramBlock);
pascal OSErr PBCloseWD		(WDPBPtr paramBlock, Boolean async);
pascal OSErr PBCloseWDSync	(WDPBPtr paramBlock);
pascal OSErr PBCloseWDAsync	(WDPBPtr paramBlock);
pascal OSErr PBGetWDInfo	(WDPBPtr paramBlock, Boolean async);
pascal OSErr PBGetWDInfoSync	(WDPBPtr paramBlock);
pascal OSErr PBGetWDInfoAsync
   				(WDPBPtr paramBlock);

Searching a Catalog

pascal OSErr PBCatSearch	(HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBCatSearchSync	(HParmBlkPtr paramBlock);
pascal OSErr PBCatSearchAsync
   				(HParmBlkPtr paramBlock);

Exchanging the Data in Two Files

pascal OSErr PBExchangeFiles	(HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBExchangeFilesSync
   				(HParmBlkPtr paramBlock);
pascal OSErr PBExchangeFilesAsync
   				(HParmBlkPtr paramBlock);

Shared Environment Routines

Opening Files While Denying Access

pascal OSErr PBHOpenDeny	(HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHOpenDenySync	(HParmBlkPtr paramBlock);
pascal OSErr PBHOpenDenyAsync
   				(HParmBlkPtr paramBlock);
pascal OSErr PBHOpenRFDeny	(HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHOpenRFDenySync
   				(HParmBlkPtr paramBlock);
pascal OSErr PBHOpenRFDenyAsync
   				(HParmBlkPtr paramBlock);

Locking and Unlocking File Ranges

pascal OSErr PBLockRange	(ParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBLockRangeSync	(ParmBlkPtr paramBlock);
pascal OSErr PBLockRangeAsync
   				(ParmBlkPtr paramBlock);
pascal OSErr PBUnlockRange	(ParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBUnlockRangeSync
   				(ParmBlkPtr paramBlock);
pascal OSErr PBUnlockRangeAsync
   				(ParmBlkPtr paramBlock);

Manipulating Share Points

pascal OSErr PBShare			(HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBShareSync		(HParmBlkPtr paramBlock);
pascal OSErr PBShareAsync		(HParmBlkPtr paramBlock);
pascal OSErr PBUnshare			(HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBUnshareSync		(HParmBlkPtr paramBlock);
pascal OSErr PBUnshareAsync		(HParmBlkPtr paramBlock);
pascal OSErr PBGetUGEntry		(HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBGetUGEntrySync
   					(HParmBlkPtr paramBlock);
pascal OSErr PBGetUGEntryAsync
   					(HParmBlkPtr paramBlock);

Controlling Directory Access

pascal OSErr PBHGetDirAccess		(HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHGetDirAccessSync
   					(HParmBlkPtr paramBlock);
pascal OSErr PBHGetDirAccessAsync
   					(HParmBlkPtr paramBlock);
pascal OSErr PBHSetDirAccess		(HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHSetDirAccessSync
   					(HParmBlkPtr paramBlock);
pascal OSErr PBHSetDirAccessAsync
   					(HParmBlkPtr paramBlock);

Mounting Volumes

pascal OSErr PBGetVolMountInfoSize
   					(ParmBlkPtr paramBlock);
pascal OSErr PBGetVolMountInfo
   					(ParmBlkPtr paramBlock);
pascal OSErr PBVolumeMount		(ParmBlkPtr paramBlock);

Controlling Login Access

pascal OSErr PBHGetLogInInfo		(HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHGetLogInInfoSync
   					(HParmBlkPtr paramBlock);
pascal OSErr PBHGetLogInInfoAsync
   					(HParmBlkPtr paramBlock);
pascal OSErr PBHMapID			(HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHMapIDSync		(HParmBlkPtr paramBlock);
pascal OSErr PBHMapIDAsync		(HParmBlkPtr paramBlock);
pascal OSErr PBHMapName			(HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHMapNameSync		(HParmBlkPtr paramBlock);
pascal OSErr PBHMapNameAsync		(HParmBlkPtr paramBlock);

Copying and Moving Files

pascal OSErr PBHCopyFile		(HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHCopyFileSync		(HParmBlkPtr paramBlock);
pascal OSErr PBHCopyFileAsync
   					(HParmBlkPtr paramBlock);
pascal OSErr PBHMoveRename		(HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBHMoveRenameSync
   					(HParmBlkPtr paramBlock);
pascal OSErr PBHMoveRenameAsync
   					(HParmBlkPtr paramBlock);

File ID Routines

Resolving File ID References

pascal OSErr PBResolveFileIDRef
   					(HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBResolveFileIDRefSync
   					(HParmBlkPtr paramBlock);
pascal OSErr PBResolveFileIDRefAsync
   					(HParmBlkPtr paramBlock);

Creating and Deleting File ID References

pascal OSErr PBCreateFileIDRef
   					(HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBCreateFileIDRefSync
   					(HParmBlkPtr paramBlock);
pascal OSErr PBCreateFileIDRefAsync
   					(HParmBlkPtr paramBlock);
pascal OSErr PBDeleteFileIDRef
   					(HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBDeleteFileIDRefSync
   					(HParmBlkPtr paramBlock);
pascal OSErr PBDeleteFileIDRefAsync
   					(HParmBlkPtr paramBlock);

Foreign File System Routines

Accessing Privilege Information in Foreign File Systems

pascal OSErr PBGetForeignPrivs
   					(HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBGetForeignPrivsSync
   					(HParmBlkPtr paramBlock);
pascal OSErr PBGetForeignPrivsAsync
   					(HParmBlkPtr paramBlock);
pascal OSErr PBSetForeignPrivs
   					(HParmBlkPtr paramBlock, Boolean async);
pascal OSErr PBSetForeignPrivsSync
   					(HParmBlkPtr paramBlock);
pascal OSErr PBSetForeignPrivsAsync
   					(HParmBlkPtr paramBlock);

Utility Routines

Obtaining Queue Headers

#define GetFSQHdr()		(QHdrPtr);
#define GetVCBQHdr()		(QHdrPtr);
#define GetDrvQHdr()		(QHdrPtr);

Adding a Drive

pascal void AddDrive	(short drvrRefNum, short drvNum, DrvQElPtr qEl);

Obtaining File Control Block Information

pascal OSErr PBGetFCBInfo		(FCBPBPtr paramBlock, Boolean async);
pascal OSErr PBGetFCBInfoSync
   					(FCBPBPtr paramBlock);
pascal OSErr PBGetFCBInfoAsync
   					(FCBPBPtr paramBlock);

Application-Defined Routine

Completion Routines

pascal void MyCompletionProc(void);

Assembly-Language Summary

Constants

;flags in trap words
hfsBit            EQU      9        ;set for an HFS call
asyncTrpBit       EQU      10       ;set for an asynchronous call
;masks for flags in trap words
newHFS            EQU      $200     ;make an HFS call
ASYNC             EQU      $400     ;make an asynchronous call

Data Structures

File System Specification Record
0vRefNumwordvolume reference number
2parIDlongparent directory ID
6name64 bytesfilename or directory name

HFS Parameter Block Common Fields
0qLinklongnext queue entry
4qTypewordqueue type
6ioTrapwordroutine trap
8ioCmdAddrlongroutine address
12ioCompletionlongaddress of completion routine
16ioResultwordresult code
18ioNamePtrlongpointer to pathname
22ioVRefNumwordvolume specification

I/O Parameter Variant
24ioRefNumwordfile reference number
26ioVersNumbyteversion number
27ioPermssnbyteread/write permission
28ioMisclongmiscellaneous
32ioBufferlongdata buffer
36ioReqCountlongrequested number of bytes
40ioActCountlongactual number of bytes
44ioPosModewordpositioning mode and newline character
46ioPosOffsetlongpositioning offset

File Parameter Variant
24ioFRefNumwordfile reference number
26ioFVersNumbytefile version number (unused)
27filler1bytereserved
28ioFDirIndexworddirectory index
30ioFlAttribbytefile attributes
31ioFlVersNumbytefile version number (unused)
32ioFlFndrInfo16 bytesinformation used by the Finder
48ioDirIDlongdirectory ID or file ID
52ioFlStBlkwordfirst allocation block of data fork
54ioFlLgLenlonglogical end-of-file of data fork
58ioFlPyLenlongphysical end-of-file of data fork
62ioFlRStBlkwordfirst allocation block of resource fork
64ioFlRLgLenlonglogical end-of-file of resource fork
68ioFlRPyLenlongphysical end-of-file of resource fork
72ioFlCrDatlongdate and time of creation
76ioFlMdDatlongdate and time of last modification

Volume Parameter Variant
24filler2longreserved
28ioVolIndexwordvolume index
30ioVCrDatelongdate and time of initialization
34ioVLsModlongdate and time of last modification
38ioVAtrbwordvolume attributes
40ioVNmFlswordnumber of files in root directory
42ioVBitMapwordfirst block of volume bitmap
44ioAllocPtrwordfirst block of next new file
46ioVNmAlBlkswordnumber of allocation blocks
48ioVAlBlkSizlongsize of allocation blocks
50ioVClpSizlongdefault clump size
54ioAlBlStwordfirst block in volume map
56ioVNxtCNIDlongnext unused node ID
60ioVFrBlkwordnumber of unused allocation blocks
62ioVSigWordwordvolume signature
64ioVDrvInfoworddrive number
66ioVDRefNumworddriver reference number
68ioVFSIDwordfile-system identifier
70ioVBkUplongdate and time of last backup
74ioVSeqNumwordused internally
76ioVWrCntlongvolume write count
80ioVFilCntlongnumber of files on volume
84ioVDirCntlongnumber of directories on volume
88ioVFndrInfo32 bytesinformation used by the Finder

Access Variant
24filler3wordreserved
26ioDenyModeswordaccess mode information
28filler4wordreserved
30filler5bytereserved
31ioACUserbyteuser access rights
32filler6longreserved
36ioACOwnerIDlongowner ID
40ioACGroupIDlonggroup ID
44ioACAccesslongdirectory access rights

Object Variant
24filler7wordreserved
26ioObjTypewordfunction code
28ioObjNamePtrlongpointer to returned creator/group name
32ioObjIDlongcreator/group ID

Copy Variant
24ioDstVRefNumworddestination volume identifier
26filler8wordreserved
28ioNewNamelongpointer to destination pathname
32ioCopyNamelongpointer to optional name
36ioNewDirIDlongdirectory ID of destination directory

Working Directory Variant
24filler9wordreserved
26ioWDIndexwordworking directory's index
28ioWDProcIDlongworking directory's user identifier
32ioWDVRefNumwordworking directory's volume reference number
34filler10wordreserved
36filler11longreserved
40filler12longreserved
44filler13longreserved
48ioWDDirIDlongworking directory's directory ID

File ID Variant
24filler14longreserved
28ioDestNamePtrlongpointer to destination filename
32filler15longreserved
36ioDestDirIDlongdestination parent directory ID
40filler16longreserved
44filler17longreserved
48ioSrcDirIDlongsource parent directory ID
52filler18wordreserved
54ioFileIDlongfile ID

Catalog Search Variant
24ioMatchPtrlongpointer to array of matches
28ioReqMatchCountlongmaximum match count
32ioActMatchCountlongactual match count
36ioSearchBitslongsearch criteria selector
40ioSearchInfo1longpointer to values and lower bounds
44ioSearchInfo2longpointer to masks and upper bounds
48ioSearchTimelongtime limit on search
52ioCatPosition16 bytescatalog position record
68ioOptBufferlongpointer to optional read buffer
72ioOptBufSizelonglength of optional read buffer

Foreign Privileges Variant
24filler21longreserved
28filler22longreserved
32ioForeignPrivBufferlongpointer to privileges data buffer
36ioForeignPrivReqCountlongsize allocated for buffer
40ioForeignPrivActCountlongamount of buffer used
44filler23longreserved
48ioForeignPrivDirIDlongparent directory ID of target
52ioForeignPrivInfo1longprivileges data
56ioForeignPrivInfo2longprivileges data
60ioForeignPrivInfo3longprivileges data
64ioForeignPrivInfo4longprivileges data

Catalog Information Parameter Block (Files Variant)
24ioFRefNumwordfile reference number
26ioFVersNumbyteversion number
27filler1bytereserved
28ioFDirIndexworddirectory index
30ioFlAttribbytefile attributes
31ioACUserbytedirectory access rights
32ioFlUsrWds16 bytesinformation used by the Finder
48ioFlNumlongfile ID
52ioFlStBlkwordfirst allocation block of data fork
54ioFlLgLenlonglogical end-of-file of data fork
58ioFlPyLenlongphysical end-of-file of data fork
62ioFlRStBlkwordfirst allocation block of resource fork
64ioFlRLgLenlonglogical end-of-file of resource fork
68ioFlRPyLenlongphysical end-of-file of resource fork
72ioFlCrDat longdate and time of creation
76ioFlMdDatlongdate and time of last modification
80ioFlBkDatlongdate and time of last backup
84ioFlXFndrInfo16 bytesadditional information used by the Finder
100ioFlParIDlongfile parent directory ID
104ioFlClpSizlongfile's clump size

Catalog Information Parameter Block (Directories Variant)
24ioFRefNumwordfile reference number
26ioFVersNumbyteversion number
27filler1bytereserved
28ioFDirIndexworddirectory index
30ioFlAttribbytedirectory attributes
31ioACUserbytedirectory access rights
32ioDrUsrWds16 bytesinformation used by the Finder
48ioDrDirIDlongdirectory ID
52ioDrNmFlswordnumber of files in directory
54filler318 bytesreserved
72ioDrCrDatlongdate and time of creation
76ioDrMdDatlongdate and time of last modification
80ioDrBkDatlongdate and time of last backup
84ioDrFndrInfo16 bytesadditional information used by the Finder
100ioDrParIDlongdirectory's parent directory ID

Catalog Position Record
0initializelongstarting place for next search
4priv12 bytesprivate data

Catalog Move Parameter Block
24filler1longreserved
28ioNewNamelongpointer to name of new directory
32filler2longreserved
36ioNewDirIDlongdirectory ID of new directory
40filler38 bytesreserved
48ioDirIDlongdirectory ID of current directory

Working Directory Parameter Block
24filler1wordreserved
26ioWDIndexwordworking directory's index
28ioWDProcIDlongworking directory's user identifier
32ioWDVRefNumwordworking directory's volume reference number
34filler214 bytesreserved
48ioWDDirIDlongworking directory's directory ID

File Control Block Parameter Block
24ioRefNumwordfile reference number
26fillerwordreserved
28ioFCBIndxwordFCB index
30ioFCBfiller1wordreserved
32ioFCBFlNmlongfile ID
36ioFCBFlagswordflags
38ioFCBStBlkwordfirst allocation block of file
40ioFCBEOFlonglogical end-of-file
44ioFCBPLenlongphysical end-of-file
48ioFCBCrPslongposition of the file mark
52ioFCBVRefNumwordvolume reference number
54ioFCBClpSizlongfile's clump size
58ioFCBParIDlongparent directory ID

Volume Attributes Buffer
0vMVersionwordversion number
2vMAttriblongvolume attributes
6vMLocalHandlongreserved
10vMServerAdrlongnetwork server address
14vMVolumeGradelongrelative speed rating
18vMForeignPrivIDwordforeign privilege model

Volume Mounting Information Record
0lengthwordlength of record
2media4 bytestype of volume

AFP Mounting Information Record
0lengthwordlength of record
2media4 bytestype of volume
6flagswordreserved; must be 0
8nbpIntervalbyteNBP retry interval
9nbpCountbyteNBP retry count
10uamTypeworduser authentication method
12zoneNameOffsetwordoffset to zone name
14serverNameOffsetwordoffset to server name
16volNameOffsetwordoffset to volume name
18userNameOffsetwordoffset to user name
20userPasswordOffsetwordoffset to user password
22volPasswordOffsetwordoffset to volume password
24AFPData144 bytesmounting data

Volume Control Block Data Structure (Internal)
0qLinklongnext queue entry
4qTypewordqueue type
6vcbFlagswordvolume flags
8vcbSigWordwordvolume signature
10vcbCrDatelongdate and time of initialization
14vcbLsModlongdate and time of last modification
18vcbAtrbwordvolume attributes
20vcbNmFlswordnumber of files in root directory
22vcbVBMSt wordfirst block of volume bitmap
24vcbAllocPtrwordstart of next allocation search
26vcbNmAlBlkswordnumber of allocation blocks in volume
28vcbAlBlkSizlongsize (in bytes) of allocation block
32vcbClpSizlongdefault clump size
36vcbAlBlStwordfirst allocation block in volume
38vcbNxtCNIDlongnext unused catalog node ID
42vcbFreeBkswordnumber of unused allocation blocks
44vcbVN28 bytesvolume name preceded by length byte
72vcbDrvNumworddrive number
74vcbDRefNumworddriver reference number
76vcbFSIDwordfile-system identifier
78vcbVRefNumwordvolume reference number
80vcbMAdrlongpointer to block map
84vcbBufAdrlongpointer to volume buffer
88vcbMLenwordnumber of bytes in block map
90vcbDirIndexwordreserved
92vcbDirBlkwordreserved
94vcbVolBkUplongdate and time of last backup
98vcbVSeqNumwordvolume backup sequence number
100vcbWrCntlongvolume write count
104vcbXTClpSizlongclump size for extents overflow file
108vcbCTClpSizlongclump size for catalog file
112vcbNmRtDirswordnumber of directories in root directory
114vcbFilCntlongnumber of files in volume
118vcbDirCntlongnumber of directories in volume
122vcbFndrInfo32 bytesinformation used by the Finder
154vcbVCSizewordreserved
156vcbVBMCSizwordreserved
158vcbCtlCSizwordreserved
160vcbXTAlBkswordsize in blocks of extents overflow file
162vcbCTAlBkswordsize in blocks of catalog file
164vcbXTRefwordfile reference number for extents overflow file
166vcbCTRefwordfile reference number for catalog file
168vcbCtlBuflongpointer to extents and catalog tree caches
172vcbDirIDMlongdirectory last searched
176vcbOffsMwordoffspring index at last search

File Control Block Data Structure (Internal)
0fcbFlNumlongfile ID
4fcbFlagswordfile flags
6fcbSBlkwordfirst allocation block of file
8fcbEOFlonglogical end-of-file
12fcbPLenlongphysical end-of-file
16fcbCrPslongcurrent file mark position
20fcbVPtrlongpointer to volume control block
24fcbBfAdrlongpointer to access path buffer
28fcbFlPoswordreserved
30fcbClmpSizelongfile's clump size
34fcbBTCBPtrlongpointer to B*-tree control block
38fcbExtRec12 bytesfirst three file extents
50fcbFTypelongfile's four Finder type bytes
54fcbCatPoslongcatalog hint for use on close
58fcbDirIDlongfile's parent directory ID
62fcbCName32 bytesname of open file, preceded by length byte

Drive Queue Elements
0qLink longnext queue entry
4qTypewordflag for dQDrvSz and dQDrvSz2 fields
6dQDriveworddrive number
8dQRefNumworddriver reference number
10dQFSIDwordfile-system identifier
12dQDrvSzwordnumber of logical blocks on drive
14dQDrvSz2wordadditional field for large drives

Trap Macros

Trap Macro Names
Pascal nameTrap macro name
PBAllocate_Allocate
PBAllocContig_AllocContig
PBClose_Close
PBDirCreate_DirCreate
PBEject _Eject
PBFlushFile_FlushFile
PBFlushVol_FlushVol
PBGetEOF_GetEOF
PBGetFPos_GetFPos
PBGetVol _GetVol
PBHCreate_HCreate
PBHDelete_HDelete
PBHGetFInfo_HGetFileInfo
PBHGetVInfo_HGetVolInfo
PBHGetVol_HGetVol
PBHGetVolParms_GetVolParms
PBHOpen_HOpen
PBHOpenRF_HOpenRF
PBHRename_HRename
PBHRstFLock _HRstFLock
PBHSetFInfo_HSetFileInfo
PBHSetFLock_HSetFLock
PBHSetVol_HSetVol
PBMountVol_MountVol
PBOffLine_OffLine
PBRead_Read
PBSetEOF_SetEOF
PBSetFPos_SetFPos
PBSetVInfo_SetVolInfo
PBSetVol _SetVol
PBUnmountVol_UnmountVol
PBWrite_Write

Trap Macros Requiring Routine Selectors

_HFSDispatch
SelectorRoutine
$0001PBOpenWD
$0002PBCloseWD
$0005PBCatMove
$0006PBDirCreate
$0007PBGetWDInfo
$0008PBGetFCBInfo
$0009PBGetCatInfo
$000APBSetCatInfo
$000BPBSetVInfo
$0010PBLockRange
$0011PBUnlockRange
$0014PBCreateFileIDRef
$0015PBDeleteFileIDRef
$0016PBResolveFileIDRef
$0017PBExchangeFiles
$0018PBCatSearch
$001APBHOpenDF
$001BPBMakeFSSpec
$0030PBHGetVolParms
$0031PBHGetLogInInfo
$0032PBHGetDirAccess
$0033PBHSetDirAccess
$0034PBHMapID
$0035PBHMapName
$0036PBHCopyFile
$0037PBHMoveRename
$0038PBHOpenDeny
$0039PBHOpenRFDeny
$003FPBGetVolMountInfoSize
$0040PBGetVolMountInfo
$0041PBVolumeMount
$0042PBShare
$0043PBUnshare
$0044PBGetUGEntry
$0060PBGetForeignPrivs
$0061PBSetForeignPrivs
_HighLevelFSDispatch
SelectorRoutine
$0001FSMakeFSSpec
$0002FSpOpenDF
$0003FSpOpenRF
$0004FSpCreate
$0005FSpDirCreate
$0006FSpDelete
$0007FSpGetFInfo
$0008FSpSetFInfo
$0009FSpSetFLock
$000AFSpRstFLock
$000BFSpRename
$000CFSpCatMove
$000DFSpOpenResFile
$000EFSpCreateResFile
$000FFSpExchangeFiles

Global Variables
BootDrivewordWorking directory reference number for startup volume.
DefVCBPtrlongPointer to default volume control block.
DrvQHdr10 bytesDrive queue header.
FSFCBLenwordSize of a file control block.
FSQHdr10 bytes File I/O queue header.
ToExtFSlongPointer to external file system.
VCBQHdr10 bytesVolume control block queue header.

Result Codes
noErr0No error
notOpenErr-28AppleTalk is not open
dirFulErr -33File directory full
dskFulErr -34All allocation blocks on the volume are full
nsvErr-35Volume not found
ioErr-36I/O error
bdNamErr-37Bad filename or volume name
fnOpnErr -38File not open
eofErr-39Logical end-of-file reached
posErr -40Attempt to position mark before start of file
tmfoErr-42Too many files open
fnfErr-43File not found
wPrErr-44Hardware volume lock
fLckdErr-45File is locked
vLckdErr-46Software volume lock
fBsyErr -47File is busy; one or more files are open; directory not empty or working directory control block is open
dupFNErr -48A file with the specified name already exists
opWrErr-49File already open for writing
paramErr-50Parameter error
rfNumErr -51Reference number specifies nonexistent access path; bad working directory reference number
gfpErr -52Error during GetFPos
volOfflinErr-53Volume is offline
permErr -54Attempt to open locked file for writing
volOnLinErr-55Specified volume is already mounted and online
nsDrvErr -56Specified drive number doesn't match any number in the drive queue
noMacDskErr -57Volume lacks Macintosh-format directory
extFSErr-58External file system
fsRnErr -59Problem during rename
badMDBErr -60Bad master directory block
wrPermErr-61Read/write permission doesn't allow writing
memFullErr-108Insufficient memory available
dirNFErr-120Directory not found
tmwdoErr-121Too many working directories open
badMovErr-122Attempted to move into offspring
wrgVolTypErr-123Not an HFS volume
volGoneErr-124Server volume has been disconnected
fsDSIntErr-127Internal file system error
fidNotFoundErr-1300File ID not found
fidExists-1301File ID already exists
notAFileErr-1302Specified file is a directory
diffVolErr-1303Files are on different volumes
catChangedErr-1304Catalog has changed and catalog position record may be invalid
sameFileErr-1306Files are the same
afpAccessDenied-5000The operation has failed because the user does not have the correct access to the file or folder
afpBadUAM-5002User authentication method is unknown
afpBadVersNum-5003Workstation is using an AFP version that the server doesn't recognize
afpDenyConflict-5006The operation has failed because the permission or deny mode conflicts with the mode in which the fork has already been opened
afpNoMoreLocks-5015Byte range locking has failed because the server cannot lock any additional ranges
afpNoServer-5016Server is not responding
afpRangeNotLocked-5020User has attempted to unlock a range that was not locked by that user
afpRangeOverlap-5021User attempted to lock some or all of a range that is already locked
afpUserNotAuth-5023User authentication failed (usually, password is
not correct)
afpObjectTypeErr-5025Object was a file, not a directory; or, this directory is not a share point
afpContainsSharedErr-5033The directory contains a share point
afpIDNotFound-5034File ID not found
afpIDExists-5035File ID already exists
afpCatalogChanged-5037Catalog has changed and search cannot be resumed
afpSameObjectErr-5038Source and destination are the same
afpBadIDErr-5039Bad file ID
afpPwdExpired-5042Password has expired on server
afpInsideSharedErr-5043The directory is inside a shared directory
afpBadDirIDType-5060Not a fixed directory ID volume
afpCantMountMoreSrvrs-5061Maximum number of volumes have been mounted
afpAlreadyMounted-5062Volume already mounted
afpSameNodeErr-5063Attempt to log on to a server running on the
same machine


Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996