From f6650f5d19ad90b8e1f392efbe211c4ffa0e70c0 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 16 Nov 2009 09:49:23 +0100 Subject: s3: Do not talloc in readdir This is a hot codepath (called from the stat cache) --- source3/include/proto.h | 7 ++++--- source3/include/vfs.h | 12 ++++++++---- source3/include/vfs_macros.h | 8 ++++---- 3 files changed, 16 insertions(+), 11 deletions(-) (limited to 'source3/include') diff --git a/source3/include/proto.h b/source3/include/proto.h index 6f971c3a07..9450140b90 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -6219,8 +6219,8 @@ bool get_dir_entry(TALLOC_CTX *ctx, bool is_visible_file(connection_struct *conn, const char *dir_path, const char *name, SMB_STRUCT_STAT *pst, bool use_veto); struct smb_Dir *OpenDir(TALLOC_CTX *mem_ctx, connection_struct *conn, const char *name, const char *mask, uint32 attr); -char *ReadDirName(struct smb_Dir *dirp, long *poffset, - SMB_STRUCT_STAT *sbuf); +const char *ReadDirName(struct smb_Dir *dirp, long *poffset, + SMB_STRUCT_STAT *sbuf, char **talloced); void RewindDir(struct smb_Dir *dirp, long *poffset); void SeekDir(struct smb_Dir *dirp, long offset); long TellDir(struct smb_Dir *dirp); @@ -7145,7 +7145,8 @@ int vfs_allocate_file_space(files_struct *fsp, uint64_t len); int vfs_set_filelen(files_struct *fsp, SMB_OFF_T len); int vfs_fill_sparse(files_struct *fsp, SMB_OFF_T len); SMB_OFF_T vfs_transfer_file(files_struct *in, files_struct *out, SMB_OFF_T n); -char *vfs_readdirname(connection_struct *conn, void *p, SMB_STRUCT_STAT *sbuf); +const char *vfs_readdirname(connection_struct *conn, void *p, + SMB_STRUCT_STAT *sbuf, char **talloced); int vfs_ChDir(connection_struct *conn, const char *path); char *vfs_GetWd(TALLOC_CTX *ctx, connection_struct *conn); NTSTATUS check_reduced_name(connection_struct *conn, const char *fname); diff --git a/source3/include/vfs.h b/source3/include/vfs.h index f9c1f0a54f..aee84a70b7 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -308,8 +308,10 @@ struct vfs_fn_pointers { struct lock_struct *plock); NTSTATUS (*translate_name)(struct vfs_handle_struct *handle, - char **mapped_name, - enum vfs_translate_direction direction); + const char *name, + enum vfs_translate_direction direction, + TALLOC_CTX *mem_ctx, + char **mapped_name); /* NT ACL operations. */ @@ -658,8 +660,10 @@ void smb_vfs_call_strict_unlock(struct vfs_handle_struct *handle, struct files_struct *fsp, struct lock_struct *plock); NTSTATUS smb_vfs_call_translate_name(struct vfs_handle_struct *handle, - char **mapped_name, - enum vfs_translate_direction direction); + const char *name, + enum vfs_translate_direction direction, + TALLOC_CTX *mem_ctx, + char **mapped_name); NTSTATUS smb_vfs_call_fget_nt_acl(struct vfs_handle_struct *handle, struct files_struct *fsp, uint32 security_info, diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 7206bf41bb..c6f83bda07 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -345,10 +345,10 @@ #define SMB_VFS_NEXT_STRICT_UNLOCK(handle, fsp, plock) \ smb_vfs_call_strict_unlock((handle)->next, (fsp), (plock)) -#define SMB_VFS_TRANSLATE_NAME(conn, mapped_name, direction) \ - smb_vfs_call_translate_name((conn)->vfs_handles, (mapped_name), (direction)) -#define SMB_VFS_NEXT_TRANSLATE_NAME(handle, mapped_name, direction) \ - smb_vfs_call_translate_name((handle)->next, (mapped_name), (direction)) +#define SMB_VFS_TRANSLATE_NAME(conn, name, direction, mem_ctx, mapped_name) \ + smb_vfs_call_translate_name((conn)->vfs_handles, (name), (direction), (mem_ctx), (mapped_name)) +#define SMB_VFS_NEXT_TRANSLATE_NAME(handle, name, direction, mem_ctx, mapped_name) \ + smb_vfs_call_translate_name((handle)->next, (name), (direction), (mem_ctx), (mapped_name)) #define SMB_VFS_NEXT_STRICT_UNLOCK(handle, fsp, plock) \ smb_vfs_call_strict_unlock((handle)->next, (fsp), (plock)) -- cgit