Previous Book Contents Book Index Next

Inside Macintosh: Files /
Chapter 2 - File Manager / File Manager Reference
Low-Level Volume Access Routines / Mounting and Unmounting Volumes


You can use the PBUnmountVol function to unmount a volume.

FUNCTION PBUnmountVol (paramBlock: ParmBlkPtr): OSErr;
A pointer to a basic File Manager parameter block.
<--ioResultOSErrThe result code of the function.
-->ioNamePtrStringPtrA pointer to a pathname.
-->ioVRefNumIntegerA volume reference number, a working directory reference number, or 0 for the default volume.

The PBUnmountVol function unmounts the specified volume. All user files on the volume must be closed. Then, PBUnmountVol calls PBFlushVol to flush the volume and releases the memory used for the volume.

The PBUnmountVol function always executes synchronously.

Don't unmount the startup volume. Doing so will cause a
system crash.
Unmounting a volume does not close working directories; to release the memory allocated to a working directory, call PBCloseWD.
The trap macro for PBUnmountVol is _UnmountVol.

noErr0No error
nsvErr-35No such volume
ioErr-36I/O error
bdNamErr-37Bad volume name
fBsyErr-47One or more files are open
paramErr-50No default volume
nsDrvErr-56No such drive
extFSErr-58External file system

Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996