Commit 082d0642c61fc309ca7f6133968ba1264193dcc1
Committed by
Pavel Shilovsky
1 parent
2608bee744
Exists in
master
and in
20 other branches
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>
Showing 4 changed files with 15 additions and 3 deletions Side-by-side Diff
fs/cifs/cifsglob.h
... | ... | @@ -157,11 +157,18 @@ |
157 | 157 | struct mid_q_entry; |
158 | 158 | struct TCP_Server_Info; |
159 | 159 | struct cifsFileInfo; |
160 | +struct cifs_ses; | |
160 | 161 | |
161 | 162 | struct smb_version_operations { |
162 | 163 | int (*send_cancel)(struct TCP_Server_Info *, void *, |
163 | 164 | struct mid_q_entry *); |
164 | 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 | |
167 | 174 | struct smb_version_values { |
fs/cifs/cifsproto.h
... | ... | @@ -78,6 +78,8 @@ |
78 | 78 | int * /* bytes returned */ , const int long_op); |
79 | 79 | extern int SendReceiveNoRsp(const unsigned int xid, struct cifs_ses *ses, |
80 | 80 | char *in_buf, int flags); |
81 | +extern int cifs_setup_request(struct cifs_ses *, struct kvec *, unsigned int, | |
82 | + struct mid_q_entry **); | |
81 | 83 | extern int cifs_check_receive(struct mid_q_entry *mid, |
82 | 84 | struct TCP_Server_Info *server, bool log_error); |
83 | 85 | extern int SendReceive2(const unsigned int /* xid */ , struct cifs_ses *, |
fs/cifs/smb1ops.c
... | ... | @@ -69,6 +69,8 @@ |
69 | 69 | struct smb_version_operations smb1_operations = { |
70 | 70 | .send_cancel = send_nt_cancel, |
71 | 71 | .compare_fids = cifs_compare_fids, |
72 | + .setup_request = cifs_setup_request, | |
73 | + .check_receive = cifs_check_receive, | |
72 | 74 | }; |
73 | 75 | |
74 | 76 | struct smb_version_values smb1_values = { |
fs/cifs/transport.c
... | ... | @@ -514,7 +514,7 @@ |
514 | 514 | return map_smb_to_linux_error(mid->resp_buf, log_error); |
515 | 515 | } |
516 | 516 | |
517 | -static int | |
517 | +int | |
518 | 518 | cifs_setup_request(struct cifs_ses *ses, struct kvec *iov, |
519 | 519 | unsigned int nvec, struct mid_q_entry **ret_mid) |
520 | 520 | { |
... | ... | @@ -577,7 +577,7 @@ |
577 | 577 | |
578 | 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 | 581 | if (rc) { |
582 | 582 | mutex_unlock(&ses->server->srv_mutex); |
583 | 583 | cifs_small_buf_release(buf); |
... | ... | @@ -640,7 +640,8 @@ |
640 | 640 | else |
641 | 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 | 646 | /* mark it so buf will not be freed by delete_mid */ |
646 | 647 | if ((flags & CIFS_NO_RESP) == 0) |