@@ -95,8 +95,7 @@ static int parse_posix_sids(struct cifs_open_info_data *data,
95
95
*/
96
96
static int smb2_compound_op (const unsigned int xid , struct cifs_tcon * tcon ,
97
97
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 ,
100
99
int * cmds , int num_cmds , struct cifsFileInfo * cfile ,
101
100
struct kvec * out_iov , int * out_buftype , struct dentry * dentry )
102
101
{
@@ -173,16 +172,8 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
173
172
}
174
173
}
175
174
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 ;
186
177
187
178
rqst [num_rqst ].rq_iov = & vars -> open_iov [0 ];
188
179
rqst [num_rqst ].rq_nvec = SMB2_CREATE_IOV_SIZE ;
@@ -741,6 +732,7 @@ int smb2_query_path_info(const unsigned int xid,
741
732
const char * full_path ,
742
733
struct cifs_open_info_data * data )
743
734
{
735
+ struct cifs_open_parms oparms ;
744
736
__u32 create_options = 0 ;
745
737
struct cifsFileInfo * cfile ;
746
738
struct cached_fid * cfid = NULL ;
@@ -792,10 +784,11 @@ int smb2_query_path_info(const unsigned int xid,
792
784
in_iov [1 ] = in_iov [0 ];
793
785
794
786
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 );
795
789
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 );
799
792
hdr = out_iov [0 ].iov_base ;
800
793
/*
801
794
* 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,
822
815
cmds [1 ] = SMB2_OP_GET_REPARSE ;
823
816
num_cmds = 2 ;
824
817
}
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 );
826
822
cifs_get_readable_path (tcon , full_path , & cfile );
827
823
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 );
831
826
break ;
832
827
case - EREMOTE :
833
828
break ;
@@ -855,10 +850,13 @@ smb2_mkdir(const unsigned int xid, struct inode *parent_inode, umode_t mode,
855
850
struct cifs_tcon * tcon , const char * name ,
856
851
struct cifs_sb_info * cifs_sb )
857
852
{
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 ,
862
860
NULL , NULL , NULL , NULL );
863
861
}
864
862
@@ -867,6 +865,7 @@ smb2_mkdir_setinfo(struct inode *inode, const char *name,
867
865
struct cifs_sb_info * cifs_sb , struct cifs_tcon * tcon ,
868
866
const unsigned int xid )
869
867
{
868
+ struct cifs_open_parms oparms ;
870
869
FILE_BASIC_INFO data = {};
871
870
struct cifsInodeInfo * cifs_i ;
872
871
struct cifsFileInfo * cfile ;
@@ -880,9 +879,10 @@ smb2_mkdir_setinfo(struct inode *inode, const char *name,
880
879
dosattrs = cifs_i -> cifsAttrs | ATTR_READONLY ;
881
880
data .Attributes = cpu_to_le32 (dosattrs );
882
881
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 );
883
884
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 ,
886
886
& (int ){SMB2_OP_SET_INFO }, 1 ,
887
887
cfile , NULL , NULL , NULL );
888
888
if (tmprc == 0 )
@@ -893,10 +893,13 @@ int
893
893
smb2_rmdir (const unsigned int xid , struct cifs_tcon * tcon , const char * name ,
894
894
struct cifs_sb_info * cifs_sb )
895
895
{
896
+ struct cifs_open_parms oparms ;
897
+
896
898
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 ,
900
903
& (int ){SMB2_OP_RMDIR }, 1 ,
901
904
NULL , NULL , NULL , NULL );
902
905
}
@@ -905,18 +908,20 @@ int
905
908
smb2_unlink (const unsigned int xid , struct cifs_tcon * tcon , const char * name ,
906
909
struct cifs_sb_info * cifs_sb , struct dentry * dentry )
907
910
{
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 );
913
920
if (rc == - EINVAL ) {
914
921
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 );
920
925
}
921
926
return rc ;
922
927
}
@@ -928,6 +933,7 @@ static int smb2_set_path_attr(const unsigned int xid, struct cifs_tcon *tcon,
928
933
int command , struct cifsFileInfo * cfile ,
929
934
struct dentry * dentry )
930
935
{
936
+ struct cifs_open_parms oparms ;
931
937
struct kvec in_iov ;
932
938
__le16 * smb2_to_name = NULL ;
933
939
int rc ;
@@ -939,9 +945,11 @@ static int smb2_set_path_attr(const unsigned int xid, struct cifs_tcon *tcon,
939
945
}
940
946
in_iov .iov_base = smb2_to_name ;
941
947
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 );
945
953
smb2_rename_path :
946
954
kfree (smb2_to_name );
947
955
return rc ;
@@ -988,25 +996,28 @@ smb2_set_path_size(const unsigned int xid, struct cifs_tcon *tcon,
988
996
struct cifs_sb_info * cifs_sb , bool set_alloc ,
989
997
struct dentry * dentry )
990
998
{
999
+ struct cifs_open_parms oparms ;
991
1000
struct cifsFileInfo * cfile ;
992
1001
struct kvec in_iov ;
993
1002
__le64 eof = cpu_to_le64 (size );
1003
+ int rc ;
994
1004
995
1005
in_iov .iov_base = & eof ;
996
1006
in_iov .iov_len = sizeof (eof );
997
1007
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 );
1003
1015
if (rc == - EINVAL ) {
1004
1016
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 );
1010
1021
}
1011
1022
return rc ;
1012
1023
}
@@ -1015,6 +1026,7 @@ int
1015
1026
smb2_set_file_info (struct inode * inode , const char * full_path ,
1016
1027
FILE_BASIC_INFO * buf , const unsigned int xid )
1017
1028
{
1029
+ struct cifs_open_parms oparms ;
1018
1030
struct cifs_sb_info * cifs_sb = CIFS_SB (inode -> i_sb );
1019
1031
struct tcon_link * tlink ;
1020
1032
struct cifs_tcon * tcon ;
@@ -1033,9 +1045,10 @@ smb2_set_file_info(struct inode *inode, const char *full_path,
1033
1045
tcon = tlink_tcon (tlink );
1034
1046
1035
1047
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 ,
1039
1052
& (int ){SMB2_OP_SET_INFO }, 1 ,
1040
1053
cfile , NULL , NULL , NULL );
1041
1054
cifs_put_tlink (tlink );
@@ -1049,19 +1062,21 @@ struct inode *smb2_get_reparse_inode(struct cifs_open_info_data *data,
1049
1062
const char * full_path ,
1050
1063
struct kvec * iov )
1051
1064
{
1065
+ struct cifs_open_parms oparms ;
1052
1066
struct cifs_sb_info * cifs_sb = CIFS_SB (sb );
1053
1067
struct cifsFileInfo * cfile ;
1054
1068
struct inode * new = NULL ;
1055
1069
struct kvec in_iov [2 ];
1056
1070
int cmds [2 ];
1057
- int da , co , cd ;
1058
1071
int rc ;
1059
1072
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 );
1065
1080
cmds [0 ] = SMB2_OP_SET_REPARSE ;
1066
1081
in_iov [0 ] = * iov ;
1067
1082
in_iov [1 ].iov_base = data ;
@@ -1070,19 +1085,17 @@ struct inode *smb2_get_reparse_inode(struct cifs_open_info_data *data,
1070
1085
if (tcon -> posix_extensions ) {
1071
1086
cmds [1 ] = SMB2_OP_POSIX_QUERY_INFO ;
1072
1087
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 );
1076
1090
if (!rc ) {
1077
1091
rc = smb311_posix_get_inode_info (& new , full_path ,
1078
1092
data , sb , xid );
1079
1093
}
1080
1094
} else {
1081
1095
cmds [1 ] = SMB2_OP_QUERY_INFO ;
1082
1096
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 );
1086
1099
if (!rc ) {
1087
1100
rc = cifs_get_inode_info (& new , full_path ,
1088
1101
data , sb , xid , NULL );
@@ -1098,6 +1111,7 @@ int smb2_query_reparse_point(const unsigned int xid,
1098
1111
u32 * tag , struct kvec * rsp ,
1099
1112
int * rsp_buftype )
1100
1113
{
1114
+ struct cifs_open_parms oparms ;
1101
1115
struct cifs_open_info_data data = {};
1102
1116
struct cifsFileInfo * cfile ;
1103
1117
struct kvec in_iov = { .iov_base = & data , .iov_len = sizeof (data ), };
@@ -1106,9 +1120,10 @@ int smb2_query_reparse_point(const unsigned int xid,
1106
1120
cifs_dbg (FYI , "%s: path: %s\n" , __func__ , full_path );
1107
1121
1108
1122
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 ,
1112
1127
& (int ){SMB2_OP_GET_REPARSE }, 1 ,
1113
1128
cfile , NULL , NULL , NULL );
1114
1129
if (rc )
0 commit comments