diff options
author | Steve French <smfrench@gmail.com> | 2012-11-28 23:34:41 -0500 |
---|---|---|
committer | Steve French <smfrench@gmail.com> | 2012-12-05 14:27:28 -0500 |
commit | 6d3ea7e4975aed451fbee4dea2fef63b0de8cb4f (patch) | |
tree | 499881d40ec894a38bf017328fb48ebbaa30ec1b /fs/cifs/dir.c | |
parent | e5e69abd058b3fcfd484dbe1c632347332cda9b6 (diff) |
CIFS: Make use of common cifs_build_path_to_root for CIFS and SMB2
because the is no difference here. This also adds support of prefixpath
mount option for SMB2.
Signed-off-by: Pavel Shilovsky <piastry@etersoft.ru>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs/dir.c')
-rw-r--r-- | fs/cifs/dir.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index d3671f2acb29..3b7e0c1266f7 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c | |||
@@ -44,6 +44,37 @@ renew_parental_timestamps(struct dentry *direntry) | |||
44 | } while (!IS_ROOT(direntry)); | 44 | } while (!IS_ROOT(direntry)); |
45 | } | 45 | } |
46 | 46 | ||
47 | char * | ||
48 | cifs_build_path_to_root(struct smb_vol *vol, struct cifs_sb_info *cifs_sb, | ||
49 | struct cifs_tcon *tcon) | ||
50 | { | ||
51 | int pplen = vol->prepath ? strlen(vol->prepath) : 0; | ||
52 | int dfsplen; | ||
53 | char *full_path = NULL; | ||
54 | |||
55 | /* if no prefix path, simply set path to the root of share to "" */ | ||
56 | if (pplen == 0) { | ||
57 | full_path = kzalloc(1, GFP_KERNEL); | ||
58 | return full_path; | ||
59 | } | ||
60 | |||
61 | if (tcon->Flags & SMB_SHARE_IS_IN_DFS) | ||
62 | dfsplen = strnlen(tcon->treeName, MAX_TREE_SIZE + 1); | ||
63 | else | ||
64 | dfsplen = 0; | ||
65 | |||
66 | full_path = kmalloc(dfsplen + pplen + 1, GFP_KERNEL); | ||
67 | if (full_path == NULL) | ||
68 | return full_path; | ||
69 | |||
70 | if (dfsplen) | ||
71 | strncpy(full_path, tcon->treeName, dfsplen); | ||
72 | strncpy(full_path + dfsplen, vol->prepath, pplen); | ||
73 | convert_delimiter(full_path, CIFS_DIR_SEP(cifs_sb)); | ||
74 | full_path[dfsplen + pplen] = 0; /* add trailing null */ | ||
75 | return full_path; | ||
76 | } | ||
77 | |||
47 | /* Note: caller must free return buffer */ | 78 | /* Note: caller must free return buffer */ |
48 | char * | 79 | char * |
49 | build_path_from_dentry(struct dentry *direntry) | 80 | build_path_from_dentry(struct dentry *direntry) |