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