@@ -409,9 +409,10 @@ cifs_sfu_type(struct cifs_fattr *fattr, const char *path,
409409{
410410 int rc ;
411411 int oplock = 0 ;
412- __u16 netfid ;
413412 struct tcon_link * tlink ;
414413 struct cifs_tcon * tcon ;
414+ struct cifs_fid fid ;
415+ struct cifs_open_parms oparms ;
415416 struct cifs_io_parms io_parms ;
416417 char buf [24 ];
417418 unsigned int bytes_read ;
@@ -437,18 +438,23 @@ cifs_sfu_type(struct cifs_fattr *fattr, const char *path,
437438 return PTR_ERR (tlink );
438439 tcon = tlink_tcon (tlink );
439440
440- rc = CIFSSMBOpen (xid , tcon , path , FILE_OPEN , GENERIC_READ ,
441- CREATE_NOT_DIR , & netfid , & oplock , NULL ,
442- cifs_sb -> local_nls ,
443- cifs_sb -> mnt_cifs_flags &
444- CIFS_MOUNT_MAP_SPECIAL_CHR );
441+ oparms .tcon = tcon ;
442+ oparms .cifs_sb = cifs_sb ;
443+ oparms .desired_access = GENERIC_READ ;
444+ oparms .create_options = CREATE_NOT_DIR ;
445+ oparms .disposition = FILE_OPEN ;
446+ oparms .path = path ;
447+ oparms .fid = & fid ;
448+ oparms .reconnect = false;
449+
450+ rc = CIFS_open (xid , & oparms , & oplock , NULL );
445451 if (rc ) {
446452 cifs_put_tlink (tlink );
447453 return rc ;
448454 }
449455
450456 /* Read header */
451- io_parms .netfid = netfid ;
457+ io_parms .netfid = fid . netfid ;
452458 io_parms .pid = current -> tgid ;
453459 io_parms .tcon = tcon ;
454460 io_parms .offset = 0 ;
@@ -494,7 +500,7 @@ cifs_sfu_type(struct cifs_fattr *fattr, const char *path,
494500 fattr -> cf_dtype = DT_REG ;
495501 rc = - EOPNOTSUPP ; /* or some unknown SFU type */
496502 }
497- CIFSSMBClose (xid , tcon , netfid );
503+ CIFSSMBClose (xid , tcon , fid . netfid );
498504 cifs_put_tlink (tlink );
499505 return rc ;
500506}
@@ -1035,7 +1041,8 @@ cifs_rename_pending_delete(const char *full_path, struct dentry *dentry,
10351041{
10361042 int oplock = 0 ;
10371043 int rc ;
1038- __u16 netfid ;
1044+ struct cifs_fid fid ;
1045+ struct cifs_open_parms oparms ;
10391046 struct inode * inode = dentry -> d_inode ;
10401047 struct cifsInodeInfo * cifsInode = CIFS_I (inode );
10411048 struct cifs_sb_info * cifs_sb = CIFS_SB (inode -> i_sb );
@@ -1058,10 +1065,16 @@ cifs_rename_pending_delete(const char *full_path, struct dentry *dentry,
10581065 goto out ;
10591066 }
10601067
1061- rc = CIFSSMBOpen (xid , tcon , full_path , FILE_OPEN ,
1062- DELETE |FILE_WRITE_ATTRIBUTES , CREATE_NOT_DIR ,
1063- & netfid , & oplock , NULL , cifs_sb -> local_nls ,
1064- cifs_sb -> mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR );
1068+ oparms .tcon = tcon ;
1069+ oparms .cifs_sb = cifs_sb ;
1070+ oparms .desired_access = DELETE | FILE_WRITE_ATTRIBUTES ;
1071+ oparms .create_options = CREATE_NOT_DIR ;
1072+ oparms .disposition = FILE_OPEN ;
1073+ oparms .path = full_path ;
1074+ oparms .fid = & fid ;
1075+ oparms .reconnect = false;
1076+
1077+ rc = CIFS_open (xid , & oparms , & oplock , NULL );
10651078 if (rc != 0 )
10661079 goto out ;
10671080
@@ -1082,7 +1095,7 @@ cifs_rename_pending_delete(const char *full_path, struct dentry *dentry,
10821095 goto out_close ;
10831096 }
10841097 info_buf -> Attributes = cpu_to_le32 (dosattr );
1085- rc = CIFSSMBSetFileInfo (xid , tcon , info_buf , netfid ,
1098+ rc = CIFSSMBSetFileInfo (xid , tcon , info_buf , fid . netfid ,
10861099 current -> tgid );
10871100 /* although we would like to mark the file hidden
10881101 if that fails we will still try to rename it */
@@ -1093,7 +1106,8 @@ cifs_rename_pending_delete(const char *full_path, struct dentry *dentry,
10931106 }
10941107
10951108 /* rename the file */
1096- rc = CIFSSMBRenameOpenFile (xid , tcon , netfid , NULL , cifs_sb -> local_nls ,
1109+ rc = CIFSSMBRenameOpenFile (xid , tcon , fid .netfid , NULL ,
1110+ cifs_sb -> local_nls ,
10971111 cifs_sb -> mnt_cifs_flags &
10981112 CIFS_MOUNT_MAP_SPECIAL_CHR );
10991113 if (rc != 0 ) {
@@ -1103,7 +1117,7 @@ cifs_rename_pending_delete(const char *full_path, struct dentry *dentry,
11031117
11041118 /* try to set DELETE_ON_CLOSE */
11051119 if (!cifsInode -> delete_pending ) {
1106- rc = CIFSSMBSetFileDisposition (xid , tcon , true, netfid ,
1120+ rc = CIFSSMBSetFileDisposition (xid , tcon , true, fid . netfid ,
11071121 current -> tgid );
11081122 /*
11091123 * some samba versions return -ENOENT when we try to set the
@@ -1123,7 +1137,7 @@ cifs_rename_pending_delete(const char *full_path, struct dentry *dentry,
11231137 }
11241138
11251139out_close :
1126- CIFSSMBClose (xid , tcon , netfid );
1140+ CIFSSMBClose (xid , tcon , fid . netfid );
11271141out :
11281142 kfree (info_buf );
11291143 cifs_put_tlink (tlink );
@@ -1135,13 +1149,13 @@ cifs_rename_pending_delete(const char *full_path, struct dentry *dentry,
11351149 * them anyway.
11361150 */
11371151undo_rename :
1138- CIFSSMBRenameOpenFile (xid , tcon , netfid , dentry -> d_name .name ,
1152+ CIFSSMBRenameOpenFile (xid , tcon , fid . netfid , dentry -> d_name .name ,
11391153 cifs_sb -> local_nls , cifs_sb -> mnt_cifs_flags &
11401154 CIFS_MOUNT_MAP_SPECIAL_CHR );
11411155undo_setattr :
11421156 if (dosattr != origattr ) {
11431157 info_buf -> Attributes = cpu_to_le32 (origattr );
1144- if (!CIFSSMBSetFileInfo (xid , tcon , info_buf , netfid ,
1158+ if (!CIFSSMBSetFileInfo (xid , tcon , info_buf , fid . netfid ,
11451159 current -> tgid ))
11461160 cifsInode -> cifsAttrs = origattr ;
11471161 }
@@ -1552,7 +1566,8 @@ cifs_do_rename(const unsigned int xid, struct dentry *from_dentry,
15521566 struct tcon_link * tlink ;
15531567 struct cifs_tcon * tcon ;
15541568 struct TCP_Server_Info * server ;
1555- __u16 srcfid ;
1569+ struct cifs_fid fid ;
1570+ struct cifs_open_parms oparms ;
15561571 int oplock , rc ;
15571572
15581573 tlink = cifs_sb_tlink (cifs_sb );
@@ -1579,17 +1594,23 @@ cifs_do_rename(const unsigned int xid, struct dentry *from_dentry,
15791594 if (to_dentry -> d_parent != from_dentry -> d_parent )
15801595 goto do_rename_exit ;
15811596
1597+ oparms .tcon = tcon ;
1598+ oparms .cifs_sb = cifs_sb ;
15821599 /* open the file to be renamed -- we need DELETE perms */
1583- rc = CIFSSMBOpen (xid , tcon , from_path , FILE_OPEN , DELETE ,
1584- CREATE_NOT_DIR , & srcfid , & oplock , NULL ,
1585- cifs_sb -> local_nls , cifs_sb -> mnt_cifs_flags &
1586- CIFS_MOUNT_MAP_SPECIAL_CHR );
1600+ oparms .desired_access = DELETE ;
1601+ oparms .create_options = CREATE_NOT_DIR ;
1602+ oparms .disposition = FILE_OPEN ;
1603+ oparms .path = from_path ;
1604+ oparms .fid = & fid ;
1605+ oparms .reconnect = false;
1606+
1607+ rc = CIFS_open (xid , & oparms , & oplock , NULL );
15871608 if (rc == 0 ) {
1588- rc = CIFSSMBRenameOpenFile (xid , tcon , srcfid ,
1609+ rc = CIFSSMBRenameOpenFile (xid , tcon , fid . netfid ,
15891610 (const char * ) to_dentry -> d_name .name ,
15901611 cifs_sb -> local_nls , cifs_sb -> mnt_cifs_flags &
15911612 CIFS_MOUNT_MAP_SPECIAL_CHR );
1592- CIFSSMBClose (xid , tcon , srcfid );
1613+ CIFSSMBClose (xid , tcon , fid . netfid );
15931614 }
15941615do_rename_exit :
15951616 cifs_put_tlink (tlink );
0 commit comments