Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/*
2 * fs/cifs/cifsproto.h
3 *
4 * Copyright (c) International Business Machines Corp., 2002,2008
5 * Author(s): Steve French (sfrench@us.ibm.com)
6 *
7 * This library is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published
9 * by the Free Software Foundation; either version 2.1 of the License, or
10 * (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
15 * the GNU Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#ifndef _CIFSPROTO_H
22#define _CIFSPROTO_H
23#include <linux/nls.h>
24#include "trace.h"
25
26struct statfs;
27struct smb_vol;
28struct smb_rqst;
29
30/*
31 *****************************************************************
32 * All Prototypes
33 *****************************************************************
34 */
35
36extern struct smb_hdr *cifs_buf_get(void);
37extern void cifs_buf_release(void *);
38extern struct smb_hdr *cifs_small_buf_get(void);
39extern void cifs_small_buf_release(void *);
40extern void free_rsp_buf(int, void *);
41extern int smb_send(struct TCP_Server_Info *, struct smb_hdr *,
42 unsigned int /* length */);
43extern unsigned int _get_xid(void);
44extern void _free_xid(unsigned int);
45#define get_xid() \
46({ \
47 unsigned int __xid = _get_xid(); \
48 cifs_dbg(FYI, "CIFS VFS: in %s as Xid: %u with uid: %d\n", \
49 __func__, __xid, \
50 from_kuid(&init_user_ns, current_fsuid())); \
51 trace_smb3_enter(__xid, __func__); \
52 __xid; \
53})
54
55#define free_xid(curr_xid) \
56do { \
57 _free_xid(curr_xid); \
58 cifs_dbg(FYI, "CIFS VFS: leaving %s (xid = %u) rc = %d\n", \
59 __func__, curr_xid, (int)rc); \
60 if (rc) \
61 trace_smb3_exit_err(curr_xid, __func__, (int)rc); \
62 else \
63 trace_smb3_exit_done(curr_xid, __func__); \
64} while (0)
65extern int init_cifs_idmap(void);
66extern void exit_cifs_idmap(void);
67extern int init_cifs_spnego(void);
68extern void exit_cifs_spnego(void);
69extern char *build_path_from_dentry(struct dentry *);
70extern char *build_path_from_dentry_optional_prefix(struct dentry *direntry,
71 bool prefix);
72extern char *cifs_build_path_to_root(struct smb_vol *vol,
73 struct cifs_sb_info *cifs_sb,
74 struct cifs_tcon *tcon,
75 int add_treename);
76extern char *build_wildcard_path_from_dentry(struct dentry *direntry);
77extern char *cifs_compose_mount_options(const char *sb_mountdata,
78 const char *fullpath, const struct dfs_info3_param *ref,
79 char **devname);
80/* extern void renew_parental_timestamps(struct dentry *direntry);*/
81extern struct mid_q_entry *AllocMidQEntry(const struct smb_hdr *smb_buffer,
82 struct TCP_Server_Info *server);
83extern void DeleteMidQEntry(struct mid_q_entry *midEntry);
84extern void cifs_delete_mid(struct mid_q_entry *mid);
85extern void cifs_mid_q_entry_release(struct mid_q_entry *midEntry);
86extern void cifs_wake_up_task(struct mid_q_entry *mid);
87extern int cifs_handle_standard(struct TCP_Server_Info *server,
88 struct mid_q_entry *mid);
89extern int cifs_discard_remaining_data(struct TCP_Server_Info *server);
90extern int cifs_call_async(struct TCP_Server_Info *server,
91 struct smb_rqst *rqst,
92 mid_receive_t *receive, mid_callback_t *callback,
93 mid_handle_t *handle, void *cbdata, const int flags);
94extern int cifs_send_recv(const unsigned int xid, struct cifs_ses *ses,
95 struct smb_rqst *rqst, int *resp_buf_type,
96 const int flags, struct kvec *resp_iov);
97extern int SendReceive(const unsigned int /* xid */ , struct cifs_ses *,
98 struct smb_hdr * /* input */ ,
99 struct smb_hdr * /* out */ ,
100 int * /* bytes returned */ , const int);
101extern int SendReceiveNoRsp(const unsigned int xid, struct cifs_ses *ses,
102 char *in_buf, int flags);
103extern struct mid_q_entry *cifs_setup_request(struct cifs_ses *,
104 struct smb_rqst *);
105extern struct mid_q_entry *cifs_setup_async_request(struct TCP_Server_Info *,
106 struct smb_rqst *);
107extern int cifs_check_receive(struct mid_q_entry *mid,
108 struct TCP_Server_Info *server, bool log_error);
109extern int cifs_wait_mtu_credits(struct TCP_Server_Info *server,
110 unsigned int size, unsigned int *num,
111 unsigned int *credits);
112extern int SendReceive2(const unsigned int /* xid */ , struct cifs_ses *,
113 struct kvec *, int /* nvec to send */,
114 int * /* type of buf returned */, const int flags,
115 struct kvec * /* resp vec */);
116extern int SendReceiveBlockingLock(const unsigned int xid,
117 struct cifs_tcon *ptcon,
118 struct smb_hdr *in_buf ,
119 struct smb_hdr *out_buf,
120 int *bytes_returned);
121extern int cifs_reconnect(struct TCP_Server_Info *server);
122extern int checkSMB(char *buf, unsigned int len, struct TCP_Server_Info *srvr);
123extern bool is_valid_oplock_break(char *, struct TCP_Server_Info *);
124extern bool backup_cred(struct cifs_sb_info *);
125extern bool is_size_safe_to_change(struct cifsInodeInfo *, __u64 eof);
126extern void cifs_update_eof(struct cifsInodeInfo *cifsi, loff_t offset,
127 unsigned int bytes_written);
128extern struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *, bool);
129extern struct cifsFileInfo *find_readable_file(struct cifsInodeInfo *, bool);
130extern unsigned int smbCalcSize(void *buf, struct TCP_Server_Info *server);
131extern int decode_negTokenInit(unsigned char *security_blob, int length,
132 struct TCP_Server_Info *server);
133extern int cifs_convert_address(struct sockaddr *dst, const char *src, int len);
134extern void cifs_set_port(struct sockaddr *addr, const unsigned short int port);
135extern int map_smb_to_linux_error(char *buf, bool logErr);
136extern void header_assemble(struct smb_hdr *, char /* command */ ,
137 const struct cifs_tcon *, int /* length of
138 fixed section (word count) in two byte units */);
139extern int small_smb_init_no_tc(const int smb_cmd, const int wct,
140 struct cifs_ses *ses,
141 void **request_buf);
142extern enum securityEnum select_sectype(struct TCP_Server_Info *server,
143 enum securityEnum requested);
144extern int CIFS_SessSetup(const unsigned int xid, struct cifs_ses *ses,
145 const struct nls_table *nls_cp);
146extern struct timespec cifs_NTtimeToUnix(__le64 utc_nanoseconds_since_1601);
147extern u64 cifs_UnixTimeToNT(struct timespec);
148extern struct timespec cnvrtDosUnixTm(__le16 le_date, __le16 le_time,
149 int offset);
150extern void cifs_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock);
151extern int cifs_get_writer(struct cifsInodeInfo *cinode);
152extern void cifs_put_writer(struct cifsInodeInfo *cinode);
153extern void cifs_done_oplock_break(struct cifsInodeInfo *cinode);
154extern int cifs_unlock_range(struct cifsFileInfo *cfile,
155 struct file_lock *flock, const unsigned int xid);
156extern int cifs_push_mandatory_locks(struct cifsFileInfo *cfile);
157
158extern struct cifsFileInfo *cifs_new_fileinfo(struct cifs_fid *fid,
159 struct file *file,
160 struct tcon_link *tlink,
161 __u32 oplock);
162extern int cifs_posix_open(char *full_path, struct inode **inode,
163 struct super_block *sb, int mode,
164 unsigned int f_flags, __u32 *oplock, __u16 *netfid,
165 unsigned int xid);
166void cifs_fill_uniqueid(struct super_block *sb, struct cifs_fattr *fattr);
167extern void cifs_unix_basic_to_fattr(struct cifs_fattr *fattr,
168 FILE_UNIX_BASIC_INFO *info,
169 struct cifs_sb_info *cifs_sb);
170extern void cifs_dir_info_to_fattr(struct cifs_fattr *, FILE_DIRECTORY_INFO *,
171 struct cifs_sb_info *);
172extern void cifs_fattr_to_inode(struct inode *inode, struct cifs_fattr *fattr);
173extern struct inode *cifs_iget(struct super_block *sb,
174 struct cifs_fattr *fattr);
175
176extern int cifs_get_inode_info(struct inode **inode, const char *full_path,
177 FILE_ALL_INFO *data, struct super_block *sb,
178 int xid, const struct cifs_fid *fid);
179extern int cifs_get_inode_info_unix(struct inode **pinode,
180 const unsigned char *search_path,
181 struct super_block *sb, unsigned int xid);
182extern int cifs_set_file_info(struct inode *inode, struct iattr *attrs,
183 unsigned int xid, char *full_path, __u32 dosattr);
184extern int cifs_rename_pending_delete(const char *full_path,
185 struct dentry *dentry,
186 const unsigned int xid);
187extern int cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb,
188 struct cifs_fattr *fattr, struct inode *inode,
189 const char *path, const struct cifs_fid *pfid);
190extern int id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64,
191 kuid_t, kgid_t);
192extern struct cifs_ntsd *get_cifs_acl(struct cifs_sb_info *, struct inode *,
193 const char *, u32 *);
194extern struct cifs_ntsd *get_cifs_acl_by_fid(struct cifs_sb_info *,
195 const struct cifs_fid *, u32 *);
196extern int set_cifs_acl(struct cifs_ntsd *, __u32, struct inode *,
197 const char *, int);
198
199extern void dequeue_mid(struct mid_q_entry *mid, bool malformed);
200extern int cifs_read_from_socket(struct TCP_Server_Info *server, char *buf,
201 unsigned int to_read);
202extern int cifs_read_page_from_socket(struct TCP_Server_Info *server,
203 struct page *page,
204 unsigned int page_offset,
205 unsigned int to_read);
206extern int cifs_setup_cifs_sb(struct smb_vol *pvolume_info,
207 struct cifs_sb_info *cifs_sb);
208extern int cifs_match_super(struct super_block *, void *);
209extern void cifs_cleanup_volume_info(struct smb_vol *pvolume_info);
210extern struct smb_vol *cifs_get_volume_info(char *mount_data,
211 const char *devname, bool is_smb3);
212extern int cifs_mount(struct cifs_sb_info *, struct smb_vol *);
213extern void cifs_umount(struct cifs_sb_info *);
214extern void cifs_mark_open_files_invalid(struct cifs_tcon *tcon);
215extern void cifs_reopen_persistent_handles(struct cifs_tcon *tcon);
216
217extern bool cifs_find_lock_conflict(struct cifsFileInfo *cfile, __u64 offset,
218 __u64 length, __u8 type,
219 struct cifsLockInfo **conf_lock,
220 int rw_check);
221extern void cifs_add_pending_open(struct cifs_fid *fid,
222 struct tcon_link *tlink,
223 struct cifs_pending_open *open);
224extern void cifs_add_pending_open_locked(struct cifs_fid *fid,
225 struct tcon_link *tlink,
226 struct cifs_pending_open *open);
227extern void cifs_del_pending_open(struct cifs_pending_open *open);
228extern void cifs_put_tcp_session(struct TCP_Server_Info *server,
229 int from_reconnect);
230extern void cifs_put_tcon(struct cifs_tcon *tcon);
231
232#if IS_ENABLED(CONFIG_CIFS_DFS_UPCALL)
233extern void cifs_dfs_release_automount_timer(void);
234#else /* ! IS_ENABLED(CONFIG_CIFS_DFS_UPCALL) */
235#define cifs_dfs_release_automount_timer() do { } while (0)
236#endif /* ! IS_ENABLED(CONFIG_CIFS_DFS_UPCALL) */
237
238void cifs_proc_init(void);
239void cifs_proc_clean(void);
240
241extern void cifs_move_llist(struct list_head *source, struct list_head *dest);
242extern void cifs_free_llist(struct list_head *llist);
243extern void cifs_del_lock_waiters(struct cifsLockInfo *lock);
244
245extern int cifs_negotiate_protocol(const unsigned int xid,
246 struct cifs_ses *ses);
247extern int cifs_setup_session(const unsigned int xid, struct cifs_ses *ses,
248 struct nls_table *nls_info);
249extern int cifs_enable_signing(struct TCP_Server_Info *server, bool mnt_sign_required);
250extern int CIFSSMBNegotiate(const unsigned int xid, struct cifs_ses *ses);
251
252extern int CIFSTCon(const unsigned int xid, struct cifs_ses *ses,
253 const char *tree, struct cifs_tcon *tcon,
254 const struct nls_table *);
255
256extern int CIFSFindFirst(const unsigned int xid, struct cifs_tcon *tcon,
257 const char *searchName, struct cifs_sb_info *cifs_sb,
258 __u16 *searchHandle, __u16 search_flags,
259 struct cifs_search_info *psrch_inf,
260 bool msearch);
261
262extern int CIFSFindNext(const unsigned int xid, struct cifs_tcon *tcon,
263 __u16 searchHandle, __u16 search_flags,
264 struct cifs_search_info *psrch_inf);
265
266extern int CIFSFindClose(const unsigned int xid, struct cifs_tcon *tcon,
267 const __u16 search_handle);
268
269extern int CIFSSMBQFileInfo(const unsigned int xid, struct cifs_tcon *tcon,
270 u16 netfid, FILE_ALL_INFO *pFindData);
271extern int CIFSSMBQPathInfo(const unsigned int xid, struct cifs_tcon *tcon,
272 const char *search_Name, FILE_ALL_INFO *data,
273 int legacy /* whether to use old info level */,
274 const struct nls_table *nls_codepage, int remap);
275extern int SMBQueryInformation(const unsigned int xid, struct cifs_tcon *tcon,
276 const char *search_name, FILE_ALL_INFO *data,
277 const struct nls_table *nls_codepage, int remap);
278
279extern int CIFSSMBUnixQFileInfo(const unsigned int xid, struct cifs_tcon *tcon,
280 u16 netfid, FILE_UNIX_BASIC_INFO *pFindData);
281extern int CIFSSMBUnixQPathInfo(const unsigned int xid,
282 struct cifs_tcon *tcon,
283 const unsigned char *searchName,
284 FILE_UNIX_BASIC_INFO *pFindData,
285 const struct nls_table *nls_codepage, int remap);
286
287extern int CIFSGetDFSRefer(const unsigned int xid, struct cifs_ses *ses,
288 const char *search_name,
289 struct dfs_info3_param **target_nodes,
290 unsigned int *num_of_nodes,
291 const struct nls_table *nls_codepage, int remap);
292
293extern int get_dfs_path(const unsigned int xid, struct cifs_ses *ses,
294 const char *old_path,
295 const struct nls_table *nls_codepage,
296 unsigned int *num_referrals,
297 struct dfs_info3_param **referrals, int remap);
298extern int parse_dfs_referrals(struct get_dfs_referral_rsp *rsp, u32 rsp_size,
299 unsigned int *num_of_nodes,
300 struct dfs_info3_param **target_nodes,
301 const struct nls_table *nls_codepage, int remap,
302 const char *searchName, bool is_unicode);
303extern void reset_cifs_unix_caps(unsigned int xid, struct cifs_tcon *tcon,
304 struct cifs_sb_info *cifs_sb,
305 struct smb_vol *vol);
306extern int CIFSSMBQFSInfo(const unsigned int xid, struct cifs_tcon *tcon,
307 struct kstatfs *FSData);
308extern int SMBOldQFSInfo(const unsigned int xid, struct cifs_tcon *tcon,
309 struct kstatfs *FSData);
310extern int CIFSSMBSetFSUnixInfo(const unsigned int xid, struct cifs_tcon *tcon,
311 __u64 cap);
312
313extern int CIFSSMBQFSAttributeInfo(const unsigned int xid,
314 struct cifs_tcon *tcon);
315extern int CIFSSMBQFSDeviceInfo(const unsigned int xid, struct cifs_tcon *tcon);
316extern int CIFSSMBQFSUnixInfo(const unsigned int xid, struct cifs_tcon *tcon);
317extern int CIFSSMBQFSPosixInfo(const unsigned int xid, struct cifs_tcon *tcon,
318 struct kstatfs *FSData);
319
320extern int CIFSSMBSetPathInfo(const unsigned int xid, struct cifs_tcon *tcon,
321 const char *fileName, const FILE_BASIC_INFO *data,
322 const struct nls_table *nls_codepage,
323 int remap_special_chars);
324extern int CIFSSMBSetFileInfo(const unsigned int xid, struct cifs_tcon *tcon,
325 const FILE_BASIC_INFO *data, __u16 fid,
326 __u32 pid_of_opener);
327extern int CIFSSMBSetFileDisposition(const unsigned int xid,
328 struct cifs_tcon *tcon,
329 bool delete_file, __u16 fid,
330 __u32 pid_of_opener);
331#if 0
332extern int CIFSSMBSetAttrLegacy(unsigned int xid, struct cifs_tcon *tcon,
333 char *fileName, __u16 dos_attributes,
334 const struct nls_table *nls_codepage);
335#endif /* possibly unneeded function */
336extern int CIFSSMBSetEOF(const unsigned int xid, struct cifs_tcon *tcon,
337 const char *file_name, __u64 size,
338 struct cifs_sb_info *cifs_sb, bool set_allocation);
339extern int CIFSSMBSetFileSize(const unsigned int xid, struct cifs_tcon *tcon,
340 struct cifsFileInfo *cfile, __u64 size,
341 bool set_allocation);
342
343struct cifs_unix_set_info_args {
344 __u64 ctime;
345 __u64 atime;
346 __u64 mtime;
347 __u64 mode;
348 kuid_t uid;
349 kgid_t gid;
350 dev_t device;
351};
352
353extern int CIFSSMBUnixSetFileInfo(const unsigned int xid,
354 struct cifs_tcon *tcon,
355 const struct cifs_unix_set_info_args *args,
356 u16 fid, u32 pid_of_opener);
357
358extern int CIFSSMBUnixSetPathInfo(const unsigned int xid,
359 struct cifs_tcon *tcon, const char *file_name,
360 const struct cifs_unix_set_info_args *args,
361 const struct nls_table *nls_codepage,
362 int remap);
363
364extern int CIFSSMBMkDir(const unsigned int xid, struct cifs_tcon *tcon,
365 const char *name, struct cifs_sb_info *cifs_sb);
366extern int CIFSSMBRmDir(const unsigned int xid, struct cifs_tcon *tcon,
367 const char *name, struct cifs_sb_info *cifs_sb);
368extern int CIFSPOSIXDelFile(const unsigned int xid, struct cifs_tcon *tcon,
369 const char *name, __u16 type,
370 const struct nls_table *nls_codepage,
371 int remap_special_chars);
372extern int CIFSSMBDelFile(const unsigned int xid, struct cifs_tcon *tcon,
373 const char *name, struct cifs_sb_info *cifs_sb);
374extern int CIFSSMBRename(const unsigned int xid, struct cifs_tcon *tcon,
375 const char *from_name, const char *to_name,
376 struct cifs_sb_info *cifs_sb);
377extern int CIFSSMBRenameOpenFile(const unsigned int xid, struct cifs_tcon *tcon,
378 int netfid, const char *target_name,
379 const struct nls_table *nls_codepage,
380 int remap_special_chars);
381extern int CIFSCreateHardLink(const unsigned int xid, struct cifs_tcon *tcon,
382 const char *from_name, const char *to_name,
383 struct cifs_sb_info *cifs_sb);
384extern int CIFSUnixCreateHardLink(const unsigned int xid,
385 struct cifs_tcon *tcon,
386 const char *fromName, const char *toName,
387 const struct nls_table *nls_codepage,
388 int remap_special_chars);
389extern int CIFSUnixCreateSymLink(const unsigned int xid,
390 struct cifs_tcon *tcon,
391 const char *fromName, const char *toName,
392 const struct nls_table *nls_codepage, int remap);
393extern int CIFSSMBUnixQuerySymLink(const unsigned int xid,
394 struct cifs_tcon *tcon,
395 const unsigned char *searchName, char **syminfo,
396 const struct nls_table *nls_codepage, int remap);
397extern int CIFSSMBQuerySymLink(const unsigned int xid, struct cifs_tcon *tcon,
398 __u16 fid, char **symlinkinfo,
399 const struct nls_table *nls_codepage);
400extern int CIFSSMB_set_compression(const unsigned int xid,
401 struct cifs_tcon *tcon, __u16 fid);
402extern int CIFS_open(const unsigned int xid, struct cifs_open_parms *oparms,
403 int *oplock, FILE_ALL_INFO *buf);
404extern int SMBLegacyOpen(const unsigned int xid, struct cifs_tcon *tcon,
405 const char *fileName, const int disposition,
406 const int access_flags, const int omode,
407 __u16 *netfid, int *pOplock, FILE_ALL_INFO *,
408 const struct nls_table *nls_codepage, int remap);
409extern int CIFSPOSIXCreate(const unsigned int xid, struct cifs_tcon *tcon,
410 u32 posix_flags, __u64 mode, __u16 *netfid,
411 FILE_UNIX_BASIC_INFO *pRetData,
412 __u32 *pOplock, const char *name,
413 const struct nls_table *nls_codepage, int remap);
414extern int CIFSSMBClose(const unsigned int xid, struct cifs_tcon *tcon,
415 const int smb_file_id);
416
417extern int CIFSSMBFlush(const unsigned int xid, struct cifs_tcon *tcon,
418 const int smb_file_id);
419
420extern int CIFSSMBRead(const unsigned int xid, struct cifs_io_parms *io_parms,
421 unsigned int *nbytes, char **buf,
422 int *return_buf_type);
423extern int CIFSSMBWrite(const unsigned int xid, struct cifs_io_parms *io_parms,
424 unsigned int *nbytes, const char *buf);
425extern int CIFSSMBWrite2(const unsigned int xid, struct cifs_io_parms *io_parms,
426 unsigned int *nbytes, struct kvec *iov, const int nvec);
427extern int CIFSGetSrvInodeNumber(const unsigned int xid, struct cifs_tcon *tcon,
428 const char *search_name, __u64 *inode_number,
429 const struct nls_table *nls_codepage,
430 int remap);
431
432extern int cifs_lockv(const unsigned int xid, struct cifs_tcon *tcon,
433 const __u16 netfid, const __u8 lock_type,
434 const __u32 num_unlock, const __u32 num_lock,
435 LOCKING_ANDX_RANGE *buf);
436extern int CIFSSMBLock(const unsigned int xid, struct cifs_tcon *tcon,
437 const __u16 netfid, const __u32 netpid, const __u64 len,
438 const __u64 offset, const __u32 numUnlock,
439 const __u32 numLock, const __u8 lockType,
440 const bool waitFlag, const __u8 oplock_level);
441extern int CIFSSMBPosixLock(const unsigned int xid, struct cifs_tcon *tcon,
442 const __u16 smb_file_id, const __u32 netpid,
443 const loff_t start_offset, const __u64 len,
444 struct file_lock *, const __u16 lock_type,
445 const bool waitFlag);
446extern int CIFSSMBTDis(const unsigned int xid, struct cifs_tcon *tcon);
447extern int CIFSSMBEcho(struct TCP_Server_Info *server);
448extern int CIFSSMBLogoff(const unsigned int xid, struct cifs_ses *ses);
449
450extern struct cifs_ses *sesInfoAlloc(void);
451extern void sesInfoFree(struct cifs_ses *);
452extern struct cifs_tcon *tconInfoAlloc(void);
453extern void tconInfoFree(struct cifs_tcon *);
454
455extern int cifs_sign_rqst(struct smb_rqst *rqst, struct TCP_Server_Info *server,
456 __u32 *pexpected_response_sequence_number);
457extern int cifs_sign_smbv(struct kvec *iov, int n_vec, struct TCP_Server_Info *,
458 __u32 *);
459extern int cifs_sign_smb(struct smb_hdr *, struct TCP_Server_Info *, __u32 *);
460extern int cifs_verify_signature(struct smb_rqst *rqst,
461 struct TCP_Server_Info *server,
462 __u32 expected_sequence_number);
463extern int SMBNTencrypt(unsigned char *, unsigned char *, unsigned char *,
464 const struct nls_table *);
465extern int setup_ntlm_response(struct cifs_ses *, const struct nls_table *);
466extern int setup_ntlmv2_rsp(struct cifs_ses *, const struct nls_table *);
467extern void cifs_crypto_secmech_release(struct TCP_Server_Info *server);
468extern int calc_seckey(struct cifs_ses *);
469extern int generate_smb30signingkey(struct cifs_ses *);
470extern int generate_smb311signingkey(struct cifs_ses *);
471
472#ifdef CONFIG_CIFS_WEAK_PW_HASH
473extern int calc_lanman_hash(const char *password, const char *cryptkey,
474 bool encrypt, char *lnm_session_key);
475#endif /* CIFS_WEAK_PW_HASH */
476#ifdef CONFIG_CIFS_DNOTIFY_EXPERIMENTAL /* unused temporarily */
477extern int CIFSSMBNotify(const unsigned int xid, struct cifs_tcon *tcon,
478 const int notify_subdirs, const __u16 netfid,
479 __u32 filter, struct file *file, int multishot,
480 const struct nls_table *nls_codepage);
481#endif /* was needed for dnotify, and will be needed for inotify when VFS fix */
482extern int CIFSSMBCopy(unsigned int xid,
483 struct cifs_tcon *source_tcon,
484 const char *fromName,
485 const __u16 target_tid,
486 const char *toName, const int flags,
487 const struct nls_table *nls_codepage,
488 int remap_special_chars);
489extern ssize_t CIFSSMBQAllEAs(const unsigned int xid, struct cifs_tcon *tcon,
490 const unsigned char *searchName,
491 const unsigned char *ea_name, char *EAData,
492 size_t bufsize, struct cifs_sb_info *cifs_sb);
493extern int CIFSSMBSetEA(const unsigned int xid, struct cifs_tcon *tcon,
494 const char *fileName, const char *ea_name,
495 const void *ea_value, const __u16 ea_value_len,
496 const struct nls_table *nls_codepage,
497 struct cifs_sb_info *cifs_sb);
498extern int CIFSSMBGetCIFSACL(const unsigned int xid, struct cifs_tcon *tcon,
499 __u16 fid, struct cifs_ntsd **acl_inf, __u32 *buflen);
500extern int CIFSSMBSetCIFSACL(const unsigned int, struct cifs_tcon *, __u16,
501 struct cifs_ntsd *, __u32, int);
502extern int CIFSSMBGetPosixACL(const unsigned int xid, struct cifs_tcon *tcon,
503 const unsigned char *searchName,
504 char *acl_inf, const int buflen, const int acl_type,
505 const struct nls_table *nls_codepage, int remap_special_chars);
506extern int CIFSSMBSetPosixACL(const unsigned int xid, struct cifs_tcon *tcon,
507 const unsigned char *fileName,
508 const char *local_acl, const int buflen, const int acl_type,
509 const struct nls_table *nls_codepage, int remap_special_chars);
510extern int CIFSGetExtAttr(const unsigned int xid, struct cifs_tcon *tcon,
511 const int netfid, __u64 *pExtAttrBits, __u64 *pMask);
512extern void cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb);
513extern bool couldbe_mf_symlink(const struct cifs_fattr *fattr);
514extern int check_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,
515 struct cifs_sb_info *cifs_sb,
516 struct cifs_fattr *fattr,
517 const unsigned char *path);
518extern int mdfour(unsigned char *, unsigned char *, int);
519extern int E_md4hash(const unsigned char *passwd, unsigned char *p16,
520 const struct nls_table *codepage);
521extern int SMBencrypt(unsigned char *passwd, const unsigned char *c8,
522 unsigned char *p24);
523
524void cifs_readdata_release(struct kref *refcount);
525int cifs_async_readv(struct cifs_readdata *rdata);
526int cifs_readv_receive(struct TCP_Server_Info *server, struct mid_q_entry *mid);
527
528int cifs_async_writev(struct cifs_writedata *wdata,
529 void (*release)(struct kref *kref));
530void cifs_writev_complete(struct work_struct *work);
531struct cifs_writedata *cifs_writedata_alloc(unsigned int nr_pages,
532 work_func_t complete);
533struct cifs_writedata *cifs_writedata_direct_alloc(struct page **pages,
534 work_func_t complete);
535void cifs_writedata_release(struct kref *refcount);
536int cifs_query_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,
537 struct cifs_sb_info *cifs_sb,
538 const unsigned char *path, char *pbuf,
539 unsigned int *pbytes_read);
540int cifs_create_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,
541 struct cifs_sb_info *cifs_sb,
542 const unsigned char *path, char *pbuf,
543 unsigned int *pbytes_written);
544int __cifs_calc_signature(struct smb_rqst *rqst,
545 struct TCP_Server_Info *server, char *signature,
546 struct shash_desc *shash);
547enum securityEnum cifs_select_sectype(struct TCP_Server_Info *,
548 enum securityEnum);
549struct cifs_aio_ctx *cifs_aio_ctx_alloc(void);
550void cifs_aio_ctx_release(struct kref *refcount);
551int setup_aio_ctx_iter(struct cifs_aio_ctx *ctx, struct iov_iter *iter, int rw);
552void smb2_cached_lease_break(struct work_struct *work);
553
554int cifs_alloc_hash(const char *name, struct crypto_shash **shash,
555 struct sdesc **sdesc);
556void cifs_free_hash(struct crypto_shash **shash, struct sdesc **sdesc);
557
558extern void rqst_page_get_length(struct smb_rqst *rqst, unsigned int page,
559 unsigned int *len, unsigned int *offset);
560
561#endif /* _CIFSPROTO_H */