diff options
author | Pavel Shilovsky <pshilovsky@samba.org> | 2012-09-18 19:20:26 -0400 |
---|---|---|
committer | Steve French <smfrench@gmail.com> | 2012-09-24 22:46:26 -0400 |
commit | 4b4de76e35518fc0c636f628abca8c1b19ad6689 (patch) | |
tree | 18b27673849d55235c216f0cbb811e1aa4b87ae9 | |
parent | cbe6f439f5762c7fb4d2dd9293f5fdbfc4cd68f8 (diff) |
CIFS: Replace netfid with cifs_fid struct in cifsFileInfo
This is help us to extend the code for future protocols that can use
another fid mechanism (as SMB2 that has it divided into two parts:
persistent and violatile).
Also rename variables and refactor the code around the changes.
Reviewed-by: Jeff Layton <jlayton@samba.org>
Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org>
Signed-off-by: Steve French <smfrench@gmail.com>
-rw-r--r-- | fs/cifs/cifsacl.c | 2 | ||||
-rw-r--r-- | fs/cifs/cifsglob.h | 6 | ||||
-rw-r--r-- | fs/cifs/cifssmb.c | 4 | ||||
-rw-r--r-- | fs/cifs/file.c | 116 | ||||
-rw-r--r-- | fs/cifs/inode.c | 10 | ||||
-rw-r--r-- | fs/cifs/ioctl.c | 13 | ||||
-rw-r--r-- | fs/cifs/misc.c | 2 | ||||
-rw-r--r-- | fs/cifs/readdir.c | 10 | ||||
-rw-r--r-- | fs/cifs/smb1ops.c | 2 |
9 files changed, 87 insertions, 78 deletions
diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c index 05f4dc263a23..2ee5c54797fa 100644 --- a/fs/cifs/cifsacl.c +++ b/fs/cifs/cifsacl.c | |||
@@ -1222,7 +1222,7 @@ struct cifs_ntsd *get_cifs_acl(struct cifs_sb_info *cifs_sb, | |||
1222 | if (!open_file) | 1222 | if (!open_file) |
1223 | return get_cifs_acl_by_path(cifs_sb, path, pacllen); | 1223 | return get_cifs_acl_by_path(cifs_sb, path, pacllen); |
1224 | 1224 | ||
1225 | pntsd = get_cifs_acl_by_fid(cifs_sb, open_file->netfid, pacllen); | 1225 | pntsd = get_cifs_acl_by_fid(cifs_sb, open_file->fid.netfid, pacllen); |
1226 | cifsFileInfo_put(open_file); | 1226 | cifsFileInfo_put(open_file); |
1227 | return pntsd; | 1227 | return pntsd; |
1228 | } | 1228 | } |
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 843356fa262d..a2a3865dee1b 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -746,6 +746,10 @@ struct cifs_search_info { | |||
746 | bool smallBuf:1; /* so we know which buf_release function to call */ | 746 | bool smallBuf:1; /* so we know which buf_release function to call */ |
747 | }; | 747 | }; |
748 | 748 | ||
749 | struct cifs_fid { | ||
750 | __u16 netfid; | ||
751 | }; | ||
752 | |||
749 | struct cifsFileInfo { | 753 | struct cifsFileInfo { |
750 | struct list_head tlist; /* pointer to next fid owned by tcon */ | 754 | struct list_head tlist; /* pointer to next fid owned by tcon */ |
751 | struct list_head flist; /* next fid (file instance) for this inode */ | 755 | struct list_head flist; /* next fid (file instance) for this inode */ |
@@ -755,7 +759,7 @@ struct cifsFileInfo { | |||
755 | */ | 759 | */ |
756 | unsigned int uid; /* allows finding which FileInfo structure */ | 760 | unsigned int uid; /* allows finding which FileInfo structure */ |
757 | __u32 pid; /* process id who opened file */ | 761 | __u32 pid; /* process id who opened file */ |
758 | __u16 netfid; /* file id from remote */ | 762 | struct cifs_fid fid; /* file id from remote */ |
759 | /* BB add lock scope info here if needed */ ; | 763 | /* BB add lock scope info here if needed */ ; |
760 | /* lock scope id (0 if none) */ | 764 | /* lock scope id (0 if none) */ |
761 | struct dentry *dentry; | 765 | struct dentry *dentry; |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 2dddf01d2b66..4c48b9c60b26 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -1632,7 +1632,7 @@ cifs_async_readv(struct cifs_readdata *rdata) | |||
1632 | smb->hdr.PidHigh = cpu_to_le16((__u16)(rdata->pid >> 16)); | 1632 | smb->hdr.PidHigh = cpu_to_le16((__u16)(rdata->pid >> 16)); |
1633 | 1633 | ||
1634 | smb->AndXCommand = 0xFF; /* none */ | 1634 | smb->AndXCommand = 0xFF; /* none */ |
1635 | smb->Fid = rdata->cfile->netfid; | 1635 | smb->Fid = rdata->cfile->fid.netfid; |
1636 | smb->OffsetLow = cpu_to_le32(rdata->offset & 0xFFFFFFFF); | 1636 | smb->OffsetLow = cpu_to_le32(rdata->offset & 0xFFFFFFFF); |
1637 | if (wct == 12) | 1637 | if (wct == 12) |
1638 | smb->OffsetHigh = cpu_to_le32(rdata->offset >> 32); | 1638 | smb->OffsetHigh = cpu_to_le32(rdata->offset >> 32); |
@@ -2084,7 +2084,7 @@ cifs_async_writev(struct cifs_writedata *wdata) | |||
2084 | smb->hdr.PidHigh = cpu_to_le16((__u16)(wdata->pid >> 16)); | 2084 | smb->hdr.PidHigh = cpu_to_le16((__u16)(wdata->pid >> 16)); |
2085 | 2085 | ||
2086 | smb->AndXCommand = 0xFF; /* none */ | 2086 | smb->AndXCommand = 0xFF; /* none */ |
2087 | smb->Fid = wdata->cfile->netfid; | 2087 | smb->Fid = wdata->cfile->fid.netfid; |
2088 | smb->OffsetLow = cpu_to_le32(wdata->offset & 0xFFFFFFFF); | 2088 | smb->OffsetLow = cpu_to_le32(wdata->offset & 0xFFFFFFFF); |
2089 | if (wct == 14) | 2089 | if (wct == 14) |
2090 | smb->OffsetHigh = cpu_to_le32(wdata->offset >> 32); | 2090 | smb->OffsetHigh = cpu_to_le32(wdata->offset >> 32); |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 71e9ad9f5961..712f2a4d0d49 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -247,39 +247,39 @@ cifs_new_fileinfo(__u16 fileHandle, struct file *file, | |||
247 | { | 247 | { |
248 | struct dentry *dentry = file->f_path.dentry; | 248 | struct dentry *dentry = file->f_path.dentry; |
249 | struct inode *inode = dentry->d_inode; | 249 | struct inode *inode = dentry->d_inode; |
250 | struct cifsInodeInfo *pCifsInode = CIFS_I(inode); | 250 | struct cifsInodeInfo *cinode = CIFS_I(inode); |
251 | struct cifsFileInfo *pCifsFile; | 251 | struct cifsFileInfo *cfile; |
252 | 252 | ||
253 | pCifsFile = kzalloc(sizeof(struct cifsFileInfo), GFP_KERNEL); | 253 | cfile = kzalloc(sizeof(struct cifsFileInfo), GFP_KERNEL); |
254 | if (pCifsFile == NULL) | 254 | if (cfile == NULL) |
255 | return pCifsFile; | 255 | return cfile; |
256 | 256 | ||
257 | pCifsFile->count = 1; | 257 | cfile->count = 1; |
258 | pCifsFile->netfid = fileHandle; | 258 | cfile->fid.netfid = fileHandle; |
259 | pCifsFile->pid = current->tgid; | 259 | cfile->pid = current->tgid; |
260 | pCifsFile->uid = current_fsuid(); | 260 | cfile->uid = current_fsuid(); |
261 | pCifsFile->dentry = dget(dentry); | 261 | cfile->dentry = dget(dentry); |
262 | pCifsFile->f_flags = file->f_flags; | 262 | cfile->f_flags = file->f_flags; |
263 | pCifsFile->invalidHandle = false; | 263 | cfile->invalidHandle = false; |
264 | pCifsFile->tlink = cifs_get_tlink(tlink); | 264 | cfile->tlink = cifs_get_tlink(tlink); |
265 | mutex_init(&pCifsFile->fh_mutex); | 265 | mutex_init(&cfile->fh_mutex); |
266 | INIT_WORK(&pCifsFile->oplock_break, cifs_oplock_break); | 266 | INIT_WORK(&cfile->oplock_break, cifs_oplock_break); |
267 | INIT_LIST_HEAD(&pCifsFile->llist); | 267 | INIT_LIST_HEAD(&cfile->llist); |
268 | 268 | ||
269 | spin_lock(&cifs_file_list_lock); | 269 | spin_lock(&cifs_file_list_lock); |
270 | list_add(&pCifsFile->tlist, &(tlink_tcon(tlink)->openFileList)); | 270 | list_add(&cfile->tlist, &(tlink_tcon(tlink)->openFileList)); |
271 | /* if readable file instance put first in list*/ | 271 | /* if readable file instance put first in list*/ |
272 | if (file->f_mode & FMODE_READ) | 272 | if (file->f_mode & FMODE_READ) |
273 | list_add(&pCifsFile->flist, &pCifsInode->openFileList); | 273 | list_add(&cfile->flist, &cinode->openFileList); |
274 | else | 274 | else |
275 | list_add_tail(&pCifsFile->flist, &pCifsInode->openFileList); | 275 | list_add_tail(&cfile->flist, &cinode->openFileList); |
276 | spin_unlock(&cifs_file_list_lock); | 276 | spin_unlock(&cifs_file_list_lock); |
277 | 277 | ||
278 | cifs_set_oplock_level(pCifsInode, oplock); | 278 | cifs_set_oplock_level(cinode, oplock); |
279 | pCifsInode->can_cache_brlcks = pCifsInode->clientCanCacheAll; | 279 | cinode->can_cache_brlcks = cinode->clientCanCacheAll; |
280 | 280 | ||
281 | file->private_data = pCifsFile; | 281 | file->private_data = cfile; |
282 | return pCifsFile; | 282 | return cfile; |
283 | } | 283 | } |
284 | 284 | ||
285 | static void cifs_del_lock_waiters(struct cifsLockInfo *lock); | 285 | static void cifs_del_lock_waiters(struct cifsLockInfo *lock); |
@@ -336,7 +336,7 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file) | |||
336 | unsigned int xid; | 336 | unsigned int xid; |
337 | int rc; | 337 | int rc; |
338 | xid = get_xid(); | 338 | xid = get_xid(); |
339 | rc = CIFSSMBClose(xid, tcon, cifs_file->netfid); | 339 | rc = CIFSSMBClose(xid, tcon, cifs_file->fid.netfid); |
340 | free_xid(xid); | 340 | free_xid(xid); |
341 | } | 341 | } |
342 | 342 | ||
@@ -561,7 +561,7 @@ static int cifs_reopen_file(struct cifsFileInfo *pCifsFile, bool can_flush) | |||
561 | } | 561 | } |
562 | 562 | ||
563 | reopen_success: | 563 | reopen_success: |
564 | pCifsFile->netfid = netfid; | 564 | pCifsFile->fid.netfid = netfid; |
565 | pCifsFile->invalidHandle = false; | 565 | pCifsFile->invalidHandle = false; |
566 | mutex_unlock(&pCifsFile->fh_mutex); | 566 | mutex_unlock(&pCifsFile->fh_mutex); |
567 | pCifsInode = CIFS_I(inode); | 567 | pCifsInode = CIFS_I(inode); |
@@ -609,39 +609,37 @@ int cifs_closedir(struct inode *inode, struct file *file) | |||
609 | { | 609 | { |
610 | int rc = 0; | 610 | int rc = 0; |
611 | unsigned int xid; | 611 | unsigned int xid; |
612 | struct cifsFileInfo *pCFileStruct = file->private_data; | 612 | struct cifsFileInfo *cfile = file->private_data; |
613 | char *ptmp; | 613 | char *tmp; |
614 | 614 | ||
615 | cFYI(1, "Closedir inode = 0x%p", inode); | 615 | cFYI(1, "Closedir inode = 0x%p", inode); |
616 | 616 | ||
617 | xid = get_xid(); | 617 | xid = get_xid(); |
618 | 618 | ||
619 | if (pCFileStruct) { | 619 | if (cfile) { |
620 | struct cifs_tcon *pTcon = tlink_tcon(pCFileStruct->tlink); | 620 | struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); |
621 | 621 | ||
622 | cFYI(1, "Freeing private data in close dir"); | 622 | cFYI(1, "Freeing private data in close dir"); |
623 | spin_lock(&cifs_file_list_lock); | 623 | spin_lock(&cifs_file_list_lock); |
624 | if (!pCFileStruct->srch_inf.endOfSearch && | 624 | if (!cfile->srch_inf.endOfSearch && !cfile->invalidHandle) { |
625 | !pCFileStruct->invalidHandle) { | 625 | cfile->invalidHandle = true; |
626 | pCFileStruct->invalidHandle = true; | ||
627 | spin_unlock(&cifs_file_list_lock); | 626 | spin_unlock(&cifs_file_list_lock); |
628 | rc = CIFSFindClose(xid, pTcon, pCFileStruct->netfid); | 627 | rc = CIFSFindClose(xid, tcon, cfile->fid.netfid); |
629 | cFYI(1, "Closing uncompleted readdir with rc %d", | 628 | cFYI(1, "Closing uncompleted readdir with rc %d", rc); |
630 | rc); | ||
631 | /* not much we can do if it fails anyway, ignore rc */ | 629 | /* not much we can do if it fails anyway, ignore rc */ |
632 | rc = 0; | 630 | rc = 0; |
633 | } else | 631 | } else |
634 | spin_unlock(&cifs_file_list_lock); | 632 | spin_unlock(&cifs_file_list_lock); |
635 | ptmp = pCFileStruct->srch_inf.ntwrk_buf_start; | 633 | tmp = cfile->srch_inf.ntwrk_buf_start; |
636 | if (ptmp) { | 634 | if (tmp) { |
637 | cFYI(1, "closedir free smb buf in srch struct"); | 635 | cFYI(1, "closedir free smb buf in srch struct"); |
638 | pCFileStruct->srch_inf.ntwrk_buf_start = NULL; | 636 | cfile->srch_inf.ntwrk_buf_start = NULL; |
639 | if (pCFileStruct->srch_inf.smallBuf) | 637 | if (cfile->srch_inf.smallBuf) |
640 | cifs_small_buf_release(ptmp); | 638 | cifs_small_buf_release(tmp); |
641 | else | 639 | else |
642 | cifs_buf_release(ptmp); | 640 | cifs_buf_release(tmp); |
643 | } | 641 | } |
644 | cifs_put_tlink(pCFileStruct->tlink); | 642 | cifs_put_tlink(cfile->tlink); |
645 | kfree(file->private_data); | 643 | kfree(file->private_data); |
646 | file->private_data = NULL; | 644 | file->private_data = NULL; |
647 | } | 645 | } |
@@ -932,7 +930,8 @@ cifs_push_mandatory_locks(struct cifsFileInfo *cfile) | |||
932 | cur->OffsetLow = cpu_to_le32((u32)li->offset); | 930 | cur->OffsetLow = cpu_to_le32((u32)li->offset); |
933 | cur->OffsetHigh = cpu_to_le32((u32)(li->offset>>32)); | 931 | cur->OffsetHigh = cpu_to_le32((u32)(li->offset>>32)); |
934 | if (++num == max_num) { | 932 | if (++num == max_num) { |
935 | stored_rc = cifs_lockv(xid, tcon, cfile->netfid, | 933 | stored_rc = cifs_lockv(xid, tcon, |
934 | cfile->fid.netfid, | ||
936 | (__u8)li->type, 0, num, | 935 | (__u8)li->type, 0, num, |
937 | buf); | 936 | buf); |
938 | if (stored_rc) | 937 | if (stored_rc) |
@@ -944,7 +943,7 @@ cifs_push_mandatory_locks(struct cifsFileInfo *cfile) | |||
944 | } | 943 | } |
945 | 944 | ||
946 | if (num) { | 945 | if (num) { |
947 | stored_rc = cifs_lockv(xid, tcon, cfile->netfid, | 946 | stored_rc = cifs_lockv(xid, tcon, cfile->fid.netfid, |
948 | (__u8)types[i], 0, num, buf); | 947 | (__u8)types[i], 0, num, buf); |
949 | if (stored_rc) | 948 | if (stored_rc) |
950 | rc = stored_rc; | 949 | rc = stored_rc; |
@@ -1038,7 +1037,7 @@ cifs_push_posix_locks(struct cifsFileInfo *cfile) | |||
1038 | type = CIFS_WRLCK; | 1037 | type = CIFS_WRLCK; |
1039 | lck = list_entry(el, struct lock_to_push, llist); | 1038 | lck = list_entry(el, struct lock_to_push, llist); |
1040 | lck->pid = flock->fl_pid; | 1039 | lck->pid = flock->fl_pid; |
1041 | lck->netfid = cfile->netfid; | 1040 | lck->netfid = cfile->fid.netfid; |
1042 | lck->length = length; | 1041 | lck->length = length; |
1043 | lck->type = type; | 1042 | lck->type = type; |
1044 | lck->offset = flock->fl_start; | 1043 | lck->offset = flock->fl_start; |
@@ -1137,7 +1136,7 @@ static int | |||
1137 | cifs_mandatory_lock(unsigned int xid, struct cifsFileInfo *cfile, __u64 offset, | 1136 | cifs_mandatory_lock(unsigned int xid, struct cifsFileInfo *cfile, __u64 offset, |
1138 | __u64 length, __u32 type, int lock, int unlock, bool wait) | 1137 | __u64 length, __u32 type, int lock, int unlock, bool wait) |
1139 | { | 1138 | { |
1140 | return CIFSSMBLock(xid, tlink_tcon(cfile->tlink), cfile->netfid, | 1139 | return CIFSSMBLock(xid, tlink_tcon(cfile->tlink), cfile->fid.netfid, |
1141 | current->tgid, length, offset, unlock, lock, | 1140 | current->tgid, length, offset, unlock, lock, |
1142 | (__u8)type, wait, 0); | 1141 | (__u8)type, wait, 0); |
1143 | } | 1142 | } |
@@ -1151,7 +1150,7 @@ cifs_getlk(struct file *file, struct file_lock *flock, __u32 type, | |||
1151 | struct cifsFileInfo *cfile = (struct cifsFileInfo *)file->private_data; | 1150 | struct cifsFileInfo *cfile = (struct cifsFileInfo *)file->private_data; |
1152 | struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); | 1151 | struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); |
1153 | struct TCP_Server_Info *server = tcon->ses->server; | 1152 | struct TCP_Server_Info *server = tcon->ses->server; |
1154 | __u16 netfid = cfile->netfid; | 1153 | __u16 netfid = cfile->fid.netfid; |
1155 | 1154 | ||
1156 | if (posix_lck) { | 1155 | if (posix_lck) { |
1157 | int posix_lock_type; | 1156 | int posix_lock_type; |
@@ -1295,7 +1294,8 @@ cifs_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock, | |||
1295 | */ | 1294 | */ |
1296 | list_move(&li->llist, &tmp_llist); | 1295 | list_move(&li->llist, &tmp_llist); |
1297 | if (++num == max_num) { | 1296 | if (++num == max_num) { |
1298 | stored_rc = cifs_lockv(xid, tcon, cfile->netfid, | 1297 | stored_rc = cifs_lockv(xid, tcon, |
1298 | cfile->fid.netfid, | ||
1299 | li->type, num, 0, buf); | 1299 | li->type, num, 0, buf); |
1300 | if (stored_rc) { | 1300 | if (stored_rc) { |
1301 | /* | 1301 | /* |
@@ -1318,7 +1318,7 @@ cifs_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock, | |||
1318 | cur++; | 1318 | cur++; |
1319 | } | 1319 | } |
1320 | if (num) { | 1320 | if (num) { |
1321 | stored_rc = cifs_lockv(xid, tcon, cfile->netfid, | 1321 | stored_rc = cifs_lockv(xid, tcon, cfile->fid.netfid, |
1322 | types[i], num, 0, buf); | 1322 | types[i], num, 0, buf); |
1323 | if (stored_rc) { | 1323 | if (stored_rc) { |
1324 | cifs_move_llist(&tmp_llist, &cfile->llist); | 1324 | cifs_move_llist(&tmp_llist, &cfile->llist); |
@@ -1343,7 +1343,7 @@ cifs_setlk(struct file *file, struct file_lock *flock, __u32 type, | |||
1343 | struct cifsFileInfo *cfile = (struct cifsFileInfo *)file->private_data; | 1343 | struct cifsFileInfo *cfile = (struct cifsFileInfo *)file->private_data; |
1344 | struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); | 1344 | struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); |
1345 | struct TCP_Server_Info *server = tcon->ses->server; | 1345 | struct TCP_Server_Info *server = tcon->ses->server; |
1346 | __u16 netfid = cfile->netfid; | 1346 | __u16 netfid = cfile->fid.netfid; |
1347 | 1347 | ||
1348 | if (posix_lck) { | 1348 | if (posix_lck) { |
1349 | int posix_lock_type; | 1349 | int posix_lock_type; |
@@ -1423,7 +1423,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *flock) | |||
1423 | tcon->ses->server); | 1423 | tcon->ses->server); |
1424 | 1424 | ||
1425 | cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); | 1425 | cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); |
1426 | netfid = cfile->netfid; | 1426 | netfid = cfile->fid.netfid; |
1427 | cinode = CIFS_I(file->f_path.dentry->d_inode); | 1427 | cinode = CIFS_I(file->f_path.dentry->d_inode); |
1428 | 1428 | ||
1429 | if (cap_unix(tcon->ses) && | 1429 | if (cap_unix(tcon->ses) && |
@@ -1514,7 +1514,7 @@ static ssize_t cifs_write(struct cifsFileInfo *open_file, __u32 pid, | |||
1514 | /* iov[0] is reserved for smb header */ | 1514 | /* iov[0] is reserved for smb header */ |
1515 | iov[1].iov_base = (char *)write_data + total_written; | 1515 | iov[1].iov_base = (char *)write_data + total_written; |
1516 | iov[1].iov_len = len; | 1516 | iov[1].iov_len = len; |
1517 | io_parms.netfid = open_file->netfid; | 1517 | io_parms.netfid = open_file->fid.netfid; |
1518 | io_parms.pid = pid; | 1518 | io_parms.pid = pid; |
1519 | io_parms.tcon = pTcon; | 1519 | io_parms.tcon = pTcon; |
1520 | io_parms.offset = *poffset; | 1520 | io_parms.offset = *poffset; |
@@ -2078,7 +2078,7 @@ int cifs_strict_fsync(struct file *file, loff_t start, loff_t end, | |||
2078 | 2078 | ||
2079 | tcon = tlink_tcon(smbfile->tlink); | 2079 | tcon = tlink_tcon(smbfile->tlink); |
2080 | if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOSSYNC)) | 2080 | if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOSSYNC)) |
2081 | rc = CIFSSMBFlush(xid, tcon, smbfile->netfid); | 2081 | rc = CIFSSMBFlush(xid, tcon, smbfile->fid.netfid); |
2082 | 2082 | ||
2083 | free_xid(xid); | 2083 | free_xid(xid); |
2084 | mutex_unlock(&inode->i_mutex); | 2084 | mutex_unlock(&inode->i_mutex); |
@@ -2106,7 +2106,7 @@ int cifs_fsync(struct file *file, loff_t start, loff_t end, int datasync) | |||
2106 | 2106 | ||
2107 | tcon = tlink_tcon(smbfile->tlink); | 2107 | tcon = tlink_tcon(smbfile->tlink); |
2108 | if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOSSYNC)) | 2108 | if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOSSYNC)) |
2109 | rc = CIFSSMBFlush(xid, tcon, smbfile->netfid); | 2109 | rc = CIFSSMBFlush(xid, tcon, smbfile->fid.netfid); |
2110 | 2110 | ||
2111 | free_xid(xid); | 2111 | free_xid(xid); |
2112 | mutex_unlock(&inode->i_mutex); | 2112 | mutex_unlock(&inode->i_mutex); |
@@ -2802,7 +2802,7 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size, | |||
2802 | if (rc != 0) | 2802 | if (rc != 0) |
2803 | break; | 2803 | break; |
2804 | } | 2804 | } |
2805 | io_parms.netfid = open_file->netfid; | 2805 | io_parms.netfid = open_file->fid.netfid; |
2806 | io_parms.pid = pid; | 2806 | io_parms.pid = pid; |
2807 | io_parms.tcon = tcon; | 2807 | io_parms.tcon = tcon; |
2808 | io_parms.offset = *poffset; | 2808 | io_parms.offset = *poffset; |
@@ -3374,7 +3374,7 @@ void cifs_oplock_break(struct work_struct *work) | |||
3374 | * disconnected since oplock already released by the server | 3374 | * disconnected since oplock already released by the server |
3375 | */ | 3375 | */ |
3376 | if (!cfile->oplock_break_cancelled) { | 3376 | if (!cfile->oplock_break_cancelled) { |
3377 | rc = CIFSSMBLock(0, tlink_tcon(cfile->tlink), cfile->netfid, | 3377 | rc = CIFSSMBLock(0, tlink_tcon(cfile->tlink), cfile->fid.netfid, |
3378 | current->tgid, 0, 0, 0, 0, | 3378 | current->tgid, 0, 0, 0, 0, |
3379 | LOCKING_ANDX_OPLOCK_RELEASE, false, | 3379 | LOCKING_ANDX_OPLOCK_RELEASE, false, |
3380 | cinode->clientCanCacheRead ? 1 : 0); | 3380 | cinode->clientCanCacheRead ? 1 : 0); |
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index bb39ea475a20..ea7428a82a31 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -294,7 +294,7 @@ int cifs_get_file_info_unix(struct file *filp) | |||
294 | struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); | 294 | struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); |
295 | 295 | ||
296 | xid = get_xid(); | 296 | xid = get_xid(); |
297 | rc = CIFSSMBUnixQFileInfo(xid, tcon, cfile->netfid, &find_data); | 297 | rc = CIFSSMBUnixQFileInfo(xid, tcon, cfile->fid.netfid, &find_data); |
298 | if (!rc) { | 298 | if (!rc) { |
299 | cifs_unix_basic_to_fattr(&fattr, &find_data, cifs_sb); | 299 | cifs_unix_basic_to_fattr(&fattr, &find_data, cifs_sb); |
300 | } else if (rc == -EREMOTE) { | 300 | } else if (rc == -EREMOTE) { |
@@ -562,7 +562,7 @@ int cifs_get_file_info(struct file *filp) | |||
562 | struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); | 562 | struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); |
563 | 563 | ||
564 | xid = get_xid(); | 564 | xid = get_xid(); |
565 | rc = CIFSSMBQFileInfo(xid, tcon, cfile->netfid, &find_data); | 565 | rc = CIFSSMBQFileInfo(xid, tcon, cfile->fid.netfid, &find_data); |
566 | switch (rc) { | 566 | switch (rc) { |
567 | case 0: | 567 | case 0: |
568 | cifs_all_info_to_fattr(&fattr, &find_data, cifs_sb, false); | 568 | cifs_all_info_to_fattr(&fattr, &find_data, cifs_sb, false); |
@@ -930,7 +930,7 @@ cifs_set_file_info(struct inode *inode, struct iattr *attrs, unsigned int xid, | |||
930 | */ | 930 | */ |
931 | open_file = find_writable_file(cifsInode, true); | 931 | open_file = find_writable_file(cifsInode, true); |
932 | if (open_file) { | 932 | if (open_file) { |
933 | netfid = open_file->netfid; | 933 | netfid = open_file->fid.netfid; |
934 | netpid = open_file->pid; | 934 | netpid = open_file->pid; |
935 | pTcon = tlink_tcon(open_file->tlink); | 935 | pTcon = tlink_tcon(open_file->tlink); |
936 | goto set_via_filehandle; | 936 | goto set_via_filehandle; |
@@ -1887,7 +1887,7 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs, | |||
1887 | */ | 1887 | */ |
1888 | open_file = find_writable_file(cifsInode, true); | 1888 | open_file = find_writable_file(cifsInode, true); |
1889 | if (open_file) { | 1889 | if (open_file) { |
1890 | __u16 nfid = open_file->netfid; | 1890 | __u16 nfid = open_file->fid.netfid; |
1891 | __u32 npid = open_file->pid; | 1891 | __u32 npid = open_file->pid; |
1892 | pTcon = tlink_tcon(open_file->tlink); | 1892 | pTcon = tlink_tcon(open_file->tlink); |
1893 | rc = CIFSSMBSetFileSize(xid, pTcon, attrs->ia_size, nfid, | 1893 | rc = CIFSSMBSetFileSize(xid, pTcon, attrs->ia_size, nfid, |
@@ -2061,7 +2061,7 @@ cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs) | |||
2061 | args->device = 0; | 2061 | args->device = 0; |
2062 | open_file = find_writable_file(cifsInode, true); | 2062 | open_file = find_writable_file(cifsInode, true); |
2063 | if (open_file) { | 2063 | if (open_file) { |
2064 | u16 nfid = open_file->netfid; | 2064 | u16 nfid = open_file->fid.netfid; |
2065 | u32 npid = open_file->pid; | 2065 | u32 npid = open_file->pid; |
2066 | pTcon = tlink_tcon(open_file->tlink); | 2066 | pTcon = tlink_tcon(open_file->tlink); |
2067 | rc = CIFSSMBUnixSetFileInfo(xid, pTcon, args, nfid, npid); | 2067 | rc = CIFSSMBUnixSetFileInfo(xid, pTcon, args, nfid, npid); |
diff --git a/fs/cifs/ioctl.c b/fs/cifs/ioctl.c index ae082a66de2f..5b3481bd3d96 100644 --- a/fs/cifs/ioctl.c +++ b/fs/cifs/ioctl.c | |||
@@ -75,8 +75,9 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg) | |||
75 | tcon = tlink_tcon(pSMBFile->tlink); | 75 | tcon = tlink_tcon(pSMBFile->tlink); |
76 | caps = le64_to_cpu(tcon->fsUnixInfo.Capability); | 76 | caps = le64_to_cpu(tcon->fsUnixInfo.Capability); |
77 | if (CIFS_UNIX_EXTATTR_CAP & caps) { | 77 | if (CIFS_UNIX_EXTATTR_CAP & caps) { |
78 | rc = CIFSGetExtAttr(xid, tcon, pSMBFile->netfid, | 78 | rc = CIFSGetExtAttr(xid, tcon, |
79 | &ExtAttrBits, &ExtAttrMask); | 79 | pSMBFile->fid.netfid, |
80 | &ExtAttrBits, &ExtAttrMask); | ||
80 | if (rc == 0) | 81 | if (rc == 0) |
81 | rc = put_user(ExtAttrBits & | 82 | rc = put_user(ExtAttrBits & |
82 | FS_FL_USER_VISIBLE, | 83 | FS_FL_USER_VISIBLE, |
@@ -94,8 +95,12 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg) | |||
94 | rc = -EFAULT; | 95 | rc = -EFAULT; |
95 | break; | 96 | break; |
96 | } | 97 | } |
97 | /* rc= CIFSGetExtAttr(xid,tcon,pSMBFile->netfid, | 98 | /* |
98 | extAttrBits, &ExtAttrMask);*/ | 99 | * rc = CIFSGetExtAttr(xid, tcon, |
100 | * pSMBFile->fid.netfid, | ||
101 | * extAttrBits, | ||
102 | * &ExtAttrMask); | ||
103 | */ | ||
99 | } | 104 | } |
100 | cFYI(1, "set flags not implemented yet"); | 105 | cFYI(1, "set flags not implemented yet"); |
101 | break; | 106 | break; |
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c index ce41fee07e5b..a921b0712eff 100644 --- a/fs/cifs/misc.c +++ b/fs/cifs/misc.c | |||
@@ -466,7 +466,7 @@ is_valid_oplock_break(char *buffer, struct TCP_Server_Info *srv) | |||
466 | list_for_each(tmp2, &tcon->openFileList) { | 466 | list_for_each(tmp2, &tcon->openFileList) { |
467 | netfile = list_entry(tmp2, struct cifsFileInfo, | 467 | netfile = list_entry(tmp2, struct cifsFileInfo, |
468 | tlist); | 468 | tlist); |
469 | if (pSMB->Fid != netfile->netfid) | 469 | if (pSMB->Fid != netfile->fid.netfid) |
470 | continue; | 470 | continue; |
471 | 471 | ||
472 | cFYI(1, "file id match, oplock break"); | 472 | cFYI(1, "file id match, oplock break"); |
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index d87f82678bc7..9e76e3b3289b 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c | |||
@@ -279,7 +279,7 @@ ffirst_retry: | |||
279 | search_flags |= CIFS_SEARCH_BACKUP_SEARCH; | 279 | search_flags |= CIFS_SEARCH_BACKUP_SEARCH; |
280 | 280 | ||
281 | rc = CIFSFindFirst(xid, tcon, full_path, cifs_sb->local_nls, | 281 | rc = CIFSFindFirst(xid, tcon, full_path, cifs_sb->local_nls, |
282 | &cifsFile->netfid, search_flags, &cifsFile->srch_inf, | 282 | &cifsFile->fid.netfid, search_flags, &cifsFile->srch_inf, |
283 | cifs_sb->mnt_cifs_flags & | 283 | cifs_sb->mnt_cifs_flags & |
284 | CIFS_MOUNT_MAP_SPECIAL_CHR, CIFS_DIR_SEP(cifs_sb)); | 284 | CIFS_MOUNT_MAP_SPECIAL_CHR, CIFS_DIR_SEP(cifs_sb)); |
285 | if (rc == 0) | 285 | if (rc == 0) |
@@ -545,7 +545,7 @@ static int find_cifs_entry(const unsigned int xid, struct cifs_tcon *pTcon, | |||
545 | !cifsFile->invalidHandle) { | 545 | !cifsFile->invalidHandle) { |
546 | cifsFile->invalidHandle = true; | 546 | cifsFile->invalidHandle = true; |
547 | spin_unlock(&cifs_file_list_lock); | 547 | spin_unlock(&cifs_file_list_lock); |
548 | CIFSFindClose(xid, pTcon, cifsFile->netfid); | 548 | CIFSFindClose(xid, pTcon, cifsFile->fid.netfid); |
549 | } else | 549 | } else |
550 | spin_unlock(&cifs_file_list_lock); | 550 | spin_unlock(&cifs_file_list_lock); |
551 | if (cifsFile->srch_inf.ntwrk_buf_start) { | 551 | if (cifsFile->srch_inf.ntwrk_buf_start) { |
@@ -577,8 +577,8 @@ static int find_cifs_entry(const unsigned int xid, struct cifs_tcon *pTcon, | |||
577 | while ((index_to_find >= cifsFile->srch_inf.index_of_last_entry) && | 577 | while ((index_to_find >= cifsFile->srch_inf.index_of_last_entry) && |
578 | (rc == 0) && !cifsFile->srch_inf.endOfSearch) { | 578 | (rc == 0) && !cifsFile->srch_inf.endOfSearch) { |
579 | cFYI(1, "calling findnext2"); | 579 | cFYI(1, "calling findnext2"); |
580 | rc = CIFSFindNext(xid, pTcon, cifsFile->netfid, search_flags, | 580 | rc = CIFSFindNext(xid, pTcon, cifsFile->fid.netfid, |
581 | &cifsFile->srch_inf); | 581 | search_flags, &cifsFile->srch_inf); |
582 | /* FindFirst/Next set last_entry to NULL on malformed reply */ | 582 | /* FindFirst/Next set last_entry to NULL on malformed reply */ |
583 | if (cifsFile->srch_inf.last_entry) | 583 | if (cifsFile->srch_inf.last_entry) |
584 | cifs_save_resume_key(cifsFile->srch_inf.last_entry, | 584 | cifs_save_resume_key(cifsFile->srch_inf.last_entry, |
@@ -781,7 +781,7 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) | |||
781 | } | 781 | } |
782 | } /* else { | 782 | } /* else { |
783 | cifsFile->invalidHandle = true; | 783 | cifsFile->invalidHandle = true; |
784 | CIFSFindClose(xid, pTcon, cifsFile->netfid); | 784 | CIFSFindClose(xid, pTcon, cifsFile->fid.netfid); |
785 | } */ | 785 | } */ |
786 | 786 | ||
787 | pTcon = tlink_tcon(cifsFile->tlink); | 787 | pTcon = tlink_tcon(cifsFile->tlink); |
diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c index 725fa6195867..b170da0a882d 100644 --- a/fs/cifs/smb1ops.c +++ b/fs/cifs/smb1ops.c | |||
@@ -63,7 +63,7 @@ send_nt_cancel(struct TCP_Server_Info *server, void *buf, | |||
63 | static bool | 63 | static bool |
64 | cifs_compare_fids(struct cifsFileInfo *ob1, struct cifsFileInfo *ob2) | 64 | cifs_compare_fids(struct cifsFileInfo *ob1, struct cifsFileInfo *ob2) |
65 | { | 65 | { |
66 | return ob1->netfid == ob2->netfid; | 66 | return ob1->fid.netfid == ob2->fid.netfid; |
67 | } | 67 | } |
68 | 68 | ||
69 | static unsigned int | 69 | static unsigned int |