aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/smb1ops.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/smb1ops.c')
-rw-r--r--fs/cifs/smb1ops.c32
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
492static char *
493cifs_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
492struct smb_version_operations smb1_operations = { 523struct 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
523struct smb_version_values smb1_values = { 555struct smb_version_values smb1_values = {