@@ -95,8 +95,7 @@ static int parse_posix_sids(struct cifs_open_info_data *data,
9595 */
9696static int smb2_compound_op (const unsigned int xid , struct cifs_tcon * tcon ,
9797 struct cifs_sb_info * cifs_sb , const char * full_path ,
98- __u32 desired_access , __u32 create_disposition ,
99- __u32 create_options , umode_t mode , struct kvec * in_iov ,
98+ struct cifs_open_parms * oparms , struct kvec * in_iov ,
10099 int * cmds , int num_cmds , struct cifsFileInfo * cfile ,
101100 struct kvec * out_iov , int * out_buftype , struct dentry * dentry )
102101{
@@ -173,16 +172,8 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
173172 }
174173 }
175174
176- vars -> oparms = (struct cifs_open_parms ) {
177- .tcon = tcon ,
178- .path = full_path ,
179- .desired_access = desired_access ,
180- .disposition = create_disposition ,
181- .create_options = cifs_create_options (cifs_sb , create_options ),
182- .fid = & fid ,
183- .mode = mode ,
184- .cifs_sb = cifs_sb ,
185- };
175+ vars -> oparms = * oparms ;
176+ vars -> oparms .fid = & fid ;
186177
187178 rqst [num_rqst ].rq_iov = & vars -> open_iov [0 ];
188179 rqst [num_rqst ].rq_nvec = SMB2_CREATE_IOV_SIZE ;
@@ -741,6 +732,7 @@ int smb2_query_path_info(const unsigned int xid,
741732 const char * full_path ,
742733 struct cifs_open_info_data * data )
743734{
735+ struct cifs_open_parms oparms ;
744736 __u32 create_options = 0 ;
745737 struct cifsFileInfo * cfile ;
746738 struct cached_fid * cfid = NULL ;
@@ -792,10 +784,11 @@ int smb2_query_path_info(const unsigned int xid,
792784 in_iov [1 ] = in_iov [0 ];
793785
794786 cifs_get_readable_path (tcon , full_path , & cfile );
787+ oparms = CIFS_OPARMS (cifs_sb , tcon , full_path , FILE_READ_ATTRIBUTES ,
788+ FILE_OPEN , create_options , ACL_NO_MODE );
795789 rc = smb2_compound_op (xid , tcon , cifs_sb , full_path ,
796- FILE_READ_ATTRIBUTES , FILE_OPEN ,
797- create_options , ACL_NO_MODE , in_iov ,
798- cmds , 1 , cfile , out_iov , out_buftype , NULL );
790+ & oparms , in_iov , cmds , 1 , cfile ,
791+ out_iov , out_buftype , NULL );
799792 hdr = out_iov [0 ].iov_base ;
800793 /*
801794 * If first iov is unset, then SMB session was dropped or we've got a
@@ -822,12 +815,14 @@ int smb2_query_path_info(const unsigned int xid,
822815 cmds [1 ] = SMB2_OP_GET_REPARSE ;
823816 num_cmds = 2 ;
824817 }
825- create_options |= OPEN_REPARSE_POINT ;
818+ oparms = CIFS_OPARMS (cifs_sb , tcon , full_path ,
819+ FILE_READ_ATTRIBUTES , FILE_OPEN ,
820+ create_options | OPEN_REPARSE_POINT ,
821+ ACL_NO_MODE );
826822 cifs_get_readable_path (tcon , full_path , & cfile );
827823 rc = smb2_compound_op (xid , tcon , cifs_sb , full_path ,
828- FILE_READ_ATTRIBUTES , FILE_OPEN ,
829- create_options , ACL_NO_MODE , in_iov ,
830- cmds , num_cmds , cfile , NULL , NULL , NULL );
824+ & oparms , in_iov , cmds , num_cmds ,
825+ cfile , NULL , NULL , NULL );
831826 break ;
832827 case - EREMOTE :
833828 break ;
@@ -855,10 +850,13 @@ smb2_mkdir(const unsigned int xid, struct inode *parent_inode, umode_t mode,
855850 struct cifs_tcon * tcon , const char * name ,
856851 struct cifs_sb_info * cifs_sb )
857852{
858- return smb2_compound_op (xid , tcon , cifs_sb , name ,
859- FILE_WRITE_ATTRIBUTES , FILE_CREATE ,
860- CREATE_NOT_FILE , mode ,
861- NULL , & (int ){SMB2_OP_MKDIR }, 1 ,
853+ struct cifs_open_parms oparms ;
854+
855+ oparms = CIFS_OPARMS (cifs_sb , tcon , name , FILE_WRITE_ATTRIBUTES ,
856+ FILE_CREATE , CREATE_NOT_FILE , mode );
857+ return smb2_compound_op (xid , tcon , cifs_sb ,
858+ name , & oparms , NULL ,
859+ & (int ){SMB2_OP_MKDIR }, 1 ,
862860 NULL , NULL , NULL , NULL );
863861}
864862
@@ -867,6 +865,7 @@ smb2_mkdir_setinfo(struct inode *inode, const char *name,
867865 struct cifs_sb_info * cifs_sb , struct cifs_tcon * tcon ,
868866 const unsigned int xid )
869867{
868+ struct cifs_open_parms oparms ;
870869 FILE_BASIC_INFO data = {};
871870 struct cifsInodeInfo * cifs_i ;
872871 struct cifsFileInfo * cfile ;
@@ -880,9 +879,10 @@ smb2_mkdir_setinfo(struct inode *inode, const char *name,
880879 dosattrs = cifs_i -> cifsAttrs | ATTR_READONLY ;
881880 data .Attributes = cpu_to_le32 (dosattrs );
882881 cifs_get_writable_path (tcon , name , FIND_WR_ANY , & cfile );
882+ oparms = CIFS_OPARMS (cifs_sb , tcon , name , FILE_WRITE_ATTRIBUTES ,
883+ FILE_CREATE , CREATE_NOT_FILE , ACL_NO_MODE );
883884 tmprc = smb2_compound_op (xid , tcon , cifs_sb , name ,
884- FILE_WRITE_ATTRIBUTES , FILE_CREATE ,
885- CREATE_NOT_FILE , ACL_NO_MODE , & in_iov ,
885+ & oparms , & in_iov ,
886886 & (int ){SMB2_OP_SET_INFO }, 1 ,
887887 cfile , NULL , NULL , NULL );
888888 if (tmprc == 0 )
@@ -893,10 +893,13 @@ int
893893smb2_rmdir (const unsigned int xid , struct cifs_tcon * tcon , const char * name ,
894894 struct cifs_sb_info * cifs_sb )
895895{
896+ struct cifs_open_parms oparms ;
897+
896898 drop_cached_dir_by_name (xid , tcon , name , cifs_sb );
897- return smb2_compound_op (xid , tcon , cifs_sb , name ,
898- DELETE , FILE_OPEN , CREATE_NOT_FILE ,
899- ACL_NO_MODE , NULL ,
899+ oparms = CIFS_OPARMS (cifs_sb , tcon , name , DELETE ,
900+ FILE_OPEN , CREATE_NOT_FILE , ACL_NO_MODE );
901+ return smb2_compound_op (xid , tcon , cifs_sb ,
902+ name , & oparms , NULL ,
900903 & (int ){SMB2_OP_RMDIR }, 1 ,
901904 NULL , NULL , NULL , NULL );
902905}
@@ -905,18 +908,20 @@ int
905908smb2_unlink (const unsigned int xid , struct cifs_tcon * tcon , const char * name ,
906909 struct cifs_sb_info * cifs_sb , struct dentry * dentry )
907910{
908- int rc = smb2_compound_op (xid , tcon , cifs_sb , name , DELETE , FILE_OPEN ,
909- CREATE_DELETE_ON_CLOSE | OPEN_REPARSE_POINT ,
910- ACL_NO_MODE , NULL ,
911- & (int ){SMB2_OP_DELETE }, 1 ,
912- NULL , NULL , NULL , dentry );
911+ struct cifs_open_parms oparms ;
912+
913+ oparms = CIFS_OPARMS (cifs_sb , tcon , name ,
914+ DELETE , FILE_OPEN ,
915+ CREATE_DELETE_ON_CLOSE | OPEN_REPARSE_POINT ,
916+ ACL_NO_MODE );
917+ int rc = smb2_compound_op (xid , tcon , cifs_sb , name , & oparms ,
918+ NULL , & (int ){SMB2_OP_DELETE }, 1 ,
919+ NULL , NULL , NULL , dentry );
913920 if (rc == - EINVAL ) {
914921 cifs_dbg (FYI , "invalid lease key, resending request without lease" );
915- rc = smb2_compound_op (xid , tcon , cifs_sb , name , DELETE , FILE_OPEN ,
916- CREATE_DELETE_ON_CLOSE | OPEN_REPARSE_POINT ,
917- ACL_NO_MODE , NULL ,
918- & (int ){SMB2_OP_DELETE }, 1 ,
919- NULL , NULL , NULL , NULL );
922+ rc = smb2_compound_op (xid , tcon , cifs_sb , name , & oparms ,
923+ NULL , & (int ){SMB2_OP_DELETE }, 1 ,
924+ NULL , NULL , NULL , NULL );
920925 }
921926 return rc ;
922927}
@@ -928,6 +933,7 @@ static int smb2_set_path_attr(const unsigned int xid, struct cifs_tcon *tcon,
928933 int command , struct cifsFileInfo * cfile ,
929934 struct dentry * dentry )
930935{
936+ struct cifs_open_parms oparms ;
931937 struct kvec in_iov ;
932938 __le16 * smb2_to_name = NULL ;
933939 int rc ;
@@ -939,9 +945,11 @@ static int smb2_set_path_attr(const unsigned int xid, struct cifs_tcon *tcon,
939945 }
940946 in_iov .iov_base = smb2_to_name ;
941947 in_iov .iov_len = 2 * UniStrnlen ((wchar_t * )smb2_to_name , PATH_MAX );
942- rc = smb2_compound_op (xid , tcon , cifs_sb , from_name , access ,
943- FILE_OPEN , create_options , ACL_NO_MODE ,
944- & in_iov , & command , 1 , cfile , NULL , NULL , dentry );
948+ oparms = CIFS_OPARMS (cifs_sb , tcon , from_name , access , FILE_OPEN ,
949+ create_options , ACL_NO_MODE );
950+ rc = smb2_compound_op (xid , tcon , cifs_sb , from_name ,
951+ & oparms , & in_iov , & command , 1 ,
952+ cfile , NULL , NULL , dentry );
945953smb2_rename_path :
946954 kfree (smb2_to_name );
947955 return rc ;
@@ -988,25 +996,28 @@ smb2_set_path_size(const unsigned int xid, struct cifs_tcon *tcon,
988996 struct cifs_sb_info * cifs_sb , bool set_alloc ,
989997 struct dentry * dentry )
990998{
999+ struct cifs_open_parms oparms ;
9911000 struct cifsFileInfo * cfile ;
9921001 struct kvec in_iov ;
9931002 __le64 eof = cpu_to_le64 (size );
1003+ int rc ;
9941004
9951005 in_iov .iov_base = & eof ;
9961006 in_iov .iov_len = sizeof (eof );
9971007 cifs_get_writable_path (tcon , full_path , FIND_WR_ANY , & cfile );
998- int rc = smb2_compound_op (xid , tcon , cifs_sb , full_path ,
999- FILE_WRITE_DATA , FILE_OPEN ,
1000- 0 , ACL_NO_MODE , & in_iov ,
1001- & (int ){SMB2_OP_SET_EOF }, 1 ,
1002- cfile , NULL , NULL , dentry );
1008+
1009+ oparms = CIFS_OPARMS (cifs_sb , tcon , full_path , FILE_WRITE_DATA ,
1010+ FILE_OPEN , 0 , ACL_NO_MODE );
1011+ rc = smb2_compound_op (xid , tcon , cifs_sb ,
1012+ full_path , & oparms , & in_iov ,
1013+ & (int ){SMB2_OP_SET_EOF }, 1 ,
1014+ cfile , NULL , NULL , dentry );
10031015 if (rc == - EINVAL ) {
10041016 cifs_dbg (FYI , "invalid lease key, resending request without lease" );
1005- rc = smb2_compound_op (xid , tcon , cifs_sb , full_path ,
1006- FILE_WRITE_DATA , FILE_OPEN ,
1007- 0 , ACL_NO_MODE , & in_iov ,
1008- & (int ){SMB2_OP_SET_EOF }, 1 ,
1009- cfile , NULL , NULL , NULL );
1017+ rc = smb2_compound_op (xid , tcon , cifs_sb ,
1018+ full_path , & oparms , & in_iov ,
1019+ & (int ){SMB2_OP_SET_EOF }, 1 ,
1020+ cfile , NULL , NULL , NULL );
10101021 }
10111022 return rc ;
10121023}
@@ -1015,6 +1026,7 @@ int
10151026smb2_set_file_info (struct inode * inode , const char * full_path ,
10161027 FILE_BASIC_INFO * buf , const unsigned int xid )
10171028{
1029+ struct cifs_open_parms oparms ;
10181030 struct cifs_sb_info * cifs_sb = CIFS_SB (inode -> i_sb );
10191031 struct tcon_link * tlink ;
10201032 struct cifs_tcon * tcon ;
@@ -1033,9 +1045,10 @@ smb2_set_file_info(struct inode *inode, const char *full_path,
10331045 tcon = tlink_tcon (tlink );
10341046
10351047 cifs_get_writable_path (tcon , full_path , FIND_WR_ANY , & cfile );
1036- rc = smb2_compound_op (xid , tcon , cifs_sb , full_path ,
1037- FILE_WRITE_ATTRIBUTES , FILE_OPEN ,
1038- 0 , ACL_NO_MODE , & in_iov ,
1048+ oparms = CIFS_OPARMS (cifs_sb , tcon , full_path , FILE_WRITE_ATTRIBUTES ,
1049+ FILE_OPEN , 0 , ACL_NO_MODE );
1050+ rc = smb2_compound_op (xid , tcon , cifs_sb ,
1051+ full_path , & oparms , & in_iov ,
10391052 & (int ){SMB2_OP_SET_INFO }, 1 ,
10401053 cfile , NULL , NULL , NULL );
10411054 cifs_put_tlink (tlink );
@@ -1049,19 +1062,21 @@ struct inode *smb2_get_reparse_inode(struct cifs_open_info_data *data,
10491062 const char * full_path ,
10501063 struct kvec * iov )
10511064{
1065+ struct cifs_open_parms oparms ;
10521066 struct cifs_sb_info * cifs_sb = CIFS_SB (sb );
10531067 struct cifsFileInfo * cfile ;
10541068 struct inode * new = NULL ;
10551069 struct kvec in_iov [2 ];
10561070 int cmds [2 ];
1057- int da , co , cd ;
10581071 int rc ;
10591072
1060- da = SYNCHRONIZE | DELETE |
1061- FILE_READ_ATTRIBUTES |
1062- FILE_WRITE_ATTRIBUTES ;
1063- co = CREATE_NOT_DIR | OPEN_REPARSE_POINT ;
1064- cd = FILE_CREATE ;
1073+ oparms = CIFS_OPARMS (cifs_sb , tcon , full_path ,
1074+ SYNCHRONIZE | DELETE |
1075+ FILE_READ_ATTRIBUTES |
1076+ FILE_WRITE_ATTRIBUTES ,
1077+ FILE_CREATE ,
1078+ CREATE_NOT_DIR | OPEN_REPARSE_POINT ,
1079+ ACL_NO_MODE );
10651080 cmds [0 ] = SMB2_OP_SET_REPARSE ;
10661081 in_iov [0 ] = * iov ;
10671082 in_iov [1 ].iov_base = data ;
@@ -1070,19 +1085,17 @@ struct inode *smb2_get_reparse_inode(struct cifs_open_info_data *data,
10701085 if (tcon -> posix_extensions ) {
10711086 cmds [1 ] = SMB2_OP_POSIX_QUERY_INFO ;
10721087 cifs_get_writable_path (tcon , full_path , FIND_WR_ANY , & cfile );
1073- rc = smb2_compound_op (xid , tcon , cifs_sb , full_path ,
1074- da , cd , co , ACL_NO_MODE , in_iov ,
1075- cmds , 2 , cfile , NULL , NULL , NULL );
1088+ rc = smb2_compound_op (xid , tcon , cifs_sb , full_path , & oparms ,
1089+ in_iov , cmds , 2 , cfile , NULL , NULL , NULL );
10761090 if (!rc ) {
10771091 rc = smb311_posix_get_inode_info (& new , full_path ,
10781092 data , sb , xid );
10791093 }
10801094 } else {
10811095 cmds [1 ] = SMB2_OP_QUERY_INFO ;
10821096 cifs_get_writable_path (tcon , full_path , FIND_WR_ANY , & cfile );
1083- rc = smb2_compound_op (xid , tcon , cifs_sb , full_path ,
1084- da , cd , co , ACL_NO_MODE , in_iov ,
1085- cmds , 2 , cfile , NULL , NULL , NULL );
1097+ rc = smb2_compound_op (xid , tcon , cifs_sb , full_path , & oparms ,
1098+ in_iov , cmds , 2 , cfile , NULL , NULL , NULL );
10861099 if (!rc ) {
10871100 rc = cifs_get_inode_info (& new , full_path ,
10881101 data , sb , xid , NULL );
@@ -1098,6 +1111,7 @@ int smb2_query_reparse_point(const unsigned int xid,
10981111 u32 * tag , struct kvec * rsp ,
10991112 int * rsp_buftype )
11001113{
1114+ struct cifs_open_parms oparms ;
11011115 struct cifs_open_info_data data = {};
11021116 struct cifsFileInfo * cfile ;
11031117 struct kvec in_iov = { .iov_base = & data , .iov_len = sizeof (data ), };
@@ -1106,9 +1120,10 @@ int smb2_query_reparse_point(const unsigned int xid,
11061120 cifs_dbg (FYI , "%s: path: %s\n" , __func__ , full_path );
11071121
11081122 cifs_get_readable_path (tcon , full_path , & cfile );
1109- rc = smb2_compound_op (xid , tcon , cifs_sb , full_path ,
1110- FILE_READ_ATTRIBUTES , FILE_OPEN ,
1111- OPEN_REPARSE_POINT , ACL_NO_MODE , & in_iov ,
1123+ oparms = CIFS_OPARMS (cifs_sb , tcon , full_path , FILE_READ_ATTRIBUTES ,
1124+ FILE_OPEN , OPEN_REPARSE_POINT , ACL_NO_MODE );
1125+ rc = smb2_compound_op (xid , tcon , cifs_sb ,
1126+ full_path , & oparms , & in_iov ,
11121127 & (int ){SMB2_OP_GET_REPARSE }, 1 ,
11131128 cfile , NULL , NULL , NULL );
11141129 if (rc )
0 commit comments