Legacy Documentclose button

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

 
Advanced Search
Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

Previous Book Contents Book Index Next

Inside Macintosh: Files /
Chapter 2 - File Manager / Data Organization on Volumes


Master Directory Blocks

A master directory block (MDB)--also sometimes known as a volume information block (VIB)--contains information about the rest of the volume. This information is written into the MDB when the volume is initialized. Thereafter, whenever the volume is mounted, the File Manager reads the information in the MDB and copies some of that information into a volume control block (VCB). A VCB is a private data structure maintained in memory by the File Manager (in the VCB queue). The structure of a VCB is described in "Volume Control Blocks," later in this chapter.

Note in Figure 2-5 (page 2-56) that a copy of the MDB is located in the next-to-last block in the volume. This copy is updated only when the extents overflow file or the catalog file grows larger. This alternate MBD is intended for use solely by disk utilities.

The MDB data type defines a master directory block record.

TYPE MDB          =           {master directory block}
RECORD
   drSigWord:     Integer;    {volume signature}
   drCrDate:      LongInt;    {date and time of volume creation}
   drLsMod:       LongInt;    {date and time of last modification}
   drAtrb:        Integer;    {volume attributes}
   drNmFls:       Integer;    {number of files in root directory}
   drVBMSt:       Integer;    {first block of volume bitmap}
   drAllocPtr:    Integer;    {start of next allocation search}
   drNmAlBlks:    Integer;    {number of allocation blocks in volume}
   drAlBlkSiz:    LongInt;    {size (in bytes) of allocation blocks}
   drClpSiz:      LongInt;    {default clump size}
   drAlBlSt:      Integer;    {first allocation block in volume}
   drNxtCNID:     LongInt;    {next unused catalog node ID}
   drFreeBks:     Integer;    {number of unused allocation blocks}
   drVN:          String[27]; {volume name}
   drVolBkUp:     LongInt;    {date and time of last backup}
   drVSeqNum:     Integer;    {volume backup sequence number}
   drWrCnt:       LongInt;    {volume write count}
   drXTClpSiz:    LongInt;    {clump size for extents overflow file}
   drCTClpSiz:    LongInt;    {clump size for catalog file}
   drNmRtDirs:    Integer;    {number of directories in root directory}
   drFilCnt:      LongInt;    {number of files in volume}
   drDirCnt:      LongInt;    {number of directories in volume}
   drFndrInfo:    ARRAY[1..8] OF LongInt;
                              {information used by the Finder}
   drVCSize:      Integer;    {size (in blocks) of volume cache}
   drVBMCSize:    Integer;    {size (in blocks) of volume bitmap cache}
   drCtlCSize:    Integer;    {size (in blocks) of common volume cache}
   drXTFlSize:    LongInt;    {size of extents overflow file}
   drXTExtRec:    ExtDataRec; {extent record for extents overflow file}
   drCTFlSize:    LongInt;    {size of catalog file}
   drCTExtRec:    ExtDataRec; {extent record for catalog file}
END;
Field Description
drSigWord
The volume signature. For HFS volumes, this field contains $4244; for the obsolete flat MFS volumes, this field contains $D2D7.
drCrDate
The date and time of volume creation (initialization).
drLsMod
The date and time the volume was last modified. This is not necessarily when the volume was last flushed.
drAtrb
Volume attributes. Currently the following bits are defined:
 BitMeaning
 7Set if the volume is locked by hardware
 8Set if the volume was successfully unmounted
 9Set if the volume has had its bad blocks spared
 15Set if the volume is locked by software
drNmFls
The number of files in the root directory.
drVBMSt
The first block of the volume bitmap. This field always contains 3 in the current implementation.
drAllocPtr
The number of the allocation block at which the next allocation search will begin. Used internally.
drNmAlBlks
The number of allocation blocks in the volume. Because the value in this field is an integer, a volume can contain at most 65,535 allocation blocks.
drAlBlkSiz
The allocation block size (in bytes). This value must always be a multiple of 512 bytes.
drClpSiz
The default clump size.
drAlBlSt
The location of the first allocation block in the volume.
drNxtCNID
The next unused catalog node ID (directory ID or file ID).
drFreeBks
The number of unused allocation blocks on the volume.
drVN
The volume name. This field consists of a length byte followed
by 27 bytes. Note that the volume name can occupy at most
27 characters; this is an exception to the normal file and directory name limit of 31 characters.
drVolBkUp
The date and time of the last volume backup.
drVSeqNum
Volume backup sequence number. Used internally.
drWrCnt
The volume write count (that is, the number of times the volume has been written to).
drXTClpSize
The clump size for the extents overflow file.
drCTClpSize
The clump size for the catalog file.
drNmRtDirs
The number of directories in the root directory.
drFilCnt
The number of files on the volume.
drDirCnt
The number of directories on the volume.
drFndrInfo
Information used by the Finder. See the chapter "Finder Interface" in Inside Macintosh: Macintosh Toolbox Essentials for details on
Finder information.
drVCSize
The size (in allocation blocks) of the volume cache. Used internally.
drVBMCSize
The size (in allocation blocks) of the volume bitmap cache.
Used internally.
drCtlCSize
The size (in allocation blocks) of the common volume cache.
Used internally.
drXTFlSize
The size (in allocation blocks) of the extents overflow file.
drXTExtRec
First extent record for the extents overflow file. An extent record is an array of three extents. See "Extents Overflow Files" on page 2-74 for a description of extents and extent records.
drCTFlSize
The size (in allocation blocks) of the catalog file.
drCTExtRec
First extent record for the catalog file.
Note
The values in the drNmAlBlks and drFreeBks fields should be interpreted as unsigned integers (that is, they can range from 0 to 65,535, not from -32,768 to 32,767). Pascal does not support unsigned data types, and so you need to use the technique illustrated in "Determining the Amount of Free Space on a Volume" on page 2-46 to read the values in these fields correctly.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996

Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice