diff options
author | Volker Lendecke <vl@samba.org> | 2008-12-10 03:17:19 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2008-12-10 18:05:26 +0100 |
commit | 21b9dec990b08a104600bf8e408e64e805a02835 (patch) | |
tree | 949c1aca56818a2a982428109345084100abf7a8 | |
parent | 31543640e6227e8dc808e365ba0bf6d2d5b08727 (diff) | |
download | samba-21b9dec990b08a104600bf8e408e64e805a02835.tar.gz samba-21b9dec990b08a104600bf8e408e64e805a02835.tar.bz2 samba-21b9dec990b08a104600bf8e408e64e805a02835.zip |
Pass the get_real_filename operation through the VFS
This is done to help file systems that can tell us about the real upper/lower
case combination given a case-insensitive file name. The sample I will soon
push is the gpfs module (recent gpfs has a get_real_filename function), others
might have a similar function to help alleviate the 1million files in a single
directory problem.
Jeremy, please comment!
Thanks,
Volker
-rw-r--r-- | source3/include/vfs.h | 8 | ||||
-rw-r--r-- | source3/include/vfs_macros.h | 3 | ||||
-rw-r--r-- | source3/modules/vfs_default.c | 12 | ||||
-rw-r--r-- | source3/smbd/filename.c | 5 |
4 files changed, 24 insertions, 4 deletions
diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 383cd327ae..d02d14b854 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -210,6 +210,7 @@ typedef enum _vfs_op_type { SMB_VFS_OP_CHFLAGS, SMB_VFS_OP_FILE_ID_CREATE, SMB_VFS_OP_STREAMINFO, + SMB_VFS_OP_GET_REAL_FILENAME, /* NT ACL operations. */ @@ -375,6 +376,12 @@ struct vfs_ops { unsigned int *num_streams, struct stream_struct **streams); + int (*get_real_filename)(struct vfs_handle_struct *handle, + const char *path, + const char *name, + TALLOC_CTX *mem_ctx, + char **found_name); + /* NT ACL operations. */ NTSTATUS (*fget_nt_acl)(struct vfs_handle_struct *handle, @@ -510,6 +517,7 @@ struct vfs_ops { struct vfs_handle_struct *chflags; struct vfs_handle_struct *file_id_create; struct vfs_handle_struct *streaminfo; + struct vfs_handle_struct *get_real_filename; /* NT ACL operations. */ diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index fa5dad8781..b008d86b3c 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -85,6 +85,7 @@ #define SMB_VFS_CHFLAGS(conn, path, flags) ((conn)->vfs.ops.chflags((conn)->vfs.handles.chflags, (path), (flags))) #define SMB_VFS_FILE_ID_CREATE(conn, dev, inode) ((conn)->vfs.ops.file_id_create((conn)->vfs.handles.file_id_create, (dev), (inode))) #define SMB_VFS_STREAMINFO(conn, fsp, fname, mem_ctx, num_streams, streams) ((conn)->vfs.ops.streaminfo((conn)->vfs.handles.streaminfo, (fsp), (fname), (mem_ctx), (num_streams), (streams))) +#define SMB_VFS_GET_REAL_FILENAME(conn, path, name, mem_ctx, found_name) ((conn)->vfs.ops.get_real_filename((conn)->vfs.handles.get_real_filename, (path), (name), (mem_ctx), (found_name))) /* NT ACL operations. */ #define SMB_VFS_FGET_NT_ACL(fsp, security_info, ppdesc) ((fsp)->conn->vfs.ops.fget_nt_acl((fsp)->conn->vfs.handles.fget_nt_acl, (fsp), (security_info), (ppdesc))) @@ -211,6 +212,7 @@ #define SMB_VFS_OPAQUE_CHFLAGS(conn, path, flags) ((conn)->vfs_opaque.ops.chflags((conn)->vfs_opaque.handles.chflags, (path), (flags))) #define SMB_VFS_OPAQUE_FILE_ID_CREATE(conn, dev, inode) ((conn)->vfs.ops_opaque.file_id_create((conn)->vfs_opaque.handles.file_id_create, (dev), (inode))) #define SMB_VFS_OPAQUE_STREAMINFO(conn, fsp, fname, mem_ctx, num_streams, streams) ((conn)->vfs_opaque.ops.streaminfo((conn)->vfs_opaque.handles.streaminfo, (fsp), (fname), (mem_ctx), (num_streams), (streams))) +#define SMB_VFS_OPAQUE_GET_REAL_FILENAME(conn, path, name, mem_ctx, found_name) ((conn)->vfs_opaque.ops.get_real_filename((conn)->vfs_opaque.handles.get_real_filename, (path), (name), (mem_ctx), (found_name))) /* NT ACL operations. */ #define SMB_VFS_OPAQUE_FGET_NT_ACL(fsp, security_info, ppdesc) ((fsp)->conn->vfs_opaque.ops.fget_nt_acl((fsp)->conn->vfs_opaque.handles.fget_nt_acl, (fsp), (security_info), (ppdesc))) @@ -338,6 +340,7 @@ #define SMB_VFS_NEXT_CHFLAGS(handle, path, flags) ((handle)->vfs_next.ops.chflags((handle)->vfs_next.handles.chflags, (path), (flags))) #define SMB_VFS_NEXT_FILE_ID_CREATE(handle, dev, inode) ((handle)->vfs_next.ops.file_id_create((handle)->vfs_next.handles.file_id_create, (dev), (inode))) #define SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname, mem_ctx, num_streams, streams) ((handle)->vfs_next.ops.streaminfo((handle)->vfs_next.handles.streaminfo, (fsp), (fname), (mem_ctx), (num_streams), (streams))) +#define SMB_VFS_NEXT_GET_REAL_FILENAME(conn, path, name, mem_ctx, found_name) ((conn)->vfs_next.ops.get_real_filename((conn)->vfs_next.handles.get_real_filename, (path), (name), (mem_ctx), (found_name))) /* NT ACL operations. */ #define SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, ppdesc) ((handle)->vfs_next.ops.fget_nt_acl((handle)->vfs_next.handles.fget_nt_acl, (fsp), (security_info), (ppdesc))) diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 6d8d8f8065..8fa8f6ae06 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -1038,6 +1038,16 @@ static NTSTATUS vfswrap_streaminfo(vfs_handle_struct *handle, return NT_STATUS_OK; } +static int vfswrap_get_real_filename(struct vfs_handle_struct *handle, + const char *path, + const char *name, + TALLOC_CTX *mem_ctx, + char **found_name) +{ + return get_real_filename(handle->conn, path, name, mem_ctx, + found_name); +} + static NTSTATUS vfswrap_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info, SEC_DESC **ppdesc) @@ -1459,6 +1469,8 @@ static vfs_op_tuple vfs_default_ops[] = { SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(vfswrap_streaminfo), SMB_VFS_OP_STREAMINFO, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(vfswrap_get_real_filename), SMB_VFS_OP_GET_REAL_FILENAME, + SMB_VFS_LAYER_OPAQUE}, /* NT ACL operations. */ diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c index c803e40649..d240ecfa64 100644 --- a/source3/smbd/filename.c +++ b/source3/smbd/filename.c @@ -26,9 +26,6 @@ #include "includes.h" -static int get_real_filename(connection_struct *conn, const char *path, - const char *name, TALLOC_CTX *mem_ctx, - char **found_name); static NTSTATUS build_stream_path(TALLOC_CTX *mem_ctx, connection_struct *conn, const char *orig_path, @@ -434,7 +431,7 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx, */ if (name_has_wildcard || - (get_real_filename( + (SMB_VFS_GET_REAL_FILENAME( conn, dirpath, start, talloc_tos(), &found_name) == -1)) { char *unmangled; |