aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/connect.c
diff options
context:
space:
mode:
authorPavel Shilovsky <piastry@etersoft.ru>2012-05-17 05:25:35 -0400
committerPavel Shilovsky <pshilovsky@samba.org>2012-05-23 04:33:11 -0400
commit8aa26f3ed80ddbaf78804b6481fcfdbd447caa1c (patch)
tree7c0a61eb9711dd93bb5eda33d875fbdd7c20a0e4 /fs/cifs/connect.c
parenteb37871118abfc30629ee2bef11013eddb42c756 (diff)
CIFS: Move protocol specific demultiplex thread calls to ops struct
Acked-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com> Signed-off-by: Pavel Shilovsky <piastry@etersoft.ru> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/connect.c')
-rw-r--r--fs/cifs/connect.c27
1 files changed, 4 insertions, 23 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 65ec6ef0995e..ce033d74f315 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -783,25 +783,6 @@ is_smb_response(struct TCP_Server_Info *server, unsigned char type)
783 return false; 783 return false;
784} 784}
785 785
786static struct mid_q_entry *
787find_mid(struct TCP_Server_Info *server, char *buffer)
788{
789 struct smb_hdr *buf = (struct smb_hdr *)buffer;
790 struct mid_q_entry *mid;
791
792 spin_lock(&GlobalMid_Lock);
793 list_for_each_entry(mid, &server->pending_mid_q, qhead) {
794 if (mid->mid == buf->Mid &&
795 mid->mid_state == MID_REQUEST_SUBMITTED &&
796 le16_to_cpu(mid->command) == buf->Command) {
797 spin_unlock(&GlobalMid_Lock);
798 return mid;
799 }
800 }
801 spin_unlock(&GlobalMid_Lock);
802 return NULL;
803}
804
805void 786void
806dequeue_mid(struct mid_q_entry *mid, bool malformed) 787dequeue_mid(struct mid_q_entry *mid, bool malformed)
807{ 788{
@@ -986,7 +967,7 @@ standard_receive3(struct TCP_Server_Info *server, struct mid_q_entry *mid)
986 * 48 bytes is enough to display the header and a little bit 967 * 48 bytes is enough to display the header and a little bit
987 * into the payload for debugging purposes. 968 * into the payload for debugging purposes.
988 */ 969 */
989 length = checkSMB(buf, server->total_read); 970 length = server->ops->check_message(buf, server->total_read);
990 if (length != 0) 971 if (length != 0)
991 cifs_dump_mem("Bad SMB: ", buf, 972 cifs_dump_mem("Bad SMB: ", buf,
992 min_t(unsigned int, server->total_read, 48)); 973 min_t(unsigned int, server->total_read, 48));
@@ -1059,7 +1040,7 @@ cifs_demultiplex_thread(void *p)
1059 continue; 1040 continue;
1060 server->total_read += length; 1041 server->total_read += length;
1061 1042
1062 mid_entry = find_mid(server, buf); 1043 mid_entry = server->ops->find_mid(server, buf);
1063 1044
1064 if (!mid_entry || !mid_entry->receive) 1045 if (!mid_entry || !mid_entry->receive)
1065 length = standard_receive3(server, mid_entry); 1046 length = standard_receive3(server, mid_entry);
@@ -1076,13 +1057,13 @@ cifs_demultiplex_thread(void *p)
1076 if (mid_entry != NULL) { 1057 if (mid_entry != NULL) {
1077 if (!mid_entry->multiRsp || mid_entry->multiEnd) 1058 if (!mid_entry->multiRsp || mid_entry->multiEnd)
1078 mid_entry->callback(mid_entry); 1059 mid_entry->callback(mid_entry);
1079 } else if (!is_valid_oplock_break(buf, server)) { 1060 } else if (!server->ops->is_oplock_break(buf, server)) {
1080 cERROR(1, "No task to wake, unknown frame received! " 1061 cERROR(1, "No task to wake, unknown frame received! "
1081 "NumMids %d", atomic_read(&midCount)); 1062 "NumMids %d", atomic_read(&midCount));
1082 cifs_dump_mem("Received Data is: ", buf, 1063 cifs_dump_mem("Received Data is: ", buf,
1083 HEADER_SIZE(server)); 1064 HEADER_SIZE(server));
1084#ifdef CONFIG_CIFS_DEBUG2 1065#ifdef CONFIG_CIFS_DEBUG2
1085 cifs_dump_detail(buf); 1066 server->ops->dump_detail(buf);
1086 cifs_dump_mids(server); 1067 cifs_dump_mids(server);
1087#endif /* CIFS_DEBUG2 */ 1068#endif /* CIFS_DEBUG2 */
1088 1069