cifs: rename smb_vol as smb3_fs_context and move it to fs_context.h

Harmonize and change all such variables to 'ctx', where possible.
No changes to actual logic.

Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
diff --git a/fs/cifs/dfs_cache.c b/fs/cifs/dfs_cache.c
index 6ee8496..3860241 100644
--- a/fs/cifs/dfs_cache.c
+++ b/fs/cifs/dfs_cache.c
@@ -20,6 +20,7 @@
 #include "smb2glob.h"
 
 #include "dfs_cache.h"
+#include "fs_context.h"
 
 #define CACHE_HTABLE_SIZE 32
 #define CACHE_MAX_ENTRIES 64
@@ -48,8 +49,8 @@ struct cache_entry {
 
 struct vol_info {
 	char *fullpath;
-	spinlock_t smb_vol_lock;
-	struct smb_vol smb_vol;
+	spinlock_t ctx_lock;
+	struct smb3_fs_context ctx;
 	char *mntdata;
 	struct list_head list;
 	struct list_head rlist;
@@ -586,7 +587,7 @@ static void __vol_release(struct vol_info *vi)
 {
 	kfree(vi->fullpath);
 	kfree(vi->mntdata);
-	cifs_cleanup_volume_info_contents(&vi->smb_vol);
+	cifs_cleanup_volume_info_contents(&vi->ctx);
 	kfree(vi);
 }
 
@@ -1140,43 +1141,43 @@ int dfs_cache_get_tgt_referral(const char *path,
 	return rc;
 }
 
-static int dup_vol(struct smb_vol *vol, struct smb_vol *new)
+static int dup_vol(struct smb3_fs_context *ctx, struct smb3_fs_context *new)
 {
-	memcpy(new, vol, sizeof(*new));
+	memcpy(new, ctx, sizeof(*new));
 
-	if (vol->username) {
-		new->username = kstrndup(vol->username, strlen(vol->username),
+	if (ctx->username) {
+		new->username = kstrndup(ctx->username, strlen(ctx->username),
 					 GFP_KERNEL);
 		if (!new->username)
 			return -ENOMEM;
 	}
-	if (vol->password) {
-		new->password = kstrndup(vol->password, strlen(vol->password),
+	if (ctx->password) {
+		new->password = kstrndup(ctx->password, strlen(ctx->password),
 					 GFP_KERNEL);
 		if (!new->password)
 			goto err_free_username;
 	}
-	if (vol->UNC) {
-		cifs_dbg(FYI, "%s: vol->UNC: %s\n", __func__, vol->UNC);
-		new->UNC = kstrndup(vol->UNC, strlen(vol->UNC), GFP_KERNEL);
+	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 (vol->domainname) {
-		new->domainname = kstrndup(vol->domainname,
-					   strlen(vol->domainname), GFP_KERNEL);
+	if (ctx->domainname) {
+		new->domainname = kstrndup(ctx->domainname,
+					   strlen(ctx->domainname), GFP_KERNEL);
 		if (!new->domainname)
 			goto err_free_unc;
 	}
-	if (vol->iocharset) {
-		new->iocharset = kstrndup(vol->iocharset,
-					  strlen(vol->iocharset), GFP_KERNEL);
+	if (ctx->iocharset) {
+		new->iocharset = kstrndup(ctx->iocharset,
+					  strlen(ctx->iocharset), GFP_KERNEL);
 		if (!new->iocharset)
 			goto err_free_domainname;
 	}
-	if (vol->prepath) {
-		cifs_dbg(FYI, "%s: vol->prepath: %s\n", __func__, vol->prepath);
-		new->prepath = kstrndup(vol->prepath, strlen(vol->prepath),
+	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;
@@ -1203,17 +1204,17 @@ static int dup_vol(struct smb_vol *vol, struct smb_vol *new)
  * DFS cache refresh worker.
  *
  * @mntdata: mount data.
- * @vol: cifs volume.
+ * @ctx: cifs context.
  * @fullpath: origin full path.
  *
  * Return zero if volume was set up correctly, otherwise non-zero.
  */
-int dfs_cache_add_vol(char *mntdata, struct smb_vol *vol, const char *fullpath)
+int dfs_cache_add_vol(char *mntdata, struct smb3_fs_context *ctx, const char *fullpath)
 {
 	int rc;
 	struct vol_info *vi;
 
-	if (!vol || !fullpath || !mntdata)
+	if (!ctx || !fullpath || !mntdata)
 		return -EINVAL;
 
 	cifs_dbg(FYI, "%s: fullpath: %s\n", __func__, fullpath);
@@ -1228,12 +1229,12 @@ int dfs_cache_add_vol(char *mntdata, struct smb_vol *vol, const char *fullpath)
 		goto err_free_vi;
 	}
 
-	rc = dup_vol(vol, &vi->smb_vol);
+	rc = dup_vol(ctx, &vi->ctx);
 	if (rc)
 		goto err_free_fullpath;
 
 	vi->mntdata = mntdata;
-	spin_lock_init(&vi->smb_vol_lock);
+	spin_lock_init(&vi->ctx_lock);
 	kref_init(&vi->refcnt);
 
 	spin_lock(&vol_list_lock);
@@ -1289,10 +1290,10 @@ int dfs_cache_update_vol(const char *fullpath, struct TCP_Server_Info *server)
 	spin_unlock(&vol_list_lock);
 
 	cifs_dbg(FYI, "%s: updating volume info\n", __func__);
-	spin_lock(&vi->smb_vol_lock);
-	memcpy(&vi->smb_vol.dstaddr, &server->dstaddr,
-	       sizeof(vi->smb_vol.dstaddr));
-	spin_unlock(&vi->smb_vol_lock);
+	spin_lock(&vi->ctx_lock);
+	memcpy(&vi->ctx.dstaddr, &server->dstaddr,
+	       sizeof(vi->ctx.dstaddr));
+	spin_unlock(&vi->ctx_lock);
 
 	kref_put(&vi->refcnt, vol_release);
 
@@ -1445,11 +1446,11 @@ static inline void put_tcp_server(struct TCP_Server_Info *server)
 	cifs_put_tcp_session(server, 0);
 }
 
-static struct TCP_Server_Info *get_tcp_server(struct smb_vol *vol)
+static struct TCP_Server_Info *get_tcp_server(struct smb3_fs_context *ctx)
 {
 	struct TCP_Server_Info *server;
 
-	server = cifs_find_tcp_session(vol);
+	server = cifs_find_tcp_session(ctx);
 	if (IS_ERR_OR_NULL(server))
 		return NULL;
 
@@ -1476,7 +1477,7 @@ static struct cifs_ses *find_root_ses(struct vol_info *vi,
 	char *mdata = NULL, *devname = NULL;
 	struct TCP_Server_Info *server;
 	struct cifs_ses *ses;
-	struct smb_vol vol = {NULL};
+	struct smb3_fs_context ctx = {NULL};
 
 	rpath = get_dfs_root(path);
 	if (IS_ERR(rpath))
@@ -1510,7 +1511,7 @@ static struct cifs_ses *find_root_ses(struct vol_info *vi,
 		goto out;
 	}
 
-	rc = cifs_setup_volume_info(&vol, mdata, devname, false);
+	rc = cifs_setup_volume_info(&ctx, mdata, devname, false);
 	kfree(devname);
 
 	if (rc) {
@@ -1518,16 +1519,16 @@ static struct cifs_ses *find_root_ses(struct vol_info *vi,
 		goto out;
 	}
 
-	server = get_tcp_server(&vol);
+	server = get_tcp_server(&ctx);
 	if (!server) {
 		ses = ERR_PTR(-EHOSTDOWN);
 		goto out;
 	}
 
-	ses = cifs_get_smb_ses(server, &vol);
+	ses = cifs_get_smb_ses(server, &ctx);
 
 out:
-	cifs_cleanup_volume_info_contents(&vol);
+	cifs_cleanup_volume_info_contents(&ctx);
 	kfree(mdata);
 	kfree(rpath);
 
@@ -1619,7 +1620,7 @@ static void refresh_cache_worker(struct work_struct *work)
 	 */
 	spin_lock(&vol_list_lock);
 	list_for_each_entry(vi, &vol_list, list) {
-		server = get_tcp_server(&vi->smb_vol);
+		server = get_tcp_server(&vi->ctx);
 		if (!server)
 			continue;
 
@@ -1631,9 +1632,9 @@ static void refresh_cache_worker(struct work_struct *work)
 
 	/* Walk through all TCONs and refresh any expired cache entry */
 	list_for_each_entry_safe(vi, nvi, &vols, rlist) {
-		spin_lock(&vi->smb_vol_lock);
-		server = get_tcp_server(&vi->smb_vol);
-		spin_unlock(&vi->smb_vol_lock);
+		spin_lock(&vi->ctx_lock);
+		server = get_tcp_server(&vi->ctx);
+		spin_unlock(&vi->ctx_lock);
 
 		if (!server)
 			goto next_vol;