[PATCH 2/4] sync_file: add replace and export some functionality