// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // % Project : GUSI - Grand Unified Socket Interface // % File : GUSIFSWrappers.nw - Pseudo-synchronous file calls // % Author : Matthias Neeracher // % Language : C++ // % // % $Log$ // % Revision 1.8 2001/07/23 06:31:37 neeri // % Use PBXGetVolInfoSync to get correct block size for stat() (MacPerl Bug #424874) // % // % Revision 1.7 2001/01/17 08:45:49 neeri // % Make open calls synchronous // % // % Revision 1.6 2000/05/23 06:58:04 neeri // % Improve formatting // % // % Revision 1.5 2000/01/17 01:41:52 neeri // % Handle special cases in FSMoveRename // % // % Revision 1.4 1999/08/26 05:45:01 neeri // % Fixes for literate edition of source code // % // % Revision 1.3 1999/07/19 06:21:02 neeri // % Add mkdir/rmdir, fix various file manager related bugs // % // % Revision 1.2 1999/05/30 02:16:54 neeri // % Cleaner definition of GUSICatInfo // % // % Revision 1.1 1998/10/11 16:45:14 neeri // % Ready to release 2.0a2 // % // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // // \chapter{Pseudo-synchronous File System Calls} // // MacOS offers a wide variety of file system APIs, but the most convenient // of them--the [[FSpXXX]] calls only works synchronously. The routines defined // here offer a version of these calls, executed asynchronously and embedded // into the [[GUSIContext]] switching model. // // = #ifndef _GUSIFSWrappers_ #define _GUSIFSWrappers_ #ifdef GUSI_SOURCE #include #include #include "GUSIFileSpec.h" __BEGIN_DECLS // = OSErr GUSIFSOpenDriver(StringPtr name, short * refNum); // = OSErr GUSIFSGetFInfo(const FSSpec * spec, FInfo * info); OSErr GUSIFSSetFInfo(const FSSpec * spec, const FInfo * info); // = OSErr GUSIFSOpenDF(const FSSpec * spec, char permission, short * refNum); OSErr GUSIFSOpenRF(const FSSpec * spec, char permission, short * refNum); // = OSErr GUSIFSGetVolParms(short vRefNum, GetVolParmsInfoBuffer * volParms); // = OSErr GUSIFSCreate(const FSSpec * spec, OSType creator, OSType type, ScriptCode script); // = OSErr GUSIFSDelete(const FSSpec * spec); // = OSErr GUSIFSDirCreate(const FSSpec * spec); // = OSErr GUSIFSSetFLock(const FSSpec * spec); OSErr GUSIFSRstFLock(const FSSpec * spec); // = OSErr GUSIFSRename(const FSSpec * spec, ConstStr255Param newname); // = OSErr GUSIFSCatMove(const FSSpec * spec, const FSSpec * dest); // = OSErr GUSIFSMoveRename(const FSSpec * spec, const FSSpec * dest); __END_DECLS #ifdef __cplusplus // = OSErr GUSIFSGetCatInfo(GUSIIOPBWrapper * info); OSErr GUSIFSSetCatInfo(GUSIIOPBWrapper * info); // = OSErr GUSIFSGetFCBInfo(GUSIIOPBWrapper * fcb); // = OSErr GUSIFSGetVInfo(GUSIIOPBWrapper * pb); OSErr GUSIFSHGetVInfo(GUSIIOPBWrapper * pb); // According to Andreas Grosam, [[PBOpenAsync]] may cause the file not to be closed properly when the // process quits, so we call that call synchronously. // // = OSErr GUSIFSOpen(GUSIIOPBWrapper * pb); // = OSErr GUSIFSHGetFInfo(GUSIIOPBWrapper * pb); OSErr GUSIFSHSetFInfo(GUSIIOPBWrapper * pb); // = OSErr GUSIFSHGetVolParms(GUSIIOPBWrapper * pb); // = OSErr GUSIFSCreate(const FSSpec * spec); // = OSErr GUSIFSCatMove(const FSSpec * spec, long dest); // Getting the correct allocation block size can be sort of tricky. [[PBHGetVInfoAsync]] returns // a value tweaked to allow free space calculations on large volumes, so we have to walk the // fcb queue to get a legitimate value. // // = OSErr GUSIFSXGetVolInfo(GUSIIOPBWrapper * pb); #endif #endif /* GUSI_SOURCE */ #endif /* GUSIFSWrappers */