From patchwork Tue Nov 8 16:33:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Aur=C3=A9lien_Aptel?= X-Patchwork-Id: 9417751 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EBF9B60512 for ; Tue, 8 Nov 2016 16:34:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DDB6228EA8 for ; Tue, 8 Nov 2016 16:34:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D286828FCA; Tue, 8 Nov 2016 16:34:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 80DBE28EA8 for ; Tue, 8 Nov 2016 16:34:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752014AbcKHQeY (ORCPT ); Tue, 8 Nov 2016 11:34:24 -0500 Received: from smtp.nue.novell.com ([195.135.221.5]:52422 "EHLO smtp.nue.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752430AbcKHQeX (ORCPT ); Tue, 8 Nov 2016 11:34:23 -0500 Received: from nwb-ext-pat.microfocus.com ([10.120.13.103]) by smtp.nue.novell.com with ESMTP (TLS encrypted); Tue, 08 Nov 2016 17:34:21 +0100 Received: from localhost (nwb-a10-snat.microfocus.com [10.120.13.201]) by nwb-ext-pat.microfocus.com with ESMTP (TLS encrypted); Tue, 08 Nov 2016 16:33:56 +0000 From: Aurelien Aptel To: linux-cifs@vger.kernel.org Cc: Aurelien Aptel Subject: [PATCH v1 4/6] fs/cifs: add build_path_from_dentry_optional_prefix() Date: Tue, 8 Nov 2016 17:33:24 +0100 Message-Id: <1478622806-19636-5-git-send-email-aaptel@suse.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1478622806-19636-1-git-send-email-aaptel@suse.com> References: <1478622806-19636-1-git-send-email-aaptel@suse.com> Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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;