You are currently viewing the documentation for:
ECF_WriteSector writes a single sector to the block device.
ECF_ErrorCode ECF_WriteSector(
   struct ECF_BlockDriver *pBlockDriver,
   uint32_t sector,
   uint8_t *pData,
   uint8_t flags
This is a pointer to the struct ECF_BlockDriver to write sectors in.
This specifies which sector to write.
This points to a uint8_t array with the data for the block driver to write.
These are flags for the write.
If this flag is set, the block driver will bypass the wear leveling layer and write a physical sector. There are very few reasons, if any, to do this.
Set this flag if you allow EcFAT to overwrite the buffer passed in pData. Useful if you will not reuse that data you just wrote since it will speed up EcFAT slightly.
Return value
Returns one of the EcFAT error codes (ECFERR_SUCCESS on success). Will return ECFERR_BUFFEROVERWRITTEN if ECF_WRITESECTOR_ALLOW_BUFFER_OVERWRITE was set and the buffer was actually overwritten.
The difference between calling ECF_WriteSector and calling the block driver's m_fnWriteSector directly is that ECF_WriteSector will properly handle wear leveling and locking of the block driver. ECF_WriteSector will automatically handle wear leveling and move blocks that are written frequently. The normal use case for ECF_WriteSector is for writing sectors to a RAW partition without file system.
See also