diff options
author | Pavel Shilovsky <piastryyy@gmail.com> | 2011-06-08 07:51:07 -0400 |
---|---|---|
committer | Pavel Shilovsky <pshilovsky@samba.org> | 2012-07-24 13:54:52 -0400 |
commit | 093b2bdad3221e3fae3c26d89387e7297a157664 (patch) | |
tree | 13f5d345c587b96e7890da13d0a8d1a4c6ab87c5 /fs/cifs/smb2ops.c | |
parent | 4b1241006c337f57745b0fc2f17b24f8009ca82d (diff) |
CIFS: Make demultiplex_thread work with SMB2 code
Now we can process SMB2 messages: check message, get message id
and wakeup awaiting routines.
Signed-off-by: Pavel Shilovsky <piastryyy@gmail.com>
Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs/smb2ops.c')
-rw-r--r-- | fs/cifs/smb2ops.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 67a05984cd41..c6f81541a635 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c | |||
@@ -107,6 +107,38 @@ smb2_get_next_mid(struct TCP_Server_Info *server) | |||
107 | return mid; | 107 | return mid; |
108 | } | 108 | } |
109 | 109 | ||
110 | static struct mid_q_entry * | ||
111 | smb2_find_mid(struct TCP_Server_Info *server, char *buf) | ||
112 | { | ||
113 | struct mid_q_entry *mid; | ||
114 | struct smb2_hdr *hdr = (struct smb2_hdr *)buf; | ||
115 | |||
116 | spin_lock(&GlobalMid_Lock); | ||
117 | list_for_each_entry(mid, &server->pending_mid_q, qhead) { | ||
118 | if ((mid->mid == hdr->MessageId) && | ||
119 | (mid->mid_state == MID_REQUEST_SUBMITTED) && | ||
120 | (mid->command == hdr->Command)) { | ||
121 | spin_unlock(&GlobalMid_Lock); | ||
122 | return mid; | ||
123 | } | ||
124 | } | ||
125 | spin_unlock(&GlobalMid_Lock); | ||
126 | return NULL; | ||
127 | } | ||
128 | |||
129 | static void | ||
130 | smb2_dump_detail(void *buf) | ||
131 | { | ||
132 | #ifdef CONFIG_CIFS_DEBUG2 | ||
133 | struct smb2_hdr *smb = (struct smb2_hdr *)buf; | ||
134 | |||
135 | cERROR(1, "Cmd: %d Err: 0x%x Flags: 0x%x Mid: %llu Pid: %d", | ||
136 | smb->Command, smb->Status, smb->Flags, smb->MessageId, | ||
137 | smb->ProcessId); | ||
138 | cERROR(1, "smb buf %p len %u", smb, smb2_calc_size(smb)); | ||
139 | #endif | ||
140 | } | ||
141 | |||
110 | struct smb_version_operations smb21_operations = { | 142 | struct smb_version_operations smb21_operations = { |
111 | .setup_request = smb2_setup_request, | 143 | .setup_request = smb2_setup_request, |
112 | .check_receive = smb2_check_receive, | 144 | .check_receive = smb2_check_receive, |
@@ -115,9 +147,14 @@ struct smb_version_operations smb21_operations = { | |||
115 | .get_credits_field = smb2_get_credits_field, | 147 | .get_credits_field = smb2_get_credits_field, |
116 | .get_credits = smb2_get_credits, | 148 | .get_credits = smb2_get_credits, |
117 | .get_next_mid = smb2_get_next_mid, | 149 | .get_next_mid = smb2_get_next_mid, |
150 | .find_mid = smb2_find_mid, | ||
151 | .check_message = smb2_check_message, | ||
152 | .dump_detail = smb2_dump_detail, | ||
118 | }; | 153 | }; |
119 | 154 | ||
120 | struct smb_version_values smb21_values = { | 155 | struct smb_version_values smb21_values = { |
121 | .version_string = SMB21_VERSION_STRING, | 156 | .version_string = SMB21_VERSION_STRING, |
157 | .header_size = sizeof(struct smb2_hdr), | ||
158 | .max_header_size = MAX_SMB2_HDR_SIZE, | ||
122 | .lock_cmd = SMB2_LOCK, | 159 | .lock_cmd = SMB2_LOCK, |
123 | }; | 160 | }; |