Merge branches 'work.misc' and 'work.dcache' of git://git.kernel.org/pub/scm/linux...
[sfrench/cifs-2.6.git] / fs / cifs / cifsproto.h
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
26 struct statfs;
27 struct smb_vol;
28 struct smb_rqst;
29
30 /*
31  *****************************************************************
32  * All Prototypes
33  *****************************************************************
34  */
35
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;                                                  \
53 })
54
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_mid_q_entry_release(struct mid_q_entry *midEntry);
86 extern void cifs_wake_up_task(struct mid_q_entry *mid);
87 extern int cifs_handle_standard(struct TCP_Server_Info *server,
88                                 struct mid_q_entry *mid);
89 extern int cifs_discard_remaining_data(struct TCP_Server_Info *server);
90 extern 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);
94 extern 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);
97 extern 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);
101 extern int SendReceiveNoRsp(const unsigned int xid, struct cifs_ses *ses,
102                             char *in_buf, int flags);
103 extern struct mid_q_entry *cifs_setup_request(struct cifs_ses *,
104                                 struct smb_rqst *);
105 extern struct mid_q_entry *cifs_setup_async_request(struct TCP_Server_Info *,
106                                                 struct smb_rqst *);
107 extern int cifs_check_receive(struct mid_q_entry *mid,
108                         struct TCP_Server_Info *server, bool log_error);
109 extern int cifs_wait_mtu_credits(struct TCP_Server_Info *server,
110                                  unsigned int size, unsigned int *num,
111                                  unsigned int *credits);
112 extern 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 */);
116 extern 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);
121 extern int cifs_reconnect(struct TCP_Server_Info *server);
122 extern int checkSMB(char *buf, unsigned int len, struct TCP_Server_Info *srvr);
123 extern bool is_valid_oplock_break(char *, struct TCP_Server_Info *);
124 extern bool backup_cred(struct cifs_sb_info *);
125 extern bool is_size_safe_to_change(struct cifsInodeInfo *, __u64 eof);
126 extern void cifs_update_eof(struct cifsInodeInfo *cifsi, loff_t offset,
127                             unsigned int bytes_written);
128 extern struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *, bool);
129 extern struct cifsFileInfo *find_readable_file(struct cifsInodeInfo *, bool);
130 extern unsigned int smbCalcSize(void *buf, struct TCP_Server_Info *server);
131 extern int decode_negTokenInit(unsigned char *security_blob, int length,
132                         struct TCP_Server_Info *server);
133 extern int cifs_convert_address(struct sockaddr *dst, const char *src, int len);
134 extern void cifs_set_port(struct sockaddr *addr, const unsigned short int port);
135 extern int map_smb_to_linux_error(char *buf, bool logErr);
136 extern 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 */);
139 extern int small_smb_init_no_tc(const int smb_cmd, const int wct,
140                                 struct cifs_ses *ses,
141                                 void **request_buf);
142 extern enum securityEnum select_sectype(struct TCP_Server_Info *server,
143                                 enum securityEnum requested);
144 extern int CIFS_SessSetup(const unsigned int xid, struct cifs_ses *ses,
145                           const struct nls_table *nls_cp);
146 extern struct timespec cifs_NTtimeToUnix(__le64 utc_nanoseconds_since_1601);
147 extern u64 cifs_UnixTimeToNT(struct timespec);
148 extern struct timespec cnvrtDosUnixTm(__le16 le_date, __le16 le_time,
149                                       int offset);
150 extern void cifs_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock);
151 extern int cifs_get_writer(struct cifsInodeInfo *cinode);
152 extern void cifs_put_writer(struct cifsInodeInfo *cinode);
153 extern void cifs_done_oplock_break(struct cifsInodeInfo *cinode);
154 extern int cifs_unlock_range(struct cifsFileInfo *cfile,
155                              struct file_lock *flock, const unsigned int xid);
156 extern int cifs_push_mandatory_locks(struct cifsFileInfo *cfile);
157
158 extern struct cifsFileInfo *cifs_new_fileinfo(struct cifs_fid *fid,
159                                               struct file *file,
160                                               struct tcon_link *tlink,
161                                               __u32 oplock);
162 extern 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);
166 void cifs_fill_uniqueid(struct super_block *sb, struct cifs_fattr *fattr);
167 extern void cifs_unix_basic_to_fattr(struct cifs_fattr *fattr,
168                                      FILE_UNIX_BASIC_INFO *info,
169                                      struct cifs_sb_info *cifs_sb);
170 extern void cifs_dir_info_to_fattr(struct cifs_fattr *, FILE_DIRECTORY_INFO *,
171                                         struct cifs_sb_info *);
172 extern void cifs_fattr_to_inode(struct inode *inode, struct cifs_fattr *fattr);
173 extern struct inode *cifs_iget(struct super_block *sb,
174                                struct cifs_fattr *fattr);
175
176 extern 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);
179 extern int cifs_get_inode_info_unix(struct inode **pinode,
180                         const unsigned char *search_path,
181                         struct super_block *sb, unsigned int xid);
182 extern int cifs_set_file_info(struct inode *inode, struct iattr *attrs,
183                               unsigned int xid, char *full_path, __u32 dosattr);
184 extern int cifs_rename_pending_delete(const char *full_path,
185                                       struct dentry *dentry,
186                                       const unsigned int xid);
187 extern 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);
190 extern int id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64,
191                                         kuid_t, kgid_t);
192 extern struct cifs_ntsd *get_cifs_acl(struct cifs_sb_info *, struct inode *,
193                                         const char *, u32 *);
194 extern struct cifs_ntsd *get_cifs_acl_by_fid(struct cifs_sb_info *,
195                                                 const struct cifs_fid *, u32 *);
196 extern int set_cifs_acl(struct cifs_ntsd *, __u32, struct inode *,
197                                 const char *, int);
198
199 extern void dequeue_mid(struct mid_q_entry *mid, bool malformed);
200 extern int cifs_read_from_socket(struct TCP_Server_Info *server, char *buf,
201                                  unsigned int to_read);
202 extern 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);
206 extern int cifs_setup_cifs_sb(struct smb_vol *pvolume_info,
207                                struct cifs_sb_info *cifs_sb);
208 extern int cifs_match_super(struct super_block *, void *);
209 extern void cifs_cleanup_volume_info(struct smb_vol *pvolume_info);
210 extern struct smb_vol *cifs_get_volume_info(char *mount_data,
211                                             const char *devname, bool is_smb3);
212 extern int cifs_mount(struct cifs_sb_info *, struct smb_vol *);
213 extern void cifs_umount(struct cifs_sb_info *);
214 extern void cifs_mark_open_files_invalid(struct cifs_tcon *tcon);
215 extern void cifs_reopen_persistent_handles(struct cifs_tcon *tcon);
216
217 extern bool cifs_find_lock_conflict(struct cifsFileInfo *cfile, __u64 offset,
218                                     __u64 length, __u8 type,
219                                     struct cifsLockInfo **conf_lock,
220                                     int rw_check);
221 extern void cifs_add_pending_open(struct cifs_fid *fid,
222                                   struct tcon_link *tlink,
223                                   struct cifs_pending_open *open);
224 extern void cifs_add_pending_open_locked(struct cifs_fid *fid,
225                                          struct tcon_link *tlink,
226                                          struct cifs_pending_open *open);
227 extern void cifs_del_pending_open(struct cifs_pending_open *open);
228 extern void cifs_put_tcp_session(struct TCP_Server_Info *server,
229                                  int from_reconnect);
230 extern void cifs_put_tcon(struct cifs_tcon *tcon);
231
232 #if IS_ENABLED(CONFIG_CIFS_DFS_UPCALL)
233 extern 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
238 void cifs_proc_init(void);
239 void cifs_proc_clean(void);
240
241 extern void cifs_move_llist(struct list_head *source, struct list_head *dest);
242 extern void cifs_free_llist(struct list_head *llist);
243 extern void cifs_del_lock_waiters(struct cifsLockInfo *lock);
244
245 extern int cifs_negotiate_protocol(const unsigned int xid,
246                                    struct cifs_ses *ses);
247 extern int cifs_setup_session(const unsigned int xid, struct cifs_ses *ses,
248                               struct nls_table *nls_info);
249 extern int cifs_enable_signing(struct TCP_Server_Info *server, bool mnt_sign_required);
250 extern int CIFSSMBNegotiate(const unsigned int xid, struct cifs_ses *ses);
251
252 extern int CIFSTCon(const unsigned int xid, struct cifs_ses *ses,
253                     const char *tree, struct cifs_tcon *tcon,
254                     const struct nls_table *);
255
256 extern 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
262 extern int CIFSFindNext(const unsigned int xid, struct cifs_tcon *tcon,
263                 __u16 searchHandle, __u16 search_flags,
264                 struct cifs_search_info *psrch_inf);
265
266 extern int CIFSFindClose(const unsigned int xid, struct cifs_tcon *tcon,
267                         const __u16 search_handle);
268
269 extern int CIFSSMBQFileInfo(const unsigned int xid, struct cifs_tcon *tcon,
270                         u16 netfid, FILE_ALL_INFO *pFindData);
271 extern 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);
275 extern 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
279 extern int CIFSSMBUnixQFileInfo(const unsigned int xid, struct cifs_tcon *tcon,
280                         u16 netfid, FILE_UNIX_BASIC_INFO *pFindData);
281 extern 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
287 extern 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
293 extern 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);
298 extern 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);
303 extern void reset_cifs_unix_caps(unsigned int xid, struct cifs_tcon *tcon,
304                                  struct cifs_sb_info *cifs_sb,
305                                  struct smb_vol *vol);
306 extern int CIFSSMBQFSInfo(const unsigned int xid, struct cifs_tcon *tcon,
307                         struct kstatfs *FSData);
308 extern int SMBOldQFSInfo(const unsigned int xid, struct cifs_tcon *tcon,
309                         struct kstatfs *FSData);
310 extern int CIFSSMBSetFSUnixInfo(const unsigned int xid, struct cifs_tcon *tcon,
311                         __u64 cap);
312
313 extern int CIFSSMBQFSAttributeInfo(const unsigned int xid,
314                         struct cifs_tcon *tcon);
315 extern int CIFSSMBQFSDeviceInfo(const unsigned int xid, struct cifs_tcon *tcon);
316 extern int CIFSSMBQFSUnixInfo(const unsigned int xid, struct cifs_tcon *tcon);
317 extern int CIFSSMBQFSPosixInfo(const unsigned int xid, struct cifs_tcon *tcon,
318                         struct kstatfs *FSData);
319
320 extern 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);
324 extern int CIFSSMBSetFileInfo(const unsigned int xid, struct cifs_tcon *tcon,
325                         const FILE_BASIC_INFO *data, __u16 fid,
326                         __u32 pid_of_opener);
327 extern 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
332 extern 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 */
336 extern 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);
339 extern int CIFSSMBSetFileSize(const unsigned int xid, struct cifs_tcon *tcon,
340                               struct cifsFileInfo *cfile, __u64 size,
341                               bool set_allocation);
342
343 struct 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
353 extern 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
358 extern 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
364 extern int CIFSSMBMkDir(const unsigned int xid, struct cifs_tcon *tcon,
365                         const char *name, struct cifs_sb_info *cifs_sb);
366 extern int CIFSSMBRmDir(const unsigned int xid, struct cifs_tcon *tcon,
367                         const char *name, struct cifs_sb_info *cifs_sb);
368 extern 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);
372 extern int CIFSSMBDelFile(const unsigned int xid, struct cifs_tcon *tcon,
373                           const char *name, struct cifs_sb_info *cifs_sb);
374 extern 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);
377 extern 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);
381 extern 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);
384 extern 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);
389 extern 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);
393 extern 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);
397 extern int CIFSSMBQuerySymLink(const unsigned int xid, struct cifs_tcon *tcon,
398                                __u16 fid, char **symlinkinfo,
399                                const struct nls_table *nls_codepage);
400 extern int CIFSSMB_set_compression(const unsigned int xid,
401                                    struct cifs_tcon *tcon, __u16 fid);
402 extern int CIFS_open(const unsigned int xid, struct cifs_open_parms *oparms,
403                      int *oplock, FILE_ALL_INFO *buf);
404 extern 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);
409 extern 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);
414 extern int CIFSSMBClose(const unsigned int xid, struct cifs_tcon *tcon,
415                         const int smb_file_id);
416
417 extern int CIFSSMBFlush(const unsigned int xid, struct cifs_tcon *tcon,
418                         const int smb_file_id);
419
420 extern int CIFSSMBRead(const unsigned int xid, struct cifs_io_parms *io_parms,
421                         unsigned int *nbytes, char **buf,
422                         int *return_buf_type);
423 extern int CIFSSMBWrite(const unsigned int xid, struct cifs_io_parms *io_parms,
424                         unsigned int *nbytes, const char *buf);
425 extern int CIFSSMBWrite2(const unsigned int xid, struct cifs_io_parms *io_parms,
426                         unsigned int *nbytes, struct kvec *iov, const int nvec);
427 extern 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
432 extern 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);
436 extern 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);
441 extern 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);
446 extern int CIFSSMBTDis(const unsigned int xid, struct cifs_tcon *tcon);
447 extern int CIFSSMBEcho(struct TCP_Server_Info *server);
448 extern int CIFSSMBLogoff(const unsigned int xid, struct cifs_ses *ses);
449
450 extern struct cifs_ses *sesInfoAlloc(void);
451 extern void sesInfoFree(struct cifs_ses *);
452 extern struct cifs_tcon *tconInfoAlloc(void);
453 extern void tconInfoFree(struct cifs_tcon *);
454
455 extern int cifs_sign_rqst(struct smb_rqst *rqst, struct TCP_Server_Info *server,
456                    __u32 *pexpected_response_sequence_number);
457 extern int cifs_sign_smbv(struct kvec *iov, int n_vec, struct TCP_Server_Info *,
458                           __u32 *);
459 extern int cifs_sign_smb(struct smb_hdr *, struct TCP_Server_Info *, __u32 *);
460 extern int cifs_verify_signature(struct smb_rqst *rqst,
461                                  struct TCP_Server_Info *server,
462                                 __u32 expected_sequence_number);
463 extern int SMBNTencrypt(unsigned char *, unsigned char *, unsigned char *,
464                         const struct nls_table *);
465 extern int setup_ntlm_response(struct cifs_ses *, const struct nls_table *);
466 extern int setup_ntlmv2_rsp(struct cifs_ses *, const struct nls_table *);
467 extern void cifs_crypto_secmech_release(struct TCP_Server_Info *server);
468 extern int calc_seckey(struct cifs_ses *);
469 extern int generate_smb30signingkey(struct cifs_ses *);
470 extern int generate_smb311signingkey(struct cifs_ses *);
471
472 #ifdef CONFIG_CIFS_WEAK_PW_HASH
473 extern 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 */
477 extern 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 */
482 extern 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);
489 extern 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);
493 extern 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);
498 extern int CIFSSMBGetCIFSACL(const unsigned int xid, struct cifs_tcon *tcon,
499                         __u16 fid, struct cifs_ntsd **acl_inf, __u32 *buflen);
500 extern int CIFSSMBSetCIFSACL(const unsigned int, struct cifs_tcon *, __u16,
501                         struct cifs_ntsd *, __u32, int);
502 extern 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);
506 extern 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);
510 extern int CIFSGetExtAttr(const unsigned int xid, struct cifs_tcon *tcon,
511                         const int netfid, __u64 *pExtAttrBits, __u64 *pMask);
512 extern void cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb);
513 extern bool couldbe_mf_symlink(const struct cifs_fattr *fattr);
514 extern 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);
518 extern int mdfour(unsigned char *, unsigned char *, int);
519 extern int E_md4hash(const unsigned char *passwd, unsigned char *p16,
520                         const struct nls_table *codepage);
521 extern int SMBencrypt(unsigned char *passwd, const unsigned char *c8,
522                         unsigned char *p24);
523
524 void cifs_readdata_release(struct kref *refcount);
525 int cifs_async_readv(struct cifs_readdata *rdata);
526 int cifs_readv_receive(struct TCP_Server_Info *server, struct mid_q_entry *mid);
527
528 int cifs_async_writev(struct cifs_writedata *wdata,
529                       void (*release)(struct kref *kref));
530 void cifs_writev_complete(struct work_struct *work);
531 struct cifs_writedata *cifs_writedata_alloc(unsigned int nr_pages,
532                                                 work_func_t complete);
533 struct cifs_writedata *cifs_writedata_direct_alloc(struct page **pages,
534                                                 work_func_t complete);
535 void cifs_writedata_release(struct kref *refcount);
536 int 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);
540 int 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);
544 int __cifs_calc_signature(struct smb_rqst *rqst,
545                         struct TCP_Server_Info *server, char *signature,
546                         struct shash_desc *shash);
547 enum securityEnum cifs_select_sectype(struct TCP_Server_Info *,
548                                         enum securityEnum);
549 struct cifs_aio_ctx *cifs_aio_ctx_alloc(void);
550 void cifs_aio_ctx_release(struct kref *refcount);
551 int setup_aio_ctx_iter(struct cifs_aio_ctx *ctx, struct iov_iter *iter, int rw);
552 void smb2_cached_lease_break(struct work_struct *work);
553
554 int cifs_alloc_hash(const char *name, struct crypto_shash **shash,
555                     struct sdesc **sdesc);
556 void cifs_free_hash(struct crypto_shash **shash, struct sdesc **sdesc);
557
558 extern void rqst_page_get_length(struct smb_rqst *rqst, unsigned int page,
559                                 unsigned int *len, unsigned int *offset);
560
561 #endif                  /* _CIFSPROTO_H */