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 / File Manager Reference
Data Structures


Basic File Manager Parameter Block

Many of the low-level functions that manipulate files and volumes exchange information with your application using the basic File Manager parameter block, defined by the ParamBlockRec data type.

TYPE ParamBlockRec   =                 {basic File Manager parameter block}
RECORD
      qLink:            QElemPtr;      {next queue entry}
      qType:            Integer;       {queue type}
      ioTrap:           Integer;       {routine trap}
      ioCmdAddr:        Ptr;           {routine address}
      ioCompletion:     ProcPtr;       {pointer to completion routine}
      ioResult:         OSErr;         {result code}
      ioNamePtr:        StringPtr;     {pointer to pathname}
      ioVRefNum:        Integer;       {volume specification}
   CASE ParamBlkType OF
   ioParam:       
     (ioRefNum:         Integer;       {file reference number}
      ioVersNum:        SignedByte;    {version number}
      ioPermssn:        SignedByte;    {read/write permission}
      ioMisc:           Ptr;           {miscellaneous}
      ioBuffer:         Ptr;           {data buffer}
      ioReqCount:       LongInt;       {requested number of bytes}
      ioActCount:       LongInt;       {actual number of bytes}
      ioPosMode:        Integer;       {positioning mode and newline char.}
      ioPosOffset:      LongInt);      {positioning offset}
   fileParam:     
     (ioFRefNum:        Integer;       {file reference number}
      ioFVersNum:       SignedByte;    {file version number (unused)}
      filler1:          SignedByte;    {reserved}
      ioFDirIndex:      Integer;       {directory index}
      ioFlAttrib:       SignedByte;    {file attributes}
      ioFlVersNum:      SignedByte;    {file version number (unused)}
      ioFlFndrInfo:     FInfo;         {information used by the Finder}
      ioFlNum:          LongInt;       {file ID}
      ioFlStBlk:        Integer;       {first alloc. blk. of data fork}
      ioFlLgLen:        LongInt;       {logical EOF of data fork}
      ioFlPyLen:        LongInt;       {physical EOF of data fork}
      ioFlRStBlk:       Integer;       {first alloc. blk. of resource fork}
      ioFlRLgLen:       LongInt;       {logical EOF of resource fork}
      ioFlRPyLen:       LongInt;       {physical EOF of resource fork}
      ioFlCrDat:        LongInt;       {date and time of creation}
      ioFlMdDat:        LongInt);      {date and time of last modification}
   volumeParam:   
     (filler2:          LongInt;       {reserved}
      ioVolIndex:       Integer;       {volume index}
      ioVCrDate:        LongInt;       {date and time of initialization}
      ioVLsBkUp:        LongInt;       {date and time of last modification}
      ioVAtrb:          Integer;       {volume attributes}
      ioVNmFls:         Integer;       {number of files in root directory}
      ioVDirSt:         Integer;       {first block of directory}
      ioVBlLn:          Integer;       {length of directory in blocks}
      ioVNmAlBlks:      Integer;       {number of allocation blocks}
      ioVAlBlkSiz:      LongInt;       {size of allocation blocks}
      ioVClpSiz:        LongInt;       {default clump size}
      ioAlBlSt:         Integer;       {first block in block map}
      ioVNxtFNum:       LongInt;       {next unused file ID}
      ioVFrBlk:         Integer);      {number of unused allocation blocks}
   END;
The first eight fields are common to all three variants. Each variant also includes its own unique fields.

Field descriptions for fields common to all variants

qLink
A pointer to the next entry in the file I/O queue. (This field is used internally by the File Manager to keep track of asynchronous calls awaiting execution.)
qType
The queue type. (This field is used internally by the File Manager.)
ioTrap
The trap number of the routine that was called. (This field is used internally by the File Manager.)
ioCmdAddr
The address of the routine that was called. (This field is used internally by the File Manager.)
ioCompletion
A pointer to a completion routine to be executed at the end of an asynchronous call. It should be NIL for asynchronous calls with
no completion routine and is automatically set to NIL for all synchronous calls. See "Completion Routines" on page 2-238 for information about completion routines.
ioResult
The result code of the function. For synchronous calls, this field is the same as the result code of the function call itself. To determine when an asynchronous call has actually been completed, your application can poll this field; it's set to a positive number when
the call is made and receives the actual result code when the call
is completed.
ioNamePtr
A pointer to a pathname. Whenever a routine description specifies that ioNamePtr is used--whether for input, output, or both--
it's very important that you set this field to point to storage for a Str255 value (if you're using a pathname) or to NIL (if you're not).
ioVRefNum
A volume specification (volume reference number, working directory reference number, drive number, or 0 for default volume).
Field descriptions for the ioParam variant

ioRefNum
The file reference number of an open file.
ioVersNum
A version number. This field is no longer used and you should always set it to 0.
ioPermssn
The access mode.
ioMisc
Depends on the routine called. This field contains either a new logical end-of-file, a new version number, or a pointer to a new pathname. Because ioMisc is of type Ptr, you'll need to perform type coercion to interpret the value of ioMisc correctly when it contains an end-of-file (a LongInt value) or version number (a SignedByte value).
ioBuffer
A pointer to a data buffer into which data is written by _Read calls and from which data is read by _Write calls.
ioReqCount
The requested number of bytes to be read, written, or allocated.
ioActCount
The number of bytes actually read, written, or allocated.
ioPosMode
The positioning mode for setting the mark. Bits 0 and 1 of this field indicate how to position the mark; you can use the following predefined constants to set or test their value:
               CONST
                  fsAtMark       =  0; {at current mark}
                  fsFromStart    =  1; {from beginning of file}
                  fsFromLEOF     =  2; {from logical end-of-file}
                  fsFromMark     =  3; {relative to current mark}
You can set bit 4 of the ioPosMode field to request that the data be cached, and you can set bit 5 to request that the data not be cached. You can set bit 6 to request that any data written be immediately

read; this ensures that the data written to a volume exactly matches the data in memory. To request a read-verify operation, add the following constant to the positioning mode:
               CONST
                  rdVerify       =  64;   {use read-verify mode}
You can set bit 7 to read a continuous stream of bytes, and place
the ASCII code of a newline character in the high-order byte to terminate a read operation at the end of a line.
ioPosOffset
The offset to be used in conjunction with the positioning mode.
Field descriptions for the fileParam variant

ioFRefNum
The file reference number of an open file.
ioFVersNum
A file version number. This field is no longer used and you should always set it to 0.
filler1
Reserved.
ioFDirIndex
An index for use with the PBHGetFInfo function.
ioFlAttrib
File attributes. The bits in this field have these meanings:
 BitMeaning
 0Set if file is locked
 2Set if resource fork is open
 3Set if data fork is open
 4Set if a directory
 7Set if file (either fork) is open
ioFlVersNum
A file version number. This feature is no longer supported, and you must always set this field to 0.
ioFlFndrInfo
Information used by the Finder. (See the chapter "Finder Interface" in Inside Macintosh: Macintosh Toolbox Essentials for details.)
ioFlNum
A file ID.
ioFlStBlk
The first allocation block of the data fork. This field contains 0 if the file's data fork is empty.
ioFlLgLen
The logical end-of-file of the data fork.
ioFlPyLen
The physical end-of-file of the data fork.
ioFlRStBlk
The first allocation block of the resource fork. This field contains 0 if the file's resource fork is empty.
ioFlRLgLen
The logical end-of-file of the resource fork.
ioFlRPyLen
The physical end-of-file of the resource fork.
ioFlCrDat
The date and time of the file's creation, specified in seconds since midnight, January 1, 1904.
ioFlMdDat
The date and time of the last modification to the file, specified in seconds since midnight, January 1, 1904.
Field descriptions for the volumeParam variant

filler2
Reserved.
ioVolIndex
The volume index.
ioVCrDate
The date and time of volume initialization.
ioVLsBkUp
The date and time the volume information was last modified. (This field is not changed when information is written to a file and does not necessarily indicate when the volume was flushed.)
ioVAtrb
The volume attributes.
ioVNmFls
The number of files in the root directory.
ioVDirSt
The first block of the volume directory.
ioVBlLn
Length of directory in blocks.
ioVNmAlBlks
The number of allocation blocks.
ioVAlBlkSiz
The size of allocation blocks.
ioVClpSiz
The volume clump size.
ioAlBlSt
The first block in the volume map.
ioVNxtFNum
The next unused file number.
ioVFrBlk
The number of unused allocation blocks.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996