hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/fs/cifs/smb2proto.h
....@@ -46,7 +46,8 @@
4646 extern int smb2_check_receive(struct mid_q_entry *mid,
4747 struct TCP_Server_Info *server, bool log_error);
4848 extern struct mid_q_entry *smb2_setup_request(struct cifs_ses *ses,
49
- struct smb_rqst *rqst);
49
+ struct TCP_Server_Info *,
50
+ struct smb_rqst *rqst);
5051 extern struct mid_q_entry *smb2_setup_async_request(
5152 struct TCP_Server_Info *server, struct smb_rqst *rqst);
5253 extern struct cifs_ses *smb2_find_smb_ses(struct TCP_Server_Info *server,
....@@ -54,9 +55,11 @@
5455 extern struct cifs_tcon *smb2_find_smb_tcon(struct TCP_Server_Info *server,
5556 __u64 ses_id, __u32 tid);
5657 extern int smb2_calc_signature(struct smb_rqst *rqst,
57
- struct TCP_Server_Info *server);
58
+ struct TCP_Server_Info *server,
59
+ bool allocate_crypto);
5860 extern int smb3_calc_signature(struct smb_rqst *rqst,
59
- struct TCP_Server_Info *server);
61
+ struct TCP_Server_Info *server,
62
+ bool allocate_crypto);
6063 extern void smb2_echo_request(struct work_struct *work);
6164 extern __le32 smb2_get_lease_state(struct cifsInodeInfo *cinode);
6265 extern bool smb2_is_valid_oplock_break(char *buffer,
....@@ -67,10 +70,16 @@
6770 struct mid_q_entry *mid);
6871
6972 extern int open_shroot(unsigned int xid, struct cifs_tcon *tcon,
70
- struct cifs_fid *pfid);
73
+ struct cifs_sb_info *cifs_sb,
74
+ struct cached_fid **cfid);
7175 extern void close_shroot(struct cached_fid *cfid);
76
+extern void close_shroot_lease(struct cached_fid *cfid);
77
+extern void close_shroot_lease_locked(struct cached_fid *cfid);
7278 extern void move_smb2_info_to_cifs(FILE_ALL_INFO *dst,
7379 struct smb2_file_all_info *src);
80
+extern int smb2_query_reparse_tag(const unsigned int xid, struct cifs_tcon *tcon,
81
+ struct cifs_sb_info *cifs_sb, const char *path,
82
+ __u32 *reparse_tag);
7483 extern int smb2_query_path_info(const unsigned int xid, struct cifs_tcon *tcon,
7584 struct cifs_sb_info *cifs_sb,
7685 const char *full_path, FILE_ALL_INFO *data,
....@@ -84,7 +93,8 @@
8493 umode_t mode, struct cifs_tcon *tcon,
8594 const char *full_path,
8695 struct cifs_sb_info *cifs_sb);
87
-extern int smb2_mkdir(const unsigned int xid, struct cifs_tcon *tcon,
96
+extern int smb2_mkdir(const unsigned int xid, struct inode *inode,
97
+ umode_t mode, struct cifs_tcon *tcon,
8898 const char *name, struct cifs_sb_info *cifs_sb);
8999 extern void smb2_mkdir_setinfo(struct inode *inode, const char *full_path,
90100 struct cifs_sb_info *cifs_sb,
....@@ -116,6 +126,9 @@
116126 extern int smb3_crypto_aead_allocate(struct TCP_Server_Info *server);
117127 extern unsigned long smb_rqst_len(struct TCP_Server_Info *server,
118128 struct smb_rqst *rqst);
129
+extern void smb2_set_next_command(struct cifs_tcon *tcon,
130
+ struct smb_rqst *rqst);
131
+extern void smb2_set_related(struct smb_rqst *rqst);
119132
120133 /*
121134 * SMB2 Worker functions - most of protocol specific implementation details
....@@ -132,35 +145,59 @@
132145 extern int SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms,
133146 __le16 *path, __u8 *oplock,
134147 struct smb2_file_all_info *buf,
148
+ struct create_posix_rsp *posix,
135149 struct kvec *err_iov, int *resp_buftype);
136
-extern int SMB2_open_init(struct cifs_tcon *tcon, struct smb_rqst *rqst,
150
+extern int SMB2_open_init(struct cifs_tcon *tcon,
151
+ struct TCP_Server_Info *server,
152
+ struct smb_rqst *rqst,
137153 __u8 *oplock, struct cifs_open_parms *oparms,
138154 __le16 *path);
139155 extern void SMB2_open_free(struct smb_rqst *rqst);
140156 extern int SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon,
141157 u64 persistent_fid, u64 volatile_fid, u32 opcode,
142
- bool is_fsctl, char *in_data, u32 indatalen,
158
+ char *in_data, u32 indatalen, u32 maxoutlen,
143159 char **out_data, u32 *plen /* returned data len */);
160
+extern int SMB2_ioctl_init(struct cifs_tcon *tcon,
161
+ struct TCP_Server_Info *server,
162
+ struct smb_rqst *rqst,
163
+ u64 persistent_fid, u64 volatile_fid, u32 opcode,
164
+ char *in_data, u32 indatalen,
165
+ __u32 max_response_size);
166
+extern void SMB2_ioctl_free(struct smb_rqst *rqst);
167
+extern int SMB2_change_notify(const unsigned int xid, struct cifs_tcon *tcon,
168
+ u64 persistent_fid, u64 volatile_fid, bool watch_tree,
169
+ u32 completion_filter);
170
+
171
+extern int __SMB2_close(const unsigned int xid, struct cifs_tcon *tcon,
172
+ u64 persistent_fid, u64 volatile_fid,
173
+ struct smb2_file_network_open_info *pbuf);
144174 extern int SMB2_close(const unsigned int xid, struct cifs_tcon *tcon,
145175 u64 persistent_file_id, u64 volatile_file_id);
146
-extern int SMB2_close_flags(const unsigned int xid, struct cifs_tcon *tcon,
147
- u64 persistent_fid, u64 volatile_fid, int flags);
148
-extern int SMB2_close_init(struct cifs_tcon *tcon, struct smb_rqst *rqst,
149
- u64 persistent_file_id, u64 volatile_file_id);
176
+extern int SMB2_close_init(struct cifs_tcon *tcon,
177
+ struct TCP_Server_Info *server,
178
+ struct smb_rqst *rqst,
179
+ u64 persistent_fid, u64 volatile_fid,
180
+ bool query_attrs);
150181 extern void SMB2_close_free(struct smb_rqst *rqst);
151182 extern int SMB2_flush(const unsigned int xid, struct cifs_tcon *tcon,
152183 u64 persistent_file_id, u64 volatile_file_id);
153
-extern int SMB2_query_eas(const unsigned int xid, struct cifs_tcon *tcon,
154
- u64 persistent_file_id, u64 volatile_file_id,
155
- int ea_buf_size,
156
- struct smb2_file_full_ea_info *data);
184
+extern int SMB2_flush_init(const unsigned int xid, struct smb_rqst *rqst,
185
+ struct cifs_tcon *tcon,
186
+ struct TCP_Server_Info *server,
187
+ u64 persistent_file_id, u64 volatile_file_id);
188
+extern void SMB2_flush_free(struct smb_rqst *rqst);
189
+extern int SMB311_posix_query_info(const unsigned int xid, struct cifs_tcon *tcon,
190
+ u64 persistent_fid, u64 volatile_fid, struct smb311_posix_qinfo *data, u32 *plen);
157191 extern int SMB2_query_info(const unsigned int xid, struct cifs_tcon *tcon,
158192 u64 persistent_file_id, u64 volatile_file_id,
159193 struct smb2_file_all_info *data);
160
-extern int SMB2_query_info_init(struct cifs_tcon *tcon, struct smb_rqst *rqst,
194
+extern int SMB2_query_info_init(struct cifs_tcon *tcon,
195
+ struct TCP_Server_Info *server,
196
+ struct smb_rqst *rqst,
161197 u64 persistent_fid, u64 volatile_fid,
162198 u8 info_class, u8 info_type,
163
- u32 additional_info, size_t output_len);
199
+ u32 additional_info, size_t output_len,
200
+ size_t input_len, void *input);
164201 extern void SMB2_query_info_free(struct smb_rqst *rqst);
165202 extern int SMB2_query_acl(const unsigned int xid, struct cifs_tcon *tcon,
166203 u64 persistent_file_id, u64 volatile_file_id,
....@@ -179,20 +216,22 @@
179216 extern int SMB2_query_directory(const unsigned int xid, struct cifs_tcon *tcon,
180217 u64 persistent_fid, u64 volatile_fid, int index,
181218 struct cifs_search_info *srch_inf);
182
-extern int SMB2_rename(const unsigned int xid, struct cifs_tcon *tcon,
183
- u64 persistent_fid, u64 volatile_fid,
184
- __le16 *target_file);
185
-extern int SMB2_rmdir(const unsigned int xid, struct cifs_tcon *tcon,
186
- u64 persistent_fid, u64 volatile_fid);
187
-extern int SMB2_set_hardlink(const unsigned int xid, struct cifs_tcon *tcon,
188
- u64 persistent_fid, u64 volatile_fid,
189
- __le16 *target_file);
219
+extern int SMB2_query_directory_init(unsigned int xid, struct cifs_tcon *tcon,
220
+ struct TCP_Server_Info *server,
221
+ struct smb_rqst *rqst,
222
+ u64 persistent_fid, u64 volatile_fid,
223
+ int index, int info_level);
224
+extern void SMB2_query_directory_free(struct smb_rqst *rqst);
190225 extern int SMB2_set_eof(const unsigned int xid, struct cifs_tcon *tcon,
191226 u64 persistent_fid, u64 volatile_fid, u32 pid,
192
- __le64 *eof, bool is_fallocate);
193
-extern int SMB2_set_info(const unsigned int xid, struct cifs_tcon *tcon,
194
- u64 persistent_fid, u64 volatile_fid,
195
- FILE_BASIC_INFO *buf);
227
+ __le64 *eof);
228
+extern int SMB2_set_info_init(struct cifs_tcon *tcon,
229
+ struct TCP_Server_Info *server,
230
+ struct smb_rqst *rqst,
231
+ u64 persistent_fid, u64 volatile_fid, u32 pid,
232
+ u8 info_class, u8 info_type, u32 additional_info,
233
+ void **data, unsigned int *size);
234
+extern void SMB2_set_info_free(struct smb_rqst *rqst);
196235 extern int SMB2_set_acl(const unsigned int xid, struct cifs_tcon *tcon,
197236 u64 persistent_fid, u64 volatile_fid,
198237 struct cifs_ntsd *pnntsd, int pacllen, int aclflag);
....@@ -207,8 +246,7 @@
207246 extern int smb2_handle_cancelled_close(struct cifs_tcon *tcon,
208247 __u64 persistent_fid,
209248 __u64 volatile_fid);
210
-extern int smb2_handle_cancelled_mid(char *buffer,
211
- struct TCP_Server_Info *server);
249
+extern int smb2_handle_cancelled_mid(struct mid_q_entry *mid, struct TCP_Server_Info *server);
212250 void smb2_cancelled_close_fid(struct work_struct *work);
213251 extern int SMB2_QFS_info(const unsigned int xid, struct cifs_tcon *tcon,
214252 u64 persistent_file_id, u64 volatile_file_id,
....@@ -232,13 +270,35 @@
232270
233271 extern enum securityEnum smb2_select_sectype(struct TCP_Server_Info *,
234272 enum securityEnum);
273
+extern void smb2_parse_contexts(struct TCP_Server_Info *server,
274
+ struct smb2_create_rsp *rsp,
275
+ unsigned int *epoch, char *lease_key,
276
+ __u8 *oplock, struct smb2_file_all_info *buf,
277
+ struct create_posix_rsp *posix);
235278 extern int smb3_encryption_required(const struct cifs_tcon *tcon);
236279 extern int smb2_validate_iov(unsigned int offset, unsigned int buffer_length,
237280 struct kvec *iov, unsigned int min_buf_size);
281
+extern int smb2_validate_and_copy_iov(unsigned int offset,
282
+ unsigned int buffer_length,
283
+ struct kvec *iov,
284
+ unsigned int minbufsize, char *data);
238285 extern void smb2_copy_fs_info_to_kstatfs(
239286 struct smb2_fs_full_size_info *pfs_inf,
240287 struct kstatfs *kst);
241288 extern int smb311_crypto_shash_allocate(struct TCP_Server_Info *server);
242289 extern int smb311_update_preauth_hash(struct cifs_ses *ses,
243290 struct kvec *iov, int nvec);
291
+extern int smb2_query_info_compound(const unsigned int xid,
292
+ struct cifs_tcon *tcon,
293
+ __le16 *utf16_path, u32 desired_access,
294
+ u32 class, u32 type, u32 output_len,
295
+ struct kvec *rsp, int *buftype,
296
+ struct cifs_sb_info *cifs_sb);
297
+/* query path info from the server using SMB311 POSIX extensions*/
298
+extern int smb311_posix_query_path_info(const unsigned int xid, struct cifs_tcon *tcon,
299
+ struct cifs_sb_info *sb, const char *path, struct smb311_posix_qinfo *qinf,
300
+ bool *adjust_tx, bool *symlink);
301
+int posix_info_parse(const void *beg, const void *end,
302
+ struct smb2_posix_info_parsed *out);
303
+int posix_info_sid_size(const void *beg, const void *end);
244304 #endif /* _SMB2PROTO_H */