From 6085ba3dec4fa616fca78c55b793cfd89ef272a8 Mon Sep 17 00:00:00 2001 From: Aravind Srinivasan Date: Fri, 13 Feb 2009 11:07:46 -0800 Subject: s3 OneFS: Add vfs implementation for SMB_VFS_GET_REAL_FILE_NAME --- source3/modules/vfs_onefs.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'source3/modules') diff --git a/source3/modules/vfs_onefs.c b/source3/modules/vfs_onefs.c index 860a3ae7d9..123139f729 100644 --- a/source3/modules/vfs_onefs.c +++ b/source3/modules/vfs_onefs.c @@ -205,6 +205,45 @@ static int onefs_statvfs(vfs_handle_struct *handle, const char *path, return result; } +static int onefs_get_real_filename(vfs_handle_struct *handle, const char *path, + const char *name, TALLOC_CTX *mem_ctx, + char **found_name) +{ + SMB_STRUCT_STAT sb; + struct stat_extra se; + int result; + char *full_name = NULL; + + ZERO_STRUCT(se); + se.se_version = ESTAT_CURRENT_VERSION; + se.se_flags = ESTAT_CASE_INSENSITIVE | ESTAT_SYMLINK_NOFOLLOW; + + if (*path != '\0') { + if (!(full_name = talloc_asprintf(mem_ctx, "%s/%s", path, name))) { + errno = ENOMEM; + DEBUG(2, ("talloc_asprintf failed\n")); + result = -1; + goto done; + } + } + + if ((result = estat(full_name ? full_name : name, &sb, &se)) != 0) { + DEBUG(2, ("error calling estat: %s\n", strerror(errno))); + goto done; + } + + *found_name = talloc_strdup(mem_ctx, se.se_realname); + if (*found_name == NULL) { + errno = ENOMEM; + result = -1; + goto done; + } + +done: + TALLOC_FREE(full_name); + return result; +} + static int onefs_ntimes(vfs_handle_struct *handle, const char *fname, struct smb_file_time *ft) { @@ -302,6 +341,8 @@ static vfs_op_tuple onefs_ops[] = { SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(onefs_statvfs), SMB_VFS_OP_STATVFS, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(onefs_get_real_filename), SMB_VFS_OP_GET_REAL_FILENAME, + SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(NULL), SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} }; -- cgit