aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/inode.c
diff options
context:
space:
mode:
authorPavel Shilovsky <pshilovsky@samba.org>2012-06-20 03:21:16 -0400
committerSteve French <smfrench@gmail.com>2012-07-24 11:25:08 -0400
commit6d5786a34d98bffb8ad50d8053d1e53231fe0636 (patch)
treeae49860befc52cb18dfb2b86929878a204289601 /fs/cifs/inode.c
parent2e6e02ab6ddbd539fd7e092973daf057adbd53dc (diff)
CIFS: Rename Get/FreeXid and make them work with unsigned int
Acked-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org> Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs/inode.c')
-rw-r--r--fs/cifs/inode.c87
1 files changed, 45 insertions, 42 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 8e8bb49112ff..af902864ac03 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -289,7 +289,7 @@ cifs_create_dfs_fattr(struct cifs_fattr *fattr, struct super_block *sb)
289int cifs_get_file_info_unix(struct file *filp) 289int cifs_get_file_info_unix(struct file *filp)
290{ 290{
291 int rc; 291 int rc;
292 int xid; 292 unsigned int xid;
293 FILE_UNIX_BASIC_INFO find_data; 293 FILE_UNIX_BASIC_INFO find_data;
294 struct cifs_fattr fattr; 294 struct cifs_fattr fattr;
295 struct inode *inode = filp->f_path.dentry->d_inode; 295 struct inode *inode = filp->f_path.dentry->d_inode;
@@ -297,7 +297,7 @@ int cifs_get_file_info_unix(struct file *filp)
297 struct cifsFileInfo *cfile = filp->private_data; 297 struct cifsFileInfo *cfile = filp->private_data;
298 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); 298 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
299 299
300 xid = GetXid(); 300 xid = get_xid();
301 rc = CIFSSMBUnixQFileInfo(xid, tcon, cfile->netfid, &find_data); 301 rc = CIFSSMBUnixQFileInfo(xid, tcon, cfile->netfid, &find_data);
302 if (!rc) { 302 if (!rc) {
303 cifs_unix_basic_to_fattr(&fattr, &find_data, cifs_sb); 303 cifs_unix_basic_to_fattr(&fattr, &find_data, cifs_sb);
@@ -307,13 +307,13 @@ int cifs_get_file_info_unix(struct file *filp)
307 } 307 }
308 308
309 cifs_fattr_to_inode(inode, &fattr); 309 cifs_fattr_to_inode(inode, &fattr);
310 FreeXid(xid); 310 free_xid(xid);
311 return rc; 311 return rc;
312} 312}
313 313
314int cifs_get_inode_info_unix(struct inode **pinode, 314int cifs_get_inode_info_unix(struct inode **pinode,
315 const unsigned char *full_path, 315 const unsigned char *full_path,
316 struct super_block *sb, int xid) 316 struct super_block *sb, unsigned int xid)
317{ 317{
318 int rc; 318 int rc;
319 FILE_UNIX_BASIC_INFO find_data; 319 FILE_UNIX_BASIC_INFO find_data;
@@ -367,7 +367,7 @@ int cifs_get_inode_info_unix(struct inode **pinode,
367 367
368static int 368static int
369cifs_sfu_type(struct cifs_fattr *fattr, const unsigned char *path, 369cifs_sfu_type(struct cifs_fattr *fattr, const unsigned char *path,
370 struct cifs_sb_info *cifs_sb, int xid) 370 struct cifs_sb_info *cifs_sb, unsigned int xid)
371{ 371{
372 int rc; 372 int rc;
373 int oplock = 0; 373 int oplock = 0;
@@ -466,7 +466,7 @@ cifs_sfu_type(struct cifs_fattr *fattr, const unsigned char *path,
466 * FIXME: Doesn't this clobber the type bit we got from cifs_sfu_type ? 466 * FIXME: Doesn't this clobber the type bit we got from cifs_sfu_type ?
467 */ 467 */
468static int cifs_sfu_mode(struct cifs_fattr *fattr, const unsigned char *path, 468static int cifs_sfu_mode(struct cifs_fattr *fattr, const unsigned char *path,
469 struct cifs_sb_info *cifs_sb, int xid) 469 struct cifs_sb_info *cifs_sb, unsigned int xid)
470{ 470{
471#ifdef CONFIG_CIFS_XATTR 471#ifdef CONFIG_CIFS_XATTR
472 ssize_t rc; 472 ssize_t rc;
@@ -557,7 +557,7 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info,
557int cifs_get_file_info(struct file *filp) 557int cifs_get_file_info(struct file *filp)
558{ 558{
559 int rc; 559 int rc;
560 int xid; 560 unsigned int xid;
561 FILE_ALL_INFO find_data; 561 FILE_ALL_INFO find_data;
562 struct cifs_fattr fattr; 562 struct cifs_fattr fattr;
563 struct inode *inode = filp->f_path.dentry->d_inode; 563 struct inode *inode = filp->f_path.dentry->d_inode;
@@ -565,7 +565,7 @@ int cifs_get_file_info(struct file *filp)
565 struct cifsFileInfo *cfile = filp->private_data; 565 struct cifsFileInfo *cfile = filp->private_data;
566 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); 566 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
567 567
568 xid = GetXid(); 568 xid = get_xid();
569 rc = CIFSSMBQFileInfo(xid, tcon, cfile->netfid, &find_data); 569 rc = CIFSSMBQFileInfo(xid, tcon, cfile->netfid, &find_data);
570 switch (rc) { 570 switch (rc) {
571 case 0: 571 case 0:
@@ -596,13 +596,13 @@ int cifs_get_file_info(struct file *filp)
596 fattr.cf_flags |= CIFS_FATTR_NEED_REVAL; 596 fattr.cf_flags |= CIFS_FATTR_NEED_REVAL;
597 cifs_fattr_to_inode(inode, &fattr); 597 cifs_fattr_to_inode(inode, &fattr);
598cgfi_exit: 598cgfi_exit:
599 FreeXid(xid); 599 free_xid(xid);
600 return rc; 600 return rc;
601} 601}
602 602
603int cifs_get_inode_info(struct inode **pinode, 603int cifs_get_inode_info(struct inode **pinode,
604 const unsigned char *full_path, FILE_ALL_INFO *pfindData, 604 const unsigned char *full_path, FILE_ALL_INFO *pfindData,
605 struct super_block *sb, int xid, const __u16 *pfid) 605 struct super_block *sb, unsigned int xid, const __u16 *pfid)
606{ 606{
607 int rc = 0, tmprc; 607 int rc = 0, tmprc;
608 struct cifs_tcon *pTcon; 608 struct cifs_tcon *pTcon;
@@ -886,13 +886,13 @@ retry_iget5_locked:
886/* gets root inode */ 886/* gets root inode */
887struct inode *cifs_root_iget(struct super_block *sb) 887struct inode *cifs_root_iget(struct super_block *sb)
888{ 888{
889 int xid; 889 unsigned int xid;
890 struct cifs_sb_info *cifs_sb = CIFS_SB(sb); 890 struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
891 struct inode *inode = NULL; 891 struct inode *inode = NULL;
892 long rc; 892 long rc;
893 struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb); 893 struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb);
894 894
895 xid = GetXid(); 895 xid = get_xid();
896 if (tcon->unix_ext) 896 if (tcon->unix_ext)
897 rc = cifs_get_inode_info_unix(&inode, "", sb, xid); 897 rc = cifs_get_inode_info_unix(&inode, "", sb, xid);
898 else 898 else
@@ -922,15 +922,15 @@ struct inode *cifs_root_iget(struct super_block *sb)
922 } 922 }
923 923
924out: 924out:
925 /* can not call macro FreeXid here since in a void func 925 /* can not call macro free_xid here since in a void func
926 * TODO: This is no longer true 926 * TODO: This is no longer true
927 */ 927 */
928 _FreeXid(xid); 928 _free_xid(xid);
929 return inode; 929 return inode;
930} 930}
931 931
932static int 932static int
933cifs_set_file_info(struct inode *inode, struct iattr *attrs, int xid, 933cifs_set_file_info(struct inode *inode, struct iattr *attrs, unsigned int xid,
934 char *full_path, __u32 dosattr) 934 char *full_path, __u32 dosattr)
935{ 935{
936 int rc; 936 int rc;
@@ -1051,7 +1051,8 @@ out:
1051 * anything else. 1051 * anything else.
1052 */ 1052 */
1053static int 1053static int
1054cifs_rename_pending_delete(char *full_path, struct dentry *dentry, int xid) 1054cifs_rename_pending_delete(char *full_path, struct dentry *dentry,
1055 unsigned int xid)
1055{ 1056{
1056 int oplock = 0; 1057 int oplock = 0;
1057 int rc; 1058 int rc;
@@ -1171,7 +1172,7 @@ undo_setattr:
1171int cifs_unlink(struct inode *dir, struct dentry *dentry) 1172int cifs_unlink(struct inode *dir, struct dentry *dentry)
1172{ 1173{
1173 int rc = 0; 1174 int rc = 0;
1174 int xid; 1175 unsigned int xid;
1175 char *full_path = NULL; 1176 char *full_path = NULL;
1176 struct inode *inode = dentry->d_inode; 1177 struct inode *inode = dentry->d_inode;
1177 struct cifsInodeInfo *cifs_inode; 1178 struct cifsInodeInfo *cifs_inode;
@@ -1189,7 +1190,7 @@ int cifs_unlink(struct inode *dir, struct dentry *dentry)
1189 return PTR_ERR(tlink); 1190 return PTR_ERR(tlink);
1190 tcon = tlink_tcon(tlink); 1191 tcon = tlink_tcon(tlink);
1191 1192
1192 xid = GetXid(); 1193 xid = get_xid();
1193 1194
1194 /* Unlink can be called from rename so we can not take the 1195 /* Unlink can be called from rename so we can not take the
1195 * sb->s_vfs_rename_mutex here */ 1196 * sb->s_vfs_rename_mutex here */
@@ -1265,7 +1266,7 @@ out_reval:
1265unlink_out: 1266unlink_out:
1266 kfree(full_path); 1267 kfree(full_path);
1267 kfree(attrs); 1268 kfree(attrs);
1268 FreeXid(xid); 1269 free_xid(xid);
1269 cifs_put_tlink(tlink); 1270 cifs_put_tlink(tlink);
1270 return rc; 1271 return rc;
1271} 1272}
@@ -1273,7 +1274,7 @@ unlink_out:
1273int cifs_mkdir(struct inode *inode, struct dentry *direntry, umode_t mode) 1274int cifs_mkdir(struct inode *inode, struct dentry *direntry, umode_t mode)
1274{ 1275{
1275 int rc = 0, tmprc; 1276 int rc = 0, tmprc;
1276 int xid; 1277 unsigned int xid;
1277 struct cifs_sb_info *cifs_sb; 1278 struct cifs_sb_info *cifs_sb;
1278 struct tcon_link *tlink; 1279 struct tcon_link *tlink;
1279 struct cifs_tcon *pTcon; 1280 struct cifs_tcon *pTcon;
@@ -1289,7 +1290,7 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, umode_t mode)
1289 return PTR_ERR(tlink); 1290 return PTR_ERR(tlink);
1290 pTcon = tlink_tcon(tlink); 1291 pTcon = tlink_tcon(tlink);
1291 1292
1292 xid = GetXid(); 1293 xid = get_xid();
1293 1294
1294 full_path = build_path_from_dentry(direntry); 1295 full_path = build_path_from_dentry(direntry);
1295 if (full_path == NULL) { 1296 if (full_path == NULL) {
@@ -1446,7 +1447,7 @@ mkdir_out:
1446 */ 1447 */
1447 CIFS_I(inode)->time = 0; 1448 CIFS_I(inode)->time = 0;
1448 kfree(full_path); 1449 kfree(full_path);
1449 FreeXid(xid); 1450 free_xid(xid);
1450 cifs_put_tlink(tlink); 1451 cifs_put_tlink(tlink);
1451 return rc; 1452 return rc;
1452} 1453}
@@ -1454,7 +1455,7 @@ mkdir_out:
1454int cifs_rmdir(struct inode *inode, struct dentry *direntry) 1455int cifs_rmdir(struct inode *inode, struct dentry *direntry)
1455{ 1456{
1456 int rc = 0; 1457 int rc = 0;
1457 int xid; 1458 unsigned int xid;
1458 struct cifs_sb_info *cifs_sb; 1459 struct cifs_sb_info *cifs_sb;
1459 struct tcon_link *tlink; 1460 struct tcon_link *tlink;
1460 struct cifs_tcon *pTcon; 1461 struct cifs_tcon *pTcon;
@@ -1463,7 +1464,7 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry)
1463 1464
1464 cFYI(1, "cifs_rmdir, inode = 0x%p", inode); 1465 cFYI(1, "cifs_rmdir, inode = 0x%p", inode);
1465 1466
1466 xid = GetXid(); 1467 xid = get_xid();
1467 1468
1468 full_path = build_path_from_dentry(direntry); 1469 full_path = build_path_from_dentry(direntry);
1469 if (full_path == NULL) { 1470 if (full_path == NULL) {
@@ -1506,13 +1507,14 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry)
1506 1507
1507rmdir_exit: 1508rmdir_exit:
1508 kfree(full_path); 1509 kfree(full_path);
1509 FreeXid(xid); 1510 free_xid(xid);
1510 return rc; 1511 return rc;
1511} 1512}
1512 1513
1513static int 1514static int
1514cifs_do_rename(int xid, struct dentry *from_dentry, const char *fromPath, 1515cifs_do_rename(unsigned int xid, struct dentry *from_dentry,
1515 struct dentry *to_dentry, const char *toPath) 1516 const char *fromPath, struct dentry *to_dentry,
1517 const char *toPath)
1516{ 1518{
1517 struct cifs_sb_info *cifs_sb = CIFS_SB(from_dentry->d_sb); 1519 struct cifs_sb_info *cifs_sb = CIFS_SB(from_dentry->d_sb);
1518 struct tcon_link *tlink; 1520 struct tcon_link *tlink;
@@ -1571,7 +1573,8 @@ int cifs_rename(struct inode *source_dir, struct dentry *source_dentry,
1571 struct cifs_tcon *tcon; 1573 struct cifs_tcon *tcon;
1572 FILE_UNIX_BASIC_INFO *info_buf_source = NULL; 1574 FILE_UNIX_BASIC_INFO *info_buf_source = NULL;
1573 FILE_UNIX_BASIC_INFO *info_buf_target; 1575 FILE_UNIX_BASIC_INFO *info_buf_target;
1574 int xid, rc, tmprc; 1576 unsigned int xid;
1577 int rc, tmprc;
1575 1578
1576 cifs_sb = CIFS_SB(source_dir->i_sb); 1579 cifs_sb = CIFS_SB(source_dir->i_sb);
1577 tlink = cifs_sb_tlink(cifs_sb); 1580 tlink = cifs_sb_tlink(cifs_sb);
@@ -1579,7 +1582,7 @@ int cifs_rename(struct inode *source_dir, struct dentry *source_dentry,
1579 return PTR_ERR(tlink); 1582 return PTR_ERR(tlink);
1580 tcon = tlink_tcon(tlink); 1583 tcon = tlink_tcon(tlink);
1581 1584
1582 xid = GetXid(); 1585 xid = get_xid();
1583 1586
1584 /* 1587 /*
1585 * we already have the rename sem so we do not need to 1588 * we already have the rename sem so we do not need to
@@ -1652,7 +1655,7 @@ cifs_rename_exit:
1652 kfree(info_buf_source); 1655 kfree(info_buf_source);
1653 kfree(fromName); 1656 kfree(fromName);
1654 kfree(toName); 1657 kfree(toName);
1655 FreeXid(xid); 1658 free_xid(xid);
1656 cifs_put_tlink(tlink); 1659 cifs_put_tlink(tlink);
1657 return rc; 1660 return rc;
1658} 1661}
@@ -1727,7 +1730,7 @@ int cifs_revalidate_file_attr(struct file *filp)
1727 1730
1728int cifs_revalidate_dentry_attr(struct dentry *dentry) 1731int cifs_revalidate_dentry_attr(struct dentry *dentry)
1729{ 1732{
1730 int xid; 1733 unsigned int xid;
1731 int rc = 0; 1734 int rc = 0;
1732 struct inode *inode = dentry->d_inode; 1735 struct inode *inode = dentry->d_inode;
1733 struct super_block *sb = dentry->d_sb; 1736 struct super_block *sb = dentry->d_sb;
@@ -1739,7 +1742,7 @@ int cifs_revalidate_dentry_attr(struct dentry *dentry)
1739 if (!cifs_inode_needs_reval(inode)) 1742 if (!cifs_inode_needs_reval(inode))
1740 return rc; 1743 return rc;
1741 1744
1742 xid = GetXid(); 1745 xid = get_xid();
1743 1746
1744 /* can not safely grab the rename sem here if rename calls revalidate 1747 /* can not safely grab the rename sem here if rename calls revalidate
1745 since that would deadlock */ 1748 since that would deadlock */
@@ -1761,7 +1764,7 @@ int cifs_revalidate_dentry_attr(struct dentry *dentry)
1761 1764
1762out: 1765out:
1763 kfree(full_path); 1766 kfree(full_path);
1764 FreeXid(xid); 1767 free_xid(xid);
1765 return rc; 1768 return rc;
1766} 1769}
1767 1770
@@ -1869,7 +1872,7 @@ static void cifs_setsize(struct inode *inode, loff_t offset)
1869 1872
1870static int 1873static int
1871cifs_set_file_size(struct inode *inode, struct iattr *attrs, 1874cifs_set_file_size(struct inode *inode, struct iattr *attrs,
1872 int xid, char *full_path) 1875 unsigned int xid, char *full_path)
1873{ 1876{
1874 int rc; 1877 int rc;
1875 struct cifsFileInfo *open_file; 1878 struct cifsFileInfo *open_file;
@@ -1971,7 +1974,7 @@ static int
1971cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs) 1974cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs)
1972{ 1975{
1973 int rc; 1976 int rc;
1974 int xid; 1977 unsigned int xid;
1975 char *full_path = NULL; 1978 char *full_path = NULL;
1976 struct inode *inode = direntry->d_inode; 1979 struct inode *inode = direntry->d_inode;
1977 struct cifsInodeInfo *cifsInode = CIFS_I(inode); 1980 struct cifsInodeInfo *cifsInode = CIFS_I(inode);
@@ -1984,7 +1987,7 @@ cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs)
1984 cFYI(1, "setattr_unix on file %s attrs->ia_valid=0x%x", 1987 cFYI(1, "setattr_unix on file %s attrs->ia_valid=0x%x",
1985 direntry->d_name.name, attrs->ia_valid); 1988 direntry->d_name.name, attrs->ia_valid);
1986 1989
1987 xid = GetXid(); 1990 xid = get_xid();
1988 1991
1989 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM) 1992 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM)
1990 attrs->ia_valid |= ATTR_FORCE; 1993 attrs->ia_valid |= ATTR_FORCE;
@@ -2104,14 +2107,14 @@ cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs)
2104out: 2107out:
2105 kfree(args); 2108 kfree(args);
2106 kfree(full_path); 2109 kfree(full_path);
2107 FreeXid(xid); 2110 free_xid(xid);
2108 return rc; 2111 return rc;
2109} 2112}
2110 2113
2111static int 2114static int
2112cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs) 2115cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
2113{ 2116{
2114 int xid; 2117 unsigned int xid;
2115 uid_t uid = NO_CHANGE_32; 2118 uid_t uid = NO_CHANGE_32;
2116 gid_t gid = NO_CHANGE_32; 2119 gid_t gid = NO_CHANGE_32;
2117 struct inode *inode = direntry->d_inode; 2120 struct inode *inode = direntry->d_inode;
@@ -2122,7 +2125,7 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
2122 __u32 dosattr = 0; 2125 __u32 dosattr = 0;
2123 __u64 mode = NO_CHANGE_64; 2126 __u64 mode = NO_CHANGE_64;
2124 2127
2125 xid = GetXid(); 2128 xid = get_xid();
2126 2129
2127 cFYI(1, "setattr on file %s attrs->iavalid 0x%x", 2130 cFYI(1, "setattr on file %s attrs->iavalid 0x%x",
2128 direntry->d_name.name, attrs->ia_valid); 2131 direntry->d_name.name, attrs->ia_valid);
@@ -2132,14 +2135,14 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
2132 2135
2133 rc = inode_change_ok(inode, attrs); 2136 rc = inode_change_ok(inode, attrs);
2134 if (rc < 0) { 2137 if (rc < 0) {
2135 FreeXid(xid); 2138 free_xid(xid);
2136 return rc; 2139 return rc;
2137 } 2140 }
2138 2141
2139 full_path = build_path_from_dentry(direntry); 2142 full_path = build_path_from_dentry(direntry);
2140 if (full_path == NULL) { 2143 if (full_path == NULL) {
2141 rc = -ENOMEM; 2144 rc = -ENOMEM;
2142 FreeXid(xid); 2145 free_xid(xid);
2143 return rc; 2146 return rc;
2144 } 2147 }
2145 2148
@@ -2265,7 +2268,7 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
2265 2268
2266cifs_setattr_exit: 2269cifs_setattr_exit:
2267 kfree(full_path); 2270 kfree(full_path);
2268 FreeXid(xid); 2271 free_xid(xid);
2269 return rc; 2272 return rc;
2270} 2273}
2271 2274