aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve French <smfrench@gmail.com>2013-06-19 18:41:10 -0400
committerSteve French <smfrench@gmail.com>2013-06-24 02:56:47 -0400
commitbe7457d388d25e5d2ebba4c7f216b47b5e3d1eef (patch)
tree2fe545ec48c6d35c4c7cdb76e2f391ac78a0c272
parentf43a033d44c3f2f6b153c9c63fff0132f4314f24 (diff)
Update headers to update various SMB3 ioctl definitions
MS-SMB2 Section 2.2.31 lists fsctls. Update our list of valid cifs/smb2/smb3 fsctls and some related structs based on more recent version of docs. Additional detail on less common ones can be found in MS-FSCC section 2.3. CopyChunk (server side copy, ie refcopy) will depend on a few of these Signed-off-by: Steve French <smfrench@gmail.com>
-rw-r--r--fs/cifs/cifspdu.h8
-rw-r--r--fs/cifs/smb2pdu.h48
-rw-r--r--fs/cifs/smbfsctl.h27
3 files changed, 80 insertions, 3 deletions
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h
index 4e6135a39fd1..7e8523c5c18e 100644
--- a/fs/cifs/cifspdu.h
+++ b/fs/cifs/cifspdu.h
@@ -1315,6 +1315,14 @@ typedef struct smb_com_ntransact_rsp {
1315 /* parms and data follow */ 1315 /* parms and data follow */
1316} __attribute__((packed)) NTRANSACT_RSP; 1316} __attribute__((packed)) NTRANSACT_RSP;
1317 1317
1318/* See MS-SMB 2.2.7.2.1.1 */
1319struct srv_copychunk {
1320 __le64 SourceOffset;
1321 __le64 DestinationOffset;
1322 __le32 CopyLength;
1323 __u32 Reserved;
1324} __packed;
1325
1318typedef struct smb_com_transaction_ioctl_req { 1326typedef struct smb_com_transaction_ioctl_req {
1319 struct smb_hdr hdr; /* wct = 23 */ 1327 struct smb_hdr hdr; /* wct = 23 */
1320 __u8 MaxSetupCount; 1328 __u8 MaxSetupCount;
diff --git a/fs/cifs/smb2pdu.h b/fs/cifs/smb2pdu.h
index e27ad39f2bde..d351377d2513 100644
--- a/fs/cifs/smb2pdu.h
+++ b/fs/cifs/smb2pdu.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * fs/cifs/smb2pdu.h 2 * fs/cifs/smb2pdu.h
3 * 3 *
4 * Copyright (c) International Business Machines Corp., 2009, 2010 4 * Copyright (c) International Business Machines Corp., 2009, 2013
5 * Etersoft, 2012 5 * Etersoft, 2012
6 * Author(s): Steve French (sfrench@us.ibm.com) 6 * Author(s): Steve French (sfrench@us.ibm.com)
7 * Pavel Shilovsky (pshilovsky@samba.org) 2012 7 * Pavel Shilovsky (pshilovsky@samba.org) 2012
@@ -482,6 +482,52 @@ struct create_lease {
482 struct lease_context lcontext; 482 struct lease_context lcontext;
483} __packed; 483} __packed;
484 484
485/* this goes in the ioctl buffer when doing a copychunk request */
486struct copychunk_ioctl {
487 char SourceKey[24];
488 __le32 ChunkCount; /* we are only sending 1 */
489 __le32 Reserved;
490 /* array will only be one chunk long for us */
491 __le64 SourceOffset;
492 __le64 TargetOffset;
493 __u32 Length; /* how many bytes to copy */
494 __u32 Reserved2;
495} __packed;
496
497struct smb2_ioctl_req {
498 struct smb2_hdr hdr;
499 __le16 StructureSize; /* Must be 57 */
500 __u16 Reserved;
501 __le32 CtlCode;
502 __u64 PersistentFileId; /* opaque endianness */
503 __u64 VolatileFileId; /* opaque endianness */
504 __le32 InputOffset;
505 __le32 InputCount;
506 __le32 MaxInputResponse;
507 __le32 OutputOffset;
508 __le32 OutputCount;
509 __le32 MaxOutputResponse;
510 __le32 Flags;
511 __u32 Reserved2;
512 char Buffer[0];
513} __packed;
514
515struct smb2_ioctl_rsp {
516 struct smb2_hdr hdr;
517 __le16 StructureSize; /* Must be 57 */
518 __u16 Reserved;
519 __le32 CtlCode;
520 __u64 PersistentFileId; /* opaque endianness */
521 __u64 VolatileFileId; /* opaque endianness */
522 __le32 InputOffset;
523 __le32 InputCount;
524 __le32 OutputOffset;
525 __le32 OutputCount;
526 __le32 Flags;
527 __u32 Reserved2;
528 /* char * buffer[] */
529} __packed;
530
485/* Currently defined values for close flags */ 531/* Currently defined values for close flags */
486#define SMB2_CLOSE_FLAG_POSTQUERY_ATTRIB cpu_to_le16(0x0001) 532#define SMB2_CLOSE_FLAG_POSTQUERY_ATTRIB cpu_to_le16(0x0001)
487struct smb2_close_req { 533struct smb2_close_req {
diff --git a/fs/cifs/smbfsctl.h b/fs/cifs/smbfsctl.h
index 7056b891e087..d952ee48f4dc 100644
--- a/fs/cifs/smbfsctl.h
+++ b/fs/cifs/smbfsctl.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * fs/cifs/smbfsctl.h: SMB, CIFS, SMB2 FSCTL definitions 2 * fs/cifs/smbfsctl.h: SMB, CIFS, SMB2 FSCTL definitions
3 * 3 *
4 * Copyright (c) International Business Machines Corp., 2002,2009 4 * Copyright (c) International Business Machines Corp., 2002,2013
5 * Author(s): Steve French (sfrench@us.ibm.com) 5 * Author(s): Steve French (sfrench@us.ibm.com)
6 * 6 *
7 * This library is free software; you can redistribute it and/or modify 7 * This library is free software; you can redistribute it and/or modify
@@ -22,7 +22,7 @@
22/* IOCTL information */ 22/* IOCTL information */
23/* 23/*
24 * List of ioctl/fsctl function codes that are or could be useful in the 24 * List of ioctl/fsctl function codes that are or could be useful in the
25 * future to remote clients like cifs or SMB2 client. There is probably 25 * future to remote clients like cifs or SMB2/SMB3 client. This is probably
26 * a slightly larger set of fsctls that NTFS local filesystem could handle, 26 * a slightly larger set of fsctls that NTFS local filesystem could handle,
27 * including the seven below that we do not have struct definitions for. 27 * including the seven below that we do not have struct definitions for.
28 * Even with protocol definitions for most of these now available, we still 28 * Even with protocol definitions for most of these now available, we still
@@ -30,7 +30,13 @@
30 * remotely. Some of the following, such as the encryption/compression ones 30 * remotely. Some of the following, such as the encryption/compression ones
31 * could be invoked from tools via a specialized hook into the VFS rather 31 * could be invoked from tools via a specialized hook into the VFS rather
32 * than via the standard vfs entry points 32 * than via the standard vfs entry points
33 *
34 * See MS-SMB2 Section 2.2.31 (last checked June 2013, all of that list are
35 * below). Additional detail on less common ones can be found in MS-FSCC
36 * section 2.3.
33 */ 37 */
38#define FSCTL_DFS_GET_REFERRALS 0x00060194
39#define FSCTL_DFS_GET_REFERRALS_EX 0x000601B0
34#define FSCTL_REQUEST_OPLOCK_LEVEL_1 0x00090000 40#define FSCTL_REQUEST_OPLOCK_LEVEL_1 0x00090000
35#define FSCTL_REQUEST_OPLOCK_LEVEL_2 0x00090004 41#define FSCTL_REQUEST_OPLOCK_LEVEL_2 0x00090004
36#define FSCTL_REQUEST_BATCH_OPLOCK 0x00090008 42#define FSCTL_REQUEST_BATCH_OPLOCK 0x00090008
@@ -71,14 +77,31 @@
71#define FSCTL_SET_SHORT_NAME_BEHAVIOR 0x000901B4 /* BB add struct */ 77#define FSCTL_SET_SHORT_NAME_BEHAVIOR 0x000901B4 /* BB add struct */
72#define FSCTL_QUERY_ALLOCATED_RANGES 0x000940CF /* BB add struct */ 78#define FSCTL_QUERY_ALLOCATED_RANGES 0x000940CF /* BB add struct */
73#define FSCTL_SET_DEFECT_MANAGEMENT 0x00098134 /* BB add struct */ 79#define FSCTL_SET_DEFECT_MANAGEMENT 0x00098134 /* BB add struct */
80#define FSCTL_FILE_LEVEL_TRIM 0x00098208 /* BB add struct */
74#define FSCTL_SIS_LINK_FILES 0x0009C104 81#define FSCTL_SIS_LINK_FILES 0x0009C104
75#define FSCTL_PIPE_PEEK 0x0011400C /* BB add struct */ 82#define FSCTL_PIPE_PEEK 0x0011400C /* BB add struct */
76#define FSCTL_PIPE_TRANSCEIVE 0x0011C017 /* BB add struct */ 83#define FSCTL_PIPE_TRANSCEIVE 0x0011C017 /* BB add struct */
77/* strange that the number for this op is not sequential with previous op */ 84/* strange that the number for this op is not sequential with previous op */
78#define FSCTL_PIPE_WAIT 0x00110018 /* BB add struct */ 85#define FSCTL_PIPE_WAIT 0x00110018 /* BB add struct */
86/* Enumerate previous versions of a file */
87#define FSCTL_SRV_ENUMERATE_SNAPSHOTS 0x00144064
88/* Retrieve an opaque file reference for server-side data movement ie copy */
89#define FSCTL_SRV_REQUEST_RESUME_KEY 0x00140078
90#define FSCTL_LMR_REQUEST_RESILIENCY 0x001401D4 /* BB add struct */
79#define FSCTL_LMR_GET_LINK_TRACK_INF 0x001400E8 /* BB add struct */ 91#define FSCTL_LMR_GET_LINK_TRACK_INF 0x001400E8 /* BB add struct */
80#define FSCTL_LMR_SET_LINK_TRACK_INF 0x001400EC /* BB add struct */ 92#define FSCTL_LMR_SET_LINK_TRACK_INF 0x001400EC /* BB add struct */
93#define FSCTL_VALIDATE_NEGOTIATE_INFO 0x00140204 /* BB add struct */
94/* Perform server-side data movement */
95#define FSCTL_SRV_COPYCHUNK 0x001440F2
96#define FSCTL_SRV_COPYCHUNK_WRITE 0x001480F2
97#define FSCTL_QUERY_NETWORK_INTERFACE_INFO 0x001401FC /* BB add struct */
98#define FSCTL_SRV_READ_HASH 0x001441BB /* BB add struct */
81 99
82#define IO_REPARSE_TAG_MOUNT_POINT 0xA0000003 100#define IO_REPARSE_TAG_MOUNT_POINT 0xA0000003
83#define IO_REPARSE_TAG_HSM 0xC0000004 101#define IO_REPARSE_TAG_HSM 0xC0000004
84#define IO_REPARSE_TAG_SIS 0x80000007 102#define IO_REPARSE_TAG_SIS 0x80000007
103
104/* fsctl flags */
105/* If Flags is set to this value, the request is an FSCTL not ioctl request */
106#define SMB2_0_IOCTL_IS_FSCTL 0x00000001
107