static int ntfs_device_uefi_io_sync(struct ntfs_device *dev) { struct _uefi_fd *fd = DEV_FD(dev); ntfs_log_trace("dev %p\n", dev); // Check that the device can be written to if (NDevReadOnly(dev)) { errno = EROFS; return -1; } // Mark the device as clean NDevClearDirty(dev); NDevClearSync(dev); // Flush any sectors in the disc cache (if required) if (fd->cache) { /*if (!_NTFS_cache_flush(fd->cache)) { errno = EIO; return -1; }*/ ntfs_log_trace("ntfs_device_uefi_io_sync cache enabled?!?!"); } return 0; }
/** * ntfs_device_unix_io_sync - Flush any buffered changes to the device * @dev: * * Description... * * Returns: */ static int ntfs_device_unix_io_sync(struct ntfs_device *dev) { if (!NDevReadOnly(dev) && NDevDirty(dev)) { int res = fsync(DEV_FD(dev)); if (!res) NDevClearDirty(dev); return res; } return 0; }
static int ntfs_device_uefi_io_close(struct ntfs_device *dev) { struct _uefi_fd *fd = DEV_FD(dev); ntfs_log_trace("dev %p\n", dev); //AsciiPrint("ntfs_device_uefi_io_close\n\r"); // Get the device driver descriptor if (!fd) { errno = EBADF; return -1; } // Check that the device is actually open if (!NDevOpen(dev)) { ntfs_log_perror("device is not open\n"); errno = EIO; return -1; } // Mark the device as closed NDevClearOpen(dev); NDevClearBlock(dev); // Flush the device (if dirty and not read-only) if (NDevDirty(dev) && !NDevReadOnly(dev)) { ntfs_log_debug("device is dirty, will now sync\n"); // ...? // Mark the device as clean NDevClearDirty(dev); } // Flush and destroy the cache (if required) if (fd->cache) { //_NTFS_cache_flush(fd->cache); //_NTFS_cache_destructor(fd->cache); } // Shutdown the device interface /*const DISC_INTERFACE* interface = fd->interface; if (interface) { interface->shutdown(); }*/ // Free the device driver private data ntfs_free(dev->d_private); dev->d_private = NULL; return 0; }
/** * ntfs_device_unix_io_sync - Flush any buffered changes to the device * @dev: * * Description... * * Returns: */ static int ntfs_device_unix_io_sync(struct ntfs_device *dev) { int res = 0; if (!NDevReadOnly(dev)) { res = ntfs_fsync(DEV_FD(dev)); if (res) ntfs_log_perror("Failed to sync device %s", dev->d_name); else NDevClearDirty(dev); } return res; }