gtpc2mjlC/C++ Language Support User's Guide

TPF_FSDD_SYNC-Synchronize the File Data

This type of function is specified as part of the file system device driver interface and is called by the fsync function to synchronize any data that may be buffered by the device driver or by the TPF system.

Format

typedef long TPF_FSDD_SYNC(const TPF_FSDD_FILEDATA *filedata);

filedata
The address of the file data object returned by the TPF_FSDD_OPEN-type device driver function for the special file being synchronized.

Normal Return

0
The data was synchronized successfully.

Error Return

-1
An error occurred during the synchronization operation. The device driver should also set errno to indicate the type of error.

Programming Considerations

Examples

The following example is the synchronization device driver interface function for the null file (/dev/null).

#include <c$spif.h> /* Device driver interface */
 
/**********************************************************************/
/* The null_sync() function synchronizes a null file.  It always      */
/* succeeds.  Note that this function does not need to be specified   */
/* for the null file device driver because the default behavior when  */
/* no TPF_FSDD_SYNC-type function is specified also is to always      */
/* succeed.                                                           */
/**********************************************************************/
long null_sync(const TPF_FSDD_FILEDATA *filedata)
{
    return 0;
}

Related Information