CTL_STATUS_t ctl_ms_purge_sector_cache(void);

ctl_ms_purge_sector_cache writes all dirty sectors to the storage media and then invalidates all cache entries so that nothing remains in the cache. Before ejecting the media you should call ctl_ms_purge_sector_cache to ensure that all cached data is written and the physical storage media is consistent.

If you wish to only ensure that unwritten data is flushed such that the storage media is consistent, but allow the cache to remain valid, use ctl_ms_flush_sector_cache.

If there is an error writing to the media for any sector, ctl_ms_purge_sector_cache returns CTL_MS_DELAYED_WRITE_ERROR.

See Also