aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorPavel Shilovsky <piastry@etersoft.ru>2012-05-17 04:18:21 -0400
committerPavel Shilovsky <pshilovsky@samba.org>2012-05-23 04:32:57 -0400
commit082d0642c61fc309ca7f6133968ba1264193dcc1 (patch)
tree4a41e9ff5f3effd2672811b445ee231c32b08c36 /fs
parent2608bee744a92d60d15ff4e6e0b913d8b406aedd (diff)
CIFS: Move protocol specific part from SendReceive2 to ops struct
Acked-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com> Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Pavel Shilovsky <piastry@etersoft.ru> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/cifsglob.h7
-rw-r--r--fs/cifs/cifsproto.h2
-rw-r--r--fs/cifs/smb1ops.c2
-rw-r--r--fs/cifs/transport.c7
4 files changed, 15 insertions, 3 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index b6e97f8586d2..5b108382902a 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -157,11 +157,18 @@ enum smb_version {
157struct mid_q_entry; 157struct mid_q_entry;
158struct TCP_Server_Info; 158struct TCP_Server_Info;
159struct cifsFileInfo; 159struct cifsFileInfo;
160struct cifs_ses;
160 161
161struct smb_version_operations { 162struct smb_version_operations {
162 int (*send_cancel)(struct TCP_Server_Info *, void *, 163 int (*send_cancel)(struct TCP_Server_Info *, void *,
163 struct mid_q_entry *); 164 struct mid_q_entry *);
164 bool (*compare_fids)(struct cifsFileInfo *, struct cifsFileInfo *); 165 bool (*compare_fids)(struct cifsFileInfo *, struct cifsFileInfo *);
166 /* setup request: allocate mid, sign message */
167 int (*setup_request)(struct cifs_ses *, struct kvec *, unsigned int,
168 struct mid_q_entry **);
169 /* check response: verify signature, map error */
170 int (*check_receive)(struct mid_q_entry *, struct TCP_Server_Info *,
171 bool);
165}; 172};
166 173
167struct smb_version_values { 174struct smb_version_values {
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
index 0a3fa960b84d..57af64220747 100644
--- a/fs/cifs/cifsproto.h
+++ b/fs/cifs/cifsproto.h
@@ -78,6 +78,8 @@ extern int SendReceive(const unsigned int /* xid */ , struct cifs_ses *,
78 int * /* bytes returned */ , const int long_op); 78 int * /* bytes returned */ , const int long_op);
79extern int SendReceiveNoRsp(const unsigned int xid, struct cifs_ses *ses, 79extern int SendReceiveNoRsp(const unsigned int xid, struct cifs_ses *ses,
80 char *in_buf, int flags); 80 char *in_buf, int flags);
81extern int cifs_setup_request(struct cifs_ses *, struct kvec *, unsigned int,
82 struct mid_q_entry **);
81extern int cifs_check_receive(struct mid_q_entry *mid, 83extern int cifs_check_receive(struct mid_q_entry *mid,
82 struct TCP_Server_Info *server, bool log_error); 84 struct TCP_Server_Info *server, bool log_error);
83extern int SendReceive2(const unsigned int /* xid */ , struct cifs_ses *, 85extern int SendReceive2(const unsigned int /* xid */ , struct cifs_ses *,
diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c
index ce27f8698b20..9cf76e89745f 100644
--- a/fs/cifs/smb1ops.c
+++ b/fs/cifs/smb1ops.c
@@ -69,6 +69,8 @@ cifs_compare_fids(struct cifsFileInfo *ob1, struct cifsFileInfo *ob2)
69struct smb_version_operations smb1_operations = { 69struct smb_version_operations smb1_operations = {
70 .send_cancel = send_nt_cancel, 70 .send_cancel = send_nt_cancel,
71 .compare_fids = cifs_compare_fids, 71 .compare_fids = cifs_compare_fids,
72 .setup_request = cifs_setup_request,
73 .check_receive = cifs_check_receive,
72}; 74};
73 75
74struct smb_version_values smb1_values = { 76struct smb_version_values smb1_values = {
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 269a5a7e0030..87bd998cfbec 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -514,7 +514,7 @@ cifs_check_receive(struct mid_q_entry *mid, struct TCP_Server_Info *server,
514 return map_smb_to_linux_error(mid->resp_buf, log_error); 514 return map_smb_to_linux_error(mid->resp_buf, log_error);
515} 515}
516 516
517static int 517int
518cifs_setup_request(struct cifs_ses *ses, struct kvec *iov, 518cifs_setup_request(struct cifs_ses *ses, struct kvec *iov,
519 unsigned int nvec, struct mid_q_entry **ret_mid) 519 unsigned int nvec, struct mid_q_entry **ret_mid)
520{ 520{
@@ -577,7 +577,7 @@ SendReceive2(const unsigned int xid, struct cifs_ses *ses,
577 577
578 mutex_lock(&ses->server->srv_mutex); 578 mutex_lock(&ses->server->srv_mutex);
579 579
580 rc = cifs_setup_request(ses, iov, n_vec, &midQ); 580 rc = ses->server->ops->setup_request(ses, iov, n_vec, &midQ);
581 if (rc) { 581 if (rc) {
582 mutex_unlock(&ses->server->srv_mutex); 582 mutex_unlock(&ses->server->srv_mutex);
583 cifs_small_buf_release(buf); 583 cifs_small_buf_release(buf);
@@ -640,7 +640,8 @@ SendReceive2(const unsigned int xid, struct cifs_ses *ses,
640 else 640 else
641 *pRespBufType = CIFS_SMALL_BUFFER; 641 *pRespBufType = CIFS_SMALL_BUFFER;
642 642
643 rc = cifs_check_receive(midQ, ses->server, flags & CIFS_LOG_ERROR); 643 rc = ses->server->ops->check_receive(midQ, ses->server,
644 flags & CIFS_LOG_ERROR);
644 645
645 /* mark it so buf will not be freed by delete_mid */ 646 /* mark it so buf will not be freed by delete_mid */
646 if ((flags & CIFS_NO_RESP) == 0) 647 if ((flags & CIFS_NO_RESP) == 0)