Documentation Archive Developer
Search

ADC Home > Reference Library > Technical Notes > Legacy Documents > Carbon >

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:

VCBs and Drive Numbers : The Real Story

CONTENTS

The top of page IV-178 in The File Manager chapter of Inside Macintosh in attempts to explain the behavior of two fields in a volume control block when the corresponding disk is offline or ejected. Due to the fact that a little bit is left unsaid, this paragraph is rather misleading. The two fields in question are vcbDrvNum and vcbDRefNum (referred to as ioVDrvInfo and ioVDRefNum in C and Pascal). PBHGetVInfo can be used to access these fields.

[Jan 01 1987]






Offline

When a mounted volume is placed offline, vcbDrvNum is cleared and vcbDRefNum is set to the two's complement of the drive number. Since drive numbers are assigned positive values (starting with one), this will be a negative number. If vcbDrvNum is zero and vcbDRefNum is negative, you know that the volume is offline.

Back to top

Ejected

When a volume is ejected, vcbDrvNum is cleared and vcbDRefNum is set to the positive drive number. If vcbDrvNum is zero and vcbDRefNum is positive, you know that the volume is ejected. Ejection implies being offline. There is no such thing as "premature ejection".

Back to top

Summary

online offline ejected

vcbDrvNum            >0 (DrvNum)        0            0
vcbDRefNum            <0 (DRefNum)        <0 (-DrvNum)        >0 (DrvNum)

Please refrain from assuming anything about a VCB queue element beyond what is documented in Inside Macintosh, and don't expect it to always be 178 bytes in size. It grew when we went from MFS to HFS, and it may grow again. It's safest to use calls like PBHGetVInfo to get the information that you need.

Back to top

References

The File Manager

Technical Note M.DV.DrvQEl -- Drive Queue Element Format

Back to top

Downloadables

Acrobat gif

Acrobat version of this Note (52K)

Download


Back to top