Flush data I/O function handler

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: 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.