mirror of
https://github.com/samba-team/samba.git
synced 2025-03-27 22:50:26 +03:00
s3:vfs: add SMB_VFS_FS_FILE_ID()
Not yet used, that comes next. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
d2bac65e2e
commit
71996fef09
@ -513,6 +513,13 @@ static struct file_id skel_file_id_create(vfs_handle_struct *handle,
|
||||
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;
|
||||
};
|
||||
@ -1084,6 +1091,7 @@ static struct vfs_fn_pointers skel_opaque_fns = {
|
||||
.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,
|
||||
|
@ -600,6 +600,12 @@ static struct file_id skel_file_id_create(vfs_handle_struct *handle,
|
||||
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;
|
||||
@ -1348,6 +1354,7 @@ static struct vfs_fn_pointers skel_transparent_fns = {
|
||||
.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,
|
||||
|
@ -265,6 +265,7 @@
|
||||
/* 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
|
||||
|
||||
@ -800,6 +801,8 @@ struct vfs_fn_pointers {
|
||||
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,
|
||||
@ -1327,6 +1330,8 @@ int smb_vfs_call_chflags(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,
|
||||
@ -1751,6 +1756,8 @@ int vfs_not_implemented_chflags(vfs_handle_struct *handle,
|
||||
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,
|
||||
|
@ -331,6 +331,11 @@
|
||||
#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) \
|
||||
|
@ -158,6 +158,7 @@ typedef enum _vfs_op_type {
|
||||
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,
|
||||
@ -300,6 +301,7 @@ static struct {
|
||||
{ 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" },
|
||||
@ -1820,6 +1822,20 @@ static struct file_id smb_full_audit_file_id_create(struct vfs_handle_struct *ha
|
||||
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,
|
||||
@ -2864,6 +2880,7 @@ static struct vfs_fn_pointers vfs_full_audit_fns = {
|
||||
.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,
|
||||
|
@ -511,6 +511,13 @@ struct file_id vfs_not_implemented_file_id_create(vfs_handle_struct *handle,
|
||||
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;
|
||||
};
|
||||
@ -1088,6 +1095,7 @@ static struct vfs_fn_pointers vfs_not_implemented_fns = {
|
||||
.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,
|
||||
|
@ -1520,6 +1520,25 @@ static struct file_id smb_time_audit_file_id_create(struct vfs_handle_struct *ha
|
||||
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,
|
||||
@ -2824,6 +2843,7 @@ static struct vfs_fn_pointers vfs_time_audit_fns = {
|
||||
.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,
|
||||
|
@ -2237,6 +2237,13 @@ struct file_id smb_vfs_call_file_id_create(struct vfs_handle_struct *handle,
|
||||
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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user