Flush data I/O function handler

QNX SDP8.0Getting Started with the QNX OSDeveloperUser

Prototype:

int (*sync) ( resmgr_context_t *ctp,
              io_sync_t *msg,
              RESMGR_OCB_T *ocb ) 

Classification:

I/O

Default handler:

iofunc_sync_default()

Helper functions:

iofunc_sync_verify(), iofunc_sync()

Client functions:

fsync(), fdatasync()

Messages:

_IO_SYNC

Data structure:

struct _io_sync {
  uint16_t        type;
  uint16_t        combine_len;
  uint32_t        flag;
};

typedef union {
  struct _io_sync i;
} io_sync_t;

Description:

This is the entry point for a flush command. The helper function iofunc_sync() is passed the flag member from the input message, and returns one of the following values, which indicate what actions your resource manager must take:
  • 0—do nothing.
  • O_SYNC—everything associated with the file (including the file contents, directory structures, inodes, etc.) must be present and recoverable from media.
  • O_DSYNC—only the data portion of the file must be present and recoverable from media.
Note that this outcall will occur only if you've agreed to provide sync services by setting the mount structure flag.

Returns:

Returns the status via the helper macro _RESMGR_STATUS().

Referenced by:

resmgr_io_funcs_t I/O table

Permission checking:

The default implementation iofunc_sync_default() calls the helper function iofunc_sync_verify(), but does not actually synchronize anything after verifying. The iofunc_sync_verify() function verifies that the filesystem was mounted with the IOFUNC_PC_SYNC_IO flag. The iofunc_sync() helper function verifies that it is not a read-only filesystem when it determines whether synchronization is needed.

Page updated: