Commit c6c00919 authored by Steve French's avatar Steve French

[CIFS] Rename compose_mount_options to cifs_compose_mount_options.

Make it available to others for reuse.
Signed-off-by: default avatarIgor Mammedov <niallain@gmail.com>
Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent 64cc2c63
...@@ -104,9 +104,9 @@ static char *cifs_get_share_name(const char *node_name) ...@@ -104,9 +104,9 @@ static char *cifs_get_share_name(const char *node_name)
/** /**
* compose_mount_options - creates mount options for refferral * cifs_compose_mount_options - creates mount options for refferral
* @sb_mountdata: parent/root DFS mount options (template) * @sb_mountdata: parent/root DFS mount options (template)
* @dentry: point where we are going to mount * @fullpath: full path in UNC format
* @ref: server's referral * @ref: server's referral
* @devname: pointer for saving device name * @devname: pointer for saving device name
* *
...@@ -116,8 +116,8 @@ static char *cifs_get_share_name(const char *node_name) ...@@ -116,8 +116,8 @@ static char *cifs_get_share_name(const char *node_name)
* Returns: pointer to new mount options or ERR_PTR. * Returns: pointer to new mount options or ERR_PTR.
* Caller is responcible for freeing retunrned value if it is not error. * Caller is responcible for freeing retunrned value if it is not error.
*/ */
static char *compose_mount_options(const char *sb_mountdata, char *cifs_compose_mount_options(const char *sb_mountdata,
struct dentry *dentry, const char *fullpath,
const struct dfs_info3_param *ref, const struct dfs_info3_param *ref,
char **devname) char **devname)
{ {
...@@ -128,7 +128,6 @@ static char *compose_mount_options(const char *sb_mountdata, ...@@ -128,7 +128,6 @@ static char *compose_mount_options(const char *sb_mountdata,
char *srvIP = NULL; char *srvIP = NULL;
char sep = ','; char sep = ',';
int off, noff; int off, noff;
char *fullpath;
if (sb_mountdata == NULL) if (sb_mountdata == NULL)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
...@@ -202,17 +201,6 @@ static char *compose_mount_options(const char *sb_mountdata, ...@@ -202,17 +201,6 @@ static char *compose_mount_options(const char *sb_mountdata,
goto compose_mount_options_err; goto compose_mount_options_err;
} }
/*
* this function gives us a path with a double backslash prefix. We
* require a single backslash for DFS. Temporarily increment fullpath
* to put it in the proper form and decrement before freeing it.
*/
fullpath = build_path_from_dentry(dentry);
if (!fullpath) {
rc = -ENOMEM;
goto compose_mount_options_err;
}
++fullpath;
tkn_e = strchr(tkn_e + 1, '\\'); tkn_e = strchr(tkn_e + 1, '\\');
if (tkn_e || (strlen(fullpath) - ref->path_consumed)) { if (tkn_e || (strlen(fullpath) - ref->path_consumed)) {
strncat(mountdata, &sep, 1); strncat(mountdata, &sep, 1);
...@@ -221,8 +209,6 @@ static char *compose_mount_options(const char *sb_mountdata, ...@@ -221,8 +209,6 @@ static char *compose_mount_options(const char *sb_mountdata,
strcat(mountdata, tkn_e + 1); strcat(mountdata, tkn_e + 1);
strcat(mountdata, fullpath + ref->path_consumed); strcat(mountdata, fullpath + ref->path_consumed);
} }
--fullpath;
kfree(fullpath);
/*cFYI(1,("%s: parent mountdata: %s", __func__,sb_mountdata));*/ /*cFYI(1,("%s: parent mountdata: %s", __func__,sb_mountdata));*/
/*cFYI(1, ("%s: submount mountdata: %s", __func__, mountdata ));*/ /*cFYI(1, ("%s: submount mountdata: %s", __func__, mountdata ));*/
...@@ -245,10 +231,20 @@ static struct vfsmount *cifs_dfs_do_refmount(const struct vfsmount *mnt_parent, ...@@ -245,10 +231,20 @@ static struct vfsmount *cifs_dfs_do_refmount(const struct vfsmount *mnt_parent,
struct vfsmount *mnt; struct vfsmount *mnt;
char *mountdata; char *mountdata;
char *devname = NULL; char *devname = NULL;
char *fullpath;
cifs_sb = CIFS_SB(dentry->d_inode->i_sb); cifs_sb = CIFS_SB(dentry->d_inode->i_sb);
mountdata = compose_mount_options(cifs_sb->mountdata, /*
dentry, ref, &devname); * this function gives us a path with a double backslash prefix. We
* require a single backslash for DFS.
*/
fullpath = build_path_from_dentry(dentry);
if (!fullpath)
return ERR_PTR(-ENOMEM);
mountdata = cifs_compose_mount_options(cifs_sb->mountdata,
fullpath + 1, ref, &devname);
kfree(fullpath);
if (IS_ERR(mountdata)) if (IS_ERR(mountdata))
return (struct vfsmount *)mountdata; return (struct vfsmount *)mountdata;
......
...@@ -44,6 +44,9 @@ extern void _FreeXid(unsigned int); ...@@ -44,6 +44,9 @@ extern void _FreeXid(unsigned int);
extern char *build_path_from_dentry(struct dentry *); extern char *build_path_from_dentry(struct dentry *);
extern char *cifs_build_path_to_root(struct cifs_sb_info *cifs_sb); extern char *cifs_build_path_to_root(struct cifs_sb_info *cifs_sb);
extern char *build_wildcard_path_from_dentry(struct dentry *direntry); extern char *build_wildcard_path_from_dentry(struct dentry *direntry);
extern char *cifs_compose_mount_options(const char *sb_mountdata,
const char *fullpath, const struct dfs_info3_param *ref,
char **devname);
/* extern void renew_parental_timestamps(struct dentry *direntry);*/ /* extern void renew_parental_timestamps(struct dentry *direntry);*/
extern int SendReceive(const unsigned int /* xid */ , struct cifsSesInfo *, extern int SendReceive(const unsigned int /* xid */ , struct cifsSesInfo *,
struct smb_hdr * /* input */ , struct smb_hdr * /* input */ ,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment