summaryrefslogtreecommitdiff
path: root/fs/smb/client/cifsglob.h
diff options
context:
space:
mode:
authorHenrique Carvalho <henrique.carvalho@suse.com>2024-11-12 16:48:09 -0300
committerEnzo Matsumiya <ematsumiya@suse.de>2024-11-13 15:49:46 -0300
commit472697f67cf64a2461ad1842927f3c8cc539f37e (patch)
tree37bb1e46b0884721d35eb5d902aaf1bcf88374b0 /fs/smb/client/cifsglob.h
parent8e5cdf186897806453d95697985d2eb21a4730a7 (diff)
downloadlinux-hw24-hc-wip.tar.gz
linux-hw24-hc-wip.tar.bz2
linux-hw24-hc-wip.zip
smb: client: replace function pointers of common operations for thehw24-hc-wip
common function Signed-off-by: Henrique Carvalho <henrique.carvalho@suse.com>
Diffstat (limited to 'fs/smb/client/cifsglob.h')
-rw-r--r--fs/smb/client/cifsglob.h478
1 files changed, 206 insertions, 272 deletions
diff --git a/fs/smb/client/cifsglob.h b/fs/smb/client/cifsglob.h
index f519e8c9a81f..ef81676664a5 100644
--- a/fs/smb/client/cifsglob.h
+++ b/fs/smb/client/cifsglob.h
@@ -274,329 +274,277 @@ struct cifsInodeInfo;
struct cifs_open_parms;
struct cifs_credits;
-struct smb_version_operations {
- int (*send_cancel)(struct TCP_Server_Info *, struct smb_rqst *,
- struct mid_q_entry *);
- bool (*compare_fids)(struct cifsFileInfo *, struct cifsFileInfo *);
- /* setup request: allocate mid, sign message */
- struct mid_q_entry *(*setup_request)(struct cifs_ses *,
- struct TCP_Server_Info *,
- struct smb_rqst *);
- /* setup async request: allocate mid, sign message */
- struct mid_q_entry *(*setup_async_request)(struct TCP_Server_Info *,
- struct smb_rqst *);
- /* check response: verify signature, map error */
- int (*check_receive)(struct mid_q_entry *, struct TCP_Server_Info *,
- bool);
- void (*add_credits)(struct TCP_Server_Info *server,
- struct cifs_credits *credits,
- const int optype);
- void (*set_credits)(struct TCP_Server_Info *, const int);
- int * (*get_credits_field)(struct TCP_Server_Info *, const int);
- unsigned int (*get_credits)(struct mid_q_entry *);
- __u64 (*get_next_mid)(struct TCP_Server_Info *);
- void (*revert_current_mid)(struct TCP_Server_Info *server,
- const unsigned int val);
- /* data offset from read response message */
- unsigned int (*read_data_offset)(char *);
- /*
- * Data length from read response message
- * When in_remaining is true, the returned data length is in
- * message field DataRemaining for out-of-band data read (e.g through
- * Memory Registration RDMA write in SMBD).
- * Otherwise, the returned data length is in message field DataLength.
- */
- unsigned int (*read_data_length)(char *, bool in_remaining);
- /* map smb to linux error */
- int (*map_error)(char *, bool);
- /* find mid corresponding to the response message */
- struct mid_q_entry * (*find_mid)(struct TCP_Server_Info *, char *);
- void (*dump_detail)(void *buf, struct TCP_Server_Info *ptcp_info);
- void (*clear_stats)(struct cifs_tcon *);
- void (*print_stats)(struct seq_file *m, struct cifs_tcon *);
- void (*dump_share_caps)(struct seq_file *, struct cifs_tcon *);
- /* verify the message */
- int (*check_message)(char *, unsigned int, struct TCP_Server_Info *);
- bool (*is_oplock_break)(char *, struct TCP_Server_Info *);
- int (*handle_cancelled_mid)(struct mid_q_entry *, struct TCP_Server_Info *);
- void (*downgrade_oplock)(struct TCP_Server_Info *server,
- struct cifsInodeInfo *cinode, __u32 oplock,
- unsigned int epoch, bool *purge_cache);
- /* process transaction2 response */
- bool (*check_trans2)(struct mid_q_entry *, struct TCP_Server_Info *,
- char *, int);
- /* check if we need to negotiate */
- bool (*need_neg)(struct TCP_Server_Info *);
- /* negotiate to the server */
- int (*negotiate)(const unsigned int xid,
- struct cifs_ses *ses,
- struct TCP_Server_Info *server);
- /* set negotiated write size */
- unsigned int (*negotiate_wsize)(struct cifs_tcon *tcon, struct smb3_fs_context *ctx);
- /* set negotiated read size */
- unsigned int (*negotiate_rsize)(struct cifs_tcon *tcon, struct smb3_fs_context *ctx);
- /* setup smb sessionn */
- int (*sess_setup)(const unsigned int, struct cifs_ses *,
- struct TCP_Server_Info *server,
- const struct nls_table *);
- /* close smb session */
- int (*logoff)(const unsigned int, struct cifs_ses *);
- /* connect to a server share */
- int (*tree_connect)(const unsigned int, struct cifs_ses *, const char *,
- struct cifs_tcon *, const struct nls_table *);
- /* close tree connection */
- int (*tree_disconnect)(const unsigned int, struct cifs_tcon *);
- /* get DFS referrals */
- int (*get_dfs_refer)(const unsigned int, struct cifs_ses *,
- const char *, struct dfs_info3_param **,
- unsigned int *, const struct nls_table *, int);
- /* informational QFS call */
- void (*qfs_tcon)(const unsigned int, struct cifs_tcon *,
- struct cifs_sb_info *);
- /* query for server interfaces */
- int (*query_server_interfaces)(const unsigned int, struct cifs_tcon *,
- bool);
- /* check if a path is accessible or not */
- int (*is_path_accessible)(const unsigned int, struct cifs_tcon *,
- struct cifs_sb_info *, const char *);
- /* query path data from the server */
- int (*query_path_info)(const unsigned int xid,
- struct cifs_tcon *tcon,
- struct cifs_sb_info *cifs_sb,
- const char *full_path,
- struct cifs_open_info_data *data);
- /* query file data from the server */
- int (*query_file_info)(const unsigned int xid, struct cifs_tcon *tcon,
+/* TODO: find a suitable place for these functions */
+extern struct mid_q_entry * smb2_find_mid(struct TCP_Server_Info *, char *);
+extern void smb2_dump_detail(void *buf, struct TCP_Server_Info *ptcp_info);
+extern void clear_stats(struct cifs_tcon *);
+extern void smb2_print_stats(struct seq_file *m, struct cifs_tcon *);
+extern bool smb2_is_valid_oplock_break(char *, struct TCP_Server_Info *);
+extern int smb2_handle_cancelled_mid(struct mid_q_entry *, struct TCP_Server_Info *);
+extern bool smb2_need_neg(struct TCP_Server_Info *);
+extern int smb2_negotiate(const unsigned int xid,
+ struct cifs_ses *ses,
+ struct TCP_Server_Info *server);
+extern int SMB2_sess_setup(const unsigned int, struct cifs_ses *,
+ struct TCP_Server_Info *server,
+ const struct nls_table *);
+extern int SMB2_logoff(const unsigned int, struct cifs_ses *);
+/* connect to a server share */
+extern int SMB2_tcon(const unsigned int, struct cifs_ses *, const char *,
+ struct cifs_tcon *, const struct nls_table *);
+/* close tree connection */
+extern int SMB2_tdis(const unsigned int, struct cifs_tcon *);
+
+
+extern int smb2_get_dfs_refer(const unsigned int, struct cifs_ses *,
+ const char *, struct dfs_info3_param **,
+ unsigned int *, const struct nls_table *, int);
+/* check if a path is accessible or not */
+extern int smb2_is_path_accessible(const unsigned int, struct cifs_tcon *,
+ struct cifs_sb_info *, const char *);
+/* query path data from the server */
+extern int smb2_query_path_info(const unsigned int xid,
+ struct cifs_tcon *tcon,
+ struct cifs_sb_info *cifs_sb,
+ const char *full_path,
+ struct cifs_open_info_data *data);
+/* query reparse point to determine which type of special file */
+extern int smb2_query_reparse_point(const unsigned int xid,
+ struct cifs_tcon *tcon,
+ struct cifs_sb_info *cifs_sb,
+ const char *full_path,
+ u32 *tag, struct kvec *rsp,
+ int *rsp_buftype);
+/* get server index number */
+extern int smb2_get_srv_inum(const unsigned int xid, struct cifs_tcon *tcon,
+ struct cifs_sb_info *cifs_sb, const char *full_path, u64 *uniqueid,
+ struct cifs_open_info_data *data);
+/* query file data from the server */
+extern int smb2_query_file_info(const unsigned int xid, struct cifs_tcon *tcon,
struct cifsFileInfo *cfile, struct cifs_open_info_data *data);
- /* query reparse point to determine which type of special file */
- int (*query_reparse_point)(const unsigned int xid,
- struct cifs_tcon *tcon,
- struct cifs_sb_info *cifs_sb,
- const char *full_path,
- u32 *tag, struct kvec *rsp,
- int *rsp_buftype);
- /* get server index number */
- int (*get_srv_inum)(const unsigned int xid, struct cifs_tcon *tcon,
- struct cifs_sb_info *cifs_sb, const char *full_path, u64 *uniqueid,
- struct cifs_open_info_data *data);
- /* set size by path */
- int (*set_path_size)(const unsigned int, struct cifs_tcon *,
+/* set size by path */
+extern int smb2_set_path_size(const unsigned int, struct cifs_tcon *,
const char *, __u64, struct cifs_sb_info *, bool,
struct dentry *);
- /* set size by file handle */
- int (*set_file_size)(const unsigned int, struct cifs_tcon *,
- struct cifsFileInfo *, __u64, bool);
- /* set attributes */
- int (*set_file_info)(struct inode *, const char *, FILE_BASIC_INFO *,
- const unsigned int);
- int (*set_compression)(const unsigned int, struct cifs_tcon *,
+/* set size by file handle */
+extern int smb2_set_file_size(const unsigned int, struct cifs_tcon *,
+ struct cifsFileInfo *, __u64, bool);
+/* set attributes */
+int smb2_set_file_info(struct inode *, const char *, FILE_BASIC_INFO *,
+ const unsigned int);
+extern int smb2_set_compression(const unsigned int, struct cifs_tcon *,
struct cifsFileInfo *);
- /* check if we can send an echo or nor */
- bool (*can_echo)(struct TCP_Server_Info *);
- /* send echo request */
- int (*echo)(struct TCP_Server_Info *);
- /* create directory */
- int (*posix_mkdir)(const unsigned int xid, struct inode *inode,
- umode_t mode, struct cifs_tcon *tcon,
- const char *full_path,
- struct cifs_sb_info *cifs_sb);
- int (*mkdir)(const unsigned int xid, struct inode *inode, umode_t mode,
+/* check if we can send an echo or nor */
+extern bool smb2_can_echo(struct TCP_Server_Info *);
+/* send echo request */
+extern int SMB2_echo(struct TCP_Server_Info *);
+extern int smb2_mkdir(const unsigned int xid, struct inode *inode, umode_t mode,
struct cifs_tcon *tcon, const char *name,
struct cifs_sb_info *sb);
- /* set info on created directory */
- void (*mkdir_setinfo)(struct inode *, const char *,
+/* set info on created directory */
+extern void smb2_mkdir_setinfo(struct inode *, const char *,
struct cifs_sb_info *, struct cifs_tcon *,
const unsigned int);
- /* remove directory */
- int (*rmdir)(const unsigned int, struct cifs_tcon *, const char *,
+/* remove directory */
+extern int smb2_rmdir(const unsigned int, struct cifs_tcon *, const char *,
struct cifs_sb_info *);
- /* unlink file */
- int (*unlink)(const unsigned int, struct cifs_tcon *, const char *,
+/* unlink file */
+extern int smb2_unlink(const unsigned int, struct cifs_tcon *, const char *,
struct cifs_sb_info *, struct dentry *);
- /* open, rename and delete file */
- int (*rename_pending_delete)(const char *, struct dentry *,
- const unsigned int);
- /* send rename request */
- int (*rename)(const unsigned int xid,
+/* send rename request */
+extern int smb2_rename_path(const unsigned int xid,
struct cifs_tcon *tcon,
struct dentry *source_dentry,
const char *from_name, const char *to_name,
struct cifs_sb_info *cifs_sb);
- /* send create hardlink request */
- int (*create_hardlink)(const unsigned int xid,
+extern int smb2_create_hardlink(const unsigned int xid,
struct cifs_tcon *tcon,
struct dentry *source_dentry,
const char *from_name, const char *to_name,
struct cifs_sb_info *cifs_sb);
- /* query symlink target */
- int (*query_symlink)(const unsigned int xid,
- struct cifs_tcon *tcon,
- struct cifs_sb_info *cifs_sb,
- const char *full_path,
- char **target_path);
- /* open a file for non-posix mounts */
- int (*open)(const unsigned int xid, struct cifs_open_parms *oparms, __u32 *oplock,
+/* open a file for non-posix mounts */
+extern int smb2_open(const unsigned int xid, struct cifs_open_parms *oparms, __u32 *oplock,
void *buf);
- /* set fid protocol-specific info */
- void (*set_fid)(struct cifsFileInfo *, struct cifs_fid *, __u32);
- /* close a file */
- int (*close)(const unsigned int, struct cifs_tcon *,
+/* set fid protocol-specific info */
+extern void smb2_set_fid(struct cifsFileInfo *, struct cifs_fid *, __u32);
+/* close a file */
+extern int smb2_close(const unsigned int, struct cifs_tcon *,
struct cifs_fid *);
- /* close a file, returning file attributes and timestamps */
- int (*close_getattr)(const unsigned int xid, struct cifs_tcon *tcon,
- struct cifsFileInfo *pfile_info);
- /* send a flush request to the server */
- int (*flush)(const unsigned int, struct cifs_tcon *, struct cifs_fid *);
- /* async read from the server */
- int (*async_readv)(struct cifs_io_subrequest *);
- /* async write to the server */
- void (*async_writev)(struct cifs_io_subrequest *);
- /* sync read from the server */
- int (*sync_read)(const unsigned int, struct cifs_fid *,
+/* send a flush request to the server */
+extern int smb2_flush_file(const unsigned int, struct cifs_tcon *, struct cifs_fid *);
+/* async read from the server */
+extern int smb2_async_readv(struct cifs_io_subrequest *);
+/* async write to the server */
+extern void smb2_async_writev(struct cifs_io_subrequest *);
+/* sync read from the server */
+extern int smb2_sync_read(const unsigned int, struct cifs_fid *,
struct cifs_io_parms *, unsigned int *, char **,
int *);
- /* sync write to the server */
- int (*sync_write)(const unsigned int, struct cifs_fid *,
+/* sync write to the server */
+extern int smb2_sync_write(const unsigned int, struct cifs_fid *,
struct cifs_io_parms *, unsigned int *, struct kvec *,
unsigned long);
- /* open dir, start readdir */
- int (*query_dir_first)(const unsigned int, struct cifs_tcon *,
+/* open dir, start readdir */
+extern int smb2_query_dir_first(const unsigned int, struct cifs_tcon *,
const char *, struct cifs_sb_info *,
struct cifs_fid *, __u16,
struct cifs_search_info *);
- /* continue readdir */
- int (*query_dir_next)(const unsigned int, struct cifs_tcon *,
+/* continue readdir */
+extern int smb2_query_dir_next(const unsigned int, struct cifs_tcon *,
struct cifs_fid *,
__u16, struct cifs_search_info *srch_inf);
- /* close dir */
- int (*close_dir)(const unsigned int, struct cifs_tcon *,
+/* close dir */
+extern int smb2_close_dir(const unsigned int, struct cifs_tcon *,
struct cifs_fid *);
- /* calculate a size of SMB message */
- unsigned int (*calc_smb_size)(void *buf);
- /* check for STATUS_PENDING and process the response if yes */
- bool (*is_status_pending)(char *buf, struct TCP_Server_Info *server);
- /* check for STATUS_NETWORK_SESSION_EXPIRED */
- bool (*is_session_expired)(char *);
- /* send oplock break response */
- int (*oplock_response)(struct cifs_tcon *tcon, __u64 persistent_fid, __u64 volatile_fid,
+/* calculate a size of SMB message */
+extern unsigned int smb2_calc_size(void *buf);
+/* check for STATUS_PENDING and process the response if yes */
+extern bool smb2_is_status_pending(char *buf, struct TCP_Server_Info *server);
+/* check for STATUS_NETWORK_SESSION_EXPIRED */
+extern bool smb2_is_session_expired(char *);
+/* send oplock break response */
+extern int smb2_oplock_response(struct cifs_tcon *tcon, __u64 persistent_fid, __u64 volatile_fid,
__u16 net_fid, struct cifsInodeInfo *cifs_inode);
- /* query remote filesystem */
- int (*queryfs)(const unsigned int, struct cifs_tcon *,
- const char *, struct cifs_sb_info *, struct kstatfs *);
- /* send mandatory brlock to the server */
- int (*mand_lock)(const unsigned int, struct cifsFileInfo *, __u64,
+/* send mandatory brlock to the server */
+extern int smb2_mand_lock(const unsigned int, struct cifsFileInfo *, __u64,
__u64, __u32, int, int, bool);
- /* unlock range of mandatory locks */
- int (*mand_unlock_range)(struct cifsFileInfo *, struct file_lock *,
+/* unlock range of mandatory locks */
+extern int smb2_unlock_range(struct cifsFileInfo *, struct file_lock *,
const unsigned int);
- /* push brlocks from the cache to the server */
- int (*push_mand_locks)(struct cifsFileInfo *);
- /* get lease key of the inode */
- void (*get_lease_key)(struct inode *, struct cifs_fid *);
- /* set lease key of the inode */
- void (*set_lease_key)(struct inode *, struct cifs_fid *);
- /* generate new lease key */
- void (*new_lease_key)(struct cifs_fid *);
- int (*generate_signingkey)(struct cifs_ses *ses,
- struct TCP_Server_Info *server);
- int (*calc_signature)(struct smb_rqst *, struct TCP_Server_Info *,
- bool allocate_crypto);
- int (*set_integrity)(const unsigned int, struct cifs_tcon *tcon,
- struct cifsFileInfo *src_file);
- int (*enum_snapshots)(const unsigned int xid, struct cifs_tcon *tcon,
+
+/* push brlocks from the cache to the server */
+extern int smb2_push_mandatory_locks(struct cifsFileInfo *);
+/* get lease key of the inode */
+extern void smb2_get_lease_key(struct inode *, struct cifs_fid *);
+/* set lease key of the inode */
+extern void smb2_set_lease_key(struct inode *, struct cifs_fid *);
+/* generate new lease key */
+extern void smb2_new_lease_key(struct cifs_fid *);
+extern int smb3_enum_snapshots(const unsigned int xid, struct cifs_tcon *tcon,
struct cifsFileInfo *src_file, void __user *);
- int (*notify)(const unsigned int xid, struct file *pfile,
+extern int smb3_notify(const unsigned int xid, struct file *pfile,
void __user *pbuf, bool return_changes);
- int (*query_mf_symlink)(unsigned int, struct cifs_tcon *,
+extern int smb3_query_mf_symlink(unsigned int, struct cifs_tcon *,
struct cifs_sb_info *, const unsigned char *,
char *, unsigned int *);
- int (*create_mf_symlink)(unsigned int, struct cifs_tcon *,
+extern int smb3_create_mf_symlink(unsigned int, struct cifs_tcon *,
struct cifs_sb_info *, const unsigned char *,
char *, unsigned int *);
- /* if we can do cache read operations */
- bool (*is_read_op)(__u32);
- /* set oplock level for the inode */
- void (*set_oplock_level)(struct cifsInodeInfo *, __u32, unsigned int,
- bool *);
- /* create lease context buffer for CREATE request */
- char * (*create_lease_buf)(u8 *lease_key, u8 oplock);
- /* parse lease context buffer and return oplock/epoch info */
- __u8 (*parse_lease_buf)(void *buf, unsigned int *epoch, char *lkey);
- ssize_t (*copychunk_range)(const unsigned int,
+/* if we can do cache read operations */
+extern bool smb21_is_read_op(__u32);
+extern ssize_t copychunk_range)(const unsigned int,
struct cifsFileInfo *src_file,
struct cifsFileInfo *target_file,
u64 src_off, u64 len, u64 dest_off);
- int (*duplicate_extents)(const unsigned int, struct cifsFileInfo *src,
- struct cifsFileInfo *target_file, u64 src_off, u64 len,
- u64 dest_off);
- int (*validate_negotiate)(const unsigned int, struct cifs_tcon *);
- ssize_t (*query_all_EAs)(const unsigned int, struct cifs_tcon *,
+extern ssize_t smb2_query_eas(const unsigned int, struct cifs_tcon *,
const unsigned char *, const unsigned char *, char *,
size_t, struct cifs_sb_info *);
- int (*set_EA)(const unsigned int, struct cifs_tcon *, const char *,
+extern int smb2_set_ea(const unsigned int, struct cifs_tcon *, const char *,
const char *, const void *, const __u16,
const struct nls_table *, struct cifs_sb_info *);
- struct cifs_ntsd * (*get_acl)(struct cifs_sb_info *, struct inode *,
+extern struct cifs_ntsd * get_smb2_acl(struct cifs_sb_info *, struct inode *,
const char *, u32 *, u32);
- struct cifs_ntsd * (*get_acl_by_fid)(struct cifs_sb_info *,
+extern struct cifs_ntsd * get_smb2_acl_by_fid(struct cifs_sb_info *,
const struct cifs_fid *, u32 *, u32);
- int (*set_acl)(struct cifs_ntsd *, __u32, struct inode *, const char *,
+extern int set_smb2_acl(struct cifs_ntsd *, __u32, struct inode *, const char *,
int);
/* writepages retry size */
- unsigned int (*wp_retry_size)(struct inode *);
- /* get mtu credits */
- int (*wait_mtu_credits)(struct TCP_Server_Info *, size_t,
- size_t *, struct cifs_credits *);
- /* adjust previously taken mtu credits to request size */
- int (*adjust_credits)(struct TCP_Server_Info *server,
- struct cifs_io_subrequest *subreq,
- unsigned int /*enum smb3_rw_credits_trace*/ trace);
+extern unsigned int smb2_wp_retry_size(struct inode *);
/* check if we need to issue closedir */
- bool (*dir_needs_close)(struct cifsFileInfo *);
- long (*fallocate)(struct file *, struct cifs_tcon *, int, loff_t,
- loff_t);
- /* init transform request - used for encryption for now */
- int (*init_transform_rq)(struct TCP_Server_Info *, int num_rqst,
- struct smb_rqst *, struct smb_rqst *);
- int (*is_transform_hdr)(void *buf);
- int (*receive_transform)(struct TCP_Server_Info *,
- struct mid_q_entry **, char **, int *);
- enum securityEnum (*select_sectype)(struct TCP_Server_Info *,
+extern bool smb2_dir_needs_close(struct cifsFileInfo *);
+extern enum securityEnum smb2_select_sectype(struct TCP_Server_Info *,
enum securityEnum);
- int (*next_header)(struct TCP_Server_Info *server, char *buf,
+extern int smb2_next_header(struct TCP_Server_Info *server, char *buf,
unsigned int *noff);
- /* ioctl passthrough for query_info */
- int (*ioctl_query_info)(const unsigned int xid,
+/* ioctl passthrough for query_info */
+extern int smb2_ioctl_query_info(const unsigned int xid,
struct cifs_tcon *tcon,
struct cifs_sb_info *cifs_sb,
__le16 *path, int is_dir,
unsigned long p);
- /* make unix special files (block, char, fifo, socket) */
- int (*make_node)(unsigned int xid,
+/* make unix special files (block, char, fifo, socket) */
+extern int smb2_make_node(unsigned int xid,
struct inode *inode,
struct dentry *dentry,
struct cifs_tcon *tcon,
const char *full_path,
umode_t mode,
dev_t device_number);
- /* version specific fiemap implementation */
- int (*fiemap)(struct cifs_tcon *tcon, struct cifsFileInfo *,
+/* version specific fiemap implementation */
+extern int smb3_fiemap(struct cifs_tcon *tcon, struct cifsFileInfo *,
struct fiemap_extent_info *, u64, u64);
- /* version specific llseek implementation */
- loff_t (*llseek)(struct file *, struct cifs_tcon *, loff_t, int);
- /* Check for STATUS_IO_TIMEOUT */
- bool (*is_status_io_timeout)(char *buf);
- /* Check for STATUS_NETWORK_NAME_DELETED */
- bool (*is_network_name_deleted)(char *buf, struct TCP_Server_Info *srv);
- int (*parse_reparse_point)(struct cifs_sb_info *cifs_sb,
+/* version specific llseek implementation */
+extern loff_t smb3_llseek(struct file *, struct cifs_tcon *, loff_t, int);
+
+/* Check for STATUS_IO_TIMEOUT */
+extern bool smb2_is_status_io_timeout(char *buf);
+
+/* Check for STATUS_NETWORK_NAME_DELETED */
+extern bool smb2_is_network_name_deleted(char *buf, struct TCP_Server_Info *srv);
+
+extern int smb2_parse_reparse_point(struct cifs_sb_info *cifs_sb,
struct kvec *rsp_iov,
struct cifs_open_info_data *data);
- int (*create_reparse_symlink)(const unsigned int xid,
+extern int smb2_create_reparse_symlink(const unsigned int xid,
struct inode *inode,
struct dentry *dentry,
struct cifs_tcon *tcon,
const char *full_path,
const char *symname);
+
+struct smb_version_operations {
+ /* find mid corresponding to the response message */
+ void (*dump_share_caps)(struct seq_file *, struct cifs_tcon *);
+ /* verify the message */
+ void (*downgrade_oplock)(struct TCP_Server_Info *server,
+ struct cifsInodeInfo *cinode, __u32 oplock,
+ unsigned int epoch, bool *purge_cache);
+ /* set negotiated write size */
+ unsigned int (*negotiate_wsize)(struct cifs_tcon *tcon, struct smb3_fs_context *ctx);
+ /* set negotiated read size */
+ unsigned int (*negotiate_rsize)(struct cifs_tcon *tcon, struct smb3_fs_context *ctx);
+ /* informational QFS call */
+ void (*qfs_tcon)(const unsigned int, struct cifs_tcon *,
+ struct cifs_sb_info *);
+ /* query for server interfaces */
+ int (*query_server_interfaces)(const unsigned int, struct cifs_tcon *,
+ bool);
+ /* create directory */
+ int (*posix_mkdir)(const unsigned int xid, struct inode *inode,
+ umode_t mode, struct cifs_tcon *tcon,
+ const char *full_path,
+ struct cifs_sb_info *cifs_sb); /* send create hardlink request */
+ /* close a file, returning file attributes and timestamps */
+ int (*close_getattr)(const unsigned int xid, struct cifs_tcon *tcon,
+ struct cifsFileInfo *pfile_info);
+ /* query remote filesystem */
+ int (*queryfs)(const unsigned int, struct cifs_tcon *,
+ const char *, struct cifs_sb_info *, struct kstatfs *);
+ int (*generate_signingkey)(struct cifs_ses *ses,
+ struct TCP_Server_Info *server);
+ int (*calc_signature)(struct smb_rqst *, struct TCP_Server_Info *,
+ bool allocate_crypto);
+ int (*set_integrity)(const unsigned int, struct cifs_tcon *tcon,
+ struct cifsFileInfo *src_file);
+ /* set oplock level for the inode */
+ void (*set_oplock_level)(struct cifsInodeInfo *, __u32, unsigned int,
+ bool *);
+ /* create lease context buffer for CREATE request */
+ char * (*create_lease_buf)(u8 *lease_key, u8 oplock);
+ /* parse lease context buffer and return oplock/epoch info */
+ __u8 (*parse_lease_buf)(void *buf, unsigned int *epoch, char *lkey);
+ int (*duplicate_extents)(const unsigned int, struct cifsFileInfo *src,
+ struct cifsFileInfo *target_file, u64 src_off, u64 len,
+ u64 dest_off);
+ int (*validate_negotiate)(const unsigned int, struct cifs_tcon *);
+ long (*fallocate)(struct file *, struct cifs_tcon *, int, loff_t,
+ loff_t);
+ /* init transform request - used for encryption for now */
+ int (*init_transform_rq)(struct TCP_Server_Info *, int num_rqst,
+ struct smb_rqst *, struct smb_rqst *);
+ int (*is_transform_hdr)(void *buf);
+ int (*receive_transform)(struct TCP_Server_Info *,
+ struct mid_q_entry **, char **, int *);
};
struct smb_version_values {
@@ -873,7 +821,7 @@ static inline void
add_credits(struct TCP_Server_Info *server, struct cifs_credits *credits,
const int optype)
{
- server->ops->add_credits(server, credits, optype);
+ smb2_add_credits(server, credits, optype);
}
static inline void
@@ -881,36 +829,29 @@ add_credits_and_wake_if(struct TCP_Server_Info *server,
struct cifs_credits *credits, const int optype)
{
if (credits->value) {
- server->ops->add_credits(server, credits, optype);
+ smb2_add_credits(server, credits, optype);
wake_up(&server->request_q);
credits->value = 0;
}
}
-static inline void
-set_credits(struct TCP_Server_Info *server, const int val)
-{
- server->ops->set_credits(server, val);
-}
-
static inline int
adjust_credits(struct TCP_Server_Info *server, struct cifs_io_subrequest *subreq,
unsigned int /* enum smb3_rw_credits_trace */ trace)
{
- return server->ops->adjust_credits ?
- server->ops->adjust_credits(server, subreq, trace) : 0;
+ return smb2_adjust_credits(server, subreq, trace) : 0;
}
static inline __le64
get_next_mid64(struct TCP_Server_Info *server)
{
- return cpu_to_le64(server->ops->get_next_mid(server));
+ return cpu_to_le64(smb2_get_next_mid(server));
}
static inline __le16
get_next_mid(struct TCP_Server_Info *server)
{
- __u16 mid = server->ops->get_next_mid(server);
+ __u16 mid = smb2_get_next_mid(server);
/*
* The value in the SMB header should be little endian for easy
* on-the-wire decoding.
@@ -919,19 +860,12 @@ get_next_mid(struct TCP_Server_Info *server)
}
static inline void
-revert_current_mid(struct TCP_Server_Info *server, const unsigned int val)
-{
- if (server->ops->revert_current_mid)
- server->ops->revert_current_mid(server, val);
-}
-
-static inline void
revert_current_mid_from_hdr(struct TCP_Server_Info *server,
const struct smb2_hdr *shdr)
{
unsigned int num = le16_to_cpu(shdr->CreditCharge);
- return revert_current_mid(server, num > 0 ? num : 1);
+ return smb2_revert_current_mid(server, num > 0 ? num : 1);
}
/*