summaryrefslogtreecommitdiff
path: root/fs/cifs/dfs_cache.c
diff options
context:
space:
mode:
authorRonnie Sahlberg <lsahlber@redhat.com>2020-11-02 09:36:24 +1000
committerSteve French <stfrench@microsoft.com>2020-12-13 19:12:07 -0600
commit837e3a1bbfdc105216972c83f693e96969c62351 (patch)
treec82bc65764b3db66cd7c7252f9fde759e0772e7f /fs/cifs/dfs_cache.c
parent3fa1c6d1b8f5c3d9be9e8047ad894ab3de67dc6e (diff)
cifs: rename dup_vol to smb3_fs_context_dup and move it into fs_context.c
Continue restructuring needed for support of new mount API Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs/dfs_cache.c')
-rw-r--r--fs/cifs/dfs_cache.c60
1 files changed, 1 insertions, 59 deletions
diff --git a/fs/cifs/dfs_cache.c b/fs/cifs/dfs_cache.c
index 3860241dcc03..2b77d39d7d22 100644
--- a/fs/cifs/dfs_cache.c
+++ b/fs/cifs/dfs_cache.c
@@ -1141,64 +1141,6 @@ out_unlock:
return rc;
}
-static int dup_vol(struct smb3_fs_context *ctx, struct smb3_fs_context *new)
-{
- memcpy(new, ctx, sizeof(*new));
-
- if (ctx->username) {
- new->username = kstrndup(ctx->username, strlen(ctx->username),
- GFP_KERNEL);
- if (!new->username)
- return -ENOMEM;
- }
- if (ctx->password) {
- new->password = kstrndup(ctx->password, strlen(ctx->password),
- GFP_KERNEL);
- if (!new->password)
- goto err_free_username;
- }
- if (ctx->UNC) {
- cifs_dbg(FYI, "%s: ctx->UNC: %s\n", __func__, ctx->UNC);
- new->UNC = kstrndup(ctx->UNC, strlen(ctx->UNC), GFP_KERNEL);
- if (!new->UNC)
- goto err_free_password;
- }
- if (ctx->domainname) {
- new->domainname = kstrndup(ctx->domainname,
- strlen(ctx->domainname), GFP_KERNEL);
- if (!new->domainname)
- goto err_free_unc;
- }
- if (ctx->iocharset) {
- new->iocharset = kstrndup(ctx->iocharset,
- strlen(ctx->iocharset), GFP_KERNEL);
- if (!new->iocharset)
- goto err_free_domainname;
- }
- if (ctx->prepath) {
- cifs_dbg(FYI, "%s: ctx->prepath: %s\n", __func__, ctx->prepath);
- new->prepath = kstrndup(ctx->prepath, strlen(ctx->prepath),
- GFP_KERNEL);
- if (!new->prepath)
- goto err_free_iocharset;
- }
-
- return 0;
-
-err_free_iocharset:
- kfree(new->iocharset);
-err_free_domainname:
- kfree(new->domainname);
-err_free_unc:
- kfree(new->UNC);
-err_free_password:
- kfree_sensitive(new->password);
-err_free_username:
- kfree(new->username);
- kfree(new);
- return -ENOMEM;
-}
-
/**
* dfs_cache_add_vol - add a cifs volume during mount() that will be handled by
* DFS cache refresh worker.
@@ -1229,7 +1171,7 @@ int dfs_cache_add_vol(char *mntdata, struct smb3_fs_context *ctx, const char *fu
goto err_free_vi;
}
- rc = dup_vol(ctx, &vi->ctx);
+ rc = smb3_fs_context_dup(&vi->ctx, ctx);
if (rc)
goto err_free_fullpath;