aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/smb1ops.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2012-05-15 12:21:10 -0400
committerSteve French <sfrench@us.ibm.com>2012-05-16 21:13:34 -0400
commit121b046af54437b084aa0e4be967ae5aed7528b5 (patch)
tree68acfdb619d160a6b8d6dc03c3c0017b43616961 /fs/cifs/smb1ops.c
parent23db65f511e6ee98ad767833f2ec58b0568ba32b (diff)
cifs: convert send_nt_cancel into a version specific op
For SMB2, this should be a no-op. Obviously if we wanted to do something for the SMB2 case, we could also define an operation here for it. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Pavel Shilovsky <piastry@etersoft.ru>
Diffstat (limited to 'fs/cifs/smb1ops.c')
-rw-r--r--fs/cifs/smb1ops.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c
index d2850d194eb5..fa486f0ca8b2 100644
--- a/fs/cifs/smb1ops.c
+++ b/fs/cifs/smb1ops.c
@@ -18,8 +18,49 @@
18 */ 18 */
19 19
20#include "cifsglob.h" 20#include "cifsglob.h"
21#include "cifsproto.h"
22#include "cifs_debug.h"
23
24/*
25 * An NT cancel request header looks just like the original request except:
26 *
27 * The Command is SMB_COM_NT_CANCEL
28 * The WordCount is zeroed out
29 * The ByteCount is zeroed out
30 *
31 * This function mangles an existing request buffer into a
32 * SMB_COM_NT_CANCEL request and then sends it.
33 */
34static int
35send_nt_cancel(struct TCP_Server_Info *server, void *buf,
36 struct mid_q_entry *mid)
37{
38 int rc = 0;
39 struct smb_hdr *in_buf = (struct smb_hdr *)buf;
40
41 /* -4 for RFC1001 length and +2 for BCC field */
42 in_buf->smb_buf_length = cpu_to_be32(sizeof(struct smb_hdr) - 4 + 2);
43 in_buf->Command = SMB_COM_NT_CANCEL;
44 in_buf->WordCount = 0;
45 put_bcc(0, in_buf);
46
47 mutex_lock(&server->srv_mutex);
48 rc = cifs_sign_smb(in_buf, server, &mid->sequence_number);
49 if (rc) {
50 mutex_unlock(&server->srv_mutex);
51 return rc;
52 }
53 rc = smb_send(server, in_buf, be32_to_cpu(in_buf->smb_buf_length));
54 mutex_unlock(&server->srv_mutex);
55
56 cFYI(1, "issued NT_CANCEL for mid %u, rc = %d",
57 in_buf->Mid, rc);
58
59 return rc;
60}
21 61
22struct smb_version_operations smb1_operations = { 62struct smb_version_operations smb1_operations = {
63 .send_cancel = send_nt_cancel,
23}; 64};
24 65
25struct smb_version_values smb1_values = { 66struct smb_version_values smb1_values = {