Commit a6e8a845 authored by Jeff Layton's avatar Jeff Layton Committed by Steve French

cifs: add function to get a tcon from cifs_sb

When we convert cifs to do multiple sessions per mount, we'll need more
than one tcon per superblock. At that point "cifs_sb->tcon" will make
no sense. Add a new accessor function that gets a tcon given a cifs_sb.
For now, it just returns cifs_sb->tcon. Later it'll do more.
Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent ba00ba64
...@@ -316,7 +316,7 @@ cifs_dfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd) ...@@ -316,7 +316,7 @@ cifs_dfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd)
nd->path.dentry = dget(dentry); nd->path.dentry = dget(dentry);
cifs_sb = CIFS_SB(dentry->d_inode->i_sb); cifs_sb = CIFS_SB(dentry->d_inode->i_sb);
ses = cifs_sb->tcon->ses; ses = cifs_sb_tcon(cifs_sb)->ses;
if (!ses) { if (!ses) {
rc = -EINVAL; rc = -EINVAL;
......
...@@ -559,7 +559,7 @@ static struct cifs_ntsd *get_cifs_acl_by_fid(struct cifs_sb_info *cifs_sb, ...@@ -559,7 +559,7 @@ static struct cifs_ntsd *get_cifs_acl_by_fid(struct cifs_sb_info *cifs_sb,
int xid, rc; int xid, rc;
xid = GetXid(); xid = GetXid();
rc = CIFSSMBGetCIFSACL(xid, cifs_sb->tcon, fid, &pntsd, pacllen); rc = CIFSSMBGetCIFSACL(xid, cifs_sb_tcon(cifs_sb), fid, &pntsd, pacllen);
FreeXid(xid); FreeXid(xid);
...@@ -577,7 +577,7 @@ static struct cifs_ntsd *get_cifs_acl_by_path(struct cifs_sb_info *cifs_sb, ...@@ -577,7 +577,7 @@ static struct cifs_ntsd *get_cifs_acl_by_path(struct cifs_sb_info *cifs_sb,
xid = GetXid(); xid = GetXid();
rc = CIFSSMBOpen(xid, cifs_sb->tcon, path, FILE_OPEN, READ_CONTROL, 0, rc = CIFSSMBOpen(xid, cifs_sb_tcon(cifs_sb), path, FILE_OPEN, READ_CONTROL, 0,
&fid, &oplock, NULL, cifs_sb->local_nls, &fid, &oplock, NULL, cifs_sb->local_nls,
cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
if (rc) { if (rc) {
...@@ -585,10 +585,10 @@ static struct cifs_ntsd *get_cifs_acl_by_path(struct cifs_sb_info *cifs_sb, ...@@ -585,10 +585,10 @@ static struct cifs_ntsd *get_cifs_acl_by_path(struct cifs_sb_info *cifs_sb,
goto out; goto out;
} }
rc = CIFSSMBGetCIFSACL(xid, cifs_sb->tcon, fid, &pntsd, pacllen); rc = CIFSSMBGetCIFSACL(xid, cifs_sb_tcon(cifs_sb), fid, &pntsd, pacllen);
cFYI(1, "GetCIFSACL rc = %d ACL len %d", rc, *pacllen); cFYI(1, "GetCIFSACL rc = %d ACL len %d", rc, *pacllen);
CIFSSMBClose(xid, cifs_sb->tcon, fid); CIFSSMBClose(xid, cifs_sb_tcon(cifs_sb), fid);
out: out:
FreeXid(xid); FreeXid(xid);
return pntsd; return pntsd;
...@@ -618,7 +618,7 @@ static int set_cifs_acl_by_fid(struct cifs_sb_info *cifs_sb, __u16 fid, ...@@ -618,7 +618,7 @@ static int set_cifs_acl_by_fid(struct cifs_sb_info *cifs_sb, __u16 fid,
int xid, rc; int xid, rc;
xid = GetXid(); xid = GetXid();
rc = CIFSSMBSetCIFSACL(xid, cifs_sb->tcon, fid, pnntsd, acllen); rc = CIFSSMBSetCIFSACL(xid, cifs_sb_tcon(cifs_sb), fid, pnntsd, acllen);
FreeXid(xid); FreeXid(xid);
cFYI(DBG2, "SetCIFSACL rc = %d", rc); cFYI(DBG2, "SetCIFSACL rc = %d", rc);
...@@ -634,7 +634,7 @@ static int set_cifs_acl_by_path(struct cifs_sb_info *cifs_sb, const char *path, ...@@ -634,7 +634,7 @@ static int set_cifs_acl_by_path(struct cifs_sb_info *cifs_sb, const char *path,
xid = GetXid(); xid = GetXid();
rc = CIFSSMBOpen(xid, cifs_sb->tcon, path, FILE_OPEN, WRITE_DAC, 0, rc = CIFSSMBOpen(xid, cifs_sb_tcon(cifs_sb), path, FILE_OPEN, WRITE_DAC, 0,
&fid, &oplock, NULL, cifs_sb->local_nls, &fid, &oplock, NULL, cifs_sb->local_nls,
cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
if (rc) { if (rc) {
...@@ -642,10 +642,10 @@ static int set_cifs_acl_by_path(struct cifs_sb_info *cifs_sb, const char *path, ...@@ -642,10 +642,10 @@ static int set_cifs_acl_by_path(struct cifs_sb_info *cifs_sb, const char *path,
goto out; goto out;
} }
rc = CIFSSMBSetCIFSACL(xid, cifs_sb->tcon, fid, pnntsd, acllen); rc = CIFSSMBSetCIFSACL(xid, cifs_sb_tcon(cifs_sb), fid, pnntsd, acllen);
cFYI(DBG2, "SetCIFSACL rc = %d", rc); cFYI(DBG2, "SetCIFSACL rc = %d", rc);
CIFSSMBClose(xid, cifs_sb->tcon, fid); CIFSSMBClose(xid, cifs_sb_tcon(cifs_sb), fid);
out: out:
FreeXid(xid); FreeXid(xid);
return rc; return rc;
......
...@@ -137,9 +137,6 @@ cifs_read_super(struct super_block *sb, void *data, ...@@ -137,9 +137,6 @@ cifs_read_super(struct super_block *sb, void *data,
sb->s_magic = CIFS_MAGIC_NUMBER; sb->s_magic = CIFS_MAGIC_NUMBER;
sb->s_op = &cifs_super_ops; sb->s_op = &cifs_super_ops;
sb->s_bdi = &cifs_sb->bdi; sb->s_bdi = &cifs_sb->bdi;
/* if (cifs_sb->tcon->ses->server->maxBuf > MAX_CIFS_HDR_SIZE + 512)
sb->s_blocksize =
cifs_sb->tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE; */
sb->s_blocksize = CIFS_MAX_MSGSIZE; sb->s_blocksize = CIFS_MAX_MSGSIZE;
sb->s_blocksize_bits = 14; /* default 2**14 = CIFS_MAX_MSGSIZE */ sb->s_blocksize_bits = 14; /* default 2**14 = CIFS_MAX_MSGSIZE */
inode = cifs_root_iget(sb, ROOT_I); inode = cifs_root_iget(sb, ROOT_I);
...@@ -225,7 +222,7 @@ cifs_statfs(struct dentry *dentry, struct kstatfs *buf) ...@@ -225,7 +222,7 @@ cifs_statfs(struct dentry *dentry, struct kstatfs *buf)
{ {
struct super_block *sb = dentry->d_sb; struct super_block *sb = dentry->d_sb;
struct cifs_sb_info *cifs_sb = CIFS_SB(sb); struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
struct cifsTconInfo *tcon = cifs_sb->tcon; struct cifsTconInfo *tcon = cifs_sb_tcon(cifs_sb);
int rc = -EOPNOTSUPP; int rc = -EOPNOTSUPP;
int xid; int xid;
...@@ -367,7 +364,7 @@ static int ...@@ -367,7 +364,7 @@ static int
cifs_show_options(struct seq_file *s, struct vfsmount *m) cifs_show_options(struct seq_file *s, struct vfsmount *m)
{ {
struct cifs_sb_info *cifs_sb = CIFS_SB(m->mnt_sb); struct cifs_sb_info *cifs_sb = CIFS_SB(m->mnt_sb);
struct cifsTconInfo *tcon = cifs_sb->tcon; struct cifsTconInfo *tcon = cifs_sb_tcon(cifs_sb);
struct sockaddr *srcaddr; struct sockaddr *srcaddr;
srcaddr = (struct sockaddr *)&tcon->ses->server->srcaddr; srcaddr = (struct sockaddr *)&tcon->ses->server->srcaddr;
...@@ -458,9 +455,7 @@ static void cifs_umount_begin(struct super_block *sb) ...@@ -458,9 +455,7 @@ static void cifs_umount_begin(struct super_block *sb)
if (cifs_sb == NULL) if (cifs_sb == NULL)
return; return;
tcon = cifs_sb->tcon; tcon = cifs_sb_tcon(cifs_sb);
if (tcon == NULL)
return;
read_lock(&cifs_tcp_ses_lock); read_lock(&cifs_tcp_ses_lock);
if ((tcon->tc_count > 1) || (tcon->tidStatus == CifsExiting)) { if ((tcon->tc_count > 1) || (tcon->tidStatus == CifsExiting)) {
......
...@@ -413,6 +413,12 @@ CIFS_SB(struct super_block *sb) ...@@ -413,6 +413,12 @@ CIFS_SB(struct super_block *sb)
return sb->s_fs_info; return sb->s_fs_info;
} }
static inline struct cifsTconInfo *
cifs_sb_tcon(struct cifs_sb_info *cifs_sb)
{
return cifs_sb->tcon;
}
static inline char CIFS_DIR_SEP(const struct cifs_sb_info *cifs_sb) static inline char CIFS_DIR_SEP(const struct cifs_sb_info *cifs_sb)
{ {
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS)
......
...@@ -3026,8 +3026,8 @@ cifs_umount(struct super_block *sb, struct cifs_sb_info *cifs_sb) ...@@ -3026,8 +3026,8 @@ cifs_umount(struct super_block *sb, struct cifs_sb_info *cifs_sb)
int rc = 0; int rc = 0;
char *tmp; char *tmp;
if (cifs_sb->tcon) if (cifs_sb_tcon(cifs_sb))
cifs_put_tcon(cifs_sb->tcon); cifs_put_tcon(cifs_sb_tcon(cifs_sb));
cifs_sb->tcon = NULL; cifs_sb->tcon = NULL;
tmp = cifs_sb->prepath; tmp = cifs_sb->prepath;
......
...@@ -64,8 +64,8 @@ build_path_from_dentry(struct dentry *direntry) ...@@ -64,8 +64,8 @@ build_path_from_dentry(struct dentry *direntry)
cifs_sb = CIFS_SB(direntry->d_sb); cifs_sb = CIFS_SB(direntry->d_sb);
dirsep = CIFS_DIR_SEP(cifs_sb); dirsep = CIFS_DIR_SEP(cifs_sb);
pplen = cifs_sb->prepathlen; pplen = cifs_sb->prepathlen;
if (cifs_sb->tcon && (cifs_sb->tcon->Flags & SMB_SHARE_IS_IN_DFS)) if (cifs_sb_tcon(cifs_sb) && (cifs_sb_tcon(cifs_sb)->Flags & SMB_SHARE_IS_IN_DFS))
dfsplen = strnlen(cifs_sb->tcon->treeName, MAX_TREE_SIZE + 1); dfsplen = strnlen(cifs_sb_tcon(cifs_sb)->treeName, MAX_TREE_SIZE + 1);
else else
dfsplen = 0; dfsplen = 0;
cifs_bp_rename_retry: cifs_bp_rename_retry:
...@@ -117,7 +117,7 @@ build_path_from_dentry(struct dentry *direntry) ...@@ -117,7 +117,7 @@ build_path_from_dentry(struct dentry *direntry)
/* BB test paths to Windows with '/' in the midst of prepath */ /* BB test paths to Windows with '/' in the midst of prepath */
if (dfsplen) { if (dfsplen) {
strncpy(full_path, cifs_sb->tcon->treeName, dfsplen); strncpy(full_path, cifs_sb_tcon(cifs_sb)->treeName, dfsplen);
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) { if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) {
int i; int i;
for (i = 0; i < dfsplen; i++) { for (i = 0; i < dfsplen; i++) {
...@@ -150,7 +150,7 @@ cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle, ...@@ -150,7 +150,7 @@ cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle,
pCifsFile->pfile = file; pCifsFile->pfile = file;
pCifsFile->invalidHandle = false; pCifsFile->invalidHandle = false;
pCifsFile->closePend = false; pCifsFile->closePend = false;
pCifsFile->tcon = cifs_sb->tcon; pCifsFile->tcon = cifs_sb_tcon(cifs_sb);
mutex_init(&pCifsFile->fh_mutex); mutex_init(&pCifsFile->fh_mutex);
mutex_init(&pCifsFile->lock_mutex); mutex_init(&pCifsFile->lock_mutex);
INIT_LIST_HEAD(&pCifsFile->llist); INIT_LIST_HEAD(&pCifsFile->llist);
...@@ -158,7 +158,7 @@ cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle, ...@@ -158,7 +158,7 @@ cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle,
INIT_WORK(&pCifsFile->oplock_break, cifs_oplock_break); INIT_WORK(&pCifsFile->oplock_break, cifs_oplock_break);
write_lock(&GlobalSMBSeslock); write_lock(&GlobalSMBSeslock);
list_add(&pCifsFile->tlist, &cifs_sb->tcon->openFileList); list_add(&pCifsFile->tlist, &cifs_sb_tcon(cifs_sb)->openFileList);
pCifsInode = CIFS_I(newinode); pCifsInode = CIFS_I(newinode);
if (pCifsInode) { if (pCifsInode) {
/* if readable file instance put first in list*/ /* if readable file instance put first in list*/
...@@ -225,7 +225,7 @@ int cifs_posix_open(char *full_path, struct inode **pinode, ...@@ -225,7 +225,7 @@ int cifs_posix_open(char *full_path, struct inode **pinode,
posix_flags |= SMB_O_DIRECT; posix_flags |= SMB_O_DIRECT;
mode &= ~current_umask(); mode &= ~current_umask();
rc = CIFSPOSIXCreate(xid, cifs_sb->tcon, posix_flags, mode, rc = CIFSPOSIXCreate(xid, cifs_sb_tcon(cifs_sb), posix_flags, mode,
pnetfid, presp_data, poplock, full_path, pnetfid, presp_data, poplock, full_path,
cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & cifs_sb->local_nls, cifs_sb->mnt_cifs_flags &
CIFS_MOUNT_MAP_SPECIAL_CHR); CIFS_MOUNT_MAP_SPECIAL_CHR);
...@@ -298,7 +298,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, ...@@ -298,7 +298,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
xid = GetXid(); xid = GetXid();
cifs_sb = CIFS_SB(inode->i_sb); cifs_sb = CIFS_SB(inode->i_sb);
tcon = cifs_sb->tcon; tcon = cifs_sb_tcon(cifs_sb);
full_path = build_path_from_dentry(direntry); full_path = build_path_from_dentry(direntry);
if (full_path == NULL) { if (full_path == NULL) {
...@@ -373,7 +373,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, ...@@ -373,7 +373,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
if (!tcon->unix_ext && (mode & S_IWUGO) == 0) if (!tcon->unix_ext && (mode & S_IWUGO) == 0)
create_options |= CREATE_OPTION_READONLY; create_options |= CREATE_OPTION_READONLY;
if (cifs_sb->tcon->ses->capabilities & CAP_NT_SMBS) if (tcon->ses->capabilities & CAP_NT_SMBS)
rc = CIFSSMBOpen(xid, tcon, full_path, disposition, rc = CIFSSMBOpen(xid, tcon, full_path, disposition,
desiredAccess, create_options, desiredAccess, create_options,
&fileHandle, &oplock, buf, cifs_sb->local_nls, &fileHandle, &oplock, buf, cifs_sb->local_nls,
...@@ -504,7 +504,7 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode, ...@@ -504,7 +504,7 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode,
xid = GetXid(); xid = GetXid();
cifs_sb = CIFS_SB(inode->i_sb); cifs_sb = CIFS_SB(inode->i_sb);
pTcon = cifs_sb->tcon; pTcon = cifs_sb_tcon(cifs_sb);
full_path = build_path_from_dentry(direntry); full_path = build_path_from_dentry(direntry);
if (full_path == NULL) { if (full_path == NULL) {
...@@ -631,7 +631,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, ...@@ -631,7 +631,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
/* check whether path exists */ /* check whether path exists */
cifs_sb = CIFS_SB(parent_dir_inode->i_sb); cifs_sb = CIFS_SB(parent_dir_inode->i_sb);
pTcon = cifs_sb->tcon; pTcon = cifs_sb_tcon(cifs_sb);
/* /*
* Don't allow the separator character in a path component. * Don't allow the separator character in a path component.
......
...@@ -235,7 +235,7 @@ int cifs_open(struct inode *inode, struct file *file) ...@@ -235,7 +235,7 @@ int cifs_open(struct inode *inode, struct file *file)
xid = GetXid(); xid = GetXid();
cifs_sb = CIFS_SB(inode->i_sb); cifs_sb = CIFS_SB(inode->i_sb);
tcon = cifs_sb->tcon; tcon = cifs_sb_tcon(cifs_sb);
pCifsInode = CIFS_I(file->f_path.dentry->d_inode); pCifsInode = CIFS_I(file->f_path.dentry->d_inode);
...@@ -345,7 +345,7 @@ int cifs_open(struct inode *inode, struct file *file) ...@@ -345,7 +345,7 @@ int cifs_open(struct inode *inode, struct file *file)
goto out; goto out;
} }
if (cifs_sb->tcon->ses->capabilities & CAP_NT_SMBS) if (tcon->ses->capabilities & CAP_NT_SMBS)
rc = CIFSSMBOpen(xid, tcon, full_path, disposition, rc = CIFSSMBOpen(xid, tcon, full_path, disposition,
desiredAccess, CREATE_NOT_DIR, &netfid, &oplock, buf, desiredAccess, CREATE_NOT_DIR, &netfid, &oplock, buf,
cifs_sb->local_nls, cifs_sb->mnt_cifs_flags cifs_sb->local_nls, cifs_sb->mnt_cifs_flags
......
...@@ -66,11 +66,11 @@ static void cifs_fscache_enable_inode_cookie(struct inode *inode) ...@@ -66,11 +66,11 @@ static void cifs_fscache_enable_inode_cookie(struct inode *inode)
if (cifsi->fscache) if (cifsi->fscache)
return; return;
cifsi->fscache = fscache_acquire_cookie(cifs_sb->tcon->fscache, cifsi->fscache = fscache_acquire_cookie(cifs_sb_tcon(cifs_sb)->fscache,
&cifs_fscache_inode_object_def, &cifs_fscache_inode_object_def,
cifsi); cifsi);
cFYI(1, "CIFS: got FH cookie (0x%p/0x%p)", cFYI(1, "CIFS: got FH cookie (0x%p/0x%p)",
cifs_sb->tcon->fscache, cifsi->fscache); cifs_sb_tcon(cifs_sb)->fscache, cifsi->fscache);
} }
void cifs_fscache_release_inode_cookie(struct inode *inode) void cifs_fscache_release_inode_cookie(struct inode *inode)
...@@ -117,7 +117,8 @@ void cifs_fscache_reset_inode_cookie(struct inode *inode) ...@@ -117,7 +117,8 @@ void cifs_fscache_reset_inode_cookie(struct inode *inode)
/* retire the current fscache cache and get a new one */ /* retire the current fscache cache and get a new one */
fscache_relinquish_cookie(cifsi->fscache, 1); fscache_relinquish_cookie(cifsi->fscache, 1);
cifsi->fscache = fscache_acquire_cookie(cifs_sb->tcon->fscache, cifsi->fscache = fscache_acquire_cookie(
cifs_sb_tcon(cifs_sb)->fscache,
&cifs_fscache_inode_object_def, &cifs_fscache_inode_object_def,
cifsi); cifsi);
cFYI(1, "CIFS: new cookie 0x%p oldcookie 0x%p", cFYI(1, "CIFS: new cookie 0x%p oldcookie 0x%p",
......
...@@ -52,7 +52,7 @@ static void cifs_set_ops(struct inode *inode, const bool is_dfs_referral) ...@@ -52,7 +52,7 @@ static void cifs_set_ops(struct inode *inode, const bool is_dfs_referral)
/* check if server can support readpages */ /* check if server can support readpages */
if (cifs_sb->tcon->ses->server->maxBuf < if (cifs_sb_tcon(cifs_sb)->ses->server->maxBuf <
PAGE_CACHE_SIZE + MAX_CIFS_HDR_SIZE) PAGE_CACHE_SIZE + MAX_CIFS_HDR_SIZE)
inode->i_data.a_ops = &cifs_addr_ops_smallbuf; inode->i_data.a_ops = &cifs_addr_ops_smallbuf;
else else
...@@ -315,7 +315,8 @@ int cifs_get_inode_info_unix(struct inode **pinode, ...@@ -315,7 +315,8 @@ int cifs_get_inode_info_unix(struct inode **pinode,
struct cifsTconInfo *tcon; struct cifsTconInfo *tcon;
struct cifs_sb_info *cifs_sb = CIFS_SB(sb); struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
tcon = cifs_sb->tcon; tcon = cifs_sb_tcon(cifs_sb);
cFYI(1, "Getting info on %s", full_path); cFYI(1, "Getting info on %s", full_path);
/* could have done a find first instead but this returns more info */ /* could have done a find first instead but this returns more info */
...@@ -360,7 +361,7 @@ cifs_sfu_type(struct cifs_fattr *fattr, const unsigned char *path, ...@@ -360,7 +361,7 @@ cifs_sfu_type(struct cifs_fattr *fattr, const unsigned char *path,
int rc; int rc;
int oplock = 0; int oplock = 0;
__u16 netfid; __u16 netfid;
struct cifsTconInfo *pTcon = cifs_sb->tcon; struct cifsTconInfo *pTcon = cifs_sb_tcon(cifs_sb);
char buf[24]; char buf[24];
unsigned int bytes_read; unsigned int bytes_read;
char *pbuf; char *pbuf;
...@@ -449,7 +450,7 @@ static int cifs_sfu_mode(struct cifs_fattr *fattr, const unsigned char *path, ...@@ -449,7 +450,7 @@ static int cifs_sfu_mode(struct cifs_fattr *fattr, const unsigned char *path,
char ea_value[4]; char ea_value[4];
__u32 mode; __u32 mode;
rc = CIFSSMBQAllEAs(xid, cifs_sb->tcon, path, "SETFILEBITS", rc = CIFSSMBQAllEAs(xid, cifs_sb_tcon(cifs_sb), path, "SETFILEBITS",
ea_value, 4 /* size of buf */, cifs_sb->local_nls, ea_value, 4 /* size of buf */, cifs_sb->local_nls,
cifs_sb->mnt_cifs_flags & cifs_sb->mnt_cifs_flags &
CIFS_MOUNT_MAP_SPECIAL_CHR); CIFS_MOUNT_MAP_SPECIAL_CHR);
...@@ -489,8 +490,8 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info, ...@@ -489,8 +490,8 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info,
fattr->cf_mtime = cifs_NTtimeToUnix(info->LastWriteTime); fattr->cf_mtime = cifs_NTtimeToUnix(info->LastWriteTime);
if (adjust_tz) { if (adjust_tz) {
fattr->cf_ctime.tv_sec += cifs_sb->tcon->ses->server->timeAdj; fattr->cf_ctime.tv_sec += cifs_sb_tcon(cifs_sb)->ses->server->timeAdj;
fattr->cf_mtime.tv_sec += cifs_sb->tcon->ses->server->timeAdj; fattr->cf_mtime.tv_sec += cifs_sb_tcon(cifs_sb)->ses->server->timeAdj;
} }
fattr->cf_eof = le64_to_cpu(info->EndOfFile); fattr->cf_eof = le64_to_cpu(info->EndOfFile);
...@@ -566,7 +567,7 @@ int cifs_get_inode_info(struct inode **pinode, ...@@ -566,7 +567,7 @@ int cifs_get_inode_info(struct inode **pinode,
bool adjustTZ = false; bool adjustTZ = false;
struct cifs_fattr fattr; struct cifs_fattr fattr;
pTcon = cifs_sb->tcon; pTcon = cifs_sb_tcon(cifs_sb);
cFYI(1, "Getting info on %s", full_path); cFYI(1, "Getting info on %s", full_path);
if ((pfindData == NULL) && (*pinode != NULL)) { if ((pfindData == NULL) && (*pinode != NULL)) {
...@@ -706,8 +707,8 @@ char *cifs_build_path_to_root(struct cifs_sb_info *cifs_sb) ...@@ -706,8 +707,8 @@ char *cifs_build_path_to_root(struct cifs_sb_info *cifs_sb)
return full_path; return full_path;
} }
if (cifs_sb->tcon && (cifs_sb->tcon->Flags & SMB_SHARE_IS_IN_DFS)) if (cifs_sb_tcon(cifs_sb) && (cifs_sb_tcon(cifs_sb)->Flags & SMB_SHARE_IS_IN_DFS))
dfsplen = strnlen(cifs_sb->tcon->treeName, MAX_TREE_SIZE + 1); dfsplen = strnlen(cifs_sb_tcon(cifs_sb)->treeName, MAX_TREE_SIZE + 1);
else else
dfsplen = 0; dfsplen = 0;
...@@ -716,7 +717,7 @@ char *cifs_build_path_to_root(struct cifs_sb_info *cifs_sb) ...@@ -716,7 +717,7 @@ char *cifs_build_path_to_root(struct cifs_sb_info *cifs_sb)
return full_path; return full_path;
if (dfsplen) { if (dfsplen) {
strncpy(full_path, cifs_sb->tcon->treeName, dfsplen); strncpy(full_path, cifs_sb_tcon(cifs_sb)->treeName, dfsplen);
/* switch slash direction in prepath depending on whether /* switch slash direction in prepath depending on whether
* windows or posix style path names * windows or posix style path names
*/ */
...@@ -841,7 +842,7 @@ struct inode *cifs_root_iget(struct super_block *sb, unsigned long ino) ...@@ -841,7 +842,7 @@ struct inode *cifs_root_iget(struct super_block *sb, unsigned long ino)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
xid = GetXid(); xid = GetXid();
if (cifs_sb->tcon->unix_ext) if (cifs_sb_tcon(cifs_sb)->unix_ext)
rc = cifs_get_inode_info_unix(&inode, full_path, sb, xid); rc = cifs_get_inode_info_unix(&inode, full_path, sb, xid);
else else
rc = cifs_get_inode_info(&inode, full_path, NULL, sb, rc = cifs_get_inode_info(&inode, full_path, NULL, sb,
...@@ -852,10 +853,10 @@ struct inode *cifs_root_iget(struct super_block *sb, unsigned long ino) ...@@ -852,10 +853,10 @@ struct inode *cifs_root_iget(struct super_block *sb, unsigned long ino)
#ifdef CONFIG_CIFS_FSCACHE #ifdef CONFIG_CIFS_FSCACHE
/* populate tcon->resource_id */ /* populate tcon->resource_id */
cifs_sb->tcon->resource_id = CIFS_I(inode)->uniqueid; cifs_sb_tcon(cifs_sb)->resource_id = CIFS_I(inode)->uniqueid;
#endif #endif
if (rc && cifs_sb->tcon->ipc) { if (rc && cifs_sb_tcon(cifs_sb)->ipc) {
cFYI(1, "ipc connection - fake read inode"); cFYI(1, "ipc connection - fake read inode");
inode->i_mode |= S_IFDIR; inode->i_mode |= S_IFDIR;
inode->i_nlink = 2; inode->i_nlink = 2;
...@@ -938,7 +939,7 @@ cifs_set_file_info(struct inode *inode, struct iattr *attrs, int xid, ...@@ -938,7 +939,7 @@ cifs_set_file_info(struct inode *inode, struct iattr *attrs, int xid,
goto set_via_filehandle; goto set_via_filehandle;
} }
pTcon = cifs_sb->tcon; pTcon = cifs_sb_tcon(cifs_sb);
/* /*
* NT4 apparently returns success on this call, but it doesn't * NT4 apparently returns success on this call, but it doesn't
...@@ -1000,7 +1001,7 @@ cifs_rename_pending_delete(char *full_path, struct dentry *dentry, int xid) ...@@ -1000,7 +1001,7 @@ cifs_rename_pending_delete(char *full_path, struct dentry *dentry, int xid)
struct inode *inode = dentry->d_inode; struct inode *inode = dentry->d_inode;
struct cifsInodeInfo *cifsInode = CIFS_I(inode); struct cifsInodeInfo *cifsInode = CIFS_I(inode);
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
struct cifsTconInfo *tcon = cifs_sb->tcon; struct cifsTconInfo *tcon = cifs_sb_tcon(cifs_sb);
__u32 dosattr, origattr; __u32 dosattr, origattr;
FILE_BASIC_INFO *info_buf = NULL; FILE_BASIC_INFO *info_buf = NULL;
...@@ -1111,7 +1112,7 @@ int cifs_unlink(struct inode *dir, struct dentry *dentry) ...@@ -1111,7 +1112,7 @@ int cifs_unlink(struct inode *dir, struct dentry *dentry)
struct cifsInodeInfo *cifs_inode; struct cifsInodeInfo *cifs_inode;
struct super_block *sb = dir->i_sb; struct super_block *sb = dir->i_sb;
struct cifs_sb_info *cifs_sb = CIFS_SB(sb); struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
struct cifsTconInfo *tcon = cifs_sb->tcon; struct cifsTconInfo *tcon = cifs_sb_tcon(cifs_sb);
struct iattr *attrs = NULL; struct iattr *attrs = NULL;
__u32 dosattr = 0, origattr = 0; __u32 dosattr = 0, origattr = 0;
...@@ -1213,7 +1214,7 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode) ...@@ -1213,7 +1214,7 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
xid = GetXid(); xid = GetXid();
cifs_sb = CIFS_SB(inode->i_sb); cifs_sb = CIFS_SB(inode->i_sb);
pTcon = cifs_sb->tcon; pTcon = cifs_sb_tcon(cifs_sb);
full_path = build_path_from_dentry(direntry); full_path = build_path_from_dentry(direntry);
if (full_path == NULL) { if (full_path == NULL) {
...@@ -1394,7 +1395,7 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry) ...@@ -1394,7 +1395,7 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry)
xid = GetXid(); xid = GetXid();
cifs_sb = CIFS_SB(inode->i_sb); cifs_sb = CIFS_SB(inode->i_sb);
pTcon = cifs_sb->tcon; pTcon = cifs_sb_tcon(cifs_sb);
full_path = build_path_from_dentry(direntry); full_path = build_path_from_dentry(direntry);
if (full_path == NULL) { if (full_path == NULL) {
...@@ -1435,7 +1436,7 @@ cifs_do_rename(int xid, struct dentry *from_dentry, const char *fromPath, ...@@ -1435,7 +1436,7 @@ cifs_do_rename(int xid, struct dentry *from_dentry, const char *fromPath,
struct dentry *to_dentry, const char *toPath) struct dentry *to_dentry, const char *toPath)
{ {
struct cifs_sb_info *cifs_sb = CIFS_SB(from_dentry->d_sb); struct cifs_sb_info *cifs_sb = CIFS_SB(from_dentry->d_sb);
struct cifsTconInfo *pTcon = cifs_sb->tcon; struct cifsTconInfo *pTcon = cifs_sb_tcon(cifs_sb);
__u16 srcfid; __u16 srcfid;
int oplock, rc; int oplock, rc;
...@@ -1486,7 +1487,7 @@ int cifs_rename(struct inode *source_dir, struct dentry *source_dentry, ...@@ -1486,7 +1487,7 @@ int cifs_rename(struct inode *source_dir, struct dentry *source_dentry,
int xid, rc, tmprc; int xid, rc, tmprc;
cifs_sb = CIFS_SB(source_dir->i_sb); cifs_sb = CIFS_SB(source_dir->i_sb);
tcon = cifs_sb->tcon; tcon = cifs_sb_tcon(cifs_sb);
xid = GetXid(); xid = GetXid();
...@@ -1660,7 +1661,7 @@ int cifs_revalidate_dentry(struct dentry *dentry) ...@@ -1660,7 +1661,7 @@ int cifs_revalidate_dentry(struct dentry *dentry)
"jiffies %ld", full_path, inode, inode->i_count.counter, "jiffies %ld", full_path, inode, inode->i_count.counter,
dentry, dentry->d_time, jiffies); dentry, dentry->d_time, jiffies);
if (CIFS_SB(sb)->tcon->unix_ext) if (cifs_sb_tcon(CIFS_SB(sb))->unix_ext)
rc = cifs_get_inode_info_unix(&inode, full_path, sb, xid); rc = cifs_get_inode_info_unix(&inode, full_path, sb, xid);
else else
rc = cifs_get_inode_info(&inode, full_path, NULL, sb, rc = cifs_get_inode_info(&inode, full_path, NULL, sb,
...@@ -1755,7 +1756,7 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs, ...@@ -1755,7 +1756,7 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs,
if (rc != 0) { if (rc != 0) {
if (pTcon == NULL) if (pTcon == NULL)
pTcon = cifs_sb->tcon; pTcon = cifs_sb_tcon(cifs_sb);
/* Set file size by pathname rather than by handle /* Set file size by pathname rather than by handle
either because no valid, writeable file handle for either because no valid, writeable file handle for
...@@ -1901,7 +1902,7 @@ cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs) ...@@ -1901,7 +1902,7 @@ cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs)
rc = CIFSSMBUnixSetFileInfo(xid, pTcon, args, nfid, npid); rc = CIFSSMBUnixSetFileInfo(xid, pTcon, args, nfid, npid);
cifsFileInfo_put(open_file); cifsFileInfo_put(open_file);
} else { } else {
pTcon = cifs_sb->tcon; pTcon = cifs_sb_tcon(cifs_sb);
rc = CIFSSMBUnixSetPathInfo(xid, pTcon, full_path, args, rc = CIFSSMBUnixSetPathInfo(xid, pTcon, full_path, args,
cifs_sb->local_nls, cifs_sb->local_nls,
cifs_sb->mnt_cifs_flags & cifs_sb->mnt_cifs_flags &
...@@ -2086,7 +2087,7 @@ cifs_setattr(struct dentry *direntry, struct iattr *attrs) ...@@ -2086,7 +2087,7 @@ cifs_setattr(struct dentry *direntry, struct iattr *attrs)
{ {
struct inode *inode = direntry->d_inode; struct inode *inode = direntry->d_inode;
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
struct cifsTconInfo *pTcon = cifs_sb->tcon; struct cifsTconInfo *pTcon = cifs_sb_tcon(cifs_sb);
if (pTcon->unix_ext) if (pTcon->unix_ext)
return cifs_setattr_unix(direntry, attrs); return cifs_setattr_unix(direntry, attrs);
......
...@@ -249,7 +249,7 @@ CIFSCheckMFSymlink(struct cifs_fattr *fattr, ...@@ -249,7 +249,7 @@ CIFSCheckMFSymlink(struct cifs_fattr *fattr,
int rc; int rc;
int oplock = 0; int oplock = 0;
__u16 netfid = 0; __u16 netfid = 0;
struct cifsTconInfo *pTcon = cifs_sb->tcon; struct cifsTconInfo *pTcon = cifs_sb_tcon(cifs_sb);
u8 *buf; u8 *buf;
char *pbuf; char *pbuf;
unsigned int bytes_read = 0; unsigned int bytes_read = 0;
...@@ -321,7 +321,7 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode, ...@@ -321,7 +321,7 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode,
xid = GetXid(); xid = GetXid();
cifs_sb_target = CIFS_SB(inode->i_sb); cifs_sb_target = CIFS_SB(inode->i_sb);
pTcon = cifs_sb_target->tcon; pTcon = cifs_sb_tcon(cifs_sb_target);
/* No need to check for cross device links since server will do that /* No need to check for cross device links since server will do that
BB note DFS case in future though (when we may have to check) */ BB note DFS case in future though (when we may have to check) */
...@@ -390,7 +390,7 @@ cifs_follow_link(struct dentry *direntry, struct nameidata *nd) ...@@ -390,7 +390,7 @@ cifs_follow_link(struct dentry *direntry, struct nameidata *nd)
char *full_path = NULL; char *full_path = NULL;
char *target_path = NULL; char *target_path = NULL;
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
struct cifsTconInfo *tcon = cifs_sb->tcon; struct cifsTconInfo *tcon = cifs_sb_tcon(cifs_sb);
xid = GetXid(); xid = GetXid();
...@@ -459,7 +459,7 @@ cifs_symlink(struct inode *inode, struct dentry *direntry, const char *symname) ...@@ -459,7 +459,7 @@ cifs_symlink(struct inode *inode, struct dentry *direntry, const char *symname)
xid = GetXid(); xid = GetXid();
cifs_sb = CIFS_SB(inode->i_sb); cifs_sb = CIFS_SB(inode->i_sb);
pTcon = cifs_sb->tcon; pTcon = cifs_sb_tcon(cifs_sb);
full_path = build_path_from_dentry(direntry); full_path = build_path_from_dentry(direntry);
......
...@@ -729,6 +729,6 @@ cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb) ...@@ -729,6 +729,6 @@ cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb)
"properly. Hardlinks will not be recognized on this " "properly. Hardlinks will not be recognized on this "
"mount. Consider mounting with the \"noserverino\" " "mount. Consider mounting with the \"noserverino\" "
"option to silence this message.", "option to silence this message.",
cifs_sb->tcon->treeName); cifs_sb_tcon(cifs_sb)->treeName);
} }
} }
...@@ -102,7 +102,7 @@ cifs_readdir_lookup(struct dentry *parent, struct qstr *name, ...@@ -102,7 +102,7 @@ cifs_readdir_lookup(struct dentry *parent, struct qstr *name,
return NULL; return NULL;
} }
if (CIFS_SB(sb)->tcon->nocase) if (cifs_sb_tcon(CIFS_SB(sb))->nocase)
dentry->d_op = &cifs_ci_dentry_ops; dentry->d_op = &cifs_ci_dentry_ops;
else else
dentry->d_op = &cifs_dentry_ops; dentry->d_op = &cifs_dentry_ops;
...@@ -171,7 +171,7 @@ static void ...@@ -171,7 +171,7 @@ static void
cifs_std_info_to_fattr(struct cifs_fattr *fattr, FIND_FILE_STANDARD_INFO *info, cifs_std_info_to_fattr(struct cifs_fattr *fattr, FIND_FILE_STANDARD_INFO *info,
struct cifs_sb_info *cifs_sb) struct cifs_sb_info *cifs_sb)
{ {
int offset = cifs_sb->tcon->ses->server->timeAdj; int offset = cifs_sb_tcon(cifs_sb)->ses->server->timeAdj;
memset(fattr, 0, sizeof(*fattr)); memset(fattr, 0, sizeof(*fattr));
fattr->cf_atime = cnvrtDosUnixTm(info->LastAccessDate, fattr->cf_atime = cnvrtDosUnixTm(info->LastAccessDate,
...@@ -199,7 +199,7 @@ int get_symlink_reparse_path(char *full_path, struct cifs_sb_info *cifs_sb, ...@@ -199,7 +199,7 @@ int get_symlink_reparse_path(char *full_path, struct cifs_sb_info *cifs_sb,
int len; int len;
int oplock = 0; int oplock = 0;
int rc; int rc;
struct cifsTconInfo *ptcon = cifs_sb->tcon; struct cifsTconInfo *ptcon = cifs_sb_tcon(cifs_sb);
char *tmpbuffer; char *tmpbuffer;
rc = CIFSSMBOpen(xid, ptcon, full_path, FILE_OPEN, GENERIC_READ, rc = CIFSSMBOpen(xid, ptcon, full_path, FILE_OPEN, GENERIC_READ,
...@@ -241,7 +241,7 @@ static int initiate_cifs_search(const int xid, struct file *file) ...@@ -241,7 +241,7 @@ static int initiate_cifs_search(const int xid, struct file *file)
cifsFile = file->private_data; cifsFile = file->private_data;
cifsFile->invalidHandle = true; cifsFile->invalidHandle = true;
cifsFile->srch_inf.endOfSearch = false; cifsFile->srch_inf.endOfSearch = false;
cifsFile->tcon = cifs_sb->tcon; cifsFile->tcon = cifs_sb_tcon(cifs_sb);
pTcon = cifsFile->tcon; pTcon = cifsFile->tcon;
if (pTcon == NULL) if (pTcon == NULL)
return -EINVAL; return -EINVAL;
......
...@@ -61,7 +61,7 @@ int cifs_removexattr(struct dentry *direntry, const char *ea_name) ...@@ -61,7 +61,7 @@ int cifs_removexattr(struct dentry *direntry, const char *ea_name)
xid = GetXid(); xid = GetXid();
cifs_sb = CIFS_SB(sb); cifs_sb = CIFS_SB(sb);
pTcon = cifs_sb->tcon; pTcon = cifs_sb_tcon(cifs_sb);
full_path = build_path_from_dentry(direntry); full_path = build_path_from_dentry(direntry);
if (full_path == NULL) { if (full_path == NULL) {
...@@ -116,7 +116,7 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name, ...@@ -116,7 +116,7 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name,
xid = GetXid(); xid = GetXid();
cifs_sb = CIFS_SB(sb); cifs_sb = CIFS_SB(sb);
pTcon = cifs_sb->tcon; pTcon = cifs_sb_tcon(cifs_sb);
full_path = build_path_from_dentry(direntry); full_path = build_path_from_dentry(direntry);
if (full_path == NULL) { if (full_path == NULL) {
...@@ -224,7 +224,7 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name, ...@@ -224,7 +224,7 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name,
xid = GetXid(); xid = GetXid();
cifs_sb = CIFS_SB(sb); cifs_sb = CIFS_SB(sb);
pTcon = cifs_sb->tcon; pTcon = cifs_sb_tcon(cifs_sb);
full_path = build_path_from_dentry(direntry); full_path = build_path_from_dentry(direntry);
if (full_path == NULL) { if (full_path == NULL) {
...@@ -346,7 +346,7 @@ ssize_t cifs_listxattr(struct dentry *direntry, char *data, size_t buf_size) ...@@ -346,7 +346,7 @@ ssize_t cifs_listxattr(struct dentry *direntry, char *data, size_t buf_size)
return -EIO; return -EIO;
cifs_sb = CIFS_SB(sb); cifs_sb = CIFS_SB(sb);
pTcon = cifs_sb->tcon; pTcon = cifs_sb_tcon(cifs_sb);
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR)
return -EOPNOTSUPP; return -EOPNOTSUPP;
......
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