Not yet used, that comes next.
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
return id;
}
+static uint64_t skel_fs_file_id(vfs_handle_struct *handle,
+ const SMB_STRUCT_STAT *sbuf)
+{
+ errno = ENOSYS;
+ return 0;
+}
+
struct skel_offload_read_state {
bool dummy;
};
.realpath_fn = skel_realpath,
.chflags_fn = skel_chflags,
.file_id_create_fn = skel_file_id_create,
+ .fs_file_id_fn = skel_fs_file_id,
.offload_read_send_fn = skel_offload_read_send,
.offload_read_recv_fn = skel_offload_read_recv,
.offload_write_send_fn = skel_offload_write_send,
return SMB_VFS_NEXT_FILE_ID_CREATE(handle, sbuf);
}
+static uint64_t skel_fs_file_id(vfs_handle_struct *handle,
+ const SMB_STRUCT_STAT *sbuf)
+{
+ return SMB_VFS_NEXT_FS_FILE_ID(handle, sbuf);
+}
+
struct skel_offload_read_state {
struct vfs_handle_struct *handle;
DATA_BLOB token;
.realpath_fn = skel_realpath,
.chflags_fn = skel_chflags,
.file_id_create_fn = skel_file_id_create,
+ .fs_file_id_fn = skel_fs_file_id,
.offload_read_send_fn = skel_offload_read_send,
.offload_read_recv_fn = skel_offload_read_recv,
.offload_write_send_fn = skel_offload_write_send,
/* Version 41 - convert struct stat_ex.st_ex_calculated_birthtime to flags */
/* Version 41 - add st_ex_itime to struct stat_ex */
/* Version 41 - add st_ex_file_id to struct stat_ex */
+/* Version 41 - add SMB_VFS_FS_FILE_ID */
#define SMB_VFS_INTERFACE_VERSION 41
unsigned int flags);
struct file_id (*file_id_create_fn)(struct vfs_handle_struct *handle,
const SMB_STRUCT_STAT *sbuf);
+ uint64_t (*fs_file_id_fn)(struct vfs_handle_struct *handle,
+ const SMB_STRUCT_STAT *sbuf);
struct tevent_req *(*offload_read_send_fn)(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct vfs_handle_struct *handle,
unsigned int flags);
struct file_id smb_vfs_call_file_id_create(struct vfs_handle_struct *handle,
const SMB_STRUCT_STAT *sbuf);
+uint64_t smb_vfs_call_fs_file_id(struct vfs_handle_struct *handle,
+ const SMB_STRUCT_STAT *sbuf);
NTSTATUS smb_vfs_call_streaminfo(struct vfs_handle_struct *handle,
struct files_struct *fsp,
const struct smb_filename *smb_fname,
uint flags);
struct file_id vfs_not_implemented_file_id_create(vfs_handle_struct *handle,
const SMB_STRUCT_STAT *sbuf);
+uint64_t vfs_not_implemented_fs_file_id(vfs_handle_struct *handle,
+ const SMB_STRUCT_STAT *sbuf);
struct tevent_req *vfs_not_implemented_offload_read_send(
TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
#define SMB_VFS_NEXT_FILE_ID_CREATE(handle, sbuf) \
smb_vfs_call_file_id_create((handle)->next, (sbuf))
+#define SMB_VFS_FS_FILE_ID(conn, sbuf) \
+ smb_vfs_call_fs_file_id((conn)->vfs_handles, (sbuf))
+#define SMB_VFS_NEXT_FS_FILE_ID(handle, sbuf) \
+ smb_vfs_call_fs_file_id((handle)->next, (sbuf))
+
#define SMB_VFS_STREAMINFO(conn, fsp, smb_fname, mem_ctx, num_streams, streams) \
smb_vfs_call_streaminfo((conn)->vfs_handles, (fsp), (smb_fname), (mem_ctx), (num_streams), (streams))
#define SMB_VFS_NEXT_STREAMINFO(handle, fsp, smb_fname, mem_ctx, num_streams, streams) \
SMB_VFS_OP_REALPATH,
SMB_VFS_OP_CHFLAGS,
SMB_VFS_OP_FILE_ID_CREATE,
+ SMB_VFS_OP_FS_FILE_ID,
SMB_VFS_OP_STREAMINFO,
SMB_VFS_OP_GET_REAL_FILENAME,
SMB_VFS_OP_CONNECTPATH,
{ SMB_VFS_OP_REALPATH, "realpath" },
{ SMB_VFS_OP_CHFLAGS, "chflags" },
{ SMB_VFS_OP_FILE_ID_CREATE, "file_id_create" },
+ { SMB_VFS_OP_FS_FILE_ID, "fs_file_id" },
{ SMB_VFS_OP_STREAMINFO, "streaminfo" },
{ SMB_VFS_OP_GET_REAL_FILENAME, "get_real_filename" },
{ SMB_VFS_OP_CONNECTPATH, "connectpath" },
return result;
}
+static uint64_t smb_full_audit_fs_file_id(struct vfs_handle_struct *handle,
+ const SMB_STRUCT_STAT *sbuf)
+{
+ uint64_t result;
+
+ result = SMB_VFS_NEXT_FS_FILE_ID(handle, sbuf);
+
+ do_log(SMB_VFS_OP_FS_FILE_ID,
+ result != 0,
+ handle, "%" PRIu64, result);
+
+ return result;
+}
+
static NTSTATUS smb_full_audit_streaminfo(vfs_handle_struct *handle,
struct files_struct *fsp,
const struct smb_filename *smb_fname,
.realpath_fn = smb_full_audit_realpath,
.chflags_fn = smb_full_audit_chflags,
.file_id_create_fn = smb_full_audit_file_id_create,
+ .fs_file_id_fn = smb_full_audit_fs_file_id,
.offload_read_send_fn = smb_full_audit_offload_read_send,
.offload_read_recv_fn = smb_full_audit_offload_read_recv,
.offload_write_send_fn = smb_full_audit_offload_write_send,
return id;
}
+uint64_t vfs_not_implemented_fs_file_id(vfs_handle_struct *handle,
+ const SMB_STRUCT_STAT *sbuf)
+{
+ errno = ENOSYS;
+ return 0;
+}
+
struct vfs_not_implemented_offload_read_state {
bool dummy;
};
.realpath_fn = vfs_not_implemented_realpath,
.chflags_fn = vfs_not_implemented_chflags,
.file_id_create_fn = vfs_not_implemented_file_id_create,
+ .fs_file_id_fn = vfs_not_implemented_fs_file_id,
.offload_read_send_fn = vfs_not_implemented_offload_read_send,
.offload_read_recv_fn = vfs_not_implemented_offload_read_recv,
.offload_write_send_fn = vfs_not_implemented_offload_write_send,
return result;
}
+static uint64_t smb_time_audit_fs_file_id(struct vfs_handle_struct *handle,
+ const SMB_STRUCT_STAT *sbuf)
+{
+ uint64_t result;
+ struct timespec ts1,ts2;
+ double timediff;
+
+ clock_gettime_mono(&ts1);
+ result = SMB_VFS_NEXT_FS_FILE_ID(handle, sbuf);
+ clock_gettime_mono(&ts2);
+ timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
+
+ if (timediff > audit_timeout) {
+ smb_time_audit_log("fs_file_id", timediff);
+ }
+
+ return result;
+}
+
static NTSTATUS smb_time_audit_streaminfo(vfs_handle_struct *handle,
struct files_struct *fsp,
const struct smb_filename *smb_fname,
.realpath_fn = smb_time_audit_realpath,
.chflags_fn = smb_time_audit_chflags,
.file_id_create_fn = smb_time_audit_file_id_create,
+ .fs_file_id_fn = smb_time_audit_fs_file_id,
.offload_read_send_fn = smb_time_audit_offload_read_send,
.offload_read_recv_fn = smb_time_audit_offload_read_recv,
.offload_write_send_fn = smb_time_audit_offload_write_send,
return handle->fns->file_id_create_fn(handle, sbuf);
}
+uint64_t smb_vfs_call_fs_file_id(struct vfs_handle_struct *handle,
+ const SMB_STRUCT_STAT *sbuf)
+{
+ VFS_FIND(fs_file_id);
+ return handle->fns->fs_file_id_fn(handle, sbuf);
+}
+
NTSTATUS smb_vfs_call_streaminfo(struct vfs_handle_struct *handle,
struct files_struct *fsp,
const struct smb_filename *smb_fname,