vere: uses c3_sync macro instead of inline platform checks

This commit is contained in:
Joe Bryan 2019-10-08 15:15:20 -07:00
parent c8a4a5d699
commit 68f05b722b
2 changed files with 5 additions and 28 deletions

View File

@ -592,29 +592,13 @@ _ce_patch_compose(void)
}
}
/* _ce_sync(): sync a file descriptor.
*/
static void
_ce_sync(c3_i fid_i)
{
#if defined(U3_OS_linux)
fdatasync(fid_i);
#elif defined(U3_OS_osx)
fcntl(fid_i, F_FULLFSYNC);
#elif defined(U3_OS_bsd)
fsync(fid_i);
#else
# error "port: datasync"
#endif
}
/* _ce_patch_sync(): make sure patch is synced to disk.
*/
static void
_ce_patch_sync(u3_ce_patch* pat_u)
{
_ce_sync(pat_u->ctl_i);
_ce_sync(pat_u->mem_i);
c3_sync(pat_u->ctl_i);
c3_sync(pat_u->mem_i);
}
/* _ce_image_sync(): make sure image is synced to disk.
@ -622,7 +606,7 @@ _ce_patch_sync(u3_ce_patch* pat_u)
static void
_ce_image_sync(u3e_image* img_u)
{
_ce_sync(img_u->fid_i);
c3_sync(img_u->fid_i);
}
/* _ce_patch_apply(): apply patch to image.

View File

@ -1257,16 +1257,9 @@ u3_unix_acquire(c3_c* pax_c)
{
c3_i fid_i = fileno(loq_u);
#if defined(U3_OS_linux)
fdatasync(fid_i);
#elif defined(U3_OS_osx)
fcntl(fid_i, F_FULLFSYNC);
#elif defined(U3_OS_bsd)
fsync(fid_i);
#else
# error "port: datasync"
#endif
c3_sync(fid_i);
}
fclose(loq_u);
free(paf_c);
}