^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) * fs/cifs/smb2proto.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright (c) International Business Machines Corp., 2002, 2011
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Etersoft, 2012
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Author(s): Steve French (sfrench@us.ibm.com)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Pavel Shilovsky (pshilovsky@samba.org) 2012
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * This library is free software; you can redistribute it and/or modify
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) * it under the terms of the GNU Lesser General Public License as published
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) * by the Free Software Foundation; either version 2.1 of the License, or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * (at your option) any later version.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) * This library is distributed in the hope that it will be useful,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) * but WITHOUT ANY WARRANTY; without even the implied warranty of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) * the GNU Lesser General Public License for more details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) * You should have received a copy of the GNU Lesser General Public License
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) * along with this library; if not, write to the Free Software
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #ifndef _SMB2PROTO_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #define _SMB2PROTO_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #include <linux/nls.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #include <linux/key-type.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) struct statfs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) struct smb_rqst;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) *****************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) * All Prototypes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) *****************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) extern int map_smb2_to_linux_error(char *buf, bool log_err);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) extern int smb2_check_message(char *buf, unsigned int length,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) struct TCP_Server_Info *server);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) extern unsigned int smb2_calc_size(void *buf, struct TCP_Server_Info *server);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) extern char *smb2_get_data_area_len(int *off, int *len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) struct smb2_sync_hdr *shdr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) extern __le16 *cifs_convert_path_to_utf16(const char *from,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) struct cifs_sb_info *cifs_sb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) extern int smb2_verify_signature(struct smb_rqst *, struct TCP_Server_Info *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) extern int smb2_check_receive(struct mid_q_entry *mid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) struct TCP_Server_Info *server, bool log_error);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) extern struct mid_q_entry *smb2_setup_request(struct cifs_ses *ses,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) struct TCP_Server_Info *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) struct smb_rqst *rqst);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) extern struct mid_q_entry *smb2_setup_async_request(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) struct TCP_Server_Info *server, struct smb_rqst *rqst);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) extern struct cifs_ses *smb2_find_smb_ses(struct TCP_Server_Info *server,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) __u64 ses_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) extern struct cifs_tcon *smb2_find_smb_tcon(struct TCP_Server_Info *server,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) __u64 ses_id, __u32 tid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) extern int smb2_calc_signature(struct smb_rqst *rqst,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) struct TCP_Server_Info *server,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) bool allocate_crypto);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) extern int smb3_calc_signature(struct smb_rqst *rqst,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) struct TCP_Server_Info *server,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) bool allocate_crypto);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) extern void smb2_echo_request(struct work_struct *work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) extern __le32 smb2_get_lease_state(struct cifsInodeInfo *cinode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) extern bool smb2_is_valid_oplock_break(char *buffer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) struct TCP_Server_Info *srv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) extern struct cifs_ses *smb2_find_smb_ses(struct TCP_Server_Info *server,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) __u64 ses_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) extern int smb3_handle_read_data(struct TCP_Server_Info *server,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) struct mid_q_entry *mid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) extern int open_shroot(unsigned int xid, struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) struct cifs_sb_info *cifs_sb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) struct cached_fid **cfid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) extern void close_shroot(struct cached_fid *cfid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) extern void close_shroot_lease(struct cached_fid *cfid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) extern void close_shroot_lease_locked(struct cached_fid *cfid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) extern void move_smb2_info_to_cifs(FILE_ALL_INFO *dst,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) struct smb2_file_all_info *src);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) extern int smb2_query_reparse_tag(const unsigned int xid, struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) struct cifs_sb_info *cifs_sb, const char *path,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) __u32 *reparse_tag);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) extern int smb2_query_path_info(const unsigned int xid, struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) struct cifs_sb_info *cifs_sb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) const char *full_path, FILE_ALL_INFO *data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) bool *adjust_tz, bool *symlink);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) extern int smb2_set_path_size(const unsigned int xid, struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) const char *full_path, __u64 size,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) struct cifs_sb_info *cifs_sb, bool set_alloc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) extern int smb2_set_file_info(struct inode *inode, const char *full_path,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) FILE_BASIC_INFO *buf, const unsigned int xid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) extern int smb311_posix_mkdir(const unsigned int xid, struct inode *inode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) umode_t mode, struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) const char *full_path,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) struct cifs_sb_info *cifs_sb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) extern int smb2_mkdir(const unsigned int xid, struct inode *inode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) umode_t mode, struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) const char *name, struct cifs_sb_info *cifs_sb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) extern void smb2_mkdir_setinfo(struct inode *inode, const char *full_path,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) struct cifs_sb_info *cifs_sb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) struct cifs_tcon *tcon, const unsigned int xid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) extern int smb2_rmdir(const unsigned int xid, struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) const char *name, struct cifs_sb_info *cifs_sb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) extern int smb2_unlink(const unsigned int xid, struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) const char *name, struct cifs_sb_info *cifs_sb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) extern int smb2_rename_path(const unsigned int xid, struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) const char *from_name, const char *to_name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) struct cifs_sb_info *cifs_sb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) extern int smb2_create_hardlink(const unsigned int xid, struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) const char *from_name, const char *to_name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) struct cifs_sb_info *cifs_sb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) extern int smb3_create_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) struct cifs_sb_info *cifs_sb, const unsigned char *path,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) char *pbuf, unsigned int *pbytes_written);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) extern int smb3_query_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) struct cifs_sb_info *cifs_sb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) const unsigned char *path, char *pbuf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) unsigned int *pbytes_read);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) extern int smb2_open_file(const unsigned int xid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) struct cifs_open_parms *oparms,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) __u32 *oplock, FILE_ALL_INFO *buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) extern int smb2_unlock_range(struct cifsFileInfo *cfile,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) struct file_lock *flock, const unsigned int xid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) extern int smb2_push_mandatory_locks(struct cifsFileInfo *cfile);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) extern void smb2_reconnect_server(struct work_struct *work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) extern int smb3_crypto_aead_allocate(struct TCP_Server_Info *server);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) extern unsigned long smb_rqst_len(struct TCP_Server_Info *server,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) struct smb_rqst *rqst);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) extern void smb2_set_next_command(struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) struct smb_rqst *rqst);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) extern void smb2_set_related(struct smb_rqst *rqst);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) * SMB2 Worker functions - most of protocol specific implementation details
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) * are contained within these calls.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) extern int SMB2_negotiate(const unsigned int xid, struct cifs_ses *ses);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) extern int SMB2_sess_setup(const unsigned int xid, struct cifs_ses *ses,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) const struct nls_table *nls_cp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) extern int SMB2_logoff(const unsigned int xid, struct cifs_ses *ses);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) extern int SMB2_tcon(const unsigned int xid, struct cifs_ses *ses,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) const char *tree, struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) const struct nls_table *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) extern int SMB2_tdis(const unsigned int xid, struct cifs_tcon *tcon);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) extern int SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) __le16 *path, __u8 *oplock,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) struct smb2_file_all_info *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) struct create_posix_rsp *posix,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) struct kvec *err_iov, int *resp_buftype);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) extern int SMB2_open_init(struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) struct TCP_Server_Info *server,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) struct smb_rqst *rqst,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) __u8 *oplock, struct cifs_open_parms *oparms,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) __le16 *path);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) extern void SMB2_open_free(struct smb_rqst *rqst);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) extern int SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) u64 persistent_fid, u64 volatile_fid, u32 opcode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) bool is_fsctl, char *in_data, u32 indatalen, u32 maxoutlen,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) char **out_data, u32 *plen /* returned data len */);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) extern int SMB2_ioctl_init(struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) struct TCP_Server_Info *server,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) struct smb_rqst *rqst,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) u64 persistent_fid, u64 volatile_fid, u32 opcode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) bool is_fsctl, char *in_data, u32 indatalen,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) __u32 max_response_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) extern void SMB2_ioctl_free(struct smb_rqst *rqst);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) extern int SMB2_change_notify(const unsigned int xid, struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) u64 persistent_fid, u64 volatile_fid, bool watch_tree,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) u32 completion_filter);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) extern int __SMB2_close(const unsigned int xid, struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) u64 persistent_fid, u64 volatile_fid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) struct smb2_file_network_open_info *pbuf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) extern int SMB2_close(const unsigned int xid, struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) u64 persistent_file_id, u64 volatile_file_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) extern int SMB2_close_init(struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) struct TCP_Server_Info *server,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) struct smb_rqst *rqst,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) u64 persistent_fid, u64 volatile_fid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) bool query_attrs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) extern void SMB2_close_free(struct smb_rqst *rqst);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) extern int SMB2_flush(const unsigned int xid, struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) u64 persistent_file_id, u64 volatile_file_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) extern int SMB2_flush_init(const unsigned int xid, struct smb_rqst *rqst,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) struct TCP_Server_Info *server,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) u64 persistent_file_id, u64 volatile_file_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) extern void SMB2_flush_free(struct smb_rqst *rqst);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) extern int SMB311_posix_query_info(const unsigned int xid, struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) u64 persistent_fid, u64 volatile_fid, struct smb311_posix_qinfo *data, u32 *plen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) extern int SMB2_query_info(const unsigned int xid, struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) u64 persistent_file_id, u64 volatile_file_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) struct smb2_file_all_info *data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) extern int SMB2_query_info_init(struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) struct TCP_Server_Info *server,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) struct smb_rqst *rqst,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) u64 persistent_fid, u64 volatile_fid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) u8 info_class, u8 info_type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) u32 additional_info, size_t output_len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) size_t input_len, void *input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) extern void SMB2_query_info_free(struct smb_rqst *rqst);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) extern int SMB2_query_acl(const unsigned int xid, struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) u64 persistent_file_id, u64 volatile_file_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) void **data, unsigned int *plen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) extern int SMB2_get_srv_num(const unsigned int xid, struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) u64 persistent_fid, u64 volatile_fid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) __le64 *uniqueid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) extern int smb2_async_readv(struct cifs_readdata *rdata);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) extern int SMB2_read(const unsigned int xid, struct cifs_io_parms *io_parms,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) unsigned int *nbytes, char **buf, int *buf_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) extern int smb2_async_writev(struct cifs_writedata *wdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) void (*release)(struct kref *kref));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) extern int SMB2_write(const unsigned int xid, struct cifs_io_parms *io_parms,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) unsigned int *nbytes, struct kvec *iov, int n_vec);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) extern int SMB2_echo(struct TCP_Server_Info *server);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) extern int SMB2_query_directory(const unsigned int xid, struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) u64 persistent_fid, u64 volatile_fid, int index,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) struct cifs_search_info *srch_inf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) extern int SMB2_query_directory_init(unsigned int xid, struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) struct TCP_Server_Info *server,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) struct smb_rqst *rqst,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) u64 persistent_fid, u64 volatile_fid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) int index, int info_level);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) extern void SMB2_query_directory_free(struct smb_rqst *rqst);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) extern int SMB2_set_eof(const unsigned int xid, struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) u64 persistent_fid, u64 volatile_fid, u32 pid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) __le64 *eof);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) extern int SMB2_set_info_init(struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) struct TCP_Server_Info *server,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) struct smb_rqst *rqst,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) u64 persistent_fid, u64 volatile_fid, u32 pid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) u8 info_class, u8 info_type, u32 additional_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) void **data, unsigned int *size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) extern void SMB2_set_info_free(struct smb_rqst *rqst);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) extern int SMB2_set_acl(const unsigned int xid, struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) u64 persistent_fid, u64 volatile_fid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) struct cifs_ntsd *pnntsd, int pacllen, int aclflag);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) extern int SMB2_set_ea(const unsigned int xid, struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) u64 persistent_fid, u64 volatile_fid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) struct smb2_file_full_ea_info *buf, int len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) extern int SMB2_set_compression(const unsigned int xid, struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) u64 persistent_fid, u64 volatile_fid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) extern int SMB2_oplock_break(const unsigned int xid, struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) const u64 persistent_fid, const u64 volatile_fid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) const __u8 oplock_level);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) extern int smb2_handle_cancelled_close(struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) __u64 persistent_fid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) __u64 volatile_fid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) extern int smb2_handle_cancelled_mid(struct mid_q_entry *mid, struct TCP_Server_Info *server);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) void smb2_cancelled_close_fid(struct work_struct *work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) extern int SMB2_QFS_info(const unsigned int xid, struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) u64 persistent_file_id, u64 volatile_file_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) struct kstatfs *FSData);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) extern int SMB311_posix_qfs_info(const unsigned int xid, struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) u64 persistent_file_id, u64 volatile_file_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) struct kstatfs *FSData);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) extern int SMB2_QFS_attr(const unsigned int xid, struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) u64 persistent_file_id, u64 volatile_file_id, int lvl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) extern int SMB2_lock(const unsigned int xid, struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) const __u64 persist_fid, const __u64 volatile_fid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) const __u32 pid, const __u64 length, const __u64 offset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) const __u32 lockFlags, const bool wait);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) extern int smb2_lockv(const unsigned int xid, struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) const __u64 persist_fid, const __u64 volatile_fid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) const __u32 pid, const __u32 num_lock,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) struct smb2_lock_element *buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) extern int SMB2_lease_break(const unsigned int xid, struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) __u8 *lease_key, const __le32 lease_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) extern int smb3_validate_negotiate(const unsigned int, struct cifs_tcon *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) extern enum securityEnum smb2_select_sectype(struct TCP_Server_Info *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) enum securityEnum);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) extern void smb2_parse_contexts(struct TCP_Server_Info *server,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) struct smb2_create_rsp *rsp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) unsigned int *epoch, char *lease_key,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) __u8 *oplock, struct smb2_file_all_info *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) struct create_posix_rsp *posix);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) extern int smb3_encryption_required(const struct cifs_tcon *tcon);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) extern int smb2_validate_iov(unsigned int offset, unsigned int buffer_length,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) struct kvec *iov, unsigned int min_buf_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) extern int smb2_validate_and_copy_iov(unsigned int offset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) unsigned int buffer_length,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) struct kvec *iov,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) unsigned int minbufsize, char *data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) extern void smb2_copy_fs_info_to_kstatfs(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) struct smb2_fs_full_size_info *pfs_inf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) struct kstatfs *kst);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) extern int smb311_crypto_shash_allocate(struct TCP_Server_Info *server);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) extern int smb311_update_preauth_hash(struct cifs_ses *ses,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) struct kvec *iov, int nvec);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) extern int smb2_query_info_compound(const unsigned int xid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) __le16 *utf16_path, u32 desired_access,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) u32 class, u32 type, u32 output_len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) struct kvec *rsp, int *buftype,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) struct cifs_sb_info *cifs_sb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) /* query path info from the server using SMB311 POSIX extensions*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) extern int smb311_posix_query_path_info(const unsigned int xid, struct cifs_tcon *tcon,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) struct cifs_sb_info *sb, const char *path, struct smb311_posix_qinfo *qinf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) bool *adjust_tx, bool *symlink);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) int posix_info_parse(const void *beg, const void *end,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) struct smb2_posix_info_parsed *out);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) int posix_info_sid_size(const void *beg, const void *end);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) #endif /* _SMB2PROTO_H */