18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci *   fs/cifs/cifsproto.h
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci *   Copyright (c) International Business Machines  Corp., 2002,2008
58c2ecf20Sopenharmony_ci *   Author(s): Steve French (sfrench@us.ibm.com)
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci *   This library is free software; you can redistribute it and/or modify
88c2ecf20Sopenharmony_ci *   it under the terms of the GNU Lesser General Public License as published
98c2ecf20Sopenharmony_ci *   by the Free Software Foundation; either version 2.1 of the License, or
108c2ecf20Sopenharmony_ci *   (at your option) any later version.
118c2ecf20Sopenharmony_ci *
128c2ecf20Sopenharmony_ci *   This library is distributed in the hope that it will be useful,
138c2ecf20Sopenharmony_ci *   but WITHOUT ANY WARRANTY; without even the implied warranty of
148c2ecf20Sopenharmony_ci *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
158c2ecf20Sopenharmony_ci *   the GNU Lesser General Public License for more details.
168c2ecf20Sopenharmony_ci *
178c2ecf20Sopenharmony_ci *   You should have received a copy of the GNU Lesser General Public License
188c2ecf20Sopenharmony_ci *   along with this library; if not, write to the Free Software
198c2ecf20Sopenharmony_ci *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
208c2ecf20Sopenharmony_ci */
218c2ecf20Sopenharmony_ci#ifndef _CIFSPROTO_H
228c2ecf20Sopenharmony_ci#define _CIFSPROTO_H
238c2ecf20Sopenharmony_ci#include <linux/nls.h>
248c2ecf20Sopenharmony_ci#include "trace.h"
258c2ecf20Sopenharmony_ci#ifdef CONFIG_CIFS_DFS_UPCALL
268c2ecf20Sopenharmony_ci#include "dfs_cache.h"
278c2ecf20Sopenharmony_ci#endif
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_cistruct statfs;
308c2ecf20Sopenharmony_cistruct smb_vol;
318c2ecf20Sopenharmony_cistruct smb_rqst;
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci/*
348c2ecf20Sopenharmony_ci *****************************************************************
358c2ecf20Sopenharmony_ci * All Prototypes
368c2ecf20Sopenharmony_ci *****************************************************************
378c2ecf20Sopenharmony_ci */
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ciextern struct smb_hdr *cifs_buf_get(void);
408c2ecf20Sopenharmony_ciextern void cifs_buf_release(void *);
418c2ecf20Sopenharmony_ciextern struct smb_hdr *cifs_small_buf_get(void);
428c2ecf20Sopenharmony_ciextern void cifs_small_buf_release(void *);
438c2ecf20Sopenharmony_ciextern void free_rsp_buf(int, void *);
448c2ecf20Sopenharmony_ciextern int smb_send(struct TCP_Server_Info *, struct smb_hdr *,
458c2ecf20Sopenharmony_ci			unsigned int /* length */);
468c2ecf20Sopenharmony_ciextern unsigned int _get_xid(void);
478c2ecf20Sopenharmony_ciextern void _free_xid(unsigned int);
488c2ecf20Sopenharmony_ci#define get_xid()							\
498c2ecf20Sopenharmony_ci({									\
508c2ecf20Sopenharmony_ci	unsigned int __xid = _get_xid();				\
518c2ecf20Sopenharmony_ci	cifs_dbg(FYI, "VFS: in %s as Xid: %u with uid: %d\n",		\
528c2ecf20Sopenharmony_ci		 __func__, __xid,					\
538c2ecf20Sopenharmony_ci		 from_kuid(&init_user_ns, current_fsuid()));		\
548c2ecf20Sopenharmony_ci	trace_smb3_enter(__xid, __func__);				\
558c2ecf20Sopenharmony_ci	__xid;								\
568c2ecf20Sopenharmony_ci})
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci#define free_xid(curr_xid)						\
598c2ecf20Sopenharmony_cido {									\
608c2ecf20Sopenharmony_ci	_free_xid(curr_xid);						\
618c2ecf20Sopenharmony_ci	cifs_dbg(FYI, "VFS: leaving %s (xid = %u) rc = %d\n",		\
628c2ecf20Sopenharmony_ci		 __func__, curr_xid, (int)rc);				\
638c2ecf20Sopenharmony_ci	if (rc)								\
648c2ecf20Sopenharmony_ci		trace_smb3_exit_err(curr_xid, __func__, (int)rc);	\
658c2ecf20Sopenharmony_ci	else								\
668c2ecf20Sopenharmony_ci		trace_smb3_exit_done(curr_xid, __func__);		\
678c2ecf20Sopenharmony_ci} while (0)
688c2ecf20Sopenharmony_ciextern int init_cifs_idmap(void);
698c2ecf20Sopenharmony_ciextern void exit_cifs_idmap(void);
708c2ecf20Sopenharmony_ciextern int init_cifs_spnego(void);
718c2ecf20Sopenharmony_ciextern void exit_cifs_spnego(void);
728c2ecf20Sopenharmony_ciextern char *build_path_from_dentry(struct dentry *);
738c2ecf20Sopenharmony_ciextern char *build_path_from_dentry_optional_prefix(struct dentry *direntry,
748c2ecf20Sopenharmony_ci						    bool prefix);
758c2ecf20Sopenharmony_ciextern char *cifs_build_path_to_root(struct smb_vol *vol,
768c2ecf20Sopenharmony_ci				     struct cifs_sb_info *cifs_sb,
778c2ecf20Sopenharmony_ci				     struct cifs_tcon *tcon,
788c2ecf20Sopenharmony_ci				     int add_treename);
798c2ecf20Sopenharmony_ciextern char *build_wildcard_path_from_dentry(struct dentry *direntry);
808c2ecf20Sopenharmony_ciextern char *cifs_compose_mount_options(const char *sb_mountdata,
818c2ecf20Sopenharmony_ci		const char *fullpath, const struct dfs_info3_param *ref,
828c2ecf20Sopenharmony_ci		char **devname);
838c2ecf20Sopenharmony_ci/* extern void renew_parental_timestamps(struct dentry *direntry);*/
848c2ecf20Sopenharmony_ciextern struct mid_q_entry *AllocMidQEntry(const struct smb_hdr *smb_buffer,
858c2ecf20Sopenharmony_ci					struct TCP_Server_Info *server);
868c2ecf20Sopenharmony_ciextern void DeleteMidQEntry(struct mid_q_entry *midEntry);
878c2ecf20Sopenharmony_ciextern void cifs_delete_mid(struct mid_q_entry *mid);
888c2ecf20Sopenharmony_ciextern void cifs_mid_q_entry_release(struct mid_q_entry *midEntry);
898c2ecf20Sopenharmony_ciextern void cifs_wake_up_task(struct mid_q_entry *mid);
908c2ecf20Sopenharmony_ciextern int cifs_handle_standard(struct TCP_Server_Info *server,
918c2ecf20Sopenharmony_ci				struct mid_q_entry *mid);
928c2ecf20Sopenharmony_ciextern bool cifs_match_ipaddr(struct sockaddr *srcaddr, struct sockaddr *rhs);
938c2ecf20Sopenharmony_ciextern int cifs_discard_remaining_data(struct TCP_Server_Info *server);
948c2ecf20Sopenharmony_ciextern int cifs_call_async(struct TCP_Server_Info *server,
958c2ecf20Sopenharmony_ci			struct smb_rqst *rqst,
968c2ecf20Sopenharmony_ci			mid_receive_t *receive, mid_callback_t *callback,
978c2ecf20Sopenharmony_ci			mid_handle_t *handle, void *cbdata, const int flags,
988c2ecf20Sopenharmony_ci			const struct cifs_credits *exist_credits);
998c2ecf20Sopenharmony_ciextern struct TCP_Server_Info *cifs_pick_channel(struct cifs_ses *ses);
1008c2ecf20Sopenharmony_ciextern int cifs_send_recv(const unsigned int xid, struct cifs_ses *ses,
1018c2ecf20Sopenharmony_ci			  struct TCP_Server_Info *server,
1028c2ecf20Sopenharmony_ci			  struct smb_rqst *rqst, int *resp_buf_type,
1038c2ecf20Sopenharmony_ci			  const int flags, struct kvec *resp_iov);
1048c2ecf20Sopenharmony_ciextern int compound_send_recv(const unsigned int xid, struct cifs_ses *ses,
1058c2ecf20Sopenharmony_ci			      struct TCP_Server_Info *server,
1068c2ecf20Sopenharmony_ci			      const int flags, const int num_rqst,
1078c2ecf20Sopenharmony_ci			      struct smb_rqst *rqst, int *resp_buf_type,
1088c2ecf20Sopenharmony_ci			      struct kvec *resp_iov);
1098c2ecf20Sopenharmony_ciextern int SendReceive(const unsigned int /* xid */ , struct cifs_ses *,
1108c2ecf20Sopenharmony_ci			struct smb_hdr * /* input */ ,
1118c2ecf20Sopenharmony_ci			struct smb_hdr * /* out */ ,
1128c2ecf20Sopenharmony_ci			int * /* bytes returned */ , const int);
1138c2ecf20Sopenharmony_ciextern int SendReceiveNoRsp(const unsigned int xid, struct cifs_ses *ses,
1148c2ecf20Sopenharmony_ci			    char *in_buf, int flags);
1158c2ecf20Sopenharmony_ciextern struct mid_q_entry *cifs_setup_request(struct cifs_ses *,
1168c2ecf20Sopenharmony_ci				struct TCP_Server_Info *,
1178c2ecf20Sopenharmony_ci				struct smb_rqst *);
1188c2ecf20Sopenharmony_ciextern struct mid_q_entry *cifs_setup_async_request(struct TCP_Server_Info *,
1198c2ecf20Sopenharmony_ci						struct smb_rqst *);
1208c2ecf20Sopenharmony_ciextern int cifs_check_receive(struct mid_q_entry *mid,
1218c2ecf20Sopenharmony_ci			struct TCP_Server_Info *server, bool log_error);
1228c2ecf20Sopenharmony_ciextern int cifs_wait_mtu_credits(struct TCP_Server_Info *server,
1238c2ecf20Sopenharmony_ci				 unsigned int size, unsigned int *num,
1248c2ecf20Sopenharmony_ci				 struct cifs_credits *credits);
1258c2ecf20Sopenharmony_ciextern int SendReceive2(const unsigned int /* xid */ , struct cifs_ses *,
1268c2ecf20Sopenharmony_ci			struct kvec *, int /* nvec to send */,
1278c2ecf20Sopenharmony_ci			int * /* type of buf returned */, const int flags,
1288c2ecf20Sopenharmony_ci			struct kvec * /* resp vec */);
1298c2ecf20Sopenharmony_ciextern int SendReceiveBlockingLock(const unsigned int xid,
1308c2ecf20Sopenharmony_ci			struct cifs_tcon *ptcon,
1318c2ecf20Sopenharmony_ci			struct smb_hdr *in_buf ,
1328c2ecf20Sopenharmony_ci			struct smb_hdr *out_buf,
1338c2ecf20Sopenharmony_ci			int *bytes_returned);
1348c2ecf20Sopenharmony_ciextern int cifs_reconnect(struct TCP_Server_Info *server);
1358c2ecf20Sopenharmony_ciextern int checkSMB(char *buf, unsigned int len, struct TCP_Server_Info *srvr);
1368c2ecf20Sopenharmony_ciextern bool is_valid_oplock_break(char *, struct TCP_Server_Info *);
1378c2ecf20Sopenharmony_ciextern bool backup_cred(struct cifs_sb_info *);
1388c2ecf20Sopenharmony_ciextern bool is_size_safe_to_change(struct cifsInodeInfo *, __u64 eof);
1398c2ecf20Sopenharmony_ciextern void cifs_update_eof(struct cifsInodeInfo *cifsi, loff_t offset,
1408c2ecf20Sopenharmony_ci			    unsigned int bytes_written);
1418c2ecf20Sopenharmony_ciextern struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *, int);
1428c2ecf20Sopenharmony_ciextern int cifs_get_writable_file(struct cifsInodeInfo *cifs_inode,
1438c2ecf20Sopenharmony_ci				  int flags,
1448c2ecf20Sopenharmony_ci				  struct cifsFileInfo **ret_file);
1458c2ecf20Sopenharmony_ciextern int cifs_get_writable_path(struct cifs_tcon *tcon, const char *name,
1468c2ecf20Sopenharmony_ci				  int flags,
1478c2ecf20Sopenharmony_ci				  struct cifsFileInfo **ret_file);
1488c2ecf20Sopenharmony_ciextern struct cifsFileInfo *find_readable_file(struct cifsInodeInfo *, bool);
1498c2ecf20Sopenharmony_ciextern int cifs_get_readable_path(struct cifs_tcon *tcon, const char *name,
1508c2ecf20Sopenharmony_ci				  struct cifsFileInfo **ret_file);
1518c2ecf20Sopenharmony_ciextern unsigned int smbCalcSize(void *buf, struct TCP_Server_Info *server);
1528c2ecf20Sopenharmony_ciextern int decode_negTokenInit(unsigned char *security_blob, int length,
1538c2ecf20Sopenharmony_ci			struct TCP_Server_Info *server);
1548c2ecf20Sopenharmony_ciextern int cifs_convert_address(struct sockaddr *dst, const char *src, int len);
1558c2ecf20Sopenharmony_ciextern void cifs_set_port(struct sockaddr *addr, const unsigned short int port);
1568c2ecf20Sopenharmony_ciextern int map_smb_to_linux_error(char *buf, bool logErr);
1578c2ecf20Sopenharmony_ciextern int map_and_check_smb_error(struct mid_q_entry *mid, bool logErr);
1588c2ecf20Sopenharmony_ciextern void header_assemble(struct smb_hdr *, char /* command */ ,
1598c2ecf20Sopenharmony_ci			    const struct cifs_tcon *, int /* length of
1608c2ecf20Sopenharmony_ci			    fixed section (word count) in two byte units */);
1618c2ecf20Sopenharmony_ciextern int small_smb_init_no_tc(const int smb_cmd, const int wct,
1628c2ecf20Sopenharmony_ci				struct cifs_ses *ses,
1638c2ecf20Sopenharmony_ci				void **request_buf);
1648c2ecf20Sopenharmony_ciextern enum securityEnum select_sectype(struct TCP_Server_Info *server,
1658c2ecf20Sopenharmony_ci				enum securityEnum requested);
1668c2ecf20Sopenharmony_ciextern int CIFS_SessSetup(const unsigned int xid, struct cifs_ses *ses,
1678c2ecf20Sopenharmony_ci			  const struct nls_table *nls_cp);
1688c2ecf20Sopenharmony_ciextern struct timespec64 cifs_NTtimeToUnix(__le64 utc_nanoseconds_since_1601);
1698c2ecf20Sopenharmony_ciextern u64 cifs_UnixTimeToNT(struct timespec64);
1708c2ecf20Sopenharmony_ciextern struct timespec64 cnvrtDosUnixTm(__le16 le_date, __le16 le_time,
1718c2ecf20Sopenharmony_ci				      int offset);
1728c2ecf20Sopenharmony_ciextern void cifs_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock);
1738c2ecf20Sopenharmony_ciextern int cifs_get_writer(struct cifsInodeInfo *cinode);
1748c2ecf20Sopenharmony_ciextern void cifs_put_writer(struct cifsInodeInfo *cinode);
1758c2ecf20Sopenharmony_ciextern void cifs_done_oplock_break(struct cifsInodeInfo *cinode);
1768c2ecf20Sopenharmony_ciextern int cifs_unlock_range(struct cifsFileInfo *cfile,
1778c2ecf20Sopenharmony_ci			     struct file_lock *flock, const unsigned int xid);
1788c2ecf20Sopenharmony_ciextern int cifs_push_mandatory_locks(struct cifsFileInfo *cfile);
1798c2ecf20Sopenharmony_ci
1808c2ecf20Sopenharmony_ciextern void cifs_down_write(struct rw_semaphore *sem);
1818c2ecf20Sopenharmony_ciextern struct cifsFileInfo *cifs_new_fileinfo(struct cifs_fid *fid,
1828c2ecf20Sopenharmony_ci					      struct file *file,
1838c2ecf20Sopenharmony_ci					      struct tcon_link *tlink,
1848c2ecf20Sopenharmony_ci					      __u32 oplock);
1858c2ecf20Sopenharmony_ciextern int cifs_posix_open(char *full_path, struct inode **inode,
1868c2ecf20Sopenharmony_ci			   struct super_block *sb, int mode,
1878c2ecf20Sopenharmony_ci			   unsigned int f_flags, __u32 *oplock, __u16 *netfid,
1888c2ecf20Sopenharmony_ci			   unsigned int xid);
1898c2ecf20Sopenharmony_civoid cifs_fill_uniqueid(struct super_block *sb, struct cifs_fattr *fattr);
1908c2ecf20Sopenharmony_ciextern void cifs_unix_basic_to_fattr(struct cifs_fattr *fattr,
1918c2ecf20Sopenharmony_ci				     FILE_UNIX_BASIC_INFO *info,
1928c2ecf20Sopenharmony_ci				     struct cifs_sb_info *cifs_sb);
1938c2ecf20Sopenharmony_ciextern void cifs_dir_info_to_fattr(struct cifs_fattr *, FILE_DIRECTORY_INFO *,
1948c2ecf20Sopenharmony_ci					struct cifs_sb_info *);
1958c2ecf20Sopenharmony_ciextern void cifs_fattr_to_inode(struct inode *inode, struct cifs_fattr *fattr);
1968c2ecf20Sopenharmony_ciextern struct inode *cifs_iget(struct super_block *sb,
1978c2ecf20Sopenharmony_ci			       struct cifs_fattr *fattr);
1988c2ecf20Sopenharmony_ci
1998c2ecf20Sopenharmony_ciextern int cifs_get_inode_info(struct inode **inode, const char *full_path,
2008c2ecf20Sopenharmony_ci			       FILE_ALL_INFO *data, struct super_block *sb,
2018c2ecf20Sopenharmony_ci			       int xid, const struct cifs_fid *fid);
2028c2ecf20Sopenharmony_ciextern int smb311_posix_get_inode_info(struct inode **pinode, const char *search_path,
2038c2ecf20Sopenharmony_ci			struct super_block *sb, unsigned int xid);
2048c2ecf20Sopenharmony_ciextern int cifs_get_inode_info_unix(struct inode **pinode,
2058c2ecf20Sopenharmony_ci			const unsigned char *search_path,
2068c2ecf20Sopenharmony_ci			struct super_block *sb, unsigned int xid);
2078c2ecf20Sopenharmony_ciextern int cifs_set_file_info(struct inode *inode, struct iattr *attrs,
2088c2ecf20Sopenharmony_ci			      unsigned int xid, char *full_path, __u32 dosattr);
2098c2ecf20Sopenharmony_ciextern int cifs_rename_pending_delete(const char *full_path,
2108c2ecf20Sopenharmony_ci				      struct dentry *dentry,
2118c2ecf20Sopenharmony_ci				      const unsigned int xid);
2128c2ecf20Sopenharmony_ciextern int sid_to_id(struct cifs_sb_info *cifs_sb, struct cifs_sid *psid,
2138c2ecf20Sopenharmony_ci				struct cifs_fattr *fattr, uint sidtype);
2148c2ecf20Sopenharmony_ciextern int cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb,
2158c2ecf20Sopenharmony_ci			      struct cifs_fattr *fattr, struct inode *inode,
2168c2ecf20Sopenharmony_ci			      bool get_mode_from_special_sid,
2178c2ecf20Sopenharmony_ci			      const char *path, const struct cifs_fid *pfid);
2188c2ecf20Sopenharmony_ciextern int id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64,
2198c2ecf20Sopenharmony_ci					kuid_t, kgid_t);
2208c2ecf20Sopenharmony_ciextern struct cifs_ntsd *get_cifs_acl(struct cifs_sb_info *, struct inode *,
2218c2ecf20Sopenharmony_ci					const char *, u32 *);
2228c2ecf20Sopenharmony_ciextern struct cifs_ntsd *get_cifs_acl_by_fid(struct cifs_sb_info *,
2238c2ecf20Sopenharmony_ci						const struct cifs_fid *, u32 *);
2248c2ecf20Sopenharmony_ciextern int set_cifs_acl(struct cifs_ntsd *, __u32, struct inode *,
2258c2ecf20Sopenharmony_ci				const char *, int);
2268c2ecf20Sopenharmony_ciextern unsigned int setup_authusers_ACE(struct cifs_ace *pace);
2278c2ecf20Sopenharmony_ciextern unsigned int setup_special_mode_ACE(struct cifs_ace *pace, __u64 nmode);
2288c2ecf20Sopenharmony_ciextern unsigned int setup_special_user_owner_ACE(struct cifs_ace *pace);
2298c2ecf20Sopenharmony_ci
2308c2ecf20Sopenharmony_ciextern void dequeue_mid(struct mid_q_entry *mid, bool malformed);
2318c2ecf20Sopenharmony_ciextern int cifs_read_from_socket(struct TCP_Server_Info *server, char *buf,
2328c2ecf20Sopenharmony_ci			         unsigned int to_read);
2338c2ecf20Sopenharmony_ciextern ssize_t cifs_discard_from_socket(struct TCP_Server_Info *server,
2348c2ecf20Sopenharmony_ci					size_t to_read);
2358c2ecf20Sopenharmony_ciextern int cifs_read_page_from_socket(struct TCP_Server_Info *server,
2368c2ecf20Sopenharmony_ci					struct page *page,
2378c2ecf20Sopenharmony_ci					unsigned int page_offset,
2388c2ecf20Sopenharmony_ci					unsigned int to_read);
2398c2ecf20Sopenharmony_ciextern int cifs_setup_cifs_sb(struct smb_vol *pvolume_info,
2408c2ecf20Sopenharmony_ci			       struct cifs_sb_info *cifs_sb);
2418c2ecf20Sopenharmony_ciextern int cifs_match_super(struct super_block *, void *);
2428c2ecf20Sopenharmony_ciextern void cifs_cleanup_volume_info(struct smb_vol *pvolume_info);
2438c2ecf20Sopenharmony_ciextern struct smb_vol *cifs_get_volume_info(char *mount_data,
2448c2ecf20Sopenharmony_ci					    const char *devname, bool is_smb3);
2458c2ecf20Sopenharmony_ciextern int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *vol);
2468c2ecf20Sopenharmony_ciextern void cifs_umount(struct cifs_sb_info *);
2478c2ecf20Sopenharmony_ciextern void cifs_mark_open_files_invalid(struct cifs_tcon *tcon);
2488c2ecf20Sopenharmony_ciextern void cifs_reopen_persistent_handles(struct cifs_tcon *tcon);
2498c2ecf20Sopenharmony_ci
2508c2ecf20Sopenharmony_ciextern bool cifs_find_lock_conflict(struct cifsFileInfo *cfile, __u64 offset,
2518c2ecf20Sopenharmony_ci				    __u64 length, __u8 type, __u16 flags,
2528c2ecf20Sopenharmony_ci				    struct cifsLockInfo **conf_lock,
2538c2ecf20Sopenharmony_ci				    int rw_check);
2548c2ecf20Sopenharmony_ciextern void cifs_add_pending_open(struct cifs_fid *fid,
2558c2ecf20Sopenharmony_ci				  struct tcon_link *tlink,
2568c2ecf20Sopenharmony_ci				  struct cifs_pending_open *open);
2578c2ecf20Sopenharmony_ciextern void cifs_add_pending_open_locked(struct cifs_fid *fid,
2588c2ecf20Sopenharmony_ci					 struct tcon_link *tlink,
2598c2ecf20Sopenharmony_ci					 struct cifs_pending_open *open);
2608c2ecf20Sopenharmony_ciextern void cifs_del_pending_open(struct cifs_pending_open *open);
2618c2ecf20Sopenharmony_ciextern struct TCP_Server_Info *cifs_get_tcp_session(struct smb_vol *vol);
2628c2ecf20Sopenharmony_ciextern void cifs_put_tcp_session(struct TCP_Server_Info *server,
2638c2ecf20Sopenharmony_ci				 int from_reconnect);
2648c2ecf20Sopenharmony_ciextern void cifs_put_tcon(struct cifs_tcon *tcon);
2658c2ecf20Sopenharmony_ci
2668c2ecf20Sopenharmony_ci#if IS_ENABLED(CONFIG_CIFS_DFS_UPCALL)
2678c2ecf20Sopenharmony_ciextern void cifs_dfs_release_automount_timer(void);
2688c2ecf20Sopenharmony_ci#else /* ! IS_ENABLED(CONFIG_CIFS_DFS_UPCALL) */
2698c2ecf20Sopenharmony_ci#define cifs_dfs_release_automount_timer()	do { } while (0)
2708c2ecf20Sopenharmony_ci#endif /* ! IS_ENABLED(CONFIG_CIFS_DFS_UPCALL) */
2718c2ecf20Sopenharmony_ci
2728c2ecf20Sopenharmony_civoid cifs_proc_init(void);
2738c2ecf20Sopenharmony_civoid cifs_proc_clean(void);
2748c2ecf20Sopenharmony_ci
2758c2ecf20Sopenharmony_ciextern void cifs_move_llist(struct list_head *source, struct list_head *dest);
2768c2ecf20Sopenharmony_ciextern void cifs_free_llist(struct list_head *llist);
2778c2ecf20Sopenharmony_ciextern void cifs_del_lock_waiters(struct cifsLockInfo *lock);
2788c2ecf20Sopenharmony_ci
2798c2ecf20Sopenharmony_ciextern int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon,
2808c2ecf20Sopenharmony_ci			     const struct nls_table *nlsc);
2818c2ecf20Sopenharmony_ci
2828c2ecf20Sopenharmony_ciextern int cifs_negotiate_protocol(const unsigned int xid,
2838c2ecf20Sopenharmony_ci				   struct cifs_ses *ses);
2848c2ecf20Sopenharmony_ciextern int cifs_setup_session(const unsigned int xid, struct cifs_ses *ses,
2858c2ecf20Sopenharmony_ci			      struct nls_table *nls_info);
2868c2ecf20Sopenharmony_ciextern int cifs_enable_signing(struct TCP_Server_Info *server, bool mnt_sign_required);
2878c2ecf20Sopenharmony_ciextern int CIFSSMBNegotiate(const unsigned int xid, struct cifs_ses *ses);
2888c2ecf20Sopenharmony_ci
2898c2ecf20Sopenharmony_ciextern int CIFSTCon(const unsigned int xid, struct cifs_ses *ses,
2908c2ecf20Sopenharmony_ci		    const char *tree, struct cifs_tcon *tcon,
2918c2ecf20Sopenharmony_ci		    const struct nls_table *);
2928c2ecf20Sopenharmony_ci
2938c2ecf20Sopenharmony_ciextern int CIFSFindFirst(const unsigned int xid, struct cifs_tcon *tcon,
2948c2ecf20Sopenharmony_ci		const char *searchName, struct cifs_sb_info *cifs_sb,
2958c2ecf20Sopenharmony_ci		__u16 *searchHandle, __u16 search_flags,
2968c2ecf20Sopenharmony_ci		struct cifs_search_info *psrch_inf,
2978c2ecf20Sopenharmony_ci		bool msearch);
2988c2ecf20Sopenharmony_ci
2998c2ecf20Sopenharmony_ciextern int CIFSFindNext(const unsigned int xid, struct cifs_tcon *tcon,
3008c2ecf20Sopenharmony_ci		__u16 searchHandle, __u16 search_flags,
3018c2ecf20Sopenharmony_ci		struct cifs_search_info *psrch_inf);
3028c2ecf20Sopenharmony_ci
3038c2ecf20Sopenharmony_ciextern int CIFSFindClose(const unsigned int xid, struct cifs_tcon *tcon,
3048c2ecf20Sopenharmony_ci			const __u16 search_handle);
3058c2ecf20Sopenharmony_ci
3068c2ecf20Sopenharmony_ciextern int CIFSSMBQFileInfo(const unsigned int xid, struct cifs_tcon *tcon,
3078c2ecf20Sopenharmony_ci			u16 netfid, FILE_ALL_INFO *pFindData);
3088c2ecf20Sopenharmony_ciextern int CIFSSMBQPathInfo(const unsigned int xid, struct cifs_tcon *tcon,
3098c2ecf20Sopenharmony_ci			    const char *search_Name, FILE_ALL_INFO *data,
3108c2ecf20Sopenharmony_ci			    int legacy /* whether to use old info level */,
3118c2ecf20Sopenharmony_ci			    const struct nls_table *nls_codepage, int remap);
3128c2ecf20Sopenharmony_ciextern int SMBQueryInformation(const unsigned int xid, struct cifs_tcon *tcon,
3138c2ecf20Sopenharmony_ci			       const char *search_name, FILE_ALL_INFO *data,
3148c2ecf20Sopenharmony_ci			       const struct nls_table *nls_codepage, int remap);
3158c2ecf20Sopenharmony_ci
3168c2ecf20Sopenharmony_ciextern int CIFSSMBUnixQFileInfo(const unsigned int xid, struct cifs_tcon *tcon,
3178c2ecf20Sopenharmony_ci			u16 netfid, FILE_UNIX_BASIC_INFO *pFindData);
3188c2ecf20Sopenharmony_ciextern int CIFSSMBUnixQPathInfo(const unsigned int xid,
3198c2ecf20Sopenharmony_ci			struct cifs_tcon *tcon,
3208c2ecf20Sopenharmony_ci			const unsigned char *searchName,
3218c2ecf20Sopenharmony_ci			FILE_UNIX_BASIC_INFO *pFindData,
3228c2ecf20Sopenharmony_ci			const struct nls_table *nls_codepage, int remap);
3238c2ecf20Sopenharmony_ci
3248c2ecf20Sopenharmony_ciextern int CIFSGetDFSRefer(const unsigned int xid, struct cifs_ses *ses,
3258c2ecf20Sopenharmony_ci			   const char *search_name,
3268c2ecf20Sopenharmony_ci			   struct dfs_info3_param **target_nodes,
3278c2ecf20Sopenharmony_ci			   unsigned int *num_of_nodes,
3288c2ecf20Sopenharmony_ci			   const struct nls_table *nls_codepage, int remap);
3298c2ecf20Sopenharmony_ci
3308c2ecf20Sopenharmony_ciextern int parse_dfs_referrals(struct get_dfs_referral_rsp *rsp, u32 rsp_size,
3318c2ecf20Sopenharmony_ci			       unsigned int *num_of_nodes,
3328c2ecf20Sopenharmony_ci			       struct dfs_info3_param **target_nodes,
3338c2ecf20Sopenharmony_ci			       const struct nls_table *nls_codepage, int remap,
3348c2ecf20Sopenharmony_ci			       const char *searchName, bool is_unicode);
3358c2ecf20Sopenharmony_ciextern void reset_cifs_unix_caps(unsigned int xid, struct cifs_tcon *tcon,
3368c2ecf20Sopenharmony_ci				 struct cifs_sb_info *cifs_sb,
3378c2ecf20Sopenharmony_ci				 struct smb_vol *vol);
3388c2ecf20Sopenharmony_ciextern int CIFSSMBQFSInfo(const unsigned int xid, struct cifs_tcon *tcon,
3398c2ecf20Sopenharmony_ci			struct kstatfs *FSData);
3408c2ecf20Sopenharmony_ciextern int SMBOldQFSInfo(const unsigned int xid, struct cifs_tcon *tcon,
3418c2ecf20Sopenharmony_ci			struct kstatfs *FSData);
3428c2ecf20Sopenharmony_ciextern int CIFSSMBSetFSUnixInfo(const unsigned int xid, struct cifs_tcon *tcon,
3438c2ecf20Sopenharmony_ci			__u64 cap);
3448c2ecf20Sopenharmony_ci
3458c2ecf20Sopenharmony_ciextern int CIFSSMBQFSAttributeInfo(const unsigned int xid,
3468c2ecf20Sopenharmony_ci			struct cifs_tcon *tcon);
3478c2ecf20Sopenharmony_ciextern int CIFSSMBQFSDeviceInfo(const unsigned int xid, struct cifs_tcon *tcon);
3488c2ecf20Sopenharmony_ciextern int CIFSSMBQFSUnixInfo(const unsigned int xid, struct cifs_tcon *tcon);
3498c2ecf20Sopenharmony_ciextern int CIFSSMBQFSPosixInfo(const unsigned int xid, struct cifs_tcon *tcon,
3508c2ecf20Sopenharmony_ci			struct kstatfs *FSData);
3518c2ecf20Sopenharmony_ci
3528c2ecf20Sopenharmony_ciextern int CIFSSMBSetPathInfo(const unsigned int xid, struct cifs_tcon *tcon,
3538c2ecf20Sopenharmony_ci			const char *fileName, const FILE_BASIC_INFO *data,
3548c2ecf20Sopenharmony_ci			const struct nls_table *nls_codepage,
3558c2ecf20Sopenharmony_ci			struct cifs_sb_info *cifs_sb);
3568c2ecf20Sopenharmony_ciextern int CIFSSMBSetFileInfo(const unsigned int xid, struct cifs_tcon *tcon,
3578c2ecf20Sopenharmony_ci			const FILE_BASIC_INFO *data, __u16 fid,
3588c2ecf20Sopenharmony_ci			__u32 pid_of_opener);
3598c2ecf20Sopenharmony_ciextern int CIFSSMBSetFileDisposition(const unsigned int xid,
3608c2ecf20Sopenharmony_ci				     struct cifs_tcon *tcon,
3618c2ecf20Sopenharmony_ci				     bool delete_file, __u16 fid,
3628c2ecf20Sopenharmony_ci				     __u32 pid_of_opener);
3638c2ecf20Sopenharmony_ci#if 0
3648c2ecf20Sopenharmony_ciextern int CIFSSMBSetAttrLegacy(unsigned int xid, struct cifs_tcon *tcon,
3658c2ecf20Sopenharmony_ci			char *fileName, __u16 dos_attributes,
3668c2ecf20Sopenharmony_ci			const struct nls_table *nls_codepage);
3678c2ecf20Sopenharmony_ci#endif /* possibly unneeded function */
3688c2ecf20Sopenharmony_ciextern int CIFSSMBSetEOF(const unsigned int xid, struct cifs_tcon *tcon,
3698c2ecf20Sopenharmony_ci			 const char *file_name, __u64 size,
3708c2ecf20Sopenharmony_ci			 struct cifs_sb_info *cifs_sb, bool set_allocation);
3718c2ecf20Sopenharmony_ciextern int CIFSSMBSetFileSize(const unsigned int xid, struct cifs_tcon *tcon,
3728c2ecf20Sopenharmony_ci			      struct cifsFileInfo *cfile, __u64 size,
3738c2ecf20Sopenharmony_ci			      bool set_allocation);
3748c2ecf20Sopenharmony_ci
3758c2ecf20Sopenharmony_cistruct cifs_unix_set_info_args {
3768c2ecf20Sopenharmony_ci	__u64	ctime;
3778c2ecf20Sopenharmony_ci	__u64	atime;
3788c2ecf20Sopenharmony_ci	__u64	mtime;
3798c2ecf20Sopenharmony_ci	__u64	mode;
3808c2ecf20Sopenharmony_ci	kuid_t	uid;
3818c2ecf20Sopenharmony_ci	kgid_t	gid;
3828c2ecf20Sopenharmony_ci	dev_t	device;
3838c2ecf20Sopenharmony_ci};
3848c2ecf20Sopenharmony_ci
3858c2ecf20Sopenharmony_ciextern int CIFSSMBUnixSetFileInfo(const unsigned int xid,
3868c2ecf20Sopenharmony_ci				  struct cifs_tcon *tcon,
3878c2ecf20Sopenharmony_ci				  const struct cifs_unix_set_info_args *args,
3888c2ecf20Sopenharmony_ci				  u16 fid, u32 pid_of_opener);
3898c2ecf20Sopenharmony_ci
3908c2ecf20Sopenharmony_ciextern int CIFSSMBUnixSetPathInfo(const unsigned int xid,
3918c2ecf20Sopenharmony_ci				  struct cifs_tcon *tcon, const char *file_name,
3928c2ecf20Sopenharmony_ci				  const struct cifs_unix_set_info_args *args,
3938c2ecf20Sopenharmony_ci				  const struct nls_table *nls_codepage,
3948c2ecf20Sopenharmony_ci				  int remap);
3958c2ecf20Sopenharmony_ci
3968c2ecf20Sopenharmony_ciextern int CIFSSMBMkDir(const unsigned int xid, struct inode *inode,
3978c2ecf20Sopenharmony_ci			umode_t mode, struct cifs_tcon *tcon,
3988c2ecf20Sopenharmony_ci			const char *name, struct cifs_sb_info *cifs_sb);
3998c2ecf20Sopenharmony_ciextern int CIFSSMBRmDir(const unsigned int xid, struct cifs_tcon *tcon,
4008c2ecf20Sopenharmony_ci			const char *name, struct cifs_sb_info *cifs_sb);
4018c2ecf20Sopenharmony_ciextern int CIFSPOSIXDelFile(const unsigned int xid, struct cifs_tcon *tcon,
4028c2ecf20Sopenharmony_ci			const char *name, __u16 type,
4038c2ecf20Sopenharmony_ci			const struct nls_table *nls_codepage,
4048c2ecf20Sopenharmony_ci			int remap_special_chars);
4058c2ecf20Sopenharmony_ciextern int CIFSSMBDelFile(const unsigned int xid, struct cifs_tcon *tcon,
4068c2ecf20Sopenharmony_ci			  const char *name, struct cifs_sb_info *cifs_sb);
4078c2ecf20Sopenharmony_ciextern int CIFSSMBRename(const unsigned int xid, struct cifs_tcon *tcon,
4088c2ecf20Sopenharmony_ci			 const char *from_name, const char *to_name,
4098c2ecf20Sopenharmony_ci			 struct cifs_sb_info *cifs_sb);
4108c2ecf20Sopenharmony_ciextern int CIFSSMBRenameOpenFile(const unsigned int xid, struct cifs_tcon *tcon,
4118c2ecf20Sopenharmony_ci				 int netfid, const char *target_name,
4128c2ecf20Sopenharmony_ci				 const struct nls_table *nls_codepage,
4138c2ecf20Sopenharmony_ci				 int remap_special_chars);
4148c2ecf20Sopenharmony_ciextern int CIFSCreateHardLink(const unsigned int xid, struct cifs_tcon *tcon,
4158c2ecf20Sopenharmony_ci			      const char *from_name, const char *to_name,
4168c2ecf20Sopenharmony_ci			      struct cifs_sb_info *cifs_sb);
4178c2ecf20Sopenharmony_ciextern int CIFSUnixCreateHardLink(const unsigned int xid,
4188c2ecf20Sopenharmony_ci			struct cifs_tcon *tcon,
4198c2ecf20Sopenharmony_ci			const char *fromName, const char *toName,
4208c2ecf20Sopenharmony_ci			const struct nls_table *nls_codepage,
4218c2ecf20Sopenharmony_ci			int remap_special_chars);
4228c2ecf20Sopenharmony_ciextern int CIFSUnixCreateSymLink(const unsigned int xid,
4238c2ecf20Sopenharmony_ci			struct cifs_tcon *tcon,
4248c2ecf20Sopenharmony_ci			const char *fromName, const char *toName,
4258c2ecf20Sopenharmony_ci			const struct nls_table *nls_codepage, int remap);
4268c2ecf20Sopenharmony_ciextern int CIFSSMBUnixQuerySymLink(const unsigned int xid,
4278c2ecf20Sopenharmony_ci			struct cifs_tcon *tcon,
4288c2ecf20Sopenharmony_ci			const unsigned char *searchName, char **syminfo,
4298c2ecf20Sopenharmony_ci			const struct nls_table *nls_codepage, int remap);
4308c2ecf20Sopenharmony_ciextern int CIFSSMBQuerySymLink(const unsigned int xid, struct cifs_tcon *tcon,
4318c2ecf20Sopenharmony_ci			       __u16 fid, char **symlinkinfo,
4328c2ecf20Sopenharmony_ci			       const struct nls_table *nls_codepage);
4338c2ecf20Sopenharmony_ciextern int CIFSSMB_set_compression(const unsigned int xid,
4348c2ecf20Sopenharmony_ci				   struct cifs_tcon *tcon, __u16 fid);
4358c2ecf20Sopenharmony_ciextern int CIFS_open(const unsigned int xid, struct cifs_open_parms *oparms,
4368c2ecf20Sopenharmony_ci		     int *oplock, FILE_ALL_INFO *buf);
4378c2ecf20Sopenharmony_ciextern int SMBLegacyOpen(const unsigned int xid, struct cifs_tcon *tcon,
4388c2ecf20Sopenharmony_ci			const char *fileName, const int disposition,
4398c2ecf20Sopenharmony_ci			const int access_flags, const int omode,
4408c2ecf20Sopenharmony_ci			__u16 *netfid, int *pOplock, FILE_ALL_INFO *,
4418c2ecf20Sopenharmony_ci			const struct nls_table *nls_codepage, int remap);
4428c2ecf20Sopenharmony_ciextern int CIFSPOSIXCreate(const unsigned int xid, struct cifs_tcon *tcon,
4438c2ecf20Sopenharmony_ci			u32 posix_flags, __u64 mode, __u16 *netfid,
4448c2ecf20Sopenharmony_ci			FILE_UNIX_BASIC_INFO *pRetData,
4458c2ecf20Sopenharmony_ci			__u32 *pOplock, const char *name,
4468c2ecf20Sopenharmony_ci			const struct nls_table *nls_codepage, int remap);
4478c2ecf20Sopenharmony_ciextern int CIFSSMBClose(const unsigned int xid, struct cifs_tcon *tcon,
4488c2ecf20Sopenharmony_ci			const int smb_file_id);
4498c2ecf20Sopenharmony_ci
4508c2ecf20Sopenharmony_ciextern int CIFSSMBFlush(const unsigned int xid, struct cifs_tcon *tcon,
4518c2ecf20Sopenharmony_ci			const int smb_file_id);
4528c2ecf20Sopenharmony_ci
4538c2ecf20Sopenharmony_ciextern int CIFSSMBRead(const unsigned int xid, struct cifs_io_parms *io_parms,
4548c2ecf20Sopenharmony_ci			unsigned int *nbytes, char **buf,
4558c2ecf20Sopenharmony_ci			int *return_buf_type);
4568c2ecf20Sopenharmony_ciextern int CIFSSMBWrite(const unsigned int xid, struct cifs_io_parms *io_parms,
4578c2ecf20Sopenharmony_ci			unsigned int *nbytes, const char *buf);
4588c2ecf20Sopenharmony_ciextern int CIFSSMBWrite2(const unsigned int xid, struct cifs_io_parms *io_parms,
4598c2ecf20Sopenharmony_ci			unsigned int *nbytes, struct kvec *iov, const int nvec);
4608c2ecf20Sopenharmony_ciextern int CIFSGetSrvInodeNumber(const unsigned int xid, struct cifs_tcon *tcon,
4618c2ecf20Sopenharmony_ci				 const char *search_name, __u64 *inode_number,
4628c2ecf20Sopenharmony_ci				 const struct nls_table *nls_codepage,
4638c2ecf20Sopenharmony_ci				 int remap);
4648c2ecf20Sopenharmony_ci
4658c2ecf20Sopenharmony_ciextern int cifs_lockv(const unsigned int xid, struct cifs_tcon *tcon,
4668c2ecf20Sopenharmony_ci		      const __u16 netfid, const __u8 lock_type,
4678c2ecf20Sopenharmony_ci		      const __u32 num_unlock, const __u32 num_lock,
4688c2ecf20Sopenharmony_ci		      LOCKING_ANDX_RANGE *buf);
4698c2ecf20Sopenharmony_ciextern int CIFSSMBLock(const unsigned int xid, struct cifs_tcon *tcon,
4708c2ecf20Sopenharmony_ci			const __u16 netfid, const __u32 netpid, const __u64 len,
4718c2ecf20Sopenharmony_ci			const __u64 offset, const __u32 numUnlock,
4728c2ecf20Sopenharmony_ci			const __u32 numLock, const __u8 lockType,
4738c2ecf20Sopenharmony_ci			const bool waitFlag, const __u8 oplock_level);
4748c2ecf20Sopenharmony_ciextern int CIFSSMBPosixLock(const unsigned int xid, struct cifs_tcon *tcon,
4758c2ecf20Sopenharmony_ci			const __u16 smb_file_id, const __u32 netpid,
4768c2ecf20Sopenharmony_ci			const loff_t start_offset, const __u64 len,
4778c2ecf20Sopenharmony_ci			struct file_lock *, const __u16 lock_type,
4788c2ecf20Sopenharmony_ci			const bool waitFlag);
4798c2ecf20Sopenharmony_ciextern int CIFSSMBTDis(const unsigned int xid, struct cifs_tcon *tcon);
4808c2ecf20Sopenharmony_ciextern int CIFSSMBEcho(struct TCP_Server_Info *server);
4818c2ecf20Sopenharmony_ciextern int CIFSSMBLogoff(const unsigned int xid, struct cifs_ses *ses);
4828c2ecf20Sopenharmony_ci
4838c2ecf20Sopenharmony_ciextern struct cifs_ses *sesInfoAlloc(void);
4848c2ecf20Sopenharmony_ciextern void sesInfoFree(struct cifs_ses *);
4858c2ecf20Sopenharmony_ciextern struct cifs_tcon *tconInfoAlloc(void);
4868c2ecf20Sopenharmony_ciextern void tconInfoFree(struct cifs_tcon *);
4878c2ecf20Sopenharmony_ci
4888c2ecf20Sopenharmony_ciextern int cifs_sign_rqst(struct smb_rqst *rqst, struct TCP_Server_Info *server,
4898c2ecf20Sopenharmony_ci		   __u32 *pexpected_response_sequence_number);
4908c2ecf20Sopenharmony_ciextern int cifs_sign_smbv(struct kvec *iov, int n_vec, struct TCP_Server_Info *,
4918c2ecf20Sopenharmony_ci			  __u32 *);
4928c2ecf20Sopenharmony_ciextern int cifs_sign_smb(struct smb_hdr *, struct TCP_Server_Info *, __u32 *);
4938c2ecf20Sopenharmony_ciextern int cifs_verify_signature(struct smb_rqst *rqst,
4948c2ecf20Sopenharmony_ci				 struct TCP_Server_Info *server,
4958c2ecf20Sopenharmony_ci				__u32 expected_sequence_number);
4968c2ecf20Sopenharmony_ciextern int SMBNTencrypt(unsigned char *, unsigned char *, unsigned char *,
4978c2ecf20Sopenharmony_ci			const struct nls_table *);
4988c2ecf20Sopenharmony_ciextern int setup_ntlm_response(struct cifs_ses *, const struct nls_table *);
4998c2ecf20Sopenharmony_ciextern int setup_ntlmv2_rsp(struct cifs_ses *, const struct nls_table *);
5008c2ecf20Sopenharmony_ciextern void cifs_crypto_secmech_release(struct TCP_Server_Info *server);
5018c2ecf20Sopenharmony_ciextern int calc_seckey(struct cifs_ses *);
5028c2ecf20Sopenharmony_ciextern int generate_smb30signingkey(struct cifs_ses *);
5038c2ecf20Sopenharmony_ciextern int generate_smb311signingkey(struct cifs_ses *);
5048c2ecf20Sopenharmony_ci
5058c2ecf20Sopenharmony_ci#ifdef CONFIG_CIFS_WEAK_PW_HASH
5068c2ecf20Sopenharmony_ciextern int calc_lanman_hash(const char *password, const char *cryptkey,
5078c2ecf20Sopenharmony_ci				bool encrypt, char *lnm_session_key);
5088c2ecf20Sopenharmony_ci#endif /* CIFS_WEAK_PW_HASH */
5098c2ecf20Sopenharmony_ci#ifdef CONFIG_CIFS_DNOTIFY_EXPERIMENTAL /* unused temporarily */
5108c2ecf20Sopenharmony_ciextern int CIFSSMBNotify(const unsigned int xid, struct cifs_tcon *tcon,
5118c2ecf20Sopenharmony_ci			const int notify_subdirs, const __u16 netfid,
5128c2ecf20Sopenharmony_ci			__u32 filter, struct file *file, int multishot,
5138c2ecf20Sopenharmony_ci			const struct nls_table *nls_codepage);
5148c2ecf20Sopenharmony_ci#endif /* was needed for dnotify, and will be needed for inotify when VFS fix */
5158c2ecf20Sopenharmony_ciextern int CIFSSMBCopy(unsigned int xid,
5168c2ecf20Sopenharmony_ci			struct cifs_tcon *source_tcon,
5178c2ecf20Sopenharmony_ci			const char *fromName,
5188c2ecf20Sopenharmony_ci			const __u16 target_tid,
5198c2ecf20Sopenharmony_ci			const char *toName, const int flags,
5208c2ecf20Sopenharmony_ci			const struct nls_table *nls_codepage,
5218c2ecf20Sopenharmony_ci			int remap_special_chars);
5228c2ecf20Sopenharmony_ciextern ssize_t CIFSSMBQAllEAs(const unsigned int xid, struct cifs_tcon *tcon,
5238c2ecf20Sopenharmony_ci			const unsigned char *searchName,
5248c2ecf20Sopenharmony_ci			const unsigned char *ea_name, char *EAData,
5258c2ecf20Sopenharmony_ci			size_t bufsize, struct cifs_sb_info *cifs_sb);
5268c2ecf20Sopenharmony_ciextern int CIFSSMBSetEA(const unsigned int xid, struct cifs_tcon *tcon,
5278c2ecf20Sopenharmony_ci		const char *fileName, const char *ea_name,
5288c2ecf20Sopenharmony_ci		const void *ea_value, const __u16 ea_value_len,
5298c2ecf20Sopenharmony_ci		const struct nls_table *nls_codepage,
5308c2ecf20Sopenharmony_ci		struct cifs_sb_info *cifs_sb);
5318c2ecf20Sopenharmony_ciextern int CIFSSMBGetCIFSACL(const unsigned int xid, struct cifs_tcon *tcon,
5328c2ecf20Sopenharmony_ci			__u16 fid, struct cifs_ntsd **acl_inf, __u32 *buflen);
5338c2ecf20Sopenharmony_ciextern int CIFSSMBSetCIFSACL(const unsigned int, struct cifs_tcon *, __u16,
5348c2ecf20Sopenharmony_ci			struct cifs_ntsd *, __u32, int);
5358c2ecf20Sopenharmony_ciextern int CIFSSMBGetPosixACL(const unsigned int xid, struct cifs_tcon *tcon,
5368c2ecf20Sopenharmony_ci		const unsigned char *searchName,
5378c2ecf20Sopenharmony_ci		char *acl_inf, const int buflen, const int acl_type,
5388c2ecf20Sopenharmony_ci		const struct nls_table *nls_codepage, int remap_special_chars);
5398c2ecf20Sopenharmony_ciextern int CIFSSMBSetPosixACL(const unsigned int xid, struct cifs_tcon *tcon,
5408c2ecf20Sopenharmony_ci		const unsigned char *fileName,
5418c2ecf20Sopenharmony_ci		const char *local_acl, const int buflen, const int acl_type,
5428c2ecf20Sopenharmony_ci		const struct nls_table *nls_codepage, int remap_special_chars);
5438c2ecf20Sopenharmony_ciextern int CIFSGetExtAttr(const unsigned int xid, struct cifs_tcon *tcon,
5448c2ecf20Sopenharmony_ci			const int netfid, __u64 *pExtAttrBits, __u64 *pMask);
5458c2ecf20Sopenharmony_ciextern void cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb);
5468c2ecf20Sopenharmony_ciextern bool couldbe_mf_symlink(const struct cifs_fattr *fattr);
5478c2ecf20Sopenharmony_ciextern int check_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,
5488c2ecf20Sopenharmony_ci			      struct cifs_sb_info *cifs_sb,
5498c2ecf20Sopenharmony_ci			      struct cifs_fattr *fattr,
5508c2ecf20Sopenharmony_ci			      const unsigned char *path);
5518c2ecf20Sopenharmony_ciextern int mdfour(unsigned char *, unsigned char *, int);
5528c2ecf20Sopenharmony_ciextern int E_md4hash(const unsigned char *passwd, unsigned char *p16,
5538c2ecf20Sopenharmony_ci			const struct nls_table *codepage);
5548c2ecf20Sopenharmony_ciextern int SMBencrypt(unsigned char *passwd, const unsigned char *c8,
5558c2ecf20Sopenharmony_ci			unsigned char *p24);
5568c2ecf20Sopenharmony_ci
5578c2ecf20Sopenharmony_ciextern int
5588c2ecf20Sopenharmony_cicifs_setup_volume_info(struct smb_vol *volume_info, char *mount_data,
5598c2ecf20Sopenharmony_ci		       const char *devname, bool is_smb3);
5608c2ecf20Sopenharmony_ciextern void
5618c2ecf20Sopenharmony_cicifs_cleanup_volume_info_contents(struct smb_vol *volume_info);
5628c2ecf20Sopenharmony_ci
5638c2ecf20Sopenharmony_ciextern struct TCP_Server_Info *
5648c2ecf20Sopenharmony_cicifs_find_tcp_session(struct smb_vol *vol);
5658c2ecf20Sopenharmony_ci
5668c2ecf20Sopenharmony_ciextern void cifs_put_smb_ses(struct cifs_ses *ses);
5678c2ecf20Sopenharmony_ci
5688c2ecf20Sopenharmony_ciextern struct cifs_ses *
5698c2ecf20Sopenharmony_cicifs_get_smb_ses(struct TCP_Server_Info *server, struct smb_vol *volume_info);
5708c2ecf20Sopenharmony_ci
5718c2ecf20Sopenharmony_civoid cifs_readdata_release(struct kref *refcount);
5728c2ecf20Sopenharmony_ciint cifs_async_readv(struct cifs_readdata *rdata);
5738c2ecf20Sopenharmony_ciint cifs_readv_receive(struct TCP_Server_Info *server, struct mid_q_entry *mid);
5748c2ecf20Sopenharmony_ci
5758c2ecf20Sopenharmony_ciint cifs_async_writev(struct cifs_writedata *wdata,
5768c2ecf20Sopenharmony_ci		      void (*release)(struct kref *kref));
5778c2ecf20Sopenharmony_civoid cifs_writev_complete(struct work_struct *work);
5788c2ecf20Sopenharmony_cistruct cifs_writedata *cifs_writedata_alloc(unsigned int nr_pages,
5798c2ecf20Sopenharmony_ci						work_func_t complete);
5808c2ecf20Sopenharmony_cistruct cifs_writedata *cifs_writedata_direct_alloc(struct page **pages,
5818c2ecf20Sopenharmony_ci						work_func_t complete);
5828c2ecf20Sopenharmony_civoid cifs_writedata_release(struct kref *refcount);
5838c2ecf20Sopenharmony_ciint cifs_query_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,
5848c2ecf20Sopenharmony_ci			  struct cifs_sb_info *cifs_sb,
5858c2ecf20Sopenharmony_ci			  const unsigned char *path, char *pbuf,
5868c2ecf20Sopenharmony_ci			  unsigned int *pbytes_read);
5878c2ecf20Sopenharmony_ciint cifs_create_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,
5888c2ecf20Sopenharmony_ci			   struct cifs_sb_info *cifs_sb,
5898c2ecf20Sopenharmony_ci			   const unsigned char *path, char *pbuf,
5908c2ecf20Sopenharmony_ci			   unsigned int *pbytes_written);
5918c2ecf20Sopenharmony_ciint __cifs_calc_signature(struct smb_rqst *rqst,
5928c2ecf20Sopenharmony_ci			struct TCP_Server_Info *server, char *signature,
5938c2ecf20Sopenharmony_ci			struct shash_desc *shash);
5948c2ecf20Sopenharmony_cienum securityEnum cifs_select_sectype(struct TCP_Server_Info *,
5958c2ecf20Sopenharmony_ci					enum securityEnum);
5968c2ecf20Sopenharmony_cistruct cifs_aio_ctx *cifs_aio_ctx_alloc(void);
5978c2ecf20Sopenharmony_civoid cifs_aio_ctx_release(struct kref *refcount);
5988c2ecf20Sopenharmony_ciint setup_aio_ctx_iter(struct cifs_aio_ctx *ctx, struct iov_iter *iter, int rw);
5998c2ecf20Sopenharmony_civoid smb2_cached_lease_break(struct work_struct *work);
6008c2ecf20Sopenharmony_ci
6018c2ecf20Sopenharmony_ciint cifs_alloc_hash(const char *name, struct crypto_shash **shash,
6028c2ecf20Sopenharmony_ci		    struct sdesc **sdesc);
6038c2ecf20Sopenharmony_civoid cifs_free_hash(struct crypto_shash **shash, struct sdesc **sdesc);
6048c2ecf20Sopenharmony_ci
6058c2ecf20Sopenharmony_civoid rqst_page_get_length(const struct smb_rqst *rqst, unsigned int page,
6068c2ecf20Sopenharmony_ci			  unsigned int *len, unsigned int *offset);
6078c2ecf20Sopenharmony_cistruct cifs_chan *
6088c2ecf20Sopenharmony_cicifs_ses_find_chan(struct cifs_ses *ses, struct TCP_Server_Info *server);
6098c2ecf20Sopenharmony_ciint cifs_try_adding_channels(struct cifs_ses *ses);
6108c2ecf20Sopenharmony_ciint cifs_ses_add_channel(struct cifs_ses *ses,
6118c2ecf20Sopenharmony_ci				struct cifs_server_iface *iface);
6128c2ecf20Sopenharmony_cibool is_server_using_iface(struct TCP_Server_Info *server,
6138c2ecf20Sopenharmony_ci			   struct cifs_server_iface *iface);
6148c2ecf20Sopenharmony_cibool is_ses_using_iface(struct cifs_ses *ses, struct cifs_server_iface *iface);
6158c2ecf20Sopenharmony_ci
6168c2ecf20Sopenharmony_civoid extract_unc_hostname(const char *unc, const char **h, size_t *len);
6178c2ecf20Sopenharmony_ciint copy_path_name(char *dst, const char *src);
6188c2ecf20Sopenharmony_ciint smb2_parse_query_directory(struct cifs_tcon *tcon, struct kvec *rsp_iov,
6198c2ecf20Sopenharmony_ci			       int resp_buftype,
6208c2ecf20Sopenharmony_ci			       struct cifs_search_info *srch_inf);
6218c2ecf20Sopenharmony_ci
6228c2ecf20Sopenharmony_cistruct super_block *cifs_get_tcp_super(struct TCP_Server_Info *server);
6238c2ecf20Sopenharmony_civoid cifs_put_tcp_super(struct super_block *sb);
6248c2ecf20Sopenharmony_ciint update_super_prepath(struct cifs_tcon *tcon, char *prefix);
6258c2ecf20Sopenharmony_ci
6268c2ecf20Sopenharmony_ci#ifdef CONFIG_CIFS_DFS_UPCALL
6278c2ecf20Sopenharmony_cistatic inline int get_dfs_path(const unsigned int xid, struct cifs_ses *ses,
6288c2ecf20Sopenharmony_ci			       const char *old_path,
6298c2ecf20Sopenharmony_ci			       const struct nls_table *nls_codepage,
6308c2ecf20Sopenharmony_ci			       struct dfs_info3_param *referral, int remap)
6318c2ecf20Sopenharmony_ci{
6328c2ecf20Sopenharmony_ci	return dfs_cache_find(xid, ses, nls_codepage, remap, old_path,
6338c2ecf20Sopenharmony_ci			      referral, NULL);
6348c2ecf20Sopenharmony_ci}
6358c2ecf20Sopenharmony_ci
6368c2ecf20Sopenharmony_ciint match_target_ip(struct TCP_Server_Info *server,
6378c2ecf20Sopenharmony_ci		    const char *share, size_t share_len,
6388c2ecf20Sopenharmony_ci		    bool *result);
6398c2ecf20Sopenharmony_ci#endif
6408c2ecf20Sopenharmony_ci
6418c2ecf20Sopenharmony_cistatic inline int cifs_create_options(struct cifs_sb_info *cifs_sb, int options)
6428c2ecf20Sopenharmony_ci{
6438c2ecf20Sopenharmony_ci	if (cifs_sb && (backup_cred(cifs_sb)))
6448c2ecf20Sopenharmony_ci		return options | CREATE_OPEN_BACKUP_INTENT;
6458c2ecf20Sopenharmony_ci	else
6468c2ecf20Sopenharmony_ci		return options;
6478c2ecf20Sopenharmony_ci}
6488c2ecf20Sopenharmony_ci
6498c2ecf20Sopenharmony_ci#endif			/* _CIFSPROTO_H */
650