return -1;
}
-static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp)
-{
- errno = ENOSYS;
- return -1;
-}
-
static struct tevent_req *skel_fsync_send(struct vfs_handle_struct *handle,
TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
.sendfile_fn = skel_sendfile,
.recvfile_fn = skel_recvfile,
.rename_fn = skel_rename,
- .fsync_fn = skel_fsync,
.fsync_send_fn = skel_fsync_send,
.fsync_recv_fn = skel_fsync_recv,
.stat_fn = skel_stat,
return SMB_VFS_NEXT_RENAME(handle, smb_fname_src, smb_fname_dst);
}
-static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp)
-{
- return SMB_VFS_NEXT_FSYNC(handle, fsp);
-}
-
struct skel_fsync_state {
int ret;
struct vfs_aio_state vfs_aio_state;
.sendfile_fn = skel_sendfile,
.recvfile_fn = skel_recvfile,
.rename_fn = skel_rename,
- .fsync_fn = skel_fsync,
.fsync_send_fn = skel_fsync_send,
.fsync_recv_fn = skel_fsync_recv,
.stat_fn = skel_stat,
/* Version 37 - Rename SMB_VFS_STRICT_LOCK to
SMB_VFS_STRICT_LOCK_CHECK */
/* Version 38 - Remove SMB_VFS_INIT_SEARCH_OP */
+/* Version 39 - Remove SMB_VFS_FSYNC
+ Only implement async versions. */
-#define SMB_VFS_INTERFACE_VERSION 38
+#define SMB_VFS_INTERFACE_VERSION 39
/*
All intercepted VFS operations must be declared as static functions inside module source
int (*rename_fn)(struct vfs_handle_struct *handle,
const struct smb_filename *smb_fname_src,
const struct smb_filename *smb_fname_dst);
- int (*fsync_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp);
struct tevent_req *(*fsync_send_fn)(struct vfs_handle_struct *handle,
TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
int smb_vfs_call_rename(struct vfs_handle_struct *handle,
const struct smb_filename *smb_fname_src,
const struct smb_filename *smb_fname_dst);
-int smb_vfs_call_fsync(struct vfs_handle_struct *handle,
- struct files_struct *fsp);
struct tevent_req *smb_vfs_call_fsync_send(struct vfs_handle_struct *handle,
TALLOC_CTX *mem_ctx,
return result;
}
-static int catia_fsync(vfs_handle_struct *handle, files_struct *fsp)
-{
- struct catia_cache *cc = NULL;
- int ret;
-
- ret = CATIA_FETCH_FSP_PRE_NEXT(talloc_tos(), handle, fsp, &cc);
- if (ret != 0) {
- return -1;
- }
-
- ret = SMB_VFS_NEXT_FSYNC(handle, fsp);
-
- CATIA_FETCH_FSP_POST_NEXT(&cc, fsp);
-
- return ret;
-}
-
struct catia_fsync_state {
int ret;
struct vfs_aio_state vfs_aio_state;
.pwrite_recv_fn = catia_pwrite_recv,
.lseek_fn = catia_lseek,
.rename_fn = catia_rename,
- .fsync_fn = catia_fsync,
.fsync_send_fn = catia_fsync_send,
.fsync_recv_fn = catia_fsync_recv,
.stat_fn = catia_stat,
WRAP_RETURN(result);
}
-static int cephwrap_fsync(struct vfs_handle_struct *handle, files_struct *fsp)
-{
- int result;
- DBG_DEBUG("[CEPH] cephwrap_fsync\n");
- result = ceph_fsync(handle->data, fsp->fh->fd, false);
- WRAP_RETURN(result);
-}
-
/*
* Fake up an async ceph fsync by calling the sychronous API.
*/
.sendfile_fn = cephwrap_sendfile,
.recvfile_fn = cephwrap_recvfile,
.rename_fn = cephwrap_rename,
- .fsync_fn = cephwrap_fsync,
.fsync_send_fn = cephwrap_fsync_send,
.fsync_recv_fn = cephwrap_fsync_recv,
.stat_fn = cephwrap_stat,
return result;
}
-static int vfswrap_fsync(vfs_handle_struct *handle, files_struct *fsp)
-{
-#ifdef HAVE_FSYNC
- int result;
-
- START_PROFILE(syscall_fsync);
- result = fsync(fsp->fh->fd);
- END_PROFILE(syscall_fsync);
- return result;
-#else
- return 0;
-#endif
-}
-
static int vfswrap_stat(vfs_handle_struct *handle,
struct smb_filename *smb_fname)
{
.sendfile_fn = vfswrap_sendfile,
.recvfile_fn = vfswrap_recvfile,
.rename_fn = vfswrap_rename,
- .fsync_fn = vfswrap_fsync,
.fsync_send_fn = vfswrap_fsync_send,
.fsync_recv_fn = vfswrap_fsync_recv,
.stat_fn = vfswrap_stat,
return result;
}
-static int smb_full_audit_fsync(vfs_handle_struct *handle, files_struct *fsp)
-{
- int result;
-
- result = SMB_VFS_NEXT_FSYNC(handle, fsp);
-
- do_log(SMB_VFS_OP_FSYNC, (result >= 0), handle, "%s",
- fsp_str_do_log(fsp));
-
- return result;
-}
-
struct smb_full_audit_fsync_state {
vfs_handle_struct *handle;
files_struct *fsp;
.sendfile_fn = smb_full_audit_sendfile,
.recvfile_fn = smb_full_audit_recvfile,
.rename_fn = smb_full_audit_rename,
- .fsync_fn = smb_full_audit_fsync,
.fsync_send_fn = smb_full_audit_fsync_send,
.fsync_recv_fn = smb_full_audit_fsync_recv,
.stat_fn = smb_full_audit_stat,
smb_fname_dst->base_name);
}
-static int vfs_gluster_fsync(struct vfs_handle_struct *handle,
- files_struct *fsp)
-{
- return glfs_fsync(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp));
-}
-
static struct tevent_req *vfs_gluster_fsync_send(struct vfs_handle_struct
*handle, TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
.sendfile_fn = vfs_gluster_sendfile,
.recvfile_fn = vfs_gluster_recvfile,
.rename_fn = vfs_gluster_rename,
- .fsync_fn = vfs_gluster_fsync,
.fsync_send_fn = vfs_gluster_fsync_send,
.fsync_recv_fn = vfs_gluster_fsync_recv,
return 0;
}
-static int streams_xattr_fsync(vfs_handle_struct *handle, files_struct *fsp)
-{
- struct stream_io *sio =
- (struct stream_io *)VFS_FETCH_FSP_EXTENSION(handle, fsp);
-
- if (sio == NULL) {
- return SMB_VFS_NEXT_FSYNC(handle, fsp);
- }
-
- return 0;
-}
-
static ssize_t streams_xattr_fgetxattr(struct vfs_handle_struct *handle,
struct files_struct *fsp,
const char *name,
.fchown_fn = streams_xattr_fchown,
.fchmod_fn = streams_xattr_fchmod,
- .fsync_fn = streams_xattr_fsync,
.fgetxattr_fn = streams_xattr_fgetxattr,
.flistxattr_fn = streams_xattr_flistxattr,
return result;
}
-static int smb_time_audit_fsync(vfs_handle_struct *handle, files_struct *fsp)
-{
- int result;
- struct timespec ts1,ts2;
- double timediff;
-
- clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_FSYNC(handle, fsp);
- clock_gettime_mono(&ts2);
- timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
-
- if (timediff > audit_timeout) {
- smb_time_audit_log_fsp("fsync", timediff, fsp);
- }
-
- return result;
-}
-
struct smb_time_audit_fsync_state {
struct files_struct *fsp;
int ret;
.sendfile_fn = smb_time_audit_sendfile,
.recvfile_fn = smb_time_audit_recvfile,
.rename_fn = smb_time_audit_rename,
- .fsync_fn = smb_time_audit_fsync,
.fsync_send_fn = smb_time_audit_fsync_send,
.fsync_recv_fn = smb_time_audit_fsync_recv,
.stat_fn = smb_time_audit_stat,
return handle->fns->rename_fn(handle, smb_fname_src, smb_fname_dst);
}
-int smb_vfs_call_fsync(struct vfs_handle_struct *handle,
- struct files_struct *fsp)
-{
- VFS_FIND(fsync);
- return handle->fns->fsync_fn(handle, fsp);
-}
-
struct smb_vfs_call_fsync_state {
int (*recv_fn)(struct tevent_req *req, struct vfs_aio_state *vfs_aio_state);
int retval;