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
23 #include <linux/nls.h>
31 *****************************************************************
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);
47 unsigned int __xid = _get_xid(); \
48 cifs_dbg(FYI, "CIFS VFS: in %s as Xid: %u with uid: %d\n", \
50 from_kuid(&init_user_ns, current_fsuid())); \
51 trace_smb3_enter(__xid, __func__); \
55 #define free_xid(curr_xid) \
57 _free_xid(curr_xid); \
58 cifs_dbg(FYI, "CIFS VFS: leaving %s (xid = %u) rc = %d\n", \
59 __func__, curr_xid, (int)rc); \
61 trace_smb3_exit_err(curr_xid, __func__, (int)rc); \
63 trace_smb3_exit_done(curr_xid, __func__); \
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,
72 extern char *cifs_build_path_to_root(struct smb_vol *vol,
73 struct cifs_sb_info *cifs_sb,
74 struct cifs_tcon *tcon,
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,
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 *,
104 extern struct mid_q_entry *cifs_setup_async_request(struct TCP_Server_Info *,
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 smb2_send_recv(const unsigned int xid, struct cifs_ses *pses,
116 struct kvec *pkvec, int nvec_to_send,
117 int *pbuftype, const int flags,
119 extern int SendReceiveBlockingLock(const unsigned int xid,
120 struct cifs_tcon *ptcon,
121 struct smb_hdr *in_buf ,
122 struct smb_hdr *out_buf,
123 int *bytes_returned);
124 extern int cifs_reconnect(struct TCP_Server_Info *server);
125 extern int checkSMB(char *buf, unsigned int len, struct TCP_Server_Info *srvr);
126 extern bool is_valid_oplock_break(char *, struct TCP_Server_Info *);
127 extern bool backup_cred(struct cifs_sb_info *);
128 extern bool is_size_safe_to_change(struct cifsInodeInfo *, __u64 eof);
129 extern void cifs_update_eof(struct cifsInodeInfo *cifsi, loff_t offset,
130 unsigned int bytes_written);
131 extern struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *, bool);
132 extern struct cifsFileInfo *find_readable_file(struct cifsInodeInfo *, bool);
133 extern unsigned int smbCalcSize(void *buf, struct TCP_Server_Info *server);
134 extern int decode_negTokenInit(unsigned char *security_blob, int length,
135 struct TCP_Server_Info *server);
136 extern int cifs_convert_address(struct sockaddr *dst, const char *src, int len);
137 extern void cifs_set_port(struct sockaddr *addr, const unsigned short int port);
138 extern int map_smb_to_linux_error(char *buf, bool logErr);
139 extern void header_assemble(struct smb_hdr *, char /* command */ ,
140 const struct cifs_tcon *, int /* length of
141 fixed section (word count) in two byte units */);
142 extern int small_smb_init_no_tc(const int smb_cmd, const int wct,
143 struct cifs_ses *ses,
145 extern enum securityEnum select_sectype(struct TCP_Server_Info *server,
146 enum securityEnum requested);
147 extern int CIFS_SessSetup(const unsigned int xid, struct cifs_ses *ses,
148 const struct nls_table *nls_cp);
149 extern struct timespec cifs_NTtimeToUnix(__le64 utc_nanoseconds_since_1601);
150 extern u64 cifs_UnixTimeToNT(struct timespec);
151 extern struct timespec cnvrtDosUnixTm(__le16 le_date, __le16 le_time,
153 extern void cifs_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock);
154 extern int cifs_get_writer(struct cifsInodeInfo *cinode);
155 extern void cifs_put_writer(struct cifsInodeInfo *cinode);
156 extern void cifs_done_oplock_break(struct cifsInodeInfo *cinode);
157 extern int cifs_unlock_range(struct cifsFileInfo *cfile,
158 struct file_lock *flock, const unsigned int xid);
159 extern int cifs_push_mandatory_locks(struct cifsFileInfo *cfile);
161 extern struct cifsFileInfo *cifs_new_fileinfo(struct cifs_fid *fid,
163 struct tcon_link *tlink,
165 extern int cifs_posix_open(char *full_path, struct inode **inode,
166 struct super_block *sb, int mode,
167 unsigned int f_flags, __u32 *oplock, __u16 *netfid,
169 void cifs_fill_uniqueid(struct super_block *sb, struct cifs_fattr *fattr);
170 extern void cifs_unix_basic_to_fattr(struct cifs_fattr *fattr,
171 FILE_UNIX_BASIC_INFO *info,
172 struct cifs_sb_info *cifs_sb);
173 extern void cifs_dir_info_to_fattr(struct cifs_fattr *, FILE_DIRECTORY_INFO *,
174 struct cifs_sb_info *);
175 extern void cifs_fattr_to_inode(struct inode *inode, struct cifs_fattr *fattr);
176 extern struct inode *cifs_iget(struct super_block *sb,
177 struct cifs_fattr *fattr);
179 extern int cifs_get_inode_info(struct inode **inode, const char *full_path,
180 FILE_ALL_INFO *data, struct super_block *sb,
181 int xid, const struct cifs_fid *fid);
182 extern int cifs_get_inode_info_unix(struct inode **pinode,
183 const unsigned char *search_path,
184 struct super_block *sb, unsigned int xid);
185 extern int cifs_set_file_info(struct inode *inode, struct iattr *attrs,
186 unsigned int xid, char *full_path, __u32 dosattr);
187 extern int cifs_rename_pending_delete(const char *full_path,
188 struct dentry *dentry,
189 const unsigned int xid);
190 extern int cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb,
191 struct cifs_fattr *fattr, struct inode *inode,
192 const char *path, const struct cifs_fid *pfid);
193 extern int id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64,
195 extern struct cifs_ntsd *get_cifs_acl(struct cifs_sb_info *, struct inode *,
196 const char *, u32 *);
197 extern struct cifs_ntsd *get_cifs_acl_by_fid(struct cifs_sb_info *,
198 const struct cifs_fid *, u32 *);
199 extern int set_cifs_acl(struct cifs_ntsd *, __u32, struct inode *,
202 extern void dequeue_mid(struct mid_q_entry *mid, bool malformed);
203 extern int cifs_read_from_socket(struct TCP_Server_Info *server, char *buf,
204 unsigned int to_read);
205 extern int cifs_read_page_from_socket(struct TCP_Server_Info *server,
207 unsigned int page_offset,
208 unsigned int to_read);
209 extern int cifs_setup_cifs_sb(struct smb_vol *pvolume_info,
210 struct cifs_sb_info *cifs_sb);
211 extern int cifs_match_super(struct super_block *, void *);
212 extern void cifs_cleanup_volume_info(struct smb_vol *pvolume_info);
213 extern struct smb_vol *cifs_get_volume_info(char *mount_data,
214 const char *devname, bool is_smb3);
215 extern int cifs_mount(struct cifs_sb_info *, struct smb_vol *);
216 extern void cifs_umount(struct cifs_sb_info *);
217 extern void cifs_mark_open_files_invalid(struct cifs_tcon *tcon);
218 extern void cifs_reopen_persistent_handles(struct cifs_tcon *tcon);
220 extern bool cifs_find_lock_conflict(struct cifsFileInfo *cfile, __u64 offset,
221 __u64 length, __u8 type,
222 struct cifsLockInfo **conf_lock,
224 extern void cifs_add_pending_open(struct cifs_fid *fid,
225 struct tcon_link *tlink,
226 struct cifs_pending_open *open);
227 extern void cifs_add_pending_open_locked(struct cifs_fid *fid,
228 struct tcon_link *tlink,
229 struct cifs_pending_open *open);
230 extern void cifs_del_pending_open(struct cifs_pending_open *open);
231 extern void cifs_put_tcp_session(struct TCP_Server_Info *server,
233 extern void cifs_put_tcon(struct cifs_tcon *tcon);
235 #if IS_ENABLED(CONFIG_CIFS_DFS_UPCALL)
236 extern void cifs_dfs_release_automount_timer(void);
237 #else /* ! IS_ENABLED(CONFIG_CIFS_DFS_UPCALL) */
238 #define cifs_dfs_release_automount_timer() do { } while (0)
239 #endif /* ! IS_ENABLED(CONFIG_CIFS_DFS_UPCALL) */
241 void cifs_proc_init(void);
242 void cifs_proc_clean(void);
244 extern void cifs_move_llist(struct list_head *source, struct list_head *dest);
245 extern void cifs_free_llist(struct list_head *llist);
246 extern void cifs_del_lock_waiters(struct cifsLockInfo *lock);
248 extern int cifs_negotiate_protocol(const unsigned int xid,
249 struct cifs_ses *ses);
250 extern int cifs_setup_session(const unsigned int xid, struct cifs_ses *ses,
251 struct nls_table *nls_info);
252 extern int cifs_enable_signing(struct TCP_Server_Info *server, bool mnt_sign_required);
253 extern int CIFSSMBNegotiate(const unsigned int xid, struct cifs_ses *ses);
255 extern int CIFSTCon(const unsigned int xid, struct cifs_ses *ses,
256 const char *tree, struct cifs_tcon *tcon,
257 const struct nls_table *);
259 extern int CIFSFindFirst(const unsigned int xid, struct cifs_tcon *tcon,
260 const char *searchName, struct cifs_sb_info *cifs_sb,
261 __u16 *searchHandle, __u16 search_flags,
262 struct cifs_search_info *psrch_inf,
265 extern int CIFSFindNext(const unsigned int xid, struct cifs_tcon *tcon,
266 __u16 searchHandle, __u16 search_flags,
267 struct cifs_search_info *psrch_inf);
269 extern int CIFSFindClose(const unsigned int xid, struct cifs_tcon *tcon,
270 const __u16 search_handle);
272 extern int CIFSSMBQFileInfo(const unsigned int xid, struct cifs_tcon *tcon,
273 u16 netfid, FILE_ALL_INFO *pFindData);
274 extern int CIFSSMBQPathInfo(const unsigned int xid, struct cifs_tcon *tcon,
275 const char *search_Name, FILE_ALL_INFO *data,
276 int legacy /* whether to use old info level */,
277 const struct nls_table *nls_codepage, int remap);
278 extern int SMBQueryInformation(const unsigned int xid, struct cifs_tcon *tcon,
279 const char *search_name, FILE_ALL_INFO *data,
280 const struct nls_table *nls_codepage, int remap);
282 extern int CIFSSMBUnixQFileInfo(const unsigned int xid, struct cifs_tcon *tcon,
283 u16 netfid, FILE_UNIX_BASIC_INFO *pFindData);
284 extern int CIFSSMBUnixQPathInfo(const unsigned int xid,
285 struct cifs_tcon *tcon,
286 const unsigned char *searchName,
287 FILE_UNIX_BASIC_INFO *pFindData,
288 const struct nls_table *nls_codepage, int remap);
290 extern int CIFSGetDFSRefer(const unsigned int xid, struct cifs_ses *ses,
291 const char *search_name,
292 struct dfs_info3_param **target_nodes,
293 unsigned int *num_of_nodes,
294 const struct nls_table *nls_codepage, int remap);
296 extern int get_dfs_path(const unsigned int xid, struct cifs_ses *ses,
297 const char *old_path,
298 const struct nls_table *nls_codepage,
299 unsigned int *num_referrals,
300 struct dfs_info3_param **referrals, int remap);
301 extern int parse_dfs_referrals(struct get_dfs_referral_rsp *rsp, u32 rsp_size,
302 unsigned int *num_of_nodes,
303 struct dfs_info3_param **target_nodes,
304 const struct nls_table *nls_codepage, int remap,
305 const char *searchName, bool is_unicode);
306 extern void reset_cifs_unix_caps(unsigned int xid, struct cifs_tcon *tcon,
307 struct cifs_sb_info *cifs_sb,
308 struct smb_vol *vol);
309 extern int CIFSSMBQFSInfo(const unsigned int xid, struct cifs_tcon *tcon,
310 struct kstatfs *FSData);
311 extern int SMBOldQFSInfo(const unsigned int xid, struct cifs_tcon *tcon,
312 struct kstatfs *FSData);
313 extern int CIFSSMBSetFSUnixInfo(const unsigned int xid, struct cifs_tcon *tcon,
316 extern int CIFSSMBQFSAttributeInfo(const unsigned int xid,
317 struct cifs_tcon *tcon);
318 extern int CIFSSMBQFSDeviceInfo(const unsigned int xid, struct cifs_tcon *tcon);
319 extern int CIFSSMBQFSUnixInfo(const unsigned int xid, struct cifs_tcon *tcon);
320 extern int CIFSSMBQFSPosixInfo(const unsigned int xid, struct cifs_tcon *tcon,
321 struct kstatfs *FSData);
323 extern int CIFSSMBSetPathInfo(const unsigned int xid, struct cifs_tcon *tcon,
324 const char *fileName, const FILE_BASIC_INFO *data,
325 const struct nls_table *nls_codepage,
326 int remap_special_chars);
327 extern int CIFSSMBSetFileInfo(const unsigned int xid, struct cifs_tcon *tcon,
328 const FILE_BASIC_INFO *data, __u16 fid,
329 __u32 pid_of_opener);
330 extern int CIFSSMBSetFileDisposition(const unsigned int xid,
331 struct cifs_tcon *tcon,
332 bool delete_file, __u16 fid,
333 __u32 pid_of_opener);
335 extern int CIFSSMBSetAttrLegacy(unsigned int xid, struct cifs_tcon *tcon,
336 char *fileName, __u16 dos_attributes,
337 const struct nls_table *nls_codepage);
338 #endif /* possibly unneeded function */
339 extern int CIFSSMBSetEOF(const unsigned int xid, struct cifs_tcon *tcon,
340 const char *file_name, __u64 size,
341 struct cifs_sb_info *cifs_sb, bool set_allocation);
342 extern int CIFSSMBSetFileSize(const unsigned int xid, struct cifs_tcon *tcon,
343 struct cifsFileInfo *cfile, __u64 size,
344 bool set_allocation);
346 struct cifs_unix_set_info_args {
356 extern int CIFSSMBUnixSetFileInfo(const unsigned int xid,
357 struct cifs_tcon *tcon,
358 const struct cifs_unix_set_info_args *args,
359 u16 fid, u32 pid_of_opener);
361 extern int CIFSSMBUnixSetPathInfo(const unsigned int xid,
362 struct cifs_tcon *tcon, const char *file_name,
363 const struct cifs_unix_set_info_args *args,
364 const struct nls_table *nls_codepage,
367 extern int CIFSSMBMkDir(const unsigned int xid, struct cifs_tcon *tcon,
368 const char *name, struct cifs_sb_info *cifs_sb);
369 extern int CIFSSMBRmDir(const unsigned int xid, struct cifs_tcon *tcon,
370 const char *name, struct cifs_sb_info *cifs_sb);
371 extern int CIFSPOSIXDelFile(const unsigned int xid, struct cifs_tcon *tcon,
372 const char *name, __u16 type,
373 const struct nls_table *nls_codepage,
374 int remap_special_chars);
375 extern int CIFSSMBDelFile(const unsigned int xid, struct cifs_tcon *tcon,
376 const char *name, struct cifs_sb_info *cifs_sb);
377 extern int CIFSSMBRename(const unsigned int xid, struct cifs_tcon *tcon,
378 const char *from_name, const char *to_name,
379 struct cifs_sb_info *cifs_sb);
380 extern int CIFSSMBRenameOpenFile(const unsigned int xid, struct cifs_tcon *tcon,
381 int netfid, const char *target_name,
382 const struct nls_table *nls_codepage,
383 int remap_special_chars);
384 extern int CIFSCreateHardLink(const unsigned int xid, struct cifs_tcon *tcon,
385 const char *from_name, const char *to_name,
386 struct cifs_sb_info *cifs_sb);
387 extern int CIFSUnixCreateHardLink(const unsigned int xid,
388 struct cifs_tcon *tcon,
389 const char *fromName, const char *toName,
390 const struct nls_table *nls_codepage,
391 int remap_special_chars);
392 extern int CIFSUnixCreateSymLink(const unsigned int xid,
393 struct cifs_tcon *tcon,
394 const char *fromName, const char *toName,
395 const struct nls_table *nls_codepage, int remap);
396 extern int CIFSSMBUnixQuerySymLink(const unsigned int xid,
397 struct cifs_tcon *tcon,
398 const unsigned char *searchName, char **syminfo,
399 const struct nls_table *nls_codepage, int remap);
400 extern int CIFSSMBQuerySymLink(const unsigned int xid, struct cifs_tcon *tcon,
401 __u16 fid, char **symlinkinfo,
402 const struct nls_table *nls_codepage);
403 extern int CIFSSMB_set_compression(const unsigned int xid,
404 struct cifs_tcon *tcon, __u16 fid);
405 extern int CIFS_open(const unsigned int xid, struct cifs_open_parms *oparms,
406 int *oplock, FILE_ALL_INFO *buf);
407 extern int SMBLegacyOpen(const unsigned int xid, struct cifs_tcon *tcon,
408 const char *fileName, const int disposition,
409 const int access_flags, const int omode,
410 __u16 *netfid, int *pOplock, FILE_ALL_INFO *,
411 const struct nls_table *nls_codepage, int remap);
412 extern int CIFSPOSIXCreate(const unsigned int xid, struct cifs_tcon *tcon,
413 u32 posix_flags, __u64 mode, __u16 *netfid,
414 FILE_UNIX_BASIC_INFO *pRetData,
415 __u32 *pOplock, const char *name,
416 const struct nls_table *nls_codepage, int remap);
417 extern int CIFSSMBClose(const unsigned int xid, struct cifs_tcon *tcon,
418 const int smb_file_id);
420 extern int CIFSSMBFlush(const unsigned int xid, struct cifs_tcon *tcon,
421 const int smb_file_id);
423 extern int CIFSSMBRead(const unsigned int xid, struct cifs_io_parms *io_parms,
424 unsigned int *nbytes, char **buf,
425 int *return_buf_type);
426 extern int CIFSSMBWrite(const unsigned int xid, struct cifs_io_parms *io_parms,
427 unsigned int *nbytes, const char *buf);
428 extern int CIFSSMBWrite2(const unsigned int xid, struct cifs_io_parms *io_parms,
429 unsigned int *nbytes, struct kvec *iov, const int nvec);
430 extern int CIFSGetSrvInodeNumber(const unsigned int xid, struct cifs_tcon *tcon,
431 const char *search_name, __u64 *inode_number,
432 const struct nls_table *nls_codepage,
435 extern int cifs_lockv(const unsigned int xid, struct cifs_tcon *tcon,
436 const __u16 netfid, const __u8 lock_type,
437 const __u32 num_unlock, const __u32 num_lock,
438 LOCKING_ANDX_RANGE *buf);
439 extern int CIFSSMBLock(const unsigned int xid, struct cifs_tcon *tcon,
440 const __u16 netfid, const __u32 netpid, const __u64 len,
441 const __u64 offset, const __u32 numUnlock,
442 const __u32 numLock, const __u8 lockType,
443 const bool waitFlag, const __u8 oplock_level);
444 extern int CIFSSMBPosixLock(const unsigned int xid, struct cifs_tcon *tcon,
445 const __u16 smb_file_id, const __u32 netpid,
446 const loff_t start_offset, const __u64 len,
447 struct file_lock *, const __u16 lock_type,
448 const bool waitFlag);
449 extern int CIFSSMBTDis(const unsigned int xid, struct cifs_tcon *tcon);
450 extern int CIFSSMBEcho(struct TCP_Server_Info *server);
451 extern int CIFSSMBLogoff(const unsigned int xid, struct cifs_ses *ses);
453 extern struct cifs_ses *sesInfoAlloc(void);
454 extern void sesInfoFree(struct cifs_ses *);
455 extern struct cifs_tcon *tconInfoAlloc(void);
456 extern void tconInfoFree(struct cifs_tcon *);
458 extern int cifs_sign_rqst(struct smb_rqst *rqst, struct TCP_Server_Info *server,
459 __u32 *pexpected_response_sequence_number);
460 extern int cifs_sign_smbv(struct kvec *iov, int n_vec, struct TCP_Server_Info *,
462 extern int cifs_sign_smb(struct smb_hdr *, struct TCP_Server_Info *, __u32 *);
463 extern int cifs_verify_signature(struct smb_rqst *rqst,
464 struct TCP_Server_Info *server,
465 __u32 expected_sequence_number);
466 extern int SMBNTencrypt(unsigned char *, unsigned char *, unsigned char *,
467 const struct nls_table *);
468 extern int setup_ntlm_response(struct cifs_ses *, const struct nls_table *);
469 extern int setup_ntlmv2_rsp(struct cifs_ses *, const struct nls_table *);
470 extern void cifs_crypto_secmech_release(struct TCP_Server_Info *server);
471 extern int calc_seckey(struct cifs_ses *);
472 extern int generate_smb30signingkey(struct cifs_ses *);
473 extern int generate_smb311signingkey(struct cifs_ses *);
475 #ifdef CONFIG_CIFS_WEAK_PW_HASH
476 extern int calc_lanman_hash(const char *password, const char *cryptkey,
477 bool encrypt, char *lnm_session_key);
478 #endif /* CIFS_WEAK_PW_HASH */
479 #ifdef CONFIG_CIFS_DNOTIFY_EXPERIMENTAL /* unused temporarily */
480 extern int CIFSSMBNotify(const unsigned int xid, struct cifs_tcon *tcon,
481 const int notify_subdirs, const __u16 netfid,
482 __u32 filter, struct file *file, int multishot,
483 const struct nls_table *nls_codepage);
484 #endif /* was needed for dnotify, and will be needed for inotify when VFS fix */
485 extern int CIFSSMBCopy(unsigned int xid,
486 struct cifs_tcon *source_tcon,
487 const char *fromName,
488 const __u16 target_tid,
489 const char *toName, const int flags,
490 const struct nls_table *nls_codepage,
491 int remap_special_chars);
492 extern ssize_t CIFSSMBQAllEAs(const unsigned int xid, struct cifs_tcon *tcon,
493 const unsigned char *searchName,
494 const unsigned char *ea_name, char *EAData,
495 size_t bufsize, struct cifs_sb_info *cifs_sb);
496 extern int CIFSSMBSetEA(const unsigned int xid, struct cifs_tcon *tcon,
497 const char *fileName, const char *ea_name,
498 const void *ea_value, const __u16 ea_value_len,
499 const struct nls_table *nls_codepage,
500 struct cifs_sb_info *cifs_sb);
501 extern int CIFSSMBGetCIFSACL(const unsigned int xid, struct cifs_tcon *tcon,
502 __u16 fid, struct cifs_ntsd **acl_inf, __u32 *buflen);
503 extern int CIFSSMBSetCIFSACL(const unsigned int, struct cifs_tcon *, __u16,
504 struct cifs_ntsd *, __u32, int);
505 extern int CIFSSMBGetPosixACL(const unsigned int xid, struct cifs_tcon *tcon,
506 const unsigned char *searchName,
507 char *acl_inf, const int buflen, const int acl_type,
508 const struct nls_table *nls_codepage, int remap_special_chars);
509 extern int CIFSSMBSetPosixACL(const unsigned int xid, struct cifs_tcon *tcon,
510 const unsigned char *fileName,
511 const char *local_acl, const int buflen, const int acl_type,
512 const struct nls_table *nls_codepage, int remap_special_chars);
513 extern int CIFSGetExtAttr(const unsigned int xid, struct cifs_tcon *tcon,
514 const int netfid, __u64 *pExtAttrBits, __u64 *pMask);
515 extern void cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb);
516 extern bool couldbe_mf_symlink(const struct cifs_fattr *fattr);
517 extern int check_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,
518 struct cifs_sb_info *cifs_sb,
519 struct cifs_fattr *fattr,
520 const unsigned char *path);
521 extern int mdfour(unsigned char *, unsigned char *, int);
522 extern int E_md4hash(const unsigned char *passwd, unsigned char *p16,
523 const struct nls_table *codepage);
524 extern int SMBencrypt(unsigned char *passwd, const unsigned char *c8,
527 void cifs_readdata_release(struct kref *refcount);
528 int cifs_async_readv(struct cifs_readdata *rdata);
529 int cifs_readv_receive(struct TCP_Server_Info *server, struct mid_q_entry *mid);
531 int cifs_async_writev(struct cifs_writedata *wdata,
532 void (*release)(struct kref *kref));
533 void cifs_writev_complete(struct work_struct *work);
534 struct cifs_writedata *cifs_writedata_alloc(unsigned int nr_pages,
535 work_func_t complete);
536 struct cifs_writedata *cifs_writedata_direct_alloc(struct page **pages,
537 work_func_t complete);
538 void cifs_writedata_release(struct kref *refcount);
539 int cifs_query_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_read);
543 int cifs_create_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,
544 struct cifs_sb_info *cifs_sb,
545 const unsigned char *path, char *pbuf,
546 unsigned int *pbytes_written);
547 int __cifs_calc_signature(struct smb_rqst *rqst, int start,
548 struct TCP_Server_Info *server, char *signature,
549 struct shash_desc *shash);
550 enum securityEnum cifs_select_sectype(struct TCP_Server_Info *,
552 struct cifs_aio_ctx *cifs_aio_ctx_alloc(void);
553 void cifs_aio_ctx_release(struct kref *refcount);
554 int setup_aio_ctx_iter(struct cifs_aio_ctx *ctx, struct iov_iter *iter, int rw);
556 int cifs_alloc_hash(const char *name, struct crypto_shash **shash,
557 struct sdesc **sdesc);
558 void cifs_free_hash(struct crypto_shash **shash, struct sdesc **sdesc);
560 extern void rqst_page_get_length(struct smb_rqst *rqst, unsigned int page,
561 unsigned int *len, unsigned int *offset);
563 #endif /* _CIFSPROTO_H */