The Virtual File System (VFS) Manager is a layer of software that manages all installed file system libraries. It provides a unified API to application developers while allowing them to seamlessly access many different types of file systems —such as VFAT, HFS, and NFS—on many different types of media, including Compact Flash, Memory Stick, and SmartMedia.This chapter provides reference material for the VFS Manager API as follows:
- VFS Manager Data Structures
- VFS Manager Constants
- VFS Manager Functions
- Application-Defined Functions
The header file VFSMgr.h
declares the VFS Manager API. For more information on the VFS Manager, see Chapter 7, "Expansion," in Palm OS Programmer's Companion, vol. I.
Note that the VFS Manager is an optional system extension; the functions described in this chapter are implemented only if the VFS Manager Feature Set is present.
VFS Manager Data Structures
FileInfoType Struct
Purpose
The FileInfoType
structure contains information about a specified file or directory. This information is returned as a parameter to VFSDirEntryEnumerate()
. The structure is defined as follows:
Prototype
typedef struct FileInfoTag { UInt32 attributes; Char *nameP; UInt16 nameBufLen; } FileInfoType, *FileInfoPtr;
Fields
-
attributes
- Characteristics of the file or directory. See File and Directory Attributes for the bits that make up this field.
-
nameP
- Pointer to the buffer that receives the full name of the file or directory. Initialize this parameter to
NULL
if you don't want to receive the name. -
nameBufLen
- Size of the
nameP
buffer, in bytes.
FileRef Typedef
Purpose
The FileRef
type is used to encode references to files and directories.
Prototype
typedef UInt32 FileRef;
VFSAnyMountParamType Struct
Purpose
The VFSAnyMountParamType
structure is a base structure for VFSSlotMountParamType
, VFSPOSEMountParamType
, and other similar structures that may be defined in the future. Use one or the other according to how you set the mountClass
parameter.
Prototype
typedef struct VFSAnyMountParamTag { UInt16 volRefNum; UInt16 reserved; UInt32 mountClass; } VFSAnyMountParamType;
typedef VFSAnyMountParamType *VFSAnyMountParamPtr;
Fields
-
volRefNum
- The volume reference number. This is initially obtained when you successfully mount a volume. It can then be used to format a volume with
VFSVolumeFormat()
or unmount a volume withVFSVolumeUnmount
. -
reserved
- Reserved for future use.
-
mountClass
- Defines the type of mount to use with the specified volume. See Volume Mount Classes for a list of mount types.
VFSSlotMountParamType Struct
Purpose
The VFSSlotMountParamType
structure is used when you are mounting a card located in an Expansion Manager slot. The vfsMountParam->mountClass
field must be set to VFSMountClass_SlotDriver
.
Prototype
typedef struct VFSSlotMountParamTag { VFSAnyMountParamType vfsMountParam; UInt16 slotLibRefNum; UInt16 slotRefNum; } VFSSlotMountParamType;
Fields
-
vfsMountParam
- See the description of
VFSAnyMountParamType
for an explanation of the fields in this structure. SetvfsMountParam->mountClass
toVFSMountClass_SlotDriver
to mount an Expansion Manager slot. -
slotLibRefNum
- Reference number for the slot driver library allocated to the given slot number. Obtain this field by calling
ExpSlotLibFind()
. -
slotRefNum
- Number of the slot to be mounted.
VFSPOSEMountParamType Struct
Purpose
The VFSPOSEMountParamType
structure is used when you are mounting a volume through the Palm OS® Emulator. The vfsMountParam->mountClass
must be set to VFSMountClass_POSE
. Note that ordinary applications and file systems shouldn't use VFSPOSEMountParamType
.
Prototype
typedef struct VFSPOSEMountParamTag { VFSAnyMountParamType vfsMountParam; UInt8 poseSlotNum; } VFSPOSEMountParamType;
Fields
-
vfsMountParam
- See the description of
VFSAnyMountParamType
for an explanation of the fields in this structure. SetvfsMountParam->mountClass
toVFSMountClass_POSE
to mount a virtual slot. -
poseSlotNum
- Number of the virtual slot number to be mounted by the Palm OS Emulator.
VolumeInfoType Struct
Purpose
The VolumeInfoType
structure defines information that is returned to VFSVolumeInfo()
and used throughout the VFS functions.
Prototype
typedef struct VolumeInfoTag { UInt32 attributes; UInt32 fsType; UInt32 fsCreator; UInt32 mountClass; UInt16 slotLibRefNum; UInt16 slotRefNum; UInt32 mediaType; UInt32 reserved; } VolumeInfoType, *VolumeInfoPtr;
Fields
-
attributes
- Characteristics of the volume. See Volume Attributes for the bits that make up this field.
-
fsType
- File system type for this volume. See Defined File Systems for a list of the supported file systems.
-
fsCreator
- Creator ID of this volume's file system driver. This information is used with
VFSCustomControl()
. -
mountClass
- Mount class that mounted this volume. The supported mount classes are listed under Volume Mount Classes.
-
slotLibRefNum
- Reference to the slot driver library with which the volume is mounted. This field is only valid when the mount class is
vfsMountClass_SlotDriver
. -
slotRefNum
- Slot number where the card containing the volume is loaded. This field is only valid when the mount class is
vfsMountClass_SlotDriver
. -
mediaType
- Type of card media. See Defined Media Types in the Expansion Manager chapter for the list of values. This field is only valid when the mount class is
vfsMountClass_SlotDriver
. -
reserved
- Reserved for future use.
VFS Manager Constants
Defined File Systems
The following file systems are currently defined by the VFS Manager. These values are used with VFSVolumeInfo()
in the VolumeInfoType.fsType parameter.
Open Mode Constants
This section describes constants that are used for the openMode
parameter to the VFSFileOpen()
function. These constants specify the mode in which a file or directory is opened.
File and Directory Attributes
The constants in the following table define bits that can be used individually or in combination when setting or interpreting the file attributes for a given file or directory. See VFSFileGetAttributes()
, VFSFileSetAttributes()
, and the FileInfoType data structure for specific use.
Volume Attributes
The constants in the following table define bits that can be used individually or in combination to make up the attributes field in the VolumeInfoType
structure.
Volume Mount Classes
The following constants define how a given volume is mounted. The mountClass
field in the VFSAnyMountParamType
and VolumeInfoType
structures takes on one of these values.
Mount the volume through the Palm OS Emulator. This is used for testing. |
||
Mount the volume through the simulator. This is used for testing. |
||
Error Codes
The VFS Manager defines the following error codes:
The operation could not be completed because of invalid data. |
|
Returned when the path leading up to the file does not exist. |
|
The file reference is invalid: it has been closed or was not obtained from |
|
Returned from the underlying file system's delete function if the file is still open. |
|
This operation can only be performed on a regular file, not a directory. |
|
A volume name or filename was automatically shortened to conform to the file system specification. |
|
Returned from the underlying file system's format function if the volume is still mounted. |
VFS Manager Functions
VFSCustomControl Function
Purpose
Make a custom API call to a particular file system, given its creator ID. You can use VFSVolumeInfo()
to determine the creator ID of the file system for a given volume.
Declared In
VfsMgr.h
Prototype
Err VFSCustomControl( UInt32 fsCreator, UInt32 apiCreator, UInt16 apiSelector, void *valueP, UInt16 *valueLenP )
Parameters
-
→
fsCreator
- Creator of the file system to call. A value of zero (0) tells the VFS Manager to check each registered file system, looking for one which supports the call.
-
→
apiCreator
- Registered creator ID.
-
→
apiSelector
- Custom operation to perform.
-
↔
valueP
- A pointer to a buffer containing data specific to the operation. On exit, depending on the function of the particular custom call and on the value of
valueLenP
, the contents of this buffer may have been updated. -
↔
valueLenP
- On entry, points to the size of the
valueP
buffer. On exit, this value reflects the size of the data written to thevalueP
buffer. IfvalueLenP
isNULL
,valueP
is passed to the file system but is not updated on exit.
Returns
Returns one of the following error codes:
-
errNone
- No error.
-
expErrNotOpen
- The file system library necessary for this call has not been installed or has not been opened.
-
expErrUnsupportedOperation
- The specified opcode and/or creator is unsupported or undefined.
-
sysErrParamErr
- The
valueP
buffer is too small. -
vfsErrNoFileSystem
- VFS Manager cannot find an appropriate file system to handle the request.
Comments
The driver identifies the call and its API by a registered creator ID and a selector. This allows file system developers to extend the API by defining selectors for their creator IDs. It also allows file system developers to support selectors (and custom calls) defined by other file system developers.
This function must return expErrUnsupportedOperation
for all unsupported or undefined opcodes and/or creators.
Compatibility
Implemented only if the VFS Manager Feature Set is present.
VFSDirCreate Function
Purpose
Declared In
VfsMgr.h
Prototype
Err VFSDirCreate( UInt16 volRefNum, const Char *dirNameP )
Parameters
-
→
volRefNum
- Volume reference number returned from
VFSVolumeEnumerate()
. -
→
dirNameP
- Pointer to the full path of the directory to be created.
Returns
Returns one of the following error codes:
-
errNone
- No error
-
expErrNotOpen
- The file system library necessary for this call has not been installed or has not been opened.
-
vfsErrBadName
- Some or all of the path, up to but not including the last component specified in the
dirNameP
parameter, does not exist. -
vfsErrFileAlreadyExists
- A file with this name already exists in this location.
-
vfsErrNoFileSystem
- The VFS Manager cannot find an appropriate file system to handle the request.
-
vfsErrVolumeBadRef
- The volume has not been mounted.
-
vfsErrVolumeFull
- There is not enough space left on the volume.
Comments
All parts of the path except the last component must already exist. The vfsFileAttrDirectory
attribute is set with this function.
VFSDirCreate()
does not open the directory. Any operations you want to perform on this directory require a reference, which is obtained through a call to VFSFileOpen()
.
Compatibility
Implemented only if the VFS Manager Feature Set is present.
VFSDirEntryEnumerate Function
Purpose
Enumerate the entries in a given directory. Entries can include files, links, and other directories.
Declared In
VfsMgr.h
Prototype
Err VFSDirEntryEnumerate ( FileRef dirRef, UInt32 *dirEntryIteratorP, FileInfoType *infoP )
Parameters
-
→
dirRef
- Directory reference returned from
VFSFileOpen()
. -
↔
dirEntryIteratorP
- Pointer to the index of the last entry enumerated. For the first iteration, initialize this parameter to the constant
vfsIteratorStart
. Upon return, this references the next entry in the directory. IfinfoP
is the last entry, this parameter is set tovfsIteratorStop
. -
↔
infoP
- Pointer to the
FileInfoType
data structure that contains information about the given directory entry. ThenameP
andnameBufLen
fields in this structure must be initialized prior to callingVFSDirEntryEnumerate
.
Returns
Returns one of the following error codes:
-
errNone
- No error.
-
expErrEnumerationEmpty
- There are no directory entries left to enumerate.
-
expErrNotOpen
- The file system library necessary for this call has not been installed or has not been opened.
-
sysErrParamErr
- The
dirEntryIteratorP
is not valid. -
vfsErrFileBadRef
- The specified file reference is invalid.
-
vfsErrIsNotADirectory
- The specified file reference is valid, but does not point to a directory.
-
vfsErrNoFileSystem
- The VFS Manager cannot find an appropriate file system to handle the request.
Comments
The directory to be enumerated must first be opened with VFSFileOpen()
in order to obtain a file reference. In order to obtain information on all entries in a directory you must make repeated calls to VFSDirEntryEnumerate
inside a loop. Boundaries on the iteration are the defined constants vfsIteratorStart
and vfsIteratorStop
. Before the first call to VFSDirEntryEnumerate
, dirEntryIteratorP
should be initialized to vfsIteratorStart
. Each iteration then changes the value pointed to by dirEntryIteratorP
. When information on the last entry in the directory is returned, dirEntryIteratorP
is set to vfsIteratorStop
.
WARNING! Creating, renaming, or deleting any file or directory invalidates the enumeration. After any such operation, the enumeration will need to be restarted.
Example
The following code excerpt illustrates how to use VFSDirEntryEnumerate
.
FileInfoType info; FileRef dirRef; UInt32 dirIterator; Char *fileName = MemPtrNew(256); // should check for err // open the directory first, to get the directory reference // volRefNum must have already been defined err = VFSFileOpen(volRefNum, "/", vfsModeRead, &dirRef); if(err == errNone) { info.nameP = fileName; // point to local buffer info.nameBufLen = 256; dirIterator = vfsIteratorStart while (dirIterator != vfsIteratorStop) { // Get the next file err = VFSDirEntryEnumerate (dirRef, &dirIterator, &info); if (err == errNone) { // Do something with the directory entry information // Pull the attributes from info.attributes // The file name is in fileName } else { // handle error, possibly by breaking out of the loop } } else { // handle directory open error here } MemPtrFree(fileName); }
Compatibility
Implemented only if the VFS Manager Feature Set is present.
VFSExportDatabaseToFile Function
Purpose
Save the specified database to a .pdb
or .prc
file on an external storage card.
Declared In
VfsMgr.h
Prototype
Err VFSExportDatabaseToFile ( UInt16 volRefNum, const Char *pathNameP, UInt16 cardNo, LocalID dbID )
Parameters
-
→
volRefNum
- Volume on which the destination file should be created.
-
→
pathNameP
- Pointer to the complete path and name of the destination file to be created.
-
→
cardNo
- Card number on which the
.pdb
or.prc
being exported resides. -
→
dbID
- ID of the database being exported.
Returns
Returns one of the following error codes:
-
errNone
- No error
-
expErrNotEnoughPower
- There is insufficient battery power to perform the database export operation.
-
vfsErrBadName
- The path name specified in
pathNameP
is not valid.
Comments
This utility function exports a database from main memory to a .pdb
or .prc
file on an external storage card. This function is the opposite of VFSImportDatabaseFromFile()
. It first creates the file specified in the pathNameP
parameter with VFSFileCreate()
. After opening the file the Exchange Manager function ExgDBWrite()
is called with an internal callback function for exporting the file from the Data Manager. The Exchange Manager makes repeated calls to this callback function, which receives the data back in blocks. Once all the data has been exported, VFS Manager closes the file.
This function is used, for example, to copy applications from main memory to a storage card.
Compatibility
Implemented only if the VFS Manager Feature Set is present.
See Also
VFSExportDatabaseToFileCustom()
, VFSFileWrite()
, VFSImportDatabaseFromFile()
VFSExportDatabaseToFileCustom Function
Purpose
Saves the specified database to a .pdb
or .prc
file on an external storage card. This function differs from VFSExportDatabaseToFile()
in that it allows you to track the progress of the export operation.
Declared In
VfsMgr.h
Prototype
Err VFSExportDatabaseToFileCustom( UInt16 volRefNum, const Char *pathNameP, UInt16 cardNo, LocalID dbID, VFSExportProcPtr exportProcP, void *userDataP )
Parameters
-
→
volRefNum
- Volume on which the destination file should be created.
-
→
pathNameP
- Pointer to the complete path and name of the destination file to be created.
-
→
cardNo
- Card number on which the
.pdb
or.prc
being exported resides. -
→
dbID
- ID of the database being exported.
-
→
exportProcP
- User-defined callback function that tracks the progress of the export. This function should allow the user to cancel the export. Pass
NULL
if you don't have a progress callback function. SeeVFSExportProcPtr()
for the requirements of this function. -
→
userDataP
- Pointer to any data you want to pass to the callback function specified in
exportProcP
. This information is not used internally by the VFS Manager. PassNULL
if you don't have a progress callback function or if that function doesn't need any such data.
Returns
Returns one of the following error codes:
-
errNone
- No error.
-
expErrNotEnoughPower
- There is insufficient battery power to perform the database export operation.
-
vfsErrBadName
- The path name specified in
pathNameP
is not valid.
This function can also return any error code other than errNone
produced by your callback function.
Comments
This function is similar to VFSExportDatabaseToFile()
in that it exports a database from main memory to a .pdb
or .prc
file on an external storage card. It extends the functionality by allowing you to specify a callback function that tracks the progress of the export. It first creates the file specified in the pathNameP
parameter with VFSFileCreate()
. After opening the file, the Exchange Manager function ExgDBWrite()
is called with an internal callback function for exporting the file from the Data Manager. Exchange Manager makes repeated calls to this function, which receives the data back in blocks. The progress tracker, if one has been specified, is also called every time a new chunk of data is passed back. Once all the data has been exported, the VFS Manager closes the file.
This function is used, for example, to copy applications from main memory to a storage card.
Compatibility
Implemented only if the VFS Manager Feature Set is present.
See Also
VFSExportDatabaseToFile()
, VFSFileWrite()
, VFSImportDatabaseFromFileCustom()
VFSFileClose Function
Purpose
Closes a file or directory that has been opened with VFSFileOpen()
.
Declared In
VfsMgr.h
Prototype
Err VFSFileClose ( FileRef fileRef )
Parameters
-
→
fileRef
- File reference number returned from
VFSFileOpen()
.
Returns
Returns one of the following error codes:
-
errNone
- No error.
-
expErrNotOpen
- The file system library necessary for this call has not been installed or has not been opened.
-
vfsErrFileBadRef
- The specified file reference is invalid.
Compatibility
Implemented only if the VFS Manager Feature Set is present.
VFSFileCreate Function
Purpose
Create a file. This function cannot be used to create a directory; use VFSDirCreate()
instead.
Declared In
VfsMgr.h
Prototype
Err VFSFileCreate( UInt16 volRefNum, const Char *pathNameP )
Parameters
-
→
volRefNum
- Reference number of the volume on which to create the file. This volume reference number is returned from
VFSVolumeEnumerate()
. -
→
pathNameP
- Pointer to the full path of the file to be created. All parts of the path, excluding the filename, must already exist.
Returns
Returns one of the following error codes:
-
errNone
- No error.
-
expErrNotOpen
- The file system library necessary for this call has not been installed or has not been opened.
-
vfsErrBadName
- The
pathNameP
is invalid. -
vfsErrFileAlreadyExists
- A file with this name already exists in this location.
-
vfsErrNoFileSystem
- The VFS Manager cannot find an appropriate file system to handle the request.
-
vfsErrVolumeBadRef
- The volume has not been mounted.
-
vfsErrVolumeFull
- There is not enough space left on the volume.
Comments
It is the responsibility of the file system library to ensure that all filenames are translated into a format that is compatible with the native format of the file system, such as the 8.3 convention for a FAT file system without long filename support. See Naming Files in the Expansion chapter of the Palm OS Programmer's Companion, vol. I for a description of how to construct a valid path.
This function does not open the file. Use VFSFileOpen()
to open the file.
This function should not be used to create a directory. To create a directory use VFSDirCreate()
.
Compatibility
Implemented only if the VFS Manager Feature Set is present.
See Also
VFSFileDBGetRecord Function
Purpose
Load a record from an opened .pdb
file on an external card into the storage heap.
Declared In
VfsMgr.h
Prototype
Err VFSFileDBGetRecord ( FileRef ref, UInt16 recIndex, MemHandle *recHP, UInt8 *recAttrP, UInt32 *uniqueIDP )
Parameters
-
→
ref
- The file reference returned from
VFSFileOpen()
. Note that the open file must be a.pdb
file. -
→
recIndex
- The index of the record to load.
-
←
recHP
- Pointer to the record data's handle in the storage heap. If
NULL
is returned in this parameter there is either no data in this field or an error occurred reading this data from the file. If the handle is notNULL
, you must dispose of the allocated handle usingMemHandleFree()
. -
←
recAttrP
- Pointer to the attributes of the record. The values returned are identical to the atttributes returned from
DmRecordInfo()
. See Record Attribute Constants in the Data and Resource Manager chapter for a description of each attribute. PassNULL
for this parameter if you do not want to retrieve this information. -
←
uniqueIDP
- Pointer to the unique identifier for this record. Pass
NULL
for this parameter if you do not want to retrieve this information.
Returns
Returns one of the following error codes:
-
errNone
- No error.
-
dmErrIndexOutOfRange
- The
recIndex
is out of range. -
dmErrNotRecordDB
- The file referenced by
ref
is not a record database. -
memErrNotEnoughSpace
- There is not enough space in memory for the requested record entry.
-
sysErrParamErr
- A
NULL
value was passed in for therecHP
,recAttrP
, anduniqueIDP
parameters. -
vfsErrBadData
- The local offsets (
localChunkID
) from the top of the.pdb
to the start of the raw record data for this entry are out of order.
Comments
This function is analogous to DmGetRecord()
but works with files on an external card rather than databases in main memory. This function allocates a handle of the appropriate size from the storage heap and returns it in the recHP
parameter. The caller is responsible for freeing this memory, using MemHandleFree()
, when it is no longer needed.
Compatibility
Implemented only if the VFS Manager Feature Set is present.
See Also
VFSFileDBGetResource Function
Purpose
Load a resource into the storage heap from an opened .prc
file.
Declared In
VfsMgr.h
Prototype
Err VFSFileDBGetResource ( FileRef ref, DmResType type, DmResID resID, MemHandle *resHP )
Parameters
-
→
ref
- The file reference returned from
VFSFileOpen()
. Note that the open file must be a.prc
file. -
→
type
- The type of resource to load. See the Data and Resource Manager chapter for more information on resources.
-
→
resID
- The ID of resource to load.
-
←
resHP
- Pointer to the resource data handle that was loaded into memory.
Returns
Returns one of the following error codes:
-
errNone
- No error.
-
dmErrNotResourceDB
- The file referenced by
ref
is not a resource database. -
dmErrResourceNotFound
- The requested resource was not found.
-
memErrNotEnoughSpace
- There is not enough space in memory for the requested resource entries.
-
sysErrParamErr
-
resHP
isNULL
.
Comments
This function locates the specified resource in the open .prc
file. See the Palm OS File Format Specification for more information on the layout of .prc
files.
Once the resource is found, VFSFileDBGetResource
allocates a handle of the appropriate size in the storage heap and reads it into memory. The handle to this memory location is returned through the resHP
parameter. The caller is responsible for freeing this memory, using MemHandleFree()
, when it is no longer needed.
Compatibility
Implemented only if the VFS Manager Feature Set is present.
VFSFileDBInfo Function
Purpose
Get information about a database represented by an open .prc
or .pdb
file.
Declared In
VfsMgr.h
Prototype
Err VFSFileDBInfo ( FileRef ref, Char *nameP, UInt16 *attributesP, UInt16 *versionP, UInt32 *crDateP, UInt32 *modDateP, UInt32 *bckUpDateP, UInt32 *modNumP, MemHandle *appInfoHP, MemHandle *sortInfoHP, UInt32 *typeP, UInt32 *creatorP, UInt16 *numRecordsP )
Parameters
-
→
ref
- The file reference returned from
VFSFileOpen()
. Note that the open file must be a.prc
or.pdb
file. -
←
nameP
- Pointer to a 32-byte character array in which the database name is returned. Pass
NULL
for this parameter if you do not want to retrieve the database name. -
←
attributesP
- Pointer to the database attributes stored in the file. The values returned are identical to the atttributes returned from
DmDatabaseInfo()
. See the Database Attribute Constants section for a description of each attribute. PassNULL
for this parameter if you do not want to retrieve the database's attributes. -
←
versionP
- Pointer to the application-specific version number of the database. The default version number is zero (0). Pass
NULL
for this parameter if you do not want to retrieve the version number. -
←
crDateP
- Pointer to the date the database was created, expressed in seconds since midnight (00:00:00) January 1, 1904. Pass
NULL
for this parameter if you do not want to retrieve the creation date. -
←
modDateP
- Pointer to the date the database was last modified, expressed in seconds since midnight (00:00:00) January 1, 1904. A database's modification date is updated only if a change has been made to the database when it is opened with write access. Pass
NULL
for this parameter if you do not want to retrieve the database's modification date. -
←
bckUpDateP
- Pointer to the date the database was last backed up, expressed in seconds since midnight (00:00:00) January 1, 1904. Pass
NULL
for this parameter if you do not want to retrieve the database's backup date. -
←
modNumP
- Pointer to the number of times the database was modified. This number is updated every time a record is added, modified, or deleted. Pass
NULL
for this parameter if you do not want to retrieve the modification count. -
←
appInfoHP
- Pointer to the application info block handle. If
NULL
is returned in this parameter, either there is no data in this field or an error occurred reading this data from the file. If a value other thanNULL
is returned, you must dispose of the allocated handle usingMemHandleFree()
. If you do not want to retrieve the application info block, passNULL
for this parameter -
←
sortInfoHP
- Pointer to the sort info block handle. If
NULL
is returned in this parameter, either there is no data in this field or an error occurred reading this data from the file. If a value other thanNULL
is returned, you must dispose of the allocated handle usingMemHandleFree()
. PassNULL
for this parameter if you do not want to retrieve the sort info block handle. -
←
typeP
- Pointer to the type of database as it was created. This may be a user-defined database type or a database type defined by the Palm OS. Some of the more common database types returned here are:
- Pass
NULL
for this parameter if you do not want to retrieve the database's type. -
←
creatorP
- Pointer to the database's creator. Pass NULL for this parameter if you do not want to retrieve this information.
-
←
numRecordsP
- Pointer to the number of records in the database. Pass
NULL
for this parameter if you do not want to retrieve this information.
Returns
Returns one of the following error codes:
-
errNone
- No error
-
memErrNotEnoughSpace
- There is not enough space in memory for the database header.
-
vfsErrBadData
- The file referenced by the
ref
parameter is too small to contain a database header, or the database header is corrupted.
Comments
This function is analogous to DmDatabaseInfo()
, but it works with files on an external card rather than with databases in main memory. See the Palm OS File Format Specification for a description of the header block in .prc
and .pdb
files.
Compatibility
Implemented only if the VFS Manager Feature Set is present.
See Also
VFSFileGetAttributes()
, VFSFileGetDate()
VFSFileDelete Function
Purpose
Deletes a closed file or directory.
Declared In
VfsMgr.h
Prototype
Err VFSFileDelete( UInt16 volRefNum, const Char *pathNameP )
Parameters
-
→
volRefNum
- Volume reference number returned from
VFSVolumeEnumerate()
. -
→
pathNameP
- Pointer to the full path of the file or directory to be deleted.
Returns
Returns one of the following error codes:
-
errNone
- No error.
-
expErrNotOpen
- The file system library necessary for this call has not been installed or has not been opened.
-
vfsErrBadName
- The path name specified in
pathNameP
is not valid. -
vfsErrDirNotEmpty
- The directory being deleted is not empty.
-
vfsErrFileStillOpen
- The file is still open.
-
vfsErrFileNotFound
- The file could not be found.
-
vfsErrFilePermissionDenied
- The requested permissions could not be granted.
-
vfsErrNoFileSystem
- The VFS Manager cannot find an appropriate file system to handle the request.
-
vfsErrVolumeBadRef
- The volume has not been mounted.
Compatibility
Implemented only if the VFS Manager Feature Set is present.
VFSFileEOF Function
Purpose
Get end-of-file status for an open file. This function only operates on files and cannot be used with directories.
Declared In
VfsMgr.h
Prototype
Err VFSFileEOF ( FileRef fileRef )
Parameters
-
→
fileRef
- File reference returned from
VFSFileOpen()
.
Returns
Returns one of the following error codes:
-
errNone
- No error. File pointer is not at end of the file.
-
vfsErrFileEOF
- The file pointer is at the end of file.
-
expErrNotOpen
- The file system library necessary for this call has not been installed or has not been opened.
-
vfsErrFileBadRef
- The specified file reference is invalid.
-
vfsErrIsADirectory
- The specified file reference points to a directory instead of a file. This is an invalid operation on a directory.
-
vfsErrNoFileSystem
- The VFS Manager cannot find an appropriate file system to handle the request.
Compatibility
Implemented only if the VFS Manager Feature Set is present.
VFSFileGetAttributes Function
Purpose
Obtain the attributes of an open file or directory.
Declared In
VfsMgr.h
Prototype
Err VFSFileGetAttributes ( FileRef fileRef, UInt32 *attributesP )
Parameters
-
→
fileRef
- File reference returned from
VFSFileOpen()
. -
←
attributesP
- Pointer to the attributes associated with the file or directory. See File and Directory Attributes for a list of values that can be returned through this parameter.
Returns
Returns one of the following error codes:
-
errNone
- No error
-
expErrNotOpen
- The file system library necessary for this call has not been installed or has not been opened.
-
vfsErrFileBadRef
- The specified file reference is invalid.
-
vfsErrNoFileSystem
- The VFS Manager cannot find an appropriate file system to handle the request.
Compatibility
Implemented only if the VFS Manager Feature Set is present.
See Also
VFSFileDBInfo()
, VFSFileGetDate()
, VFSFileSetAttributes()
VFSFileGetDate Function
Purpose
Obtain the dates on an open file or directory.
Declared In
VfsMgr.h
Prototype
Err VFSFileGetDate ( FileRef fileRef, UInt16 whichDate, UInt32 *dateP )
Parameters
-
→
fileRef
- File reference returned from
VFSFileOpen()
. -
→
whichDate
- Specifies which date—creation, modification, or last access—you want. Supply one of the following values:
-
vfsFileDateCreated
-
vfsFileDateModified
-
vfsFileDateAccessed
- Note that not all file systems are required to support the above dates. If the supplied date type is not supported by the file system,
VFSFileGetDate
returnsexpErrUnsupportedOperation
. -
←
dateP
- Pointer to the requested date. This field is expressed in the standard Palm OS date format — the number of seconds since midnight (00:00:00) January 1, 1904.
Returns
Returns one of the following error codes:
-
errNone
- No error.
-
expErrNotOpen
- The file system library necessary for this call has not been installed or has not been opened.
-
expErrUnsupportedOperation
- The specified date type is not supported by the underlying file system.
-
vfsErrFileBadRef
- The specified file reference is invalid.
-
sysErrParamErr
- The
whichDate
parameter is not one of the defined constants.
Compatibility
Implemented only if the VFS Manager Feature Set is present.
See Also
VFSFileDBInfo()
, VFSFileGetAttributes()
, VFSFileSetDate()
VFSFileOpen Function
Purpose
Opens a file or directory and returns a reference for it.
Declared In
VfsMgr.h
Prototype
Err VFSFileOpen ( UInt16 volRefNum, const Char *pathNameP, UInt16 openMode, FileRef *fileRefP )
Parameters
-
→
volRefNum
- The volume reference number returned from
VFSVolumeEnumerate()
. -
→
pathNameP
- Pointer to the full path of the file or directory to be opened. This must be a valid path. It cannot be empty and can not contain null characters. The format of the pathname should match what the underlying file system supports. See "Naming Files" in Chapter 7, "Expansion," of the Palm OS Programmer's Companion, vol. I for a description of how to construct a valid path.
-
→
openMode
- Mode to use when opening the file. See the Open Mode Constants section for a list of accepted modes.
-
←
fileRefP
- Pointer to the opened file or directory reference which is supplied to various other
VFSFile...
operations. This value is filled in on return.
Returns
Returns one of the following error codes:
-
errNone
- No error.
-
expErrCardReadOnly
- The open mode requested includes write access but the file is read-only.
-
expErrNotOpen
- The file system library necessary for this call has not been installed or has not been opened.
-
vfsErrBadName
- The
pathNameP
parameter is invalid. -
vfsErrFileNotFound
- The specified file or directory could not be found.
-
vfsErrFilePermissionDenied
- The file cannot be opened in the requested open mode, or it has already been opened with
vfsModeExclusive
. -
vfsErrVolumeBadRef
- The specified volume has not been mounted.
Compatibility
Implemented only if the VFS Manager Feature Set is present.
See Also
VFSFileClose()
, VFSDirEntryEnumerate()
VFSFileRead Function
Purpose
Read data from a file into the dynamic heap. This function only operates on files and cannot be used with directories; use VFSDirEntryEnumerate()
to explore the contents of a directory.
Declared In
VfsMgr.h
Prototype
Err VFSFileRead ( FileRef fileRef, UInt32 numBytes, void *bufP, UInt32 *numBytesReadP )
Parameters
-
→
fileRef
- File reference returned from
VFSFileOpen()
. -
→
numBytes
- Number of bytes to read.
-
←
bufP
- Pointer to the destination chunk where the data is to be stored. This can be a pointer to any writable memory.
-
←
numBytesReadP
- Pointer to an unsigned integer that reflects the number of bytes actually read. This value is set on return and does not need to be initialized. If no bytes are read the value is set to zero. Pass
NULL
for this parameter if you do not need to know how many bytes were read.
Returns
Returns one of the following error codes:
-
errNone
- No error.
-
expErrNotOpen
- The file system library necessary for this call has not been installed or has not been opened.
-
vfsErrFileBadRef
- The specified file reference is invalid.
-
vfsErrFileEOF
- The end of the file has been reached.
-
vfsErrFilePermissionDenied
- Read permission is not enabled for this file.
-
vfsErrIsADirectory
- The specified file reference is for a directory instead of a file. This is an invalid operation on a directory.
-
vfsErrNoFileSystem
- The VFS Manager cannot find an appropriate file system to handle the request.
Comments
The file system does not use DmWrite()
and cannot be used to read data into the storage heap.
Compatibility
Implemented only if the VFS Manager Feature Set is present.
See Also
VFSFileReadData()
, VFSFileWrite()
, VFSImportDatabaseFromFile()
VFSFileReadData Function
Purpose
Read data from a file into a chunk of memory in the storage heap. This function only operates on files and cannot be used with directories; use VFSDirEntryEnumerate()
to explore the contents of a directory.
Declared In
VfsMgr.h
Prototype
Err VFSFileReadData ( FileRef fileRef, UInt32 numBytes, void *bufBaseP, UInt32 offset, UInt32 *numBytesReadP )
Parameters
-
→
fileRef
- File reference returned in
VFSFileOpen()
. -
→
numBytes
- Number of bytes to read.
-
←
bufBaseP
- Pointer to the destination chunk in the storage heap where the data is to be stored. This pointer must be obtained through the appropriate call to the Memory Manager API.
-
→
offset
- Offset, in bytes, within the
bufBaseP
chunk where the data is to be written. -
←
numBytesReadP
- Pointer to an unsigned integer that reflects the number of bytes actually read. This value is set on return and does not need to be initialized. If no bytes are read, the value is set to zero. Pass
NULL
for this parameter if you do not need to know how many bytes were read.
Returns
Returns one of the following error codes:
-
errNone
- No error.
-
expErrNotOpen
- The file system library necessary for this call has not been installed or has not been opened.
-
vfsErrFileBadRef
- The specified file reference is invalid.
-
vfsErrFileEOF
- The end of the file has been reached.
-
vfsErrFilePermissionDenied
- Read permission is not enabled for this file.
-
vfsErrIsADirectory
- The specified file reference is for a directory instead of a file. This is an invalid operation on a directory.
-
vfsErrNoFileSystem
- The VFS Manager cannot find an appropriate file system to handle the request.
Comments
When data is read from an external card with VFSFileReadData
, it is copied into a chunk of memory in the storage heap. This chunk must be allocated by the application before the call to VFSFileReadData()
. This function calls DmWrite()
to put the data in the storage heap.
Compatibility
Implemented only if the VFS Manager Feature Set is present.
See Also
VFSFileRename Function
Purpose
Rename a closed file or directory. This function cannot be used to move a file to another directory within the file system.
Declared In
VfsMgr.h
Prototype
Err VFSFileRename ( UInt16 volRefNum, const Char *pathNameP, const Char *newNameP )
Parameters
-
→
volRefNum
- Volume reference number returned from
VFSVolumeEnumerate()
. -
→
pathNameP
- Pointer to the full path of the file or directory to be renamed.
-
→
newNameP
- Pointer to the new filename. Note that this is the name of the file only and does not include the path to the file.
Returns
Returns one of the following error codes:
-
errNone
- No error.
-
expErrNotOpen
- The file system library necessary for this call has not been installed or has not been opened.
-
vfsErrBadName
- The name provided in either
pathNameP
ornewNameP
is invalid. This is also returned if the string pointed to bynewNameP
is a path, rather than a filename. -
vfsErrFileAlreadyExists
- A file with the new name already exists in this location.
-
vfsErrFileNotFound
- The source file could not be found.
-
vfsErrFilePermissionDenied
- Write permission is not enabled for this file.
-
vfsErrNoFileSystem
- The VFS Manager cannot find an appropriate file system to handle the request.
-
vfsErrVolumeBadRef
- The volume has not been mounted.
-
vfsErrVolumeFull
- There is not enough space left on the volume.
Comments
WARNING! This function invalidates directory enumeration. You cannot continue enumerating files after renaming one of them with this function. If you need to operate on additional files in the directory, you must first restart the enumeration.
Example
Below is an example of how to use VFSFileRename
. Note that the renamed file remains in the /PALM/Programs
directory; VFSFileRename
can't be used to move files from one directory to another.
// volRefNum must have been previously defined; most likely, // it was returned by VFSVolumeEnumerate err = VFSFileRename(volRefNum, "/PALM/Programs/foo.prc", "bar.prc"); if (err != errNone) { // handle error... }
Compatibility
Implemented only if the VFS Manager Feature Set is present.
VFSFileResize Function
Purpose
Change the size of an open file. This function only operates on files and cannot be used with directories.
Declared In
VfsMgr.h
Prototype
Err VFSFileResize ( FileRef fileRef, UInt32 newSize )
Parameters
-
→
fileRef
- File reference returned from
VFSFileOpen()
. -
→
newSize
- The desired new size of the file. This can be larger or smaller then the current file size.
Returns
Returns one of the following error codes:
-
errNone
- No error.
-
expErrNotOpen
- The file system library necessary for this call has not been installed or has not been opened.
-
vfsErrFileBadRef
- The specified file reference is invalid.
-
vfsErrIsADirectory
- The specified file reference points to a directory instead of a file. This is an invalid operation on a directory.
-
vfsErrNoFileSystem
- The VFS Manager cannot find an appropriate file system to handle the request.
-
vfsErrVolumeFull
- There is not enough space left on the volume.
Comments
The location of the file pointer is undefined after a call to this function.
Compatibility
Implemented only if the VFS Manager Feature Set is present.
See Also
VFSFileSeek Function
Purpose
Set the position within an open file from which to read or write. This function only operates on files and cannot be used with directories.
Declared In
VfsMgr.h
Prototype
Err VFSFileSeek ( FileRef fileRef, FileOrigin origin, Int32 offset )
Parameters
-
→
fileRef
- File reference returned from
VFSFileOpen()
. -
→
origin
- Origin to use when calculating the new position. The
offset
parameter indicates the desired new position relative to this origin, which can be one of the following: -
vfsOriginBeginning
- The beginning of the file.
-
vfsOriginCurrent
- The current position within the file.
-
vfsOriginEnd
- The end of the file. Only negative offsets are allowed when
origin
is set tovfsOriginEnd
. -
→
offset
- Offset, either positive or negative, from the origin to which the current position should be set. A value of zero (0) positions you at the specified origin.
Returns
Returns one of the following error codes:
-
errNone
- No error.
-
expErrNotOpen
- The file system library necessary for this call has not been installed or has not been opened.
-
vfsErrFileBadRef
- The specified file reference is invalid.
-
vfsErrFileEOF
- The file pointer is at the end of file.
-
vfsErrIsADirectory
- The specified file reference points to a directory instead of a file. This is an invalid operation on a directory.
-
sysErrParamErr
- The specified origin is not one of the defined constants.
Comments
During a call to this function, if the resulting position would be beyond the end of the file, it sets the position to the end of the file.
Compatibility
Implemented only if the VFS Manager Feature Set is present.
See Also
VFSFileSetAttributes Function
Purpose
Change the attributes of an open file or directory.
Declared In
VfsMgr.h
Prototype
Err VFSFileSetAttributes ( FileRef fileRef, UInt32 attributes )
Parameters
-
→
fileRef
- File reference returned from
VFSFileOpen()
. -
→
attributes
- Attributes to associate with the file or directory. See File and Directory Attributes for a list of values you can use when setting this parameter:
Returns
Returns one of the following error codes:
-
errNone
- No error.
-
expErrNotOpen
- The file system library necessary for this call has not been installed or has not been opened.
-
sysErrParamErr
- One of the parameters is invalid.
-
vfsErrFileBadRef
- The specified file reference is invalid.
-
vfsErrNoFileSystem
- The VFS Manager cannot find an appropriate file system to handle the request.
Comments
NOTE: You cannot use this function to set the
vfsFileAttrDirectory
or vfsFileAttrVolumeLabel
attributes. The vfsFileAttrDirectory
is set when you call VFSDirCreate()
. The vfsFileAttrVolumeLabel
is set when you call VFSVolumeSetLabel()
. This function may fail when setting other attributes, depending on the underlying file system.
Compatibility
Implemented only if the VFS Manager Feature Set is present.
See Also
VFSFileGetAttributes()
, VFSFileSetDate()
VFSFileSetDate Function
Purpose
Changes the dates on an open file or directory.
Declared In
VfsMgr.h
Prototype
Err VFSFileSetDate ( FileRef fileRef, UInt16 whichDate, UInt32 date )
Parameters
-
→
fileRef
- File reference returned in
VFSFileOpen()
. -
→
whichDate
- Specifies which date—creation, modification, or last access—to modify. Supply one of the following values:
-
vfsFileDateCreated
-
vfsFileDateModified
-
vfsFileDateAccessed
- Note that not all file systems are required to support the above dates. If the supplied date type is not supported by the file system,
VFSFileGetDate
returnsexpErrUnsupportedOperation
. -
→
date
- The new date. This field should be expressed in the standard Palm OS date format — the number of seconds since midnight (00:00:00) January 1, 1904.
Returns
Returns one of the following error codes:
-
errNone
- No error.
-
expErrNotOpen
- The file system library necessary for this call has not been installed or has not been opened.
-
expErrUnsupportedOperation
- The specified date type is not supported by the underlying file system.
-
sysErrParamErr
- The
whichDate
parameter is not one of the defined constants. -
vfsErrFileBadRef
- The specified file reference is invalid.
-
vfsErrFilePermissionDenied
- Write permission is not enabled for this file.
-
vfsErrNoFileSystem
- The VFS Manager cannot find an appropriate file system to handle the request.
Compatibility
Implemented only if the VFS Manager Feature Set is present.
See Also
VFSFileGetDate()
, VFSFileSetAttributes()
VFSFileSize Function
Purpose
Obtain the size of an open file. This function only operates on files and cannot be used with directories.
Declared In
VfsMgr.h
Prototype
Err VFSFileSize ( FileRef fileRef, UInt32 *fileSizeP )
Parameters
-
→
fileRef
- File reference returned from
VFSFileOpen()
. -
←
fileSizeP
- Pointer to the size of the open file.
Returns
Returns one of the following error codes:
-
errNone
- No error.
-
expErrNotOpen
- The file system library necessary for this call has not been installed or has not been opened.
-
vfsErrFileBadRef
- The specified file reference is invalid.
-
vfsErrIsADirectory
- The specified file reference points to a directory instead of a file. This is an invalid operation on a directory.
-
vfsErrNoFileSystem
- The VFS Manager cannot find an appropriate file system to handle the request.
Compatibility
Implemented only if the VFS Manager Feature Set is present.
See Also
VFSFileResize()
, VFSFileTell()
, VFSVolumeSize()
VFSFileTell Function
Purpose
Get the current position of the file pointer within an open file. This function only operates on files and cannot be used with directories.
Declared In
VfsMgr.h
Prototype
Err VFSFileTell ( FileRef fileRef, UInt32 *filePosP )
Parameters
-
→
fileRef
- File reference returned from
VFSFileOpen()
. -
←
filePosP
- Pointer to the current file position.
Returns
Returns one of the following error codes:
-
errNone
- No error.
-
expErrNotOpen
- The file system library necessary for this call has not been installed or has not been opened.
-
vfsErrFileBadRef
- The specified file reference is invalid.
-
vfsErrIsADirectory
- The specified file reference points to a directory instead of a file. This is an invalid operation on a directory.
-
vfsErrNoFileSystem
- The VFS Manager cannot find an appropriate file system to handle the request.
Compatibility
Implemented only if the VFS Manager Feature Set is present.
See Also
VFSFileWrite Function
Purpose
Write data to an open file. This function only operates on files and cannot be used with directories.
Declared In
VfsMgr.h
Prototype
Err VFSFileWrite ( FileRef fileRef, UInt32 numBytes, const void *dataP, UInt32 *numBytesWrittenP )
Parameters
-
→
fileRef
- File reference returned from
VFSFileOpen()
. -
→
numBytes
- The number of bytes to write.
-
→
dataP
- Pointer to the data that is to be written.
-
←
numBytesWrittenP
- Pointer to an unsigned integer that reflects the number of bytes actually written. This value is set on return and does not need to be initialized. If no bytes are written the value is set to zero. Pass
NULL
for this parameter if you do not need to know how many bytes were written.
Returns
Returns one of the following error codes:
-
errNone
- No error.
-
expErrNotOpen
- The file system library necessary for this call has not been installed or has not been opened.
-
vfsErrFileBadRef
- The specified file reference is invalid.
-
vfsErrFilePermissionDenied
- Write permission is not enabled for this file.
-
vfsErrIsADirectory
- The specified file reference points to a directory instead of a file. This is an invalid operation on a directory.
-
vfsErrNoFileSystem
- The VFS Manager cannot find an appropriate file system to handle the request.
-
vfsErrVolumeFull
- There is not enough space left on the volume.
Compatibility
Implemented only if the VFS Manager Feature Set is present.
See Also
VFSExportDatabaseToFile()
, VFSExportDatabaseToFileCustom()
, VFSFileRead()
, VFSFileReadData()
VFSGetDefaultDirectory Function
Purpose
Determine the default location on the given volume for files of a particular type.
Declared In
VfsMgr.h
Prototype
Err VFSGetDefaultDirectory ( UInt16 volRefNum, const Char *fileTypeStr, Char *pathStr, UInt16 *bufLenP )
Parameters
-
→
volRefNum
- Volume reference number returned from
VFSVolumeEnumerate()
. -
→
fileTypeStr
- Pointer to the requested file type, as a null-terminated string. The file type may either be a MIME media type/subtype pair, such as "image/jpeg", "text/plain", or "audio/basic"; or a file extension, such as "
.jpeg
." -
←
pathStr
- Pointer to the buffer which receives the default directory path for the requested file type.
-
↔
bufLenP
- Pointer to the size of the path. Set this to the size of
pathStr
buffer on input. Reflects the number of bytes copied topathStr
on output.
Returns
Returns one of the following error codes:
-
errNone
- No error.
-
vfsErrBadName
- There is no default directory registered for the requested file type.
-
vfsErrBufferOverflow
- A match was found, but the
pathStr
buffer is too small to hold the resulting path string. A partial path is returned inpathStr
. -
vfsErrFileNotFound
- No match was found for the specified volume. The error could have occurred with either the media type specified for this volume or the file type requested.
Comments
This function returns the complete path to the default directory registered for the specified file type. A default directory can be registered for each type of media supported. The directory should be registered under media and file type. Note that this directory is typically a "root" directory for the file type; any subdirectories under this root directory should also be searched for files of the appropriate type.
This function can be used by an image viewer application, for example, to find the directory containing images without having to know what type of media the volume was on. This could be
"/DCIM", "/images", or something else depending on the type of media.
Compatibility
Implemented only if the VFS Manager Feature Set is present.
See Also
VFSDirEntryEnumerate()
, VFSRegisterDefaultDirectory()
, VFSUnregisterDefaultDirectory()
VFSImportDatabaseFromFile Function
Purpose
Creates a database from a .pdb
or .prc
file on an external storage card.
Declared In
VfsMgr.h
Prototype
Err VFSImportDatabaseFromFile ( UInt16 volRefNum, const Char *pathNameP, UInt16 *cardNoP, LocalID *dbIDP )
Parameters
-
→
volRefNum
- Volume on which the source file resides.
-
→
pathNameP
- Pointer to the full path and name of the source file.
-
←
cardNoP
- Pointer to a variable that receives the card number of the newly-created database. If the database already resides in the storage heap, the card number of the existing database is returned along with the error
dmErrAlreadyExists
. -
←
dbIDP
- Pointer to a variable that receives the database ID of the new database. If the database already resides in the storage heap, the database ID of the existing database is returned along with the error
dmErrAlreadyExists
.
Returns
Returns one of the following error codes:
-
errNone
- No error.
-
dmErrAlreadyExists
- The
.prc
or.pdb
file already exists in the storage heap. In this case thecardNoP
anddbIDP
are set to point to the existing file. -
expErrNotEnoughPower
- There is insufficient battery power to complete the requested operation.
-
vfsErrBadName
- The path name specified in
pathNameP
is not valid.
Comments
This utility function imports a .pdb
or .prc
file resident on an external storage card into a new database in the storage heap. It first calls VFSFileOpen()
to open the file specified in pathNameP
. Assuming that a corresponding .prc
or .pdb
does not already exist in the storage heap, VFSImportDatabaseFromFile()
calls the Exchange Manager function ExgDBRead()
with an internal callback function for importing a file to the Data Manager. The Exchange Manager makes repeated calls to this function, which passes the data back in blocks. Once the file has been successfully imported, the owner (the imported file, if it's an executable, or the associated application if it is not) is sent a sysAppLaunchCmdSyncNotify
launch code to make it aware of the new database.
This function only imports the specified .pdb
or .prc
file; it does not import bundled databases or overlays. If there are bundled databases and/or overlays associated with the .pdb
or .prc
file you are importing, you will need to write additional code to explicitly handle them.
This function doesn't provide any progress indication to the user. If you need to provide feedback to the user as the file import progresses, use VFSImportDatabaseFromFileCustom()
instead.
This function is used, for example, to copy applications from a storage card to main memory.
Compatibility
Implemented only if the VFS Manager Feature Set is present.
See Also
VFSExportDatabaseToFile()
, VFSFileRead()
VFSImportDatabaseFromFileCustom Function
Purpose
Create a database from the specified .pdb
or .prc
file on an external storage card. This function differs from VFSImportDatabaseFromFile()
in that it allows you to track the progress of the import operation.
Declared In
VfsMgr.h
Prototype
Err VFSImportDatabaseFromFileCustom ( UInt16 volRefNum, const Char *pathNameP, UInt16 *cardNoP, LocalID *dbIDP, VFSImportProcPtr importProcP, void *userDataP )
Parameters
-
→
volRefNum
- Volume on which the source file resides.
-
→
pathNameP
- Pointer to the full path and name of the source file.
-
←
cardNoP
- Pointer to the variable that receives the card number of the newly-created database. If the database already resides in the storage heap, the card number of the existing database is returned along with the error
dmErrAlreadyExists
. -
←
dbIDP
- Pointer to the variable that receives the database ID of the new database. If the database already resides in the storage heap, the database ID of the existing database is returned along with the error
dmErrAlreadyExists
. -
→ importProcP
- User-defined callback function that tracks the progress of the import. This function should allow the user to cancel the import. Pass
NULL
if you don't have a progress callback function. SeeVFSImportProcPtr()
for the requirements of this function. -
→
userDataP
- Pointer to any data you want to pass to the callback function specified in
importProcP
. This information is not used internally by the VFS Manager. PassNULL
if you don't have a progress callback function, or if that function doesn't need any such data.
Returns
Returns one of the following error codes:
-
errNone
- No error
-
vfsErrBadName
- The path name specified in
pathNameP
is not valid. -
expErrNotEnoughPower
- The power required to import a database is not available.
-
dmErrAlreadyExists
- The
.prc
or.pdb
file already exists in main memory. In this case thecardNoP
anddbIDP
are set to point to the existing file.
Comments
This function is similar to VFSImportDatabaseFromFile()
in that it imports a .pdb
or .prc
file on an external storage card into a new database on the storage heap. It extends the functionality by allowing you to specify a callback function that tracks the progress of the export. It first calls VFSFileOpen()
to open the file specified in pathNameP
. If a corresponding .prc
or .pdb
does not already exist in main memory, it calls the Exchange Manager function ExgDBRead()
with an internal callback function for importing the file from the Data Manager. The Exchange Manager makes repeated calls to this function, which receives the data back in blocks. The progress tracker, if one has been specified, is also called every time a new chunk of data is passed back. Once the file has been successfully imported, the owner (the imported file, if it's an executable, or the associated application if it is not) is sent a sysAppLaunchCmdSyncNotify
launch code to make it aware of the new database.
Like VFSImportDatabaseFromFile
, this function only imports the specified .pdb
or .prc
file; it does not import bundled databases or overlays.
This function is used, for example, to copy applications from a storage card to main memory.
Compatibility
Implemented only if the VFS Manager Feature Set is present.
See Also
VFSFileRead()
, VFSExportDatabaseToFileCustom()
VFSInstallFSLib Function
Purpose
Install a file system library so that the VFS Manager can use it.
Declared In
VfsMgr.h
Prototype
Err VFSInstallFSLib ( UInt32 creator, UInt16 *fsLibRefNumP )
Parameters
-
→
creator
- Creator ID of the database containing the file system library to be installed.
-
←
fsLibRefNumP
- Pointer to the reference number for the newly installed file system library. Supply
NULL
for this parameter if you don't need the library reference number.
Returns
If the file system library was loaded and installed without error, errNone
is returned. Any error generated by the underlying file system while opening the file system library or determining its type will be returned from VFSInstallFSLib
. Other errors that can be generated during the file system library installation process include:
-
expErrIncompatibleAPIVer
- The file system library has an incompatible API version.
-
expErrNotOpen
- The file system library necessary for this call has not been installed or has not been opened.
-
memErrNotEnoughSpace
,memErrChunkNotLocked
, ormemErrChunkLocked
- A memory problem occurred while inserting the library reference into the list of installed libraries.
-
sysErrLibNotFound
,sysErrNoFreeRAM
,sysErrNoFreeLibSlots
(or some other error returned from the library's install entry point) - An error occurred while loading the library.
Comments
This function calls SysLibLoad()
to load the file system library into the library table. Once loaded the appropriate file system is asked to open the library. At boot time VFSInstallFSLib
is called internally by the Expansion Manager to load all installed file system libraries and initialize them for use.
VFSInstallFSLib
is not normally called by applications.
Compatibility
Implemented only if the VFS Manager Feature Set is present. This function is not implemented, however, if Palm OS Cobalt Feature Set is present.
See Also
VFSRegisterDefaultDirectory Function
Purpose
Registers a specific directory as the default location for files of a given type on a particular kind of external storage card. This function is generally called by a slot driver for files and media types that are supported by that slot driver.
Declared In
VfsMgr.h
Prototype
Err VFSRegisterDefaultDirectory ( const Char *fileTypeStr, UInt32 mediaType, const Char *pathStr )
Parameters
-
→
fileTypeStr
- Pointer to the file type to register. This is a null-terminated string that can either be a MIME media type/subtype pair, such as "image/jpeg", "text/plain", or "audio/basic"; or a file extension, such as "
.jpeg
". -
→
mediaType
- Type of card media for which the default directory is being associated. See Defined Media Types in the Expansion Manager chapter for the list of accepted values.
-
→
pathStr
- Pointer to the default directory path to be associated with the specified file type. This string must be null-terminated, and must be the full path to the directory.
Returns
Returns one of the following error codes:
-
errNone
- No error.
-
sysErrParamErr
- Either the
fileTypeStr
parameter isNULL
or thepathStr
parameter isNULL
. -
vfsErrFileAlreadyExists
- A default directory has already been registered for this file type on the specified card media type.
Comments
This function first verifies that a default directory has not already been registered for the specified combination of file type and media type, and returns vfsErrFileAlreadyExists
if one has been registered. To change an existing entry in the registry, you must first remove the existing entry with a call to VFSUnregisterDefaultDirectory()
before re-registering it with VFSRegisterDefaultDirectory
.
The specified directory registered for a given file type is intended to be the "root" default directory. If a given default directory has one or more subdirectories, applications should also search those subdirectories for files of the appropriate type.
Compatibility
Implemented only if the VFS Manager Feature Set is present.
See Also
VFSRemoveFSLib Function
Purpose
Remove a file system library from the library table, so that the VFS Manager can no longer use it.
Declared In
VfsMgr.h
Prototype
Err VFSRemoveFSLib ( UInt16 fsLibRefNum )
Parameters
Returns
Returns one of the following error codes:
-
errNone
- No error.
-
expErrNotOpen
- The file system library necessary for this call has not been installed or has not been opened.
-
vfsErrNoFileSystem
- VFS Manager can not find the file system specified in
fsLibRefNum
.
Comments
This function is not normally called by applications. It unmounts any volumes that the specified file system may have mounted. It then closes the library and removes it from the library table with SysLibRemove()
.
Compatibility
Implemented only if the VFS Manager Feature Set is present. This function is not implemented, however, if Palm OS Cobalt Feature Set is present.
VFSUnregisterDefaultDirectory Function
Purpose
Sever the association between a particular file type and a default directory for a given type of card media.
Declared In
VfsMgr.h
Prototype
Err VFSUnregisterDefaultDirectory ( const Char *fileTypeStr, UInt32 mediaType )
Parameters
-
→
fileTypeStr
- Pointer to the file type with which the default directory is associated. This is a null-terminated string that can either be a MIME media type/subtype pair, such as "image/jpeg", "text/plain", or "audio/basic"; or a file extension, such as "
.jpeg
". -
→
mediaType
- Type of card media for which the default directory is associated. See Defined Media Types in the Expansion Manager chapter for the list of accepted values.
Returns
Returns one of the following error codes:
-
errNone
- No error.
-
sysErrParamErr
- The
fileTypeStr
parameter isNULL
. -
vfsErrFileNotFound
- A default directory could not be found in the registry for the specified file and media type.
Comments
NOTE: Caution is advised when using this function, since you may remove another application's registration, causing data to mysteriously disappear from those applications.
Compatibility
Implemented only if the VFS Manager Feature Set is present.
See Also
VFSGetDefaultDirectory()
, VFSRegisterDefaultDirectory()
VFSVolumeEnumerate Function
Purpose
Enumerate the mounted volumes.
Declared In
VfsMgr.h
Prototype
Err VFSVolumeEnumerate ( UInt16 *volRefNumP, UInt32 *volIteratorP )
Parameters
-
←
volRefNumP
- Pointer to the reference number for the volume represented by the current enumeration, or
vfsInvalidVolRef
if there are no more volumes to be enumerated or an error occurred. -
↔
volIteratorP
- Pointer to a variable that holds the index of the current enumeration. Set the variable to
vfsIteratorStart
prior to the first iteration. Each call toVFSVolumeEnumerate
updates the variable to the index of the next volume. When the last volume is reached, the variable pointed to byvolIteratorP
is set tovfsIteratorStop
.
Returns
Returns one of the following error codes:
-
errNone
- No error
-
expErrEnumerationEmpty
- There are no volumes to enumerate.
-
sysErrParamErr
- The value pointed to by
volIteratorP
is not valid. This error is also returned whenvolIteratorP
isvfsIteratorStop
.
Comments
This function returns a pointer to the volume reference number in the volRefNumP
parameter. In order to traverse all volumes you must make repeated calls to VFSVolumeEnumerate()
inside a loop. Before the first call to VFSVolumeEnumerate
, the variable pointed to by volIteratorP
should be initialized to vfsIteratorStart
. Each iteration then increments volIteratorP
to the next entry after updating volRefNumP
. When the last volume is reached, *volIteratorP
is set to vfsIteratorStop
. If there are no volumes to enumerate, VFSVolumeEnumerate
returns expErrEnumerationEmpty
when first called.
Example
Below is an example of how to use VFSVolumeEnumerate
.
UInt16 volRefNum; UInt32 volIterator = vfsIteratorStart; while (volIterator != vfsIteratorStop) { err = VFSVolumeEnumerate(&volRefNum, &volIterator); if (err == errNone) { // Do something with the volRefNum } else { // handle error... possibly by // breaking out of the loop } }
Compatibility
Implemented only if the VFS Manager Feature Set is present.
VFSVolumeFormat Function
Purpose
Format and mount the volume installed in a given slot.
Declared In
VfsMgr.h
Prototype
Err VFSVolumeFormat ( UInt8 flags, UInt16 fsLibRefNum, VFSAnyMountParamPtr vfsMountParamP )
Parameters
-
→
flags
- Flags that control how the volume should be formatted. Currently, the only flag not reserved is
vfsMountFlagsUseThisFileSystem
. Pass this flag to cause the volume to be formatted using the file system specified byfsLibRefNum
. Pass zero (0) to have the VFS Manager attempt to format the volume using a file system appropriate to the slot. -
→
fsLibRefNum
- Reference number of the file system library for which the volume should be formatted. This number is obtained through a call to
SysLibFind()
with the name of the library you want to use. If theflags
field is not set tovfsMountFlagsUseThisFileSystem
, this parameter is ignored. -
↔
vfsMountParamP
- Parameters to be used when formatting the volume and when mounting the volume after it has been formatted. Supply a pointer to either a
VFSSlotMountParamType
or aVFSPOSEMountParamType
structure. Note that you'll need to cast your structure pointer to aVFSAnyMountParamPtr
. Set themountClass
field to the appropriate value: if you are mounting to an Expansion Manager slot, setmountClass
toVFSMountClass_SlotDriver
and initializeslotLibRefNum
andslotRefNum
to the appropriate values. See the descriptions ofVFSAnyMountParamType
,VFSSlotMountParamType
, andVFSPOSEMountParamType
for information on the fields that make up these data structures.
Returns
Returns one of the following error codes:
-
errNone
- No error.
-
expErrNotEnoughPower
- There is insufficient battery power to format and/or mount a volume.
-
expErrNotOpen
- The file system library necessary for this call has not been installed or has not been opened.
-
vfsErrNoFileSystem
- The VFS Manager cannot find an appropriate file system to handle the request.
Comments
The slot driver currently only supports one volume per slot. If the volume is successfully formatted and mounted, the reference number of the mounted volume is returned in vfsMountParamP->volRefNum
. If the format is unsuccessful or cancelled, vfsMountParamP->volRefNum
is set to vfsInvalidVolRef
.
If vfsMountFlagsUseThisFileSystem
is passed as a flag, VFSVolumeFormat
attempts to format the volume using the file system library specified by fsLibRefNum
. Typically the flag parameter is not set. In this case VFSVolumeFormat
tries to find a compatible library to format the volume, as follows:
- Check to see if the default file system library feature is set. If it is, and if that file system is installed, it is used to format the volume. You can set the default file system using
FtrSet()
; supplysysFileCVFSMgr
for the feature creator, andvfsFtrIDDefaultFS
for the feature number. - Check to see if any of the installed file systems are natively supported for the slot on which the VFS Manager is trying to format. If one of them is, it is used to format the volume.
- If none of the installed file systems can perform the format using the slot's native type, a dialog displays warning the user that their media may become incompatible with other devices if they continue with the format. The user may continue or cancel the format. If the user chooses to continue,
VFSVolumeFormat
formats the volume using the first file system library that was installed.
When calling VFSVolumeFormat
, the volume can either be mounted or unmounted. The underlying file system library call requires the volume to be unmounted. VFSVolumeFormat
checks to see if the volume is currently mounted and unmounts it, if necessary, using VFSVolumeUnmount
before making the file system call. If the file system successfully formats the volume, VFSVolumeFormat
mounts it and posts a sysNotifyVolumeMountedEvent
notification.
Example
The following code excerpt formats a volume on an Expansion Manager slot using a compatible file system.
VFSSlotMountParamType slotParam; UInt32 slotIterator = expIteratorStart; slotParam.vfsMountParamP.mountClass = VFSMountClass_SlotDriver; err = ExpSlotEnumerate(&slotParam.slotRefNum, &slotIterator); err = ExpSlotLibFind(slotParam.slotRefNum, &slotParam.slotLibRefNum); err = VFSVolumeFormat(NULL, NULL, (VFSAnyMountParamPtr) & slotParam);
Compatibility
Implemented only if the VFS Manager Feature Set is present.
See Also
VFSVolumeGetLabel Function
Purpose
Determine the volume label for a particular volume.
Declared In
VfsMgr.h
Prototype
Err VFSVolumeGetLabel( UInt16 volRefNum, Char *labelP, UInt16 bufLen )
Parameters
-
→
volRefNum
- Volume reference number returned from
VFSVolumeEnumerate()
. -
←
labelP
- Pointer to a character buffer into which the volume name is placed.
-
→
bufLen
- Length, in bytes, of the
labelP
buffer.
Returns
Returns one of the following error codes:
-
errNone
- No error.
-
expErrNotOpen
- The file system library necessary for this call has not been installed or has not been opened.
-
vfsErrNoFileSystem
- The VFS Manager cannot find an appropriate file system to handle the request.
-
vfsErrVolumeBadRef
- The specified volume has not been mounted.
-
vfsErrBufferOverflow
- The value specified in
bufLen
is not big enough to receive the full volume label. -
vfsErrNameShortened
- There was an error reading the full volume name. A shortened version is being returned.
Comments
Volume reference numbers can change each time you mount a given volume. To keep track of a particular volume, save the volume's label rather than its reference number. Volume labels can be up to 255 characters long. They can contain any normal character, including spaces and lower case characters, in any character set as well as the following special characters: $ % ' - _ @ ~ ` ! ( ) ^ # & + , ; = [ ].
Compatibility
Implemented only if the VFS Manager Feature Set is present.
See Also
VFSVolumeInfo Function
Purpose
Get information about the specified volume.
Declared In
VfsMgr.h
Prototype
Err VFSVolumeInfo( UInt16 volRefNum, VolumeInfoType *volInfoP )
Parameters
-
→
volRefNum
- Volume reference number returned from
VFSVolumeEnumerate()
. -
←
volInfoP
- Pointer to the structure that receives the volume information for the specified volume. See
VolumeInfoType
for more information on the fields in this data structure.
Returns
Returns one of the following error codes:
-
errNone
- No error.
-
expErrNotOpen
- The file system library necessary for this call has not been installed or has not been opened.
-
vfsErrNoFileSystem
- The VFS Manager cannot find an appropriate file system to handle the request.
-
vfsErrVolumeBadRef
- The specified volume reference number is invalid.
Compatibility
Implemented only if the VFS Manager Feature Set is present.
See Also
VFSVolumeGetLabel()
, VFSVolumeSize()
VFSVolumeMount Function
Purpose
Mount the card's volume on the specified slot.
Declared In
VfsMgr.h
Prototype
Err VFSVolumeMount( UInt8 flags, UInt16 fsLibRefNum, VFSAnyMountParamPtr vfsMountParamP )
Parameters
-
→
flags
- Flags that control how the volume should be mounted. Currently, the only flag not reserved is
vfsMountFlagsUseThisFileSystem
. Pass this flag to cause the volume to be mounted using the file system specified byfsLibRefNum
. Pass zero (0) to have the VFS Manager attempt to mount the volume using a file system appropriate for the slot. -
→
fsLibRefNum
- Reference number of the file system library for which the volume should be mounted. This number is obtained through a call to
SysLibFind()
with the name of the library you want to use. If theflags
field is not set tovfsMountFlagsUseThisFileSystem
, this parameter is ignored. -
↔
vfsMountParamP
- Parameters to be used when mounting the volume after it has been formatted. Supply a pointer to either a
VFSSlotMountParamType
or aVFSPOSEMountParamType
structure. Note that you'll need to cast your structure pointer to aVFSAnyMountParamPtr
. Set themountClass
field to the appropriate value: if you are mounting to an Expansion Manager slot, setmountClass
toVFSMountClass_SlotDriver
and initializeslotLibRefNum
andslotRefNum
to the appropriate values. See the descriptions ofVFSAnyMountParamType
,VFSSlotMountParamType
, andVFSPOSEMountParamType
for information on the fields that make up these data structures.
Returns
Returns one of the following error codes:
-
errNone
- No error.
-
expErrNotEnoughPower
- There is insufficient battery power to mount a volume.
-
expErrNotOpen
- The file system library necessary for this call has not been installed or has not been opened.
-
sysErrParamErr
-
vfsMountParamP
was initialized toNULL
. -
vfsErrNoFileSystem
- The VFS Manager cannot find an appropriate file system to handle the request.
-
vfsErrVolumeStillMounted
- The volume is already mounted with a different file system than was specified in
fsLibRefNum
.
Comments
The slot driver only supports one volume per slot. The reference number of the mounted volume is returned in vfsMountParamP->volRefNum
. If vfsMountFlagsUseThisFileSystem
is passed as a flag, VFSVolumeMount
attempts to mount the volume using the file system library specified by fsLibRefNum
. Otherwise VFSVolumeMount
tries to find a file system library which is able to mount the volume. If none of the installed file system libraries is able to mount the volume, VFSVolumeMount
attempts to re-format the volume (using VFSVolumeFormat()
) and then mount it. If VFSVolumeMount
manages to successfully mount the volume, it ends by posting a sysNotifyVolumeMountedEvent
notification.
After VFSVolumeMount successfully mounts a volume, it broadcasts sysNotifyVolumeMountedEvent
. The VFS Manager, upon being notified of this event, searches the newly-mounted volume for /PALM/start.prc
. If start.prc
is found in the /PALM
directory, the VFS Manager copies it to main memory and launches it. If start.prc is not found, the VFS Manager switches to the Launcher instead. This behavior can be overridden; see Card Insertion and Removal in Chapter 7, "Expansion," Palm OS Programmer's Companion, vol. I.
When VFSVolumeMount
is called, if the volume is already mounted with a different file system than was specified in fsLibRefNum
, a vfsErrVolumeStillMounted
error is returned. If the volume is already mounted with the same file system that is specified in fsLibRefNum
, or if vfsMountFlagsUseThisFileSystem
is not set, VFSVolumeMount
returns errNone
and sets volRefNumP
to the reference number of the currently mounted volume.
Example
The following code excerpt mounts a volume on an Expansion Manager slot using a compatible file system.
VFSSlotMountParamType slotParam ; UInt32 slotIterator = expIteratorStart; slotParam.vfsMountParamP.mountClass = VFSMountClass_SlotDriver; err = ExpSlotEnumerate(&slotParam.slotRefNum, &slotIterator); err = ExpSlotLibFind(slotParam.slotRefNum, &slotParam.slotLibRefNum); err = VFSVolumeMount(NULL, NULL, (VFSAnyMountParamPtr) & slotParam);
Compatibility
Implemented only if the VFS Manager Feature Set is present.
See Also
VFSVolumeFormat()
, VFSVolumeUnmount()
VFSVolumeSetLabel Function
Purpose
Changes the volume label for a mounted volume.
Declared In
VfsMgr.h
Prototype
Err VFSVolumeSetLabel( UInt16 volRefNum, const Char *labelP )
Parameters
-
→
volRefNum
- Volume reference number returned from
VFSVolumeEnumerate()
. -
→
labelP
- Pointer to the label to be applied to the specified volume. This string must be null-terminated.
Returns
Returns one of the following error codes:
-
errNone
- No error
-
expErrNotOpen
- The file system library necessary for this call has not been installed or has not been opened.
-
vfsErrBadName
- The supplied label is invalid.
-
vfsErrNameShortened
- Indicates that the label name was too long. A shortened version of the label name was used instead.
-
vfsErrVolumeBadRef
- The specified volume has not been mounted.
Comments
Volume labels can be up to 255 characters long. They can contain any normal character, including spaces and lower case characters, in any character set as well as the following special characters: $ % ' - _ @ ~ ` ! ( ) ^ # & + , ; = [ ]. See Naming Volumes in Chapter 7, "Expansion,"Palm OS Programmer's Companion, vol. I for guidelines on naming.
NOTE: Most clients should not need to call this function. This function may create or delete a file in the root directory, which would invalidate any current calls to
VFSDirEntryEnumerate()
.
Compatibility
Implemented only if the VFS Manager Feature Set is present.
See Also
VFSVolumeSize Function
Purpose
Determine the total amount of space on a volume, as well as the amount that is currently being used.
Declared In
VfsMgr.h
Prototype
Err VFSVolumeSize( UInt16 volRefNum, UInt32 *volumeUsedP, UInt32 *volumeTotalP )
Parameters
-
→
volRefNum
- Volume reference number returned from
VFSVolumeEnumerate()
. -
←
volumeUsedP
- Pointer to a variable that receives the amount of space, in bytes, in use on the volume.
-
←
volumeTotalP
- Pointer to a variable that receives the total amount of space on the volume, in bytes.
Returns
Returns one of the following error codes:
-
errNone
- No error.
-
expErrNotOpen
- The file system library necessary for this call has not been installed or has not been opened.
-
vfsErrNoFileSystem
- The VFS Manager cannot find an appropriate file system to handle the request.
-
vfsErrVolumeBadRef
- The specified volume has not been mounted.
Compatibility
Implemented only if the VFS Manager Feature Set is present.
See Also
VFSVolumeUnmount Function
Purpose
Declared In
VfsMgr.h
Prototype
Err VFSVolumeUnmount( UInt16 volRefNum )
Parameters
-
→
volRefNum
- Volume reference number returned from
VFSVolumeEnumerate()
.
Returns
Returns one of the following error codes:
-
errNone
- No error.
-
expErrNotOpen
- The file system library necessary for this call has not been installed or has not been opened.
-
vfsErrNoFileSystem
- The VFS Manager cannot find an appropriate file system to handle the request.
-
vfsErrVolumeBadRef
- The specified volume has not been mounted.
Comments
This function closes any opened files and posts a sysNotifyVolumeUnmountedEvent
notification once the file system is successfully unmounted.
Compatibility
Implemented only if the VFS Manager Feature Set is present.
See Also
Application-Defined Functions
VFSExportProcPtr Function
Purpose
User-defined callback function supplied to VFSExportDatabaseToFileCustom()
that tracks the progress of the export.
Declared In
VfsMgr.h
Prototype
typedef Err ( *VFSExportProcPtr ) ( UInt32 totalBytes, UInt32 offset, void *userDataP )
Parameters
-
totalBytes
- The total number of bytes being exported.
-
offset
- Undefined.
-
userDataP
- Pointer to any application-specific data passed to the callback function. This pointer may be
NULL
if your callback doesn't need any such data.
Returns
Your progress tracker should allow the user to abort the export. Return errNone
if the export should continue, or any other value to abort the export process. If you return a value other than errNone
, that value will be returned by VFSExportDatabaseToFileCustom()
.
Comments
See the Progress Dialogs section in the Palm OS Programmer's Companion, vol. I for more information on writing a progress tracker.
Compatibility
Implemented only if the VFS Manager Feature Set is present.
See Also
VFSImportProcPtr Function
Purpose
User-defined callback function supplied to VFSImportDatabaseFromFileCustom()
that tracks the progress of the import.
Declared In
VfsMgr.h
Prototype
typedef Err ( *VFSImportProcPtr ) ( UInt32 totalBytes, UInt32 offset, void *userDataP )
Parameters
-
totalBytes
- The total number of bytes being imported.
-
offset
- The number of bytes that have already been imported. This value, along with the total number of bytes being imported, allows you to inform the user how far along the import is.
-
userDataP
- Pointer to NY application-specific data passed to the callback function. This pointer may be
NULL
if your callback doesn't need any such data.
Returns
Your progress tracker should allow the user to abort the import. Return errNone
if the import should continue, or any other value to abort the import process. If you return a value other than errNone
, that value will be returned by VFSImportDatabaseFromFileCustom()
.
Comments
See the Progress Dialogs section in the Palm OS Programmer's Companion, vol. I for more information on writing a progress tracker.
Compatibility
Implemented only if the VFS Manager Feature Set is present.