home *** CD-ROM | disk | FTP | other *** search
- /*
- File: FileManagerSPI.h
-
- Contains: FileManager extended interface
-
- Version: Technology: System 8
- Release: Universal Interfaces 3.0d3 on Copland DR1
-
- Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
-
- Bugs?: If you find a problem with this file, send the file and version
- information (from above) and the problem description to:
-
- Internet: apple.bugs@applelink.apple.com
- AppleLink: APPLE.BUGS
-
- */
- #ifndef __FILEMANAGERSPI__
- #define __FILEMANAGERSPI__
-
- #ifndef __KERNEL__
- #include <Kernel.h>
- #endif
- #ifndef __FILEMANAGERTYPES__
- #include <FileManagerTypes.h>
- #endif
- #ifndef __FILES__
- #include <Files.h>
- #endif
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- #if PRAGMA_IMPORT_SUPPORTED
- #pragma import on
- #endif
-
- #if PRAGMA_ALIGN_SUPPORTED
- #pragma options align=power
- /* the following contents can only be used by compilers that support PowerPC struct alignment */
-
- /* You can use FileManager.h or FileManagerSPI.h, but not both */
- #ifndef __FILEMANAGER__
- #if FOR_SYSTEM8_PREEMPTIVE
- /*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> C O N T A I N E R S <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
- /*
- ****************************************************************************
- OBJECTS
- ****************************************************************************
- */
- /*
- Function: FSObjectRefClone
- Purpose: Return a copy of an FSObjectRef such that the copy also needs to be disposed.
- Inputs:
- object_t The object ref to be cloned.
- Outputs:
- clone_o Copy of object_t.
- Notes:
- The value returned is the same value passed as input in object_t. This call
- would typically be used to balance a future call to FSObjectRefDispose. Some
- examples where it might be used:
- • A called procedure needs to save an FSObjectRef for future use, but the
- calling conventions dictate that the caller is responsible for disposing
- of the ref. The called function could call FSObjectRefClone to make its
- copy. The caller can safely dispose of the ref, yet the callee can use
- the ref until doing its own dispose.
- • In object-oriented programming, an object could be passed an FSObjectRef
- in its constructor. The destructor would be expected to dispose the ref,
- but so would the routine that created the object. FSObjectRefClone could
- be used in the constructor.
-
- The returned FSObjectRef is registered to the calling process (as must object_t).
- */
- extern OSStatus FSObjectRefClone(FSObjectRef object_t, FSObjectRef *clone_o);
-
- extern OSStatus FSObjectRefCloneAsync(FSObjectRef object_t, const KernelNotification *completion_i, FSObjectRef *clone_o, MessageID *requestID_o);
-
- /*
- Function: FSObjectRefDispose
- Purpose: Dispose of an FSObjectRef previously returned to a process.
- Inputs:
- object_t The object ref to be disposed.
- Outputs:
- Notes:
- A process must dispose of all FSObjectRefs returned to it. The FSObjectRefs
- may be returned as explicit output parameters, or as properties. If a ref
- is returned several times for a given object, it must be disposed for each
- time it was returned.
-
- When all refs to a given object are disposed, the File Manager will dispose
- of any resources it allocated in order to operate on that object. All refs
- for a process will be automatically disposed upon process termination.
-
- For refs returned as properties (especially when iterating over muliple
- objects), the FSObjectRefDisposeBulk call may be more convenient.
- */
- extern OSStatus FSObjectRefDispose(FSObjectRef object_t);
-
- extern OSStatus FSObjectRefDisposeAsync(FSObjectRef object_t, const KernelNotification *completion_i, MessageID *requestID_o);
-
- /*
- Function: FSObjectRefDisposeBulk
- Purpose: Dispose of many FSObjectRefs, using a list of property descriptors.
- (Typically used to dispose all refs returned by FSObjectIterate).
- Inputs:
- objectCount_i Number of objects returned by FSObjectIterate.
- propertyCount_i Number of properties per object, as passed to FSObjectIterate.
- statusBuffer_i Status buffer as returned by FSObjectIterate.
- properties_i List of property descriptors passed to FSObjectIterate.
- propertiesBuffer_i Buffer where property values were returned by FSObjectIterate.
- Outputs:
- statusBuffer_o Error status for each property of each object.
- Notes:
- This call is intended to make it easy to dispose of FSObjectRefs returned by an
- FSObjectIterate call. You would pass the same property count, property descriptor
- list and property value buffer as was passed to FSObjectIterate. You also pass the
- object count and status buffer as returned by FSObjectIterate (since these tell which
- properties were actually returned).
-
- Any property in properties_i that does not contain an FSObjectRef is ignored. Any
- property that does not have E_NoError in its propertyStatus field (in statusBuffer_i)
- is ignored.
-
- All elements of statusBuffer_o will be set. If the property was ignored (as described
- above), then its propertyStatus is set to E_NoError; otherwise, it is set based on the
- attempt to dispose of the ref. The propertyValueActualSize fields are all set to 0.
-
- */
- extern OSStatus FSObjectRefDisposeBulk(ItemCount objectCount_i, ItemCount propertyCount_i, const FSBufferDescriptor *statusBuffer_i, const FSPropertyDescriptor properties_i[], const FSBufferDescriptor *propertiesBuffer_i, FSBufferDescriptor *statusBuffer_o);
-
- /**/
- extern OSStatus FSObjectRefDisposeBulkAsync(ItemCount objectCount_i, ItemCount propertyCount_i, const FSBufferDescriptor *statusBuffer_i, const FSPropertyDescriptor properties_i[], const FSBufferDescriptor *propertiesBuffer_i, const KernelNotification *completion_i, FSBufferDescriptor *statusBuffer_o, MessageID *requestID_o);
-
- /*
- Function: FSObjectRefRegister
- Purpose: Allow an FSObjectRef to be used by another process.
- Inputs:
- senderObject_t The object ref.
- receiverPid_i The other process that will be using senderObject_t.
- Outputs:
- Notes:
- This call allows one process to send an FSObjectRef to another process
- such that the other process can use the FSObjectRef itself. The process
- specified by receiverPid_i must also dispose of senderObject_t. The File
- Manager acts as if senderObject_t has been returned to receiverPid_i.
-
-
-
-
-
- You might use this call if you have several processes where one process
- (typically a server of some kind) obtains FSObjectRefs for use by other
- processes (typically clients of that server). If the other process (as
- specified by receiverPid_i) won't actually call the File Manager with
- that FSObjectRef, then it doesn't need to be registered to that process.
-
- It would also be possible to have the server process make all of the
- calls to the File Manager. FSObjectRefs could still be passed between
- client and server, but if the clients never use the refs directly, then
- there would be no need to register the refs to those clients. (But beware:
- the server would still be responsible for disposing of all refs returned to
- it; the server would probably have some cleanup and disposal to do if one
- of its client processes were to terminate.)
- */
- extern OSStatus FSObjectRefRegister(FSObjectRef senderObject_t, KernelProcessID receiverPid_i);
-
- extern OSStatus FSObjectRefRegisterAsync(FSObjectRef senderObject_t, KernelProcessID receiverPid_i, const KernelNotification *completion_i, MessageID *requestID_o);
-
- /*
- ============================================================================
- Volume Sets
- ============================================================================
- */
- /*
- Function: FSVolumeSetGetInformation
- Purpose: Returns an FSObjectRef for a Volume Set specified by an
- FSVolumeSetObjID.
- Inputs:
- volumeSet_t The volume set.
- Outputs:
- object_o Object ref for the volume set.
- includesBootVolume_o True if the volume set includes the boot volume.
- Notes:
- There is currently only one volume set. In the future there could be others
- (perhaps file servers; perhaps to support multiple local users).
- */
- extern OSStatus FSVolumeSetGetInformation(FSVolumeSetObjID volumeSet_t, Boolean *includesBootVolume_o, FSObjectRef *object_o);
-
- extern OSStatus FSVolumeSetGetInformationAsync(FSVolumeSetObjID volumeSet_t, const KernelNotification *completion_i, Boolean *includesBootVolume_o, FSObjectRef *object_o, MessageID *requestID_o);
-
- /*
- ============================================================================
- Volumes
- ============================================================================
- */
- /**/
- extern OSStatus FSVolumeGetInformation(FSVolumeObjID volume_t, FSObjectRef *object_o);
-
- extern OSStatus FSVolumeGetInformationAsync(FSVolumeObjID volume_t, const KernelNotification *completion_i, FSObjectRef *objectRef_o, MessageID *requestID_o);
-
- /* */
- extern OSStatus FSVolumeMount(ObjectID device_t, FSVolumeCapabilities requiredCapabilities_i, const FSMountAccessConstraints *constraints_i, FSObjectRef *volume_o);
-
- extern OSStatus FSVolumeMountAsync(ObjectID device_t, FSVolumeCapabilities requiredCapabilities_i, const FSMountAccessConstraints *constraints_i, const KernelNotification *completion_i, FSObjectRef *volume_o, MessageID *requestID_o);
-
- /* */
- extern OSStatus FSVolumeUnmount(FSObjectRef volume_t);
-
- extern OSStatus FSVolumeUnmountAsync(FSObjectRef volume_t, const KernelNotification *completion_i, MessageID *requestID_o);
-
- /*
- ============================================================================
- Folders
- ============================================================================
- */
- /* */
- extern OSStatus FSFolderCreateWithProperties(FSObjectRef container_t, ItemCount propertyCount_i, const FSPropertyDescriptor properties_i[], const FSBufferDescriptor *propertiesBuffer_i, FSBufferDescriptor *statusBuffer_o, FSObjectRef *folder_o);
-
- extern OSStatus FSFolderCreateWithPropertiesAsync(FSObjectRef container_t, ItemCount propertyCount_i, const FSPropertyDescriptor properties_i[], const FSBufferDescriptor *propertiesBuffer_i, const KernelNotification *completion_i, FSBufferDescriptor *statusBuffer_o, FSObjectRef *folder_o, MessageID *requestID_o);
-
- /*
- ============================================================================
- Files
- ============================================================================
- */
- /* */
- extern OSStatus FSFileCreateWithProperties(FSObjectRef container_t, ItemCount propertyCount_i, const FSPropertyDescriptor properties_i[], const FSBufferDescriptor *propertiesBuffer_i, FSBufferDescriptor *statusBuffer_o, FSObjectRef *file_o);
-
- extern OSStatus FSFileCreateWithPropertiesAsync(FSObjectRef container_t, ItemCount propertyCount_i, const FSPropertyDescriptor properties_i[], const FSBufferDescriptor *propertiesBuffer_i, const KernelNotification *completion_i, FSBufferDescriptor *statusBuffer_o, FSObjectRef *file_o, MessageID *requestID_o);
-
- /*
- ============================================================================
- Folder and File Requests
- ============================================================================
- */
- /**/
- extern OSStatus FSObjectCopy(FSObjectRef sourceObject_t, FSObjectRef container_i, ItemCount propertyCount_i, const FSPropertyDescriptor properties_i[], const FSBufferDescriptor *propertiesBuffer_i, FSBufferDescriptor *statusBuffer_o, FSObjectRef *newObject_o);
-
- extern OSStatus FSObjectCopyAsync(FSObjectRef sourceObject_t, FSObjectRef container_i, ItemCount propertyCount_i, const FSPropertyDescriptor properties_i[], const FSBufferDescriptor *propertiesBuffer_i, const KernelNotification *completion_i, FSBufferDescriptor *statusBuffer_o, FSObjectRef *newObject_o, MessageID *requestID_o);
-
- /*
- Function: FSObjectDelete
- Purpose: Deletes an object. The FSObjectRef is NOT disposed; you must still dispose it yourself.
- Further attempts to use the ref will return errors (such as E_ObjectNotFound).
-
- Inputs:
- object_t The object to be deleted.
- Outputs:
- */
- extern OSStatus FSObjectDelete(FSObjectRef object_t);
-
- extern OSStatus FSObjectDeleteAsync(FSObjectRef object_t, const KernelNotification *completion_i, MessageID *requestID_o);
-
- /**/
- extern OSStatus FSObjectMove(FSObjectRef sourceObject_t, FSObjectRef container_i, ItemCount propertyCount_i, const FSPropertyDescriptor properties_i[], const FSBufferDescriptor *propertiesBuffer_i, FSBufferDescriptor *statusBuffer_o);
-
- extern OSStatus FSObjectMoveAsync(FSObjectRef sourceObject_t, FSObjectRef container_i, ItemCount propertyCount_i, const FSPropertyDescriptor properties_i[], const FSBufferDescriptor *propertyValues_i, const KernelNotification *completion_i, FSBufferDescriptor *statusBuffer_o, MessageID *requestID_o);
-
- /*
- ****************************************************************************
- PROPERTIES
- ****************************************************************************
- */
- /*
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- Object Properties
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- */
- /**/
- extern OSStatus FSObjectCreateProperties(FSObjectRef object_t, ItemCount propertyCount_i, const FSPropertyDescriptor properties_i[], const FSBufferDescriptor *propertiesBuffer_i, FSBufferDescriptor *statusBuffer_o);
-
- extern OSStatus FSObjectCreatePropertiesAsync(FSObjectRef object_t, ItemCount propertyCount_i, const FSPropertyDescriptor properties_i[], const FSBufferDescriptor *propertiesBuffer_i, const KernelNotification *completion_i, FSBufferDescriptor *statusBuffer_o, MessageID *requestID_o);
-
- /**/
- extern OSStatus FSObjectDeleteProperties(FSObjectRef object_t, ItemCount propertyCount_i, const FSProperty properties_i[], FSBufferDescriptor *statusBuffer_o);
-
- extern OSStatus FSObjectDeletePropertiesAsync(FSObjectRef object_t, ItemCount propertyCount_i, const FSProperty properties_i[], const KernelNotification *completion_i, FSBufferDescriptor *statusBuffer_o, MessageID *requestID_o);
-
- /*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> C a p a b i l i t i e s <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
- /*
- ****************************************************************************
- PROPERTY ACCESS METHODS
- ****************************************************************************
- */
- /*
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- Object Property Simple Values
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- */
- /**/
- extern OSStatus FSObjectGetProperties(FSObjectRef object_t, ItemCount propertyCount_i, const FSPropertyDescriptor properties_i[], FSBufferDescriptor *propertiesBuffer_o, FSBufferDescriptor *statusBuffer_o);
-
- extern OSStatus FSObjectGetPropertiesAsync(FSObjectRef object_t, ItemCount propertyCount_i, const FSPropertyDescriptor properties_i[], const KernelNotification *completion_i, FSBufferDescriptor *propertiesBuffer_o, FSBufferDescriptor *statusBuffer_o, MessageID *requestID_o);
-
- /**/
- extern OSStatus FSObjectSetProperties(FSObjectRef object_t, ItemCount propertyCount_i, const FSPropertyDescriptor properties_i[], const FSBufferDescriptor *propertiesBuffer_i, FSBufferDescriptor *statusBuffer_o);
-
- extern OSStatus FSObjectSetPropertiesAsync(FSObjectRef object_t, ItemCount propertyCount_i, const FSPropertyDescriptor properties_i[], const FSBufferDescriptor *propertiesBuffer_i, const KernelNotification *completion_i, FSBufferDescriptor *statusBuffer_o, MessageID *requestID_o);
-
- /*
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- Object Property Fork Values
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- */
- /*
- ============================================================================
- Stream-based Access Method
- ============================================================================
- */
- /* */
- extern OSStatus FSStreamAllocate(FSStreamObjID stream_t, const FSForkPositionDescriptor *start_i, FSSize length_i, FSForkAllocationPolicy policy_i, FSSize *actualAllocation_o);
-
- extern OSStatus FSStreamAllocateAsync(FSStreamObjID stream_t, const FSForkPositionDescriptor *start_i, FSSize length_i, FSForkAllocationPolicy policy_i, const KernelNotification *completion_i, FSSize *actualAllocation_o, MessageID *requestID_o);
-
- /*
- Function: FSStreamClose
- Purpose: Close a stream previously opened with FSStreamOpen or FSStreamOpenWithConstraints.
- Inputs:
- stream_t The stream to close.
- Outputs:
- Notes:
- Any data written to the stream is flushed (written by the File Manager) before the
- stream is closed. The FSStreamObjID, stream_t, may no longer be used. Any resources
- allocated by the File Manager for use by this stream will be disposed.
- */
- extern OSStatus FSStreamClose(FSStreamObjID stream_t);
-
- extern OSStatus FSStreamCloseAsync(FSStreamObjID stream_t, const KernelNotification *completion_i, MessageID *requestID_o);
-
- /*
- Function: FSStreamFlush
- Purpose: Any data written to the stream will be written by the File Manager.
- Inputs:
- stream_t The stream to flush.
- Outputs:
- Notes:
- Stream data may still reside in the File Manager's caches, but any changes will have
- been written out by the File Manager. Note that the underlying device's driver, or
- the device itself, may cache some data, so the File Manager cannot guarantee that
- all data has actually been written to the underlying media.
-
- Other information about the object (such as its modification date) might not be flushed
- by this call, though any volume-level data needed to access the stream will be.
-
-
- */
- extern OSStatus FSStreamFlush(FSStreamObjID stream_t);
-
- extern OSStatus FSStreamFlushAsync(FSStreamObjID stream_t, const KernelNotification *completion_i, MessageID *requestID_o);
-
- /* */
- extern OSStatus FSStreamGetEOF(FSStreamObjID stream_t, FSOffset *currentEOF_o);
-
- extern OSStatus FSStreamGetEOFAsync(FSStreamObjID stream_t, const KernelNotification *completion_i, FSOffset *currentEOF_o, MessageID *requestID_o);
-
- /* */
- extern OSStatus FSStreamGetInformation(FSStreamObjID stream_t, FSObjectRef *object_o, FSProperty *fork_o, FSForkAccessConstraints *constraints_o);
-
- extern OSStatus FSStreamGetInformationAsync(FSStreamObjID stream_t, const KernelNotification *completion_i, FSObjectRef *object_o, FSProperty *fork_o, FSForkAccessConstraints *constraints_o, MessageID *requestID_o);
-
- /*
- Function: FSStreamGetMark
- Purpose: Returns the current mark (position offset) for a stream.
- Inputs:
- stream_t The stream.
- Outputs:
- currentMark_o Current offset in the stream, stream_t.
- Notes:
- This call returns the offset from the start of the file that would be
- equivalent to using a FSForkPositionDescriptor whose positionOffset is
- 0, and whose positionMode is kFSFromMark. A stream's mark is set to
- the byte following the last read or write, or via FSStreamSetMark.
- */
- extern OSStatus FSStreamGetMark(FSStreamObjID stream_t, FSOffset *currentMark_o);
-
- extern OSStatus FSStreamGetMarkAsync(FSStreamObjID stream_t, const KernelNotification *completion_i, FSOffset *currentMark_o, MessageID *requestID_o);
-
- /* */
- extern OSStatus FSStreamLockRange(FSStreamObjID stream_t, const FSForkPositionDescriptor *position_i, FSSize length_i, FSRangeLockOptions options_i, FSOffset *rangeStart_o, FSSize *actualLength_o);
-
- extern OSStatus FSStreamLockRangeAsync(FSStreamObjID stream_t, const FSForkPositionDescriptor *position_i, FSSize length_i, FSRangeLockOptions options_i, const KernelNotification *completion_i, FSOffset *rangeStart_o, FSSize *actualLength_o, MessageID *requestID_o);
-
- /* */
- extern OSStatus FSStreamOpenWithConstraints(FSObjectRef object_t, const FSProperty *fork_i, const FSForkAccessConstraints *constraints_i, FSStreamObjID *stream_o);
-
- extern OSStatus FSStreamOpenWithConstraintsAsync(FSObjectRef object_t, const FSProperty *fork_i, const FSForkAccessConstraints *constraints_i, const KernelNotification *completion_i, FSStreamObjID *stream_o, MessageID *requestID_o);
-
- /* */
- extern OSStatus FSStreamRead(FSStreamObjID stream_t, const FSForkPositionDescriptor *position_i, FSStreamIOOptions options_i, FSBufferDescriptor *buffer_o, ByteCount *actualLength_o, FSOffset *currentMark_o);
-
- extern OSStatus FSStreamReadAsync(FSStreamObjID stream_t, const FSForkPositionDescriptor *position_i, FSStreamIOOptions options_i, const KernelNotification *completion_i, FSBufferDescriptor *buffer_o, ByteCount *actualLength_o, FSOffset *currentMark_o, MessageID *requestID_o);
-
- /* */
- extern OSStatus FSStreamReleaseAllocation(FSStreamObjID stream_t, const FSForkPositionDescriptor *start_i, FSSize length_i, FSSize *actualLength_o);
-
- extern OSStatus FSStreamReleaseAllocationAsync(FSStreamObjID stream_t, const FSForkPositionDescriptor *start_i, FSSize length_i, const KernelNotification *completion_i, FSSize *actualLength_o, MessageID *requestID_o);
-
- /* */
- extern OSStatus FSStreamSetEOF(FSStreamObjID stream_t, const FSForkPositionDescriptor *EOF_i, FSForkAllocationPolicy policy_i, FSOffset *currentEOF_o);
-
- extern OSStatus FSStreamSetEOFAsync(FSStreamObjID stream_t, const FSForkPositionDescriptor *EOF_i, FSForkAllocationPolicy policy_i, const KernelNotification *completion_i, FSOffset *currentEOF_o, MessageID *requestID_o);
-
- /*
- Function: FSStreamSetMark
- Purpose: Sets the current mark (position offset) for a stream.
- Inputs:
- stream_t The stream.
- newPosition_i The new position of the stream's mark.
- options_i
- Outputs:
- originalMark_o The stream's mark, before being changed (relative
- to the start of the stream).
- currentMark_o The new mark, relative to the start of the stream.
- Notes:
- A stream's mark is usually used for sequential access to a stream,
- or to position relative to the ending position of the last operation
- on a stream. This call lets you explicitly set the mark for future
- operations that will operate relative to the current mark.
-
- If kFSMarkPinToEOF is set in options_i, and the new position specified
- by newPosition_i would exceed the current end of the stream (also known
- as End Of File or EOF), then the mark will be set to the EOF and E_NoError
- is returned. Otherwise, an error will returned. The mark may never be
- set past the end of the stream.
-
-
- */
- extern OSStatus FSStreamSetMark(FSStreamObjID stream_t, const FSForkPositionDescriptor *newPosition_i, FSStreamSetMarkOptions options_i, FSOffset *originalMark_o, FSOffset *currentMark_o);
-
- extern OSStatus FSStreamSetMarkAsync(FSStreamObjID stream_t, const FSForkPositionDescriptor *newPosition_i, FSStreamSetMarkOptions options_i, const KernelNotification *completion_i, FSOffset *originalMark_o, FSOffset *currentMark_o, MessageID *requestID_o);
-
- /* */
- extern OSStatus FSStreamUnlockRange(FSStreamObjID stream_t, const FSForkPositionDescriptor *position_i, FSSize length_i, FSRangeLockOptions options_i);
-
- extern OSStatus FSStreamUnlockRangeAsync(FSStreamObjID stream_t, const FSForkPositionDescriptor *position_i, FSSize length_i, FSRangeLockOptions options_i, const KernelNotification *completion_i, MessageID *requestID_o);
-
- /* */
- extern OSStatus FSStreamWrite(FSStreamObjID stream_t, const FSForkPositionDescriptor *position_i, FSStreamIOOptions options_i, const FSBufferDescriptor *buffer_i, ByteCount *actualLength_o, FSOffset *currentMark_o);
-
- extern OSStatus FSStreamWriteAsync(FSStreamObjID stream_t, const FSForkPositionDescriptor *position_i, FSStreamIOOptions options_i, const FSBufferDescriptor *buffer_i, const KernelNotification *completion_i, ByteCount *actualLength_o, FSOffset *currentMark_o, MessageID *requestID_o);
-
- /*
- ============================================================================
- Memory-mapped Access Method(Backing Store Requests)
- ============================================================================
- */
- /*
- Function: FSMappedFileClose
- Purpose: Closes an access path to a file used for backing store.
- Inputs:
- backingStore_t The backing store object.
- Outputs:
- Notes:
- Basically the same as FSStreamClose, but for a backing store.
-
- All data written to this backing store (by writing to pages backed by
- this store) will be flushed (written) by the File Manager.
- */
- extern OSStatus FSMappedFileClose(FSBackingStoreObjID backingStore_t);
-
- extern OSStatus FSMappedFileCloseAsync(FSBackingStoreObjID backingStore_t, const KernelNotification *completion_i, MessageID *requestID_o);
-
- /*
- Function: FSMappedFileGetEOF
- Purpose: Return the EOF (length) of the fork being accessed by the given backing store.
- Inputs:
- backingStore_t The backing store used to access the fork.
- Outputs:
- currentEOF_o The size, in bytes, of the fork.
- Notes:
- Since access to a fork via a backing store (i.e. memory mapped file access) is
- accomplished by directly accessing memory pages, the virtual memory system must
- read and write entire pages. If the last page is modified, the entire page is
- written, resulting in the fork size being rounded up to a multiple of a page size.
- Similarly for access to pages beyond the fork's EOF.
-
- This call returns the current EOF (length) of the underlying fork. This may be
- set implicitly by writing to backed pages, or by using the FSBackingStoreSetEOF
- call. It may also be changed by streams opened to the same fork.
- */
- extern OSStatus FSMappedFileGetEOF(FSBackingStoreObjID backingStore_t, FSOffset *currentEOF_o);
-
- extern OSStatus FSMappedFileGetEOFAsync(FSBackingStoreObjID backingStore_t, const KernelNotification *completion_i, FSOffset *currentEOF_o, MessageID *requestID_o);
-
- /* */
- extern OSStatus FSMappedFileGetInformation(FSBackingStoreObjID backingStore_t, FSObjectRef *object_o, FSProperty *fork_o, FSForkAccessConstraints *constraints_o);
-
- extern OSStatus FSMappedFileGetInformationAsync(FSBackingStoreObjID backingStore_t, const KernelNotification *completion_i, FSObjectRef *object_o, FSProperty *fork_o, FSForkAccessConstraints *constraints_o, MessageID *requestID_o);
-
- /*
- Function: FSMappedFileSetEOF
- Purpose: Sets the EOF (length) of the fork being accessed by the given backing store.
- Inputs:
- backingStore_t The backing store used to access the fork.
- EOF_i The new length (EOF) of the fork.
- policy_i Controls how space should be allocated (if the new EOF
- is larger than the current EOF).
- Outputs:
- currentEOF_o The new size, in bytes, of the fork.
- Notes:
- Since access to a fork via a backing store (i.e. memory mapped file access) is
- accomplished by directly accessing memory pages, the virtual memory system must
- read and write entire pages. If the last page is modified, the entire page is
- written, resulting in the fork size being rounded up to a multiple of a page size.
- Similarly for access to pages beyond the fork's EOF.
-
- This call allows the EOF to be explicitly set for a fork being accessed via a
- backing store. Any data beyond the EOF will not actually be written to the fork.
- The File Manager has no way to detect whether access to pages occurs beyond the
- EOF; it is a programming error to access bytes beyond the EOF via a backing store.
-
- This call would typically be used when a fork has been memory mapped to enable
- convenient access to a file's data structures as if it were completely in memory.
- You would make all changes to the data structures, then use this call to indicate
- the number of bytes that are valid and should be written to the fork.
- */
- extern OSStatus FSMappedFileSetEOF(FSBackingStoreObjID backingStore_t, const FSForkPositionDescriptor *EOF_i, FSForkAllocationPolicy policy_i, FSOffset *currentEOF_o);
-
- extern OSStatus FSMappedFileSetEOFAsync(FSBackingStoreObjID backingStore_t, const FSForkPositionDescriptor *EOF_i, FSForkAllocationPolicy policy_i, const KernelNotification *completion_i, FSOffset *currentEOF_o, MessageID *requestID_o);
-
- /* */
- extern OSStatus FSMappedFileOpenWithConstraints(FSObjectRef object_t, const FSProperty *fork_i, const FSForkAccessConstraints *constraints_i, FSBackingStoreObjID *backingStore_o);
-
- extern OSStatus FSMappedFileOpenWithConstraintsAsync(FSObjectRef object_t, const FSProperty *fork_i, const FSForkAccessConstraints *constraints_i, const KernelNotification *completion_i, FSBackingStoreObjID *backingStore_o, MessageID *requestID_o);
-
- /*
- ****************************************************************************
- NAVIGATION & ENUMERATION
- ****************************************************************************
- */
- /*
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- Object Iteration
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- */
- /**/
- extern OSStatus FSObjectIterate(FSObjectIteratorObjID iterator_t, ItemCount objectCount_i, ItemCount propertyCount_i, const FSPropertyDescriptor properties_i[], ItemCount *actualObjectCount_o, FSBufferDescriptor *propertiesBuffer_o, FSBufferDescriptor *statusBuffer_o);
-
- extern OSStatus FSObjectIterateAsync(FSObjectIteratorObjID iterator_t, ItemCount objectCount_i, ItemCount propertyCount_i, const FSPropertyDescriptor properties_i[], const KernelNotification *completion_i, ItemCount *actualObjectCount_o, FSBufferDescriptor *propertiesBuffer_o, FSBufferDescriptor *statusBuffer_o, MessageID *requestID_o);
-
- /*
- Function: FSObjectIteratorChangeCurrentScope
- Purpose: Move an object iterator into or out of a container.
- Inputs:
- iterator_t The object iterator.
- movement_i The direction to move: into or out of a container.
- Outputs:
- Notes:
- If movement_i is kFSObjectEnter, then the iterator must be positioned on
- an object that is capable of containing other objects; it does not need to
- actually contain any objects at that time. That object will become the new
- current scope of the iterator and it will be in Start Of Iteration state
- (meaning that all objects in the current scope have yet to be returned).
- The iterator will not be positioned on any object.
-
- If movement_i is kFSObjectExit, then the current scope will become the object
- that contains the current scope; the iterator's new position will be the object
- that was the current scope. If the current scope and the outermost scope were
- the same, then the outermost scope will also change to the new current scope and
- E_ExitIteratorScope is returned (so that you realize you will be iterating outside
- of the scope that you used to create the iterator; the iterator remains usable).
-
- Object iterators keep track of all of the objects between the outermost scope and
- the current scope (this is known as the "scope stack"). If any object in the scope
- stack is moved, the iterator is invalidated and will return the error
- E_IteratorScopeException until it has been explicitly fixed (by FSObjectIteratorRecreate)
- or disposed. This call adds or removes objects from the scope stack.
- */
- extern OSStatus FSObjectIteratorChangeCurrentScope(FSObjectIteratorObjID iterator_t, FSObjectIteratorMovement movement_i);
-
- extern OSStatus FSObjectIteratorChangeCurrentScopeAsync(FSObjectIteratorObjID iterator_t, FSObjectIteratorMovement movement_i, const KernelNotification *completion_i, MessageID *requestID_o);
-
- /**/
- extern OSStatus FSObjectIteratorClone(FSObjectIteratorObjID iterator_t, FSObjectIteratorObjID *clone_o);
-
- extern OSStatus FSObjectIteratorCloneAsync(FSObjectIteratorObjID iterator_t, const KernelNotification *completion_i, FSObjectIteratorObjID *clone_o, MessageID *requestID_o);
-
- /*
- Function: FSObjectIteratorCreate
- Purpose: Create an iterator for iterating over objects.
- Inputs:
- outermostScope_t The initial outermost scope and current scope.
- options_i Controls whether the iterator will traverse objects in
- a single container or all embedded (nested) containers.
- Also controls which kinds of objects will be returned.
- Outputs:
- iterator_o The object iterator.
- Notes:
- The outermost scope and current scope of the iterator are set to outermostScope_t.
- The iterator is not positioned on any object, though it is inside outermostScope_t.
- OutermostScope_t must be an object capable of containing other objects (such as the
- Universe, a volume set, a volume, or a folder). The iterator is put into "Start Of
- Iteration" state, meaning that all objects in the current scope have yet to be
- returned.
-
- The File Manager allocates resources and maintains state for every iterator. When
- you have finished using an iterator, you should call FSObjectIteratorDispose to dispose
- of it.
- */
- extern OSStatus FSObjectIteratorCreate(FSObjectRef outermostScope_t, FSObjectIteratorCreationOptions options_i, FSObjectIteratorObjID *iterator_o);
-
- extern OSStatus FSObjectIteratorCreateAsync(FSObjectRef outermostScope_t, FSObjectIteratorCreationOptions options_i, const KernelNotification *completion_i, FSObjectIteratorObjID *iterator_o, MessageID *requestID_o);
-
- /*
- Function: FSObjectIteratorDispose
- Purpose: Dispose of an object iterator.
- Inputs:
- iterator_t The object iterator.
- Outputs:
- Notes:
- The File Manager will dispose of the iterator and release any resources
- allocated to the iterator. Further attempts to use the iterator will result
- in an error.
-
-
- */
- extern OSStatus FSObjectIteratorDispose(FSObjectIteratorObjID iterator_t);
-
- extern OSStatus FSObjectIteratorDisposeAsync(FSObjectIteratorObjID iterator_t, const KernelNotification *completion_i, MessageID *requestID_o);
-
- /**/
- extern OSStatus FSObjectIteratorGetInformation(FSObjectIteratorObjID iterator_t, FSObjectRef *outermostScope_o, FSObjectRef *currentScope_o, FSObjectIteratorCreationOptions *options_o, FSObjectIteratorState *state_o);
-
- extern OSStatus FSObjectIteratorGetInformationAsync(FSObjectIteratorObjID iterator_t, const KernelNotification *completion_i, FSObjectRef *outermostScope_o, FSObjectRef *currentScope_o, FSObjectIteratorCreationOptions *options_o, FSObjectIteratorState *state_o, MessageID *requestID_o);
-
- /**/
- extern OSStatus FSObjectIteratorRecreate(FSObjectIteratorObjID iterator_t, FSObjectRef outermostScope_i, Boolean preserveCurrentOptions_i, FSObjectIteratorCreationOptions options_i);
-
- extern OSStatus FSObjectIteratorRecreateAsync(FSObjectIteratorObjID iterator_t, FSObjectRef outermostScope_i, Boolean preserveCurrentOptions_i, FSObjectIteratorCreationOptions options_i, const KernelNotification *completion_i, MessageID *requestID_o);
-
- /*
- Function: FSObjectIteratorRestart
- Purpose: Place an object iterator in the Start Of Iterator state, in its current scope.
- Inputs:
- iterator_t The object iterator.
- Outputs:
- Notes:
- The iterator is not positioned on any object. The iterator is put into "Start Of
- Iteration" state, meaning that all objects in the current scope have yet to be
- returned.
-
- You would use this call to completely restart iteration within the current scope,
- ignoring any state about objects previously returned in the current scope. The
- outermost scope is not affected. State information about which objects have been
- returned from scopes outside the current scope is unchanged.
- */
- extern OSStatus FSObjectIteratorRestart(FSObjectIteratorObjID iterator_t);
-
- extern OSStatus FSObjectIteratorRestartAsync(FSObjectIteratorObjID iterator_t, const KernelNotification *completion_i, MessageID *requestID_o);
-
- /*
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- Object Resolution
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- */
- /*
- Function: FSObjectExchange
- Purpose: Exchange the properties of two objects. Typically used for "safe
- saving", while maintaining an object's persistent reference.
- Inputs:
- object1_i One object.
- object2_i The object to exchange it with.
- Outputs:
- Notes:
- This call is used to allow a "safe save" that preserves an object's
- persistent reference. For example, you might want to save an updated
- set of properties to an object so that any errors while saving result
- in the object being unchanged; but, you also want the object's persistent
- reference to remain unchanged (so that things like aliases still work).
-
- What you would do is create a second object somewhere (in a temporary
- folder, for example). Write out all of the properties, both unchanged
- and changed, to the second object. When done saving, you would call
- FSObjectExchange with both objects; the contents of the two objects get
- swapped in such a way that the original object has the new properties,
- but retains its old persistent reference.
-
-
- */
- extern OSStatus FSObjectExchange(FSObjectRef object1_i, FSObjectRef object2_i);
-
- extern OSStatus FSObjectExchangeAsync(FSObjectRef object1_i, FSObjectRef object2_i, const KernelNotification *completion_i, MessageID *requestID_o);
-
- /*
- Function: FSObjectRefGetFSSpec
- Purpose: Return an FSSpec for an object (suitable for use with the Files API).
- Inputs:
- object_t The object.
- Outputs:
- fSSpec_o An FSSpec that specifies the same object as object_t,
- suitable for use with the Files API.
- Notes:
- This call is intended to be used by code that is required to use both the
- Files API and the FileManager API (or has clients that use both APIs).
- For example, a piece of code may already exist with an API that uses FSSpecs,
- but has been converted internally to use the FSObjectRefs; it would use this
- call to produce an FSSpec as an output for the pre-existing API.
-
- It would be best to provide an API that allows its clients to use FSObjectRefs.
- */
- extern OSStatus FSObjectRefGetFSSpec(FSObjectRef object_t, FSSpec *fSSpec_o);
-
- extern OSStatus FSObjectRefGetFSSpecAsync(FSObjectRef object_t, const KernelNotification *completion_i, FSSpec *fSSpec_o, MessageID *requestID_o);
-
- /**/
- extern OSStatus FSObjectLocate(FSObjectRef container_t, ItemCount elementCount_i, const FSObjectPathwayElement pathway_i[], const FSBufferDescriptor *pathwayPropertiesBuffer_i, FSObjectRef *object_o);
-
- extern OSStatus FSObjectLocateAsync(FSObjectRef container_t, ItemCount elementCount_i, const FSObjectPathwayElement pathway_i[], const FSBufferDescriptor *pathwayPropertiesBuffer_i, const KernelNotification *completion_i, FSObjectRef *object_o, MessageID *requestID_o);
-
- /**/
- extern OSStatus FSObjectPersistentReferenceResolve(FSVolumeObjID volume_t, const FSObjectPersistentReference *persistentReference_i, FSObjectRef *object_o);
-
- extern OSStatus FSObjectPersistentReferenceResolveAsync(FSVolumeObjID volume_t, const FSObjectPersistentReference *persistentReference_i, const KernelNotification *completion_i, FSObjectRef *object_o, MessageID *requestID_o);
-
- /* */
- extern OSStatus FSObjectRefResolve(FSObjectRef object_t, FSVolumeObjID *objectsVolume_o, FSVolumeSetObjID *objectsVolumeSet_o);
-
- extern OSStatus FSObjectRefResolveAsync(FSObjectRef object_t, const KernelNotification *completion_i, FSVolumeObjID *objectsVolume_o, FSVolumeSetObjID *objectsVolumeSet_o, MessageID *requestID_o);
-
- /*
- Function: FSSpecGetFSObjectRef
- Purpose: Return an FSObjectRef for an object specified via an FSSpec.
- Inputs:
- theFSSpec_t An FSSpec for the object.
- Outputs:
- theObject_o An FSObjectRef for the object.
- Notes:
- This call is intended to be used by code that is required to use both the
- Files API and the FileManager API (or has clients that use both APIs).
- For example, a piece of code may already exist with an API that uses FSSpecs,
- but has been converted internally to use the FSObjectRefs; it would use this
- call to take an input FSSpec and convert it to an FSObjectRef to use internally;
- the FSObjectRef would then be disposed before completing the call.
-
- It would be best to provide an API that allows its clients to use FSObjectRefs.
- */
- extern OSStatus FSSpecGetFSObjectRef(const FSSpec *theFSSpec_t, FSObjectRef *theObject_o);
-
- /* */
- extern OSStatus FSUniverseResolve(FSObjectRef *theUniverse_o);
-
- extern OSStatus FSUniverseResolveAsync(FSObjectRef *theUniverse_o, const KernelNotification *theCompletion_i, MessageID *theRequestID_o);
-
- /*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> F a c i l i t i e s <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
- /*
- ============================================================================
- Cache Flush Routines
- ============================================================================
- */
- /*
- Function: FSObjectFlush
- Purpose: Flushes any data cached by the File Manager for the given object.
- Inputs:
- object_t The object to be flushed.
- Outputs:
- Notes:
- If object_t is a file, then any data written to that file (via a stream or backing store,
- regardless of the process that opened the stream or backing store) will be written by the
- File Manager to any underlying device. If object_t is a volume, then any data written to
- any file on that volume will be flushed.
-
- Any change to properties of object_t will be flushed (regardless of the object's type).
-
- Data about the object (or contained in the object) may still reside in the File Manager's
- caches, but any changes will have been written out by the File Manager. Note that the
- underlying device's driver, or the device itself, may cache some data, so the File Manager
- cannot guarantee that all data has actually been written to the underlying media.
-
-
-
- */
- extern OSStatus FSObjectFlush(FSObjectRef object_t);
-
- extern OSStatus FSObjectFlushAsync(FSObjectRef object_t, const KernelNotification *completion_i, MessageID *requestID_o);
-
- /*
- ============================================================================
- Request Cancellation Routines
- ============================================================================
- */
- /* */
- extern OSStatus FSRequestCancel(MessageID theRequestID_i);
-
- #define FSObjectGetPropertyValues FSObjectGetProperties
- #define FSObjectSetPropertyValues FSObjectSetProperties
- #define FSBackingStoreClose FSMappedFileClose
- #define FSBackingStoreGetEOF FSMappedFileGetEOF
- #define FSBackingStoreGetInformation FSMappedFileGetInformation
- #define FSBackingStoreSetEOF FSMappedFileSetEOF
- #define FSBackingStoreOpenWithConstraints FSMappedFileOpenWithConstraints
- /*
- ============================================================================
- Object Property Sizes
- ============================================================================
- */
- /**/
- extern OSStatus FSObjectGetForkPropertyPhysicalSizes(FSObjectRef object_t, ItemCount propertyCount_i, const FSPropertyDescriptor properties_i[], FSBufferDescriptor *propertiesBuffer_o, FSBufferDescriptor *statusBuffer_o);
-
- /**/
- extern OSStatus FSObjectGetPropertySizes(FSObjectRef object_t, ItemCount propertyCount_i, const FSPropertyDescriptor properties_i[], FSBufferDescriptor *propertiesBuffer_o, FSBufferDescriptor *statusBuffer_o);
-
- #endif
- #endif
-
- #pragma options align=reset
- #endif /* PRAGMA_ALIGN_SUPPORTED */
-
- #if PRAGMA_IMPORT_SUPPORTED
- #pragma import off
- #endif
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif /* __FILEMANAGERSPI__ */
-
-