diff options
author | Pavel Shilovsky <pshilovsky@samba.org> | 2012-05-27 12:39:52 -0400 |
---|---|---|
committer | Pavel Shilovsky <pshilovsky@samba.org> | 2012-07-24 13:55:10 -0400 |
commit | 9224dfc2f92f4faff7b3d9e169255278129b47e8 (patch) | |
tree | 43a5736568aaf772a1612d15d55781d33a643fd5 /fs/cifs/smb1ops.c | |
parent | be4cb9e3d4ef7af1aaf66cebab1391ff91b48beb (diff) |
CIFS: Move building path to root to ops struct
Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org>
Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs/smb1ops.c')
-rw-r--r-- | fs/cifs/smb1ops.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c index fa210010358d..7195fadf1cfa 100644 --- a/fs/cifs/smb1ops.c +++ b/fs/cifs/smb1ops.c | |||
@@ -489,6 +489,37 @@ cifs_get_srv_inum(const unsigned int xid, struct cifs_tcon *tcon, | |||
489 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 489 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
490 | } | 490 | } |
491 | 491 | ||
492 | static char * | ||
493 | cifs_build_path_to_root(struct smb_vol *vol, struct cifs_sb_info *cifs_sb, | ||
494 | struct cifs_tcon *tcon) | ||
495 | { | ||
496 | int pplen = vol->prepath ? strlen(vol->prepath) : 0; | ||
497 | int dfsplen; | ||
498 | char *full_path = NULL; | ||
499 | |||
500 | /* if no prefix path, simply set path to the root of share to "" */ | ||
501 | if (pplen == 0) { | ||
502 | full_path = kzalloc(1, GFP_KERNEL); | ||
503 | return full_path; | ||
504 | } | ||
505 | |||
506 | if (tcon->Flags & SMB_SHARE_IS_IN_DFS) | ||
507 | dfsplen = strnlen(tcon->treeName, MAX_TREE_SIZE + 1); | ||
508 | else | ||
509 | dfsplen = 0; | ||
510 | |||
511 | full_path = kmalloc(dfsplen + pplen + 1, GFP_KERNEL); | ||
512 | if (full_path == NULL) | ||
513 | return full_path; | ||
514 | |||
515 | if (dfsplen) | ||
516 | strncpy(full_path, tcon->treeName, dfsplen); | ||
517 | strncpy(full_path + dfsplen, vol->prepath, pplen); | ||
518 | convert_delimiter(full_path, CIFS_DIR_SEP(cifs_sb)); | ||
519 | full_path[dfsplen + pplen] = 0; /* add trailing null */ | ||
520 | return full_path; | ||
521 | } | ||
522 | |||
492 | struct smb_version_operations smb1_operations = { | 523 | struct smb_version_operations smb1_operations = { |
493 | .send_cancel = send_nt_cancel, | 524 | .send_cancel = send_nt_cancel, |
494 | .compare_fids = cifs_compare_fids, | 525 | .compare_fids = cifs_compare_fids, |
@@ -518,6 +549,7 @@ struct smb_version_operations smb1_operations = { | |||
518 | .is_path_accessible = cifs_is_path_accessible, | 549 | .is_path_accessible = cifs_is_path_accessible, |
519 | .query_path_info = cifs_query_path_info, | 550 | .query_path_info = cifs_query_path_info, |
520 | .get_srv_inum = cifs_get_srv_inum, | 551 | .get_srv_inum = cifs_get_srv_inum, |
552 | .build_path_to_root = cifs_build_path_to_root, | ||
521 | }; | 553 | }; |
522 | 554 | ||
523 | struct smb_version_values smb1_values = { | 555 | struct smb_version_values smb1_values = { |