diff options
author | Aravind Srinivasan <aravind.srinivasan@isilon.com> | 2009-02-13 11:07:46 -0800 |
---|---|---|
committer | Tim Prouty <tprouty@samba.org> | 2009-02-13 12:59:30 -0800 |
commit | 6085ba3dec4fa616fca78c55b793cfd89ef272a8 (patch) | |
tree | bbfe3ca2d4c49f0e309abe8aa3b6ff2f44c7bce5 /source3/modules | |
parent | dbe2588e4659579feec76b3e1d7c4595ecdf8242 (diff) | |
download | samba-6085ba3dec4fa616fca78c55b793cfd89ef272a8.tar.gz samba-6085ba3dec4fa616fca78c55b793cfd89ef272a8.tar.bz2 samba-6085ba3dec4fa616fca78c55b793cfd89ef272a8.zip |
s3 OneFS: Add vfs implementation for SMB_VFS_GET_REAL_FILE_NAME
Diffstat (limited to 'source3/modules')
-rw-r--r-- | source3/modules/vfs_onefs.c | 41 |
1 files changed, 41 insertions, 0 deletions
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} }; |