summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fs/smb/client/cached_dir.c5
-rw-r--r--fs/smb/client/cifs_debug.c12
-rw-r--r--fs/smb/client/cifsacl.c24
-rw-r--r--fs/smb/client/cifsfs.c22
-rw-r--r--fs/smb/client/cifsglob.h478
-rw-r--r--fs/smb/client/connect.c100
-rw-r--r--fs/smb/client/dfs.c15
-rw-r--r--fs/smb/client/dfs_cache.c4
-rw-r--r--fs/smb/client/dir.c32
-rw-r--r--fs/smb/client/file.c97
-rw-r--r--fs/smb/client/inode.c54
-rw-r--r--fs/smb/client/ioctl.c10
-rw-r--r--fs/smb/client/link.c8
-rw-r--r--fs/smb/client/misc.c2
-rw-r--r--fs/smb/client/readdir.c12
-rw-r--r--fs/smb/client/reparse.c8
-rw-r--r--fs/smb/client/smb2inode.c2
-rw-r--r--fs/smb/client/smb2ops.c308
-rw-r--r--fs/smb/client/smb2pdu.c2
-rw-r--r--fs/smb/client/smb2transport.c2
-rw-r--r--fs/smb/client/tmp89
-rw-r--r--fs/smb/client/tmp2292
-rw-r--r--fs/smb/client/tmp3168
-rw-r--r--fs/smb/client/trace.h2
-rw-r--r--fs/smb/client/transport.c24
-rw-r--r--fs/smb/client/xattr.c70
26 files changed, 954 insertions, 888 deletions
diff --git a/fs/smb/client/cached_dir.c b/fs/smb/client/cached_dir.c
index a4c3cad35c41..b41243781921 100644
--- a/fs/smb/client/cached_dir.c
+++ b/fs/smb/client/cached_dir.c
@@ -162,9 +162,6 @@ replay_again:
oplock = SMB2_OPLOCK_LEVEL_II;
server = cifs_pick_channel(ses);
- if (!server->ops->new_lease_key)
- return -EIO;
-
utf16_path = cifs_convert_path_to_utf16(path, cifs_sb);
if (!utf16_path)
return -ENOMEM;
@@ -223,7 +220,7 @@ replay_again:
flags |= CIFS_TRANSFORM_REQ;
pfid = &cfid->fid;
- server->ops->new_lease_key(pfid);
+ smb2_new_lease_key(pfid);
memset(rqst, 0, sizeof(rqst));
resp_buftype[0] = resp_buftype[1] = CIFS_NO_BUFFER;
diff --git a/fs/smb/client/cifs_debug.c b/fs/smb/client/cifs_debug.c
index 5f2b15e24bd9..f78e197327b5 100644
--- a/fs/smb/client/cifs_debug.c
+++ b/fs/smb/client/cifs_debug.c
@@ -44,9 +44,9 @@ static void cifs_dump_detail(void *buf, struct TCP_Server_Info *server)
smb->Command, smb->Status, smb->Flags, smb->MessageId, smb->Id.SyncId.ProcessId,
smb->StructureSize);
- if (!server->ops->check_message(buf, server->total_read, server)) {
+ if (!smb2_check_message(buf, server->total_read, server)) {
cifs_dbg(VFS, "smb buf %p len %u\n", smb,
- server->ops->calc_smb_size(smb));
+ smb2_calc_smb_size(smb));
}
#endif /* CONFIG_CIFS_DEBUG2 */
}
@@ -510,7 +510,7 @@ skip_rdma:
spin_unlock(&ses->ses_lock);
seq_printf(m, "\n\tSecurity type: %s ",
- get_security_type_str(server->ops->select_sectype(server, ses->sectype)));
+ get_security_type_str(smb2_select_sectype(server, ses->sectype)));
/* dump session id helpful for use with network trace */
seq_printf(m, " SessionId: 0x%llx", ses->Suid);
@@ -682,8 +682,7 @@ static ssize_t cifs_stats_proc_write(struct file *file,
tcon->bytes_written = 0;
tcon->stats_from_time = ktime_get_real_seconds();
spin_unlock(&tcon->stat_lock);
- if (server->ops->clear_stats)
- server->ops->clear_stats(tcon);
+ smb2_clear_stats(tcon);
}
}
}
@@ -764,8 +763,7 @@ static int cifs_stats_proc_show(struct seq_file *m, void *v)
seq_printf(m, "\nSMBs: %d since %ptTs UTC",
atomic_read(&tcon->num_smbs_sent),
&tcon->stats_from_time);
- if (server->ops->print_stats)
- server->ops->print_stats(m, tcon);
+ smb2_print_stats(m, tcon);
}
}
}
diff --git a/fs/smb/client/cifsacl.c b/fs/smb/client/cifsacl.c
index 6164c35ea6b8..114dd27ee918 100644
--- a/fs/smb/client/cifsacl.c
+++ b/fs/smb/client/cifsacl.c
@@ -1395,7 +1395,6 @@ cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr,
u32 acllen = 0;
int rc = 0;
struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
- struct smb_version_operations *ops;
const u32 info = 0;
cifs_dbg(NOISY, "converting ACL to mode for %s\n", path);
@@ -1403,16 +1402,11 @@ cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr,
if (IS_ERR(tlink))
return PTR_ERR(tlink);
- ops = tlink_tcon(tlink)->ses->server->ops;
+ if (pfid)
+ pntsd = get_smb2_acl_by_fid(cifs_sb, pfid, &acllen, info);
+ else
+ pntsd = get_smb2_acl(cifs_sb, inode, path, &acllen, info);
- if (pfid && (ops->get_acl_by_fid))
- pntsd = ops->get_acl_by_fid(cifs_sb, pfid, &acllen, info);
- else if (ops->get_acl)
- pntsd = ops->get_acl(cifs_sb, inode, path, &acllen, info);
- else {
- cifs_put_tlink(tlink);
- return -EOPNOTSUPP;
- }
/* if we can retrieve the ACL, now parse Access Control Entries, ACEs */
if (IS_ERR(pntsd)) {
rc = PTR_ERR(pntsd);
@@ -1448,25 +1442,17 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 *pnmode,
struct cifs_ntsd *pnntsd = NULL; /* modified acl to be sent to server */
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
- struct smb_version_operations *ops;
bool mode_from_sid, id_from_sid;
const u32 info = 0;
if (IS_ERR(tlink))
return PTR_ERR(tlink);
- ops = tlink_tcon(tlink)->ses->server->ops;
-
cifs_dbg(NOISY, "set ACL from mode for %s\n", path);
/* Get the security descriptor */
- if (ops->get_acl == NULL) {
- cifs_put_tlink(tlink);
- return -EOPNOTSUPP;
- }
-
- pntsd = ops->get_acl(cifs_sb, inode, path, &secdesclen, info);
+ pntsd = get_smb2_acl(cifs_sb, inode, path, &secdesclen, info);
if (IS_ERR(pntsd)) {
rc = PTR_ERR(pntsd);
cifs_dbg(VFS, "%s: error %d getting sec desc\n", __func__, rc);
diff --git a/fs/smb/client/cifsfs.c b/fs/smb/client/cifsfs.c
index 49e2e2bf45e6..c6f517099eea 100644
--- a/fs/smb/client/cifsfs.c
+++ b/fs/smb/client/cifsfs.c
@@ -1016,9 +1016,7 @@ static loff_t cifs_llseek(struct file *file, loff_t offset, int whence)
}
if (cfile && cfile->tlink) {
tcon = tlink_tcon(cfile->tlink);
- if (tcon->ses->server->ops->llseek)
- return tcon->ses->server->ops->llseek(file, tcon,
- offset, whence);
+ return smb3_llseek(file, tcon, offset, whence);
}
return generic_file_llseek(file, offset, whence);
}
@@ -1149,12 +1147,8 @@ static int cifs_precopy_set_eof(struct inode *src_inode, struct cifsInodeInfo *s
writeable_srcfile = find_writable_file(src_cifsi, FIND_WR_FSUID_ONLY);
if (writeable_srcfile) {
- if (src_tcon->ses->server->ops->set_file_size)
- rc = src_tcon->ses->server->ops->set_file_size(
- xid, src_tcon, writeable_srcfile,
- src_inode->i_size, true /* no need to set sparse */);
- else
- rc = -ENOSYS;
+ rc = smb2_set_file_size(xid, src_tcon, writeable_srcfile, src_inode->i_size,
+ true /* no need to set sparse */);
cifsFileInfo_put(writeable_srcfile);
cifs_dbg(FYI, "SetFSize for copychunk rc = %d\n", rc);
}
@@ -1349,10 +1343,6 @@ ssize_t cifs_file_copychunk_range(unsigned int xid,
goto out;
}
- rc = -EOPNOTSUPP;
- if (!target_tcon->ses->server->ops->copychunk_range)
- goto out;
-
/*
* Note: cifs case is easier than btrfs since server responsible for
* checks for proper open modes and file type and if it wants
@@ -1390,8 +1380,7 @@ ssize_t cifs_file_copychunk_range(unsigned int xid,
rc = file_modified(dst_file);
if (!rc) {
- rc = target_tcon->ses->server->ops->copychunk_range(xid,
- smb_file_src, smb_file_target, off, len, destoff);
+ rc = smb2_copychunk_range(xid, smb_file_src, smb_file_target, off, len, destoff);
if (rc > 0 && destoff + rc > i_size_read(target_inode)) {
truncate_setsize(target_inode, destoff + rc);
netfs_resize_file(&target_cifsi->netfs,
@@ -1446,8 +1435,7 @@ static ssize_t cifs_copy_file_range(struct file *src_file, loff_t off,
return rc;
}
- rc = cifs_file_copychunk_range(xid, src_file, off, dst_file, destoff,
- len, flags);
+ rc = cifs_file_copychunk_range(xid, src_file, off, dst_file, destoff, len, flags);
free_xid(xid);
if (rc == -EOPNOTSUPP || rc == -EXDEV)
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);