All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aurelien Aptel <aaptel-IBi9RG/b67k@public.gmane.org>
To: linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Aurelien Aptel <aaptel-IBi9RG/b67k@public.gmane.org>
Subject: [PATCH v1 4/6] fs/cifs: add build_path_from_dentry_optional_prefix()
Date: Tue,  8 Nov 2016 17:33:24 +0100	[thread overview]
Message-ID: <1478622806-19636-5-git-send-email-aaptel@suse.com> (raw)
In-Reply-To: <1478622806-19636-1-git-send-email-aaptel-IBi9RG/b67k@public.gmane.org>

this function does the same thing as add build_path_from_dentry() but
takes a boolean parameter to decide whether or not to prefix the path
with the tree name.

Signed-off-by: Aurelien Aptel <aaptel-IBi9RG/b67k@public.gmane.org>
---
 fs/cifs/cifsproto.h |  1 +
 fs/cifs/dir.c       | 12 ++++++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
index ced0e42..76fab56 100644
--- a/fs/cifs/cifsproto.h
+++ b/fs/cifs/cifsproto.h
@@ -61,6 +61,7 @@ extern void exit_cifs_idmap(void);
 extern int init_cifs_spnego(void);
 extern void exit_cifs_spnego(void);
 extern char *build_path_from_dentry(struct dentry *);
+extern char *build_path_from_dentry_optional_prefix(struct dentry *direntry, int prefix);
 extern char *cifs_build_path_to_root(struct smb_vol *vol,
 				     struct cifs_sb_info *cifs_sb,
 				     struct cifs_tcon *tcon);
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index 789ff1d..b92e676 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -79,7 +79,15 @@ cifs_build_path_to_root(struct smb_vol *vol, struct cifs_sb_info *cifs_sb,
 
 /* Note: caller must free return buffer */
 char *
-build_path_from_dentry(struct dentry *direntry)
+build_path_from_dentry(struct dentry *direntry) {
+	struct cifs_sb_info *cifs_sb = CIFS_SB(direntry->d_sb);
+	struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb);
+	return build_path_from_dentry_optional_prefix(direntry,
+						      tcon->Flags & SMB_SHARE_IS_IN_DFS);
+}
+
+char *
+build_path_from_dentry_optional_prefix(struct dentry *direntry, int prefix)
 {
 	struct dentry *temp;
 	int namelen;
@@ -92,7 +100,7 @@ build_path_from_dentry(struct dentry *direntry)
 	unsigned seq;
 
 	dirsep = CIFS_DIR_SEP(cifs_sb);
-	if (tcon->Flags & SMB_SHARE_IS_IN_DFS)
+	if (prefix)
 		dfsplen = strnlen(tcon->treeName, MAX_TREE_SIZE + 1);
 	else
 		dfsplen = 0;
-- 
2.1.4

  parent reply	other threads:[~2016-11-08 16:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-08 16:33 [PATCH v1 0/6] Add support for DFS in smb2+ Aurelien Aptel
     [not found] ` <1478622806-19636-1-git-send-email-aaptel-IBi9RG/b67k@public.gmane.org>
2016-11-08 16:33   ` [PATCH v1 1/6] fs/cifs: add smb2 fsctl payloads for DFS resolving Aurelien Aptel
2016-11-08 16:33   ` [PATCH v1 2/6] fs/cifs: implement get_dfs_refer for smb2 Aurelien Aptel
     [not found]     ` <1478622806-19636-3-git-send-email-aaptel-IBi9RG/b67k@public.gmane.org>
2016-11-11  0:42       ` Pavel Shilovsky
2016-11-08 16:33   ` [PATCH v1 3/6] fs/cifs: always use ipc for DFS resolving ioctls Aurelien Aptel
     [not found]     ` <1478622806-19636-4-git-send-email-aaptel-IBi9RG/b67k@public.gmane.org>
2016-11-11  0:46       ` Pavel Shilovsky
2016-11-08 16:33   ` Aurelien Aptel [this message]
2016-11-08 16:33   ` [PATCH v1 5/6] fs/cifs: always use tree name prefix for DFS resolving Aurelien Aptel
2016-11-08 16:33   ` [PATCH v1 6/6] fs/cifs: enable get_dfs_refer operation for smb2+ Aurelien Aptel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1478622806-19636-5-git-send-email-aaptel@suse.com \
    --to=aaptel-ibi9rg/b67k@public.gmane.org \
    --cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.