From 40d73718128a3de5ebf9758411eeba091fe2c58a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 15 Jul 2004 09:37:03 +0000 Subject: [PATCH] Implement ntfs_device_win32_sync(). (Logical change 1.459) --- libntfs/win32_io.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index 0e4b9195..dcff0bbc 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -563,11 +563,21 @@ static s64 win32_filepos(struct ntfs_device *dev) return fd->current_pos.QuadPart; } +/** + * ntfs_device_win32_sync - Flush write buffers to disk. + * @dev: An NTFS_DEVICE obtained via the open command. + * + * Return 0 if o.k. + * -errno if not, in this case handle is trashed. + */ static int ntfs_device_win32_sync(struct ntfs_device *dev) { - fprintf(stderr, "win32_fsync() unimplemented\n"); - errno = ENOTSUP; - return -1; + if (FlushFileBuffers(((win32_fd *)dev->d_private)->handle)) { + return 0; + } else { + errno = ntfs_w32error_to_errno(GetLastError()); + return -errno; + } } static s64 ntfs_device_win32_write(struct ntfs_device *dev, const void *buffer,