original development tree for Linux kernel GTP module; now long in mainline.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1051 lines
32 KiB

  1. /*
  2. * fs/cifs/smb2pdu.h
  3. *
  4. * Copyright (c) International Business Machines Corp., 2009, 2013
  5. * Etersoft, 2012
  6. * Author(s): Steve French (sfrench@us.ibm.com)
  7. * Pavel Shilovsky (pshilovsky@samba.org) 2012
  8. *
  9. * This library is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU Lesser General Public License as published
  11. * by the Free Software Foundation; either version 2.1 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
  17. * the GNU Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public License
  20. * along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  22. */
  23. #ifndef _SMB2PDU_H
  24. #define _SMB2PDU_H
  25. #include <net/sock.h>
  26. /*
  27. * Note that, due to trying to use names similar to the protocol specifications,
  28. * there are many mixed case field names in the structures below. Although
  29. * this does not match typical Linux kernel style, it is necessary to be
  30. * be able to match against the protocol specfication.
  31. *
  32. * SMB2 commands
  33. * Some commands have minimal (wct=0,bcc=0), or uninteresting, responses
  34. * (ie no useful data other than the SMB error code itself) and are marked such.
  35. * Knowing this helps avoid response buffer allocations and copy in some cases.
  36. */
  37. /* List of commands in host endian */
  38. #define SMB2_NEGOTIATE_HE 0x0000
  39. #define SMB2_SESSION_SETUP_HE 0x0001
  40. #define SMB2_LOGOFF_HE 0x0002 /* trivial request/resp */
  41. #define SMB2_TREE_CONNECT_HE 0x0003
  42. #define SMB2_TREE_DISCONNECT_HE 0x0004 /* trivial req/resp */
  43. #define SMB2_CREATE_HE 0x0005
  44. #define SMB2_CLOSE_HE 0x0006
  45. #define SMB2_FLUSH_HE 0x0007 /* trivial resp */
  46. #define SMB2_READ_HE 0x0008
  47. #define SMB2_WRITE_HE 0x0009
  48. #define SMB2_LOCK_HE 0x000A
  49. #define SMB2_IOCTL_HE 0x000B
  50. #define SMB2_CANCEL_HE 0x000C
  51. #define SMB2_ECHO_HE 0x000D
  52. #define SMB2_QUERY_DIRECTORY_HE 0x000E
  53. #define SMB2_CHANGE_NOTIFY_HE 0x000F
  54. #define SMB2_QUERY_INFO_HE 0x0010
  55. #define SMB2_SET_INFO_HE 0x0011
  56. #define SMB2_OPLOCK_BREAK_HE 0x0012
  57. /* The same list in little endian */
  58. #define SMB2_NEGOTIATE cpu_to_le16(SMB2_NEGOTIATE_HE)
  59. #define SMB2_SESSION_SETUP cpu_to_le16(SMB2_SESSION_SETUP_HE)
  60. #define SMB2_LOGOFF cpu_to_le16(SMB2_LOGOFF_HE)
  61. #define SMB2_TREE_CONNECT cpu_to_le16(SMB2_TREE_CONNECT_HE)
  62. #define SMB2_TREE_DISCONNECT cpu_to_le16(SMB2_TREE_DISCONNECT_HE)
  63. #define SMB2_CREATE cpu_to_le16(SMB2_CREATE_HE)
  64. #define SMB2_CLOSE cpu_to_le16(SMB2_CLOSE_HE)
  65. #define SMB2_FLUSH cpu_to_le16(SMB2_FLUSH_HE)
  66. #define SMB2_READ cpu_to_le16(SMB2_READ_HE)
  67. #define SMB2_WRITE cpu_to_le16(SMB2_WRITE_HE)
  68. #define SMB2_LOCK cpu_to_le16(SMB2_LOCK_HE)
  69. #define SMB2_IOCTL cpu_to_le16(SMB2_IOCTL_HE)
  70. #define SMB2_CANCEL cpu_to_le16(SMB2_CANCEL_HE)
  71. #define SMB2_ECHO cpu_to_le16(SMB2_ECHO_HE)
  72. #define SMB2_QUERY_DIRECTORY cpu_to_le16(SMB2_QUERY_DIRECTORY_HE)
  73. #define SMB2_CHANGE_NOTIFY cpu_to_le16(SMB2_CHANGE_NOTIFY_HE)
  74. #define SMB2_QUERY_INFO cpu_to_le16(SMB2_QUERY_INFO_HE)
  75. #define SMB2_SET_INFO cpu_to_le16(SMB2_SET_INFO_HE)
  76. #define SMB2_OPLOCK_BREAK cpu_to_le16(SMB2_OPLOCK_BREAK_HE)
  77. #define NUMBER_OF_SMB2_COMMANDS 0x0013
  78. /* BB FIXME - analyze following length BB */
  79. #define MAX_SMB2_HDR_SIZE 0x78 /* 4 len + 64 hdr + (2*24 wct) + 2 bct + 2 pad */
  80. #define SMB2_PROTO_NUMBER __constant_cpu_to_le32(0x424d53fe)
  81. /*
  82. * SMB2 Header Definition
  83. *
  84. * "MBZ" : Must be Zero
  85. * "BB" : BugBug, Something to check/review/analyze later
  86. * "PDU" : "Protocol Data Unit" (ie a network "frame")
  87. *
  88. */
  89. #define SMB2_HEADER_STRUCTURE_SIZE __constant_cpu_to_le16(64)
  90. struct smb2_hdr {
  91. __be32 smb2_buf_length; /* big endian on wire */
  92. /* length is only two or three bytes - with
  93. one or two byte type preceding it that MBZ */
  94. __u8 ProtocolId[4]; /* 0xFE 'S' 'M' 'B' */
  95. __le16 StructureSize; /* 64 */
  96. __le16 CreditCharge; /* MBZ */
  97. __le32 Status; /* Error from server */
  98. __le16 Command;
  99. __le16 CreditRequest; /* CreditResponse */
  100. __le32 Flags;
  101. __le32 NextCommand;
  102. __u64 MessageId; /* opaque - so can stay little endian */
  103. __le32 ProcessId;
  104. __u32 TreeId; /* opaque - so do not make little endian */
  105. __u64 SessionId; /* opaque - so do not make little endian */
  106. __u8 Signature[16];
  107. } __packed;
  108. struct smb2_pdu {
  109. struct smb2_hdr hdr;
  110. __le16 StructureSize2; /* size of wct area (varies, request specific) */
  111. } __packed;
  112. struct smb2_transform_hdr {
  113. __be32 smb2_buf_length; /* big endian on wire */
  114. /* length is only two or three bytes - with
  115. one or two byte type preceding it that MBZ */
  116. __u8 ProtocolId[4]; /* 0xFD 'S' 'M' 'B' */
  117. __u8 Signature[16];
  118. __u8 Nonce[11];
  119. __u8 Reserved[5];
  120. __le32 OriginalMessageSize;
  121. __u16 Reserved1;
  122. __le16 EncryptionAlgorithm;
  123. __u64 SessionId;
  124. } __packed;
  125. /* Encryption Algorithms */
  126. #define SMB2_ENCRYPTION_AES128_CCM __constant_cpu_to_le16(0x0001)
  127. /*
  128. * SMB2 flag definitions
  129. */
  130. #define SMB2_FLAGS_SERVER_TO_REDIR __constant_cpu_to_le32(0x00000001)
  131. #define SMB2_FLAGS_ASYNC_COMMAND __constant_cpu_to_le32(0x00000002)
  132. #define SMB2_FLAGS_RELATED_OPERATIONS __constant_cpu_to_le32(0x00000004)
  133. #define SMB2_FLAGS_SIGNED __constant_cpu_to_le32(0x00000008)
  134. #define SMB2_FLAGS_DFS_OPERATIONS __constant_cpu_to_le32(0x10000000)
  135. /*
  136. * Definitions for SMB2 Protocol Data Units (network frames)
  137. *
  138. * See MS-SMB2.PDF specification for protocol details.
  139. * The Naming convention is the lower case version of the SMB2
  140. * command code name for the struct. Note that structures must be packed.
  141. *
  142. */
  143. #define SMB2_ERROR_STRUCTURE_SIZE2 __constant_cpu_to_le16(9)
  144. struct smb2_err_rsp {
  145. struct smb2_hdr hdr;
  146. __le16 StructureSize;
  147. __le16 Reserved; /* MBZ */
  148. __le32 ByteCount; /* even if zero, at least one byte follows */
  149. __u8 ErrorData[1]; /* variable length */
  150. } __packed;
  151. struct smb2_symlink_err_rsp {
  152. __le32 SymLinkLength;
  153. __le32 SymLinkErrorTag;
  154. __le32 ReparseTag;
  155. __le16 ReparseDataLength;
  156. __le16 UnparsedPathLength;
  157. __le16 SubstituteNameOffset;
  158. __le16 SubstituteNameLength;
  159. __le16 PrintNameOffset;
  160. __le16 PrintNameLength;
  161. __le32 Flags;
  162. __u8 PathBuffer[0];
  163. } __packed;
  164. #define SMB2_CLIENT_GUID_SIZE 16
  165. extern __u8 cifs_client_guid[SMB2_CLIENT_GUID_SIZE];
  166. struct smb2_negotiate_req {
  167. struct smb2_hdr hdr;
  168. __le16 StructureSize; /* Must be 36 */
  169. __le16 DialectCount;
  170. __le16 SecurityMode;
  171. __le16 Reserved; /* MBZ */
  172. __le32 Capabilities;
  173. __u8 ClientGUID[SMB2_CLIENT_GUID_SIZE];
  174. __le64 ClientStartTime; /* MBZ */
  175. __le16 Dialects[1]; /* One dialect (vers=) at a time for now */
  176. } __packed;
  177. /* Dialects */
  178. #define SMB20_PROT_ID 0x0202
  179. #define SMB21_PROT_ID 0x0210
  180. #define SMB30_PROT_ID 0x0300
  181. #define SMB302_PROT_ID 0x0302
  182. #define BAD_PROT_ID 0xFFFF
  183. /* SecurityMode flags */
  184. #define SMB2_NEGOTIATE_SIGNING_ENABLED 0x0001
  185. #define SMB2_NEGOTIATE_SIGNING_REQUIRED 0x0002
  186. /* Capabilities flags */
  187. #define SMB2_GLOBAL_CAP_DFS 0x00000001
  188. #define SMB2_GLOBAL_CAP_LEASING 0x00000002 /* Resp only New to SMB2.1 */
  189. #define SMB2_GLOBAL_CAP_LARGE_MTU 0X00000004 /* Resp only New to SMB2.1 */
  190. #define SMB2_GLOBAL_CAP_MULTI_CHANNEL 0x00000008 /* New to SMB3 */
  191. #define SMB2_GLOBAL_CAP_PERSISTENT_HANDLES 0x00000010 /* New to SMB3 */
  192. #define SMB2_GLOBAL_CAP_DIRECTORY_LEASING 0x00000020 /* New to SMB3 */
  193. #define SMB2_GLOBAL_CAP_ENCRYPTION 0x00000040 /* New to SMB3 */
  194. /* Internal types */
  195. #define SMB2_NT_FIND 0x00100000
  196. #define SMB2_LARGE_FILES 0x00200000
  197. struct smb2_negotiate_rsp {
  198. struct smb2_hdr hdr;
  199. __le16 StructureSize; /* Must be 65 */
  200. __le16 SecurityMode;
  201. __le16 DialectRevision;
  202. __le16 Reserved; /* MBZ */
  203. __u8 ServerGUID[16];
  204. __le32 Capabilities;
  205. __le32 MaxTransactSize;
  206. __le32 MaxReadSize;
  207. __le32 MaxWriteSize;
  208. __le64 SystemTime; /* MBZ */
  209. __le64 ServerStartTime;
  210. __le16 SecurityBufferOffset;
  211. __le16 SecurityBufferLength;
  212. __le32 Reserved2; /* may be any value, ignore */
  213. __u8 Buffer[1]; /* variable length GSS security buffer */
  214. } __packed;
  215. struct smb2_sess_setup_req {
  216. struct smb2_hdr hdr;
  217. __le16 StructureSize; /* Must be 25 */
  218. __u8 VcNumber;
  219. __u8 SecurityMode;
  220. __le32 Capabilities;
  221. __le32 Channel;
  222. __le16 SecurityBufferOffset;
  223. __le16 SecurityBufferLength;
  224. __le64 PreviousSessionId;
  225. __u8 Buffer[1]; /* variable length GSS security buffer */
  226. } __packed;
  227. /* Currently defined SessionFlags */
  228. #define SMB2_SESSION_FLAG_IS_GUEST 0x0001
  229. #define SMB2_SESSION_FLAG_IS_NULL 0x0002
  230. #define SMB2_SESSION_FLAG_ENCRYPT_DATA 0x0004
  231. struct smb2_sess_setup_rsp {
  232. struct smb2_hdr hdr;
  233. __le16 StructureSize; /* Must be 9 */
  234. __le16 SessionFlags;
  235. __le16 SecurityBufferOffset;
  236. __le16 SecurityBufferLength;
  237. __u8 Buffer[1]; /* variable length GSS security buffer */
  238. } __packed;
  239. struct smb2_logoff_req {
  240. struct smb2_hdr hdr;
  241. __le16 StructureSize; /* Must be 4 */
  242. __le16 Reserved;
  243. } __packed;
  244. struct smb2_logoff_rsp {
  245. struct smb2_hdr hdr;
  246. __le16 StructureSize; /* Must be 4 */
  247. __le16 Reserved;
  248. } __packed;
  249. struct smb2_tree_connect_req {
  250. struct smb2_hdr hdr;
  251. __le16 StructureSize; /* Must be 9 */
  252. __le16 Reserved;
  253. __le16 PathOffset;
  254. __le16 PathLength;
  255. __u8 Buffer[1]; /* variable length */
  256. } __packed;
  257. struct smb2_tree_connect_rsp {
  258. struct smb2_hdr hdr;
  259. __le16 StructureSize; /* Must be 16 */
  260. __u8 ShareType; /* see below */
  261. __u8 Reserved;
  262. __le32 ShareFlags; /* see below */
  263. __le32 Capabilities; /* see below */
  264. __le32 MaximalAccess;
  265. } __packed;
  266. /* Possible ShareType values */
  267. #define SMB2_SHARE_TYPE_DISK 0x01
  268. #define SMB2_SHARE_TYPE_PIPE 0x02
  269. #define SMB2_SHARE_TYPE_PRINT 0x03
  270. /*
  271. * Possible ShareFlags - exactly one and only one of the first 4 caching flags
  272. * must be set (any of the remaining, SHI1005, flags may be set individually
  273. * or in combination.
  274. */
  275. #define SMB2_SHAREFLAG_MANUAL_CACHING 0x00000000
  276. #define SMB2_SHAREFLAG_AUTO_CACHING 0x00000010
  277. #define SMB2_SHAREFLAG_VDO_CACHING 0x00000020
  278. #define SMB2_SHAREFLAG_NO_CACHING 0x00000030
  279. #define SHI1005_FLAGS_DFS 0x00000001
  280. #define SHI1005_FLAGS_DFS_ROOT 0x00000002
  281. #define SHI1005_FLAGS_RESTRICT_EXCLUSIVE_OPENS 0x00000100
  282. #define SHI1005_FLAGS_FORCE_SHARED_DELETE 0x00000200
  283. #define SHI1005_FLAGS_ALLOW_NAMESPACE_CACHING 0x00000400
  284. #define SHI1005_FLAGS_ACCESS_BASED_DIRECTORY_ENUM 0x00000800
  285. #define SHI1005_FLAGS_FORCE_LEVELII_OPLOCK 0x00001000
  286. #define SHI1005_FLAGS_ENABLE_HASH_V1 0x00002000
  287. #define SHI1005_FLAGS_ENABLE_HASH_V2 0x00004000
  288. #define SHI1005_FLAGS_ENCRYPT_DATA 0x00008000
  289. #define SHI1005_FLAGS_ALL 0x0000FF33
  290. /* Possible share capabilities */
  291. #define SMB2_SHARE_CAP_DFS cpu_to_le32(0x00000008) /* all dialects */
  292. #define SMB2_SHARE_CAP_CONTINUOUS_AVAILABILITY cpu_to_le32(0x00000010) /* 3.0 */
  293. #define SMB2_SHARE_CAP_SCALEOUT cpu_to_le32(0x00000020) /* 3.0 */
  294. #define SMB2_SHARE_CAP_CLUSTER cpu_to_le32(0x00000040) /* 3.0 */
  295. #define SMB2_SHARE_CAP_ASYMMETRIC cpu_to_le32(0x00000080) /* 3.02 */
  296. struct smb2_tree_disconnect_req {
  297. struct smb2_hdr hdr;
  298. __le16 StructureSize; /* Must be 4 */
  299. __le16 Reserved;
  300. } __packed;
  301. struct smb2_tree_disconnect_rsp {
  302. struct smb2_hdr hdr;
  303. __le16 StructureSize; /* Must be 4 */
  304. __le16 Reserved;
  305. } __packed;
  306. /* File Attrubutes */
  307. #define FILE_ATTRIBUTE_READONLY 0x00000001
  308. #define FILE_ATTRIBUTE_HIDDEN 0x00000002
  309. #define FILE_ATTRIBUTE_SYSTEM 0x00000004
  310. #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
  311. #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
  312. #define FILE_ATTRIBUTE_NORMAL 0x00000080
  313. #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
  314. #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
  315. #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
  316. #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
  317. #define FILE_ATTRIBUTE_OFFLINE 0x00001000
  318. #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
  319. #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
  320. /* Oplock levels */
  321. #define SMB2_OPLOCK_LEVEL_NONE 0x00
  322. #define SMB2_OPLOCK_LEVEL_II 0x01
  323. #define SMB2_OPLOCK_LEVEL_EXCLUSIVE 0x08
  324. #define SMB2_OPLOCK_LEVEL_BATCH 0x09
  325. #define SMB2_OPLOCK_LEVEL_LEASE 0xFF
  326. /* Non-spec internal type */
  327. #define SMB2_OPLOCK_LEVEL_NOCHANGE 0x99
  328. /* Desired Access Flags */
  329. #define FILE_READ_DATA_LE cpu_to_le32(0x00000001)
  330. #define FILE_WRITE_DATA_LE cpu_to_le32(0x00000002)
  331. #define FILE_APPEND_DATA_LE cpu_to_le32(0x00000004)
  332. #define FILE_READ_EA_LE cpu_to_le32(0x00000008)
  333. #define FILE_WRITE_EA_LE cpu_to_le32(0x00000010)
  334. #define FILE_EXECUTE_LE cpu_to_le32(0x00000020)
  335. #define FILE_READ_ATTRIBUTES_LE cpu_to_le32(0x00000080)
  336. #define FILE_WRITE_ATTRIBUTES_LE cpu_to_le32(0x00000100)
  337. #define FILE_DELETE_LE cpu_to_le32(0x00010000)
  338. #define FILE_READ_CONTROL_LE cpu_to_le32(0x00020000)
  339. #define FILE_WRITE_DAC_LE cpu_to_le32(0x00040000)
  340. #define FILE_WRITE_OWNER_LE cpu_to_le32(0x00080000)
  341. #define FILE_SYNCHRONIZE_LE cpu_to_le32(0x00100000)
  342. #define FILE_ACCESS_SYSTEM_SECURITY_LE cpu_to_le32(0x01000000)
  343. #define FILE_MAXIMAL_ACCESS_LE cpu_to_le32(0x02000000)
  344. #define FILE_GENERIC_ALL_LE cpu_to_le32(0x10000000)
  345. #define FILE_GENERIC_EXECUTE_LE cpu_to_le32(0x20000000)
  346. #define FILE_GENERIC_WRITE_LE cpu_to_le32(0x40000000)
  347. #define FILE_GENERIC_READ_LE cpu_to_le32(0x80000000)
  348. /* ShareAccess Flags */
  349. #define FILE_SHARE_READ_LE cpu_to_le32(0x00000001)
  350. #define FILE_SHARE_WRITE_LE cpu_to_le32(0x00000002)
  351. #define FILE_SHARE_DELETE_LE cpu_to_le32(0x00000004)
  352. #define FILE_SHARE_ALL_LE cpu_to_le32(0x00000007)
  353. /* CreateDisposition Flags */
  354. #define FILE_SUPERSEDE_LE cpu_to_le32(0x00000000)
  355. #define FILE_OPEN_LE cpu_to_le32(0x00000001)
  356. #define FILE_CREATE_LE cpu_to_le32(0x00000002)
  357. #define FILE_OPEN_IF_LE cpu_to_le32(0x00000003)
  358. #define FILE_OVERWRITE_LE cpu_to_le32(0x00000004)
  359. #define FILE_OVERWRITE_IF_LE cpu_to_le32(0x00000005)
  360. /* CreateOptions Flags */
  361. #define FILE_DIRECTORY_FILE_LE cpu_to_le32(0x00000001)
  362. /* same as #define CREATE_NOT_FILE_LE cpu_to_le32(0x00000001) */
  363. #define FILE_WRITE_THROUGH_LE cpu_to_le32(0x00000002)
  364. #define FILE_SEQUENTIAL_ONLY_LE cpu_to_le32(0x00000004)
  365. #define FILE_NO_INTERMEDIATE_BUFFERRING_LE cpu_to_le32(0x00000008)
  366. #define FILE_SYNCHRONOUS_IO_ALERT_LE cpu_to_le32(0x00000010)
  367. #define FILE_SYNCHRONOUS_IO_NON_ALERT_LE cpu_to_le32(0x00000020)
  368. #define FILE_NON_DIRECTORY_FILE_LE cpu_to_le32(0x00000040)
  369. #define FILE_COMPLETE_IF_OPLOCKED_LE cpu_to_le32(0x00000100)
  370. #define FILE_NO_EA_KNOWLEDGE_LE cpu_to_le32(0x00000200)
  371. #define FILE_RANDOM_ACCESS_LE cpu_to_le32(0x00000800)
  372. #define FILE_DELETE_ON_CLOSE_LE cpu_to_le32(0x00001000)
  373. #define FILE_OPEN_BY_FILE_ID_LE cpu_to_le32(0x00002000)
  374. #define FILE_OPEN_FOR_BACKUP_INTENT_LE cpu_to_le32(0x00004000)
  375. #define FILE_NO_COMPRESSION_LE cpu_to_le32(0x00008000)
  376. #define FILE_RESERVE_OPFILTER_LE cpu_to_le32(0x00100000)
  377. #define FILE_OPEN_REPARSE_POINT_LE cpu_to_le32(0x00200000)
  378. #define FILE_OPEN_NO_RECALL_LE cpu_to_le32(0x00400000)
  379. #define FILE_OPEN_FOR_FREE_SPACE_QUERY_LE cpu_to_le32(0x00800000)
  380. #define FILE_READ_RIGHTS_LE (FILE_READ_DATA_LE | FILE_READ_EA_LE \
  381. | FILE_READ_ATTRIBUTES_LE)
  382. #define FILE_WRITE_RIGHTS_LE (FILE_WRITE_DATA_LE | FILE_APPEND_DATA_LE \
  383. | FILE_WRITE_EA_LE | FILE_WRITE_ATTRIBUTES_LE)
  384. #define FILE_EXEC_RIGHTS_LE (FILE_EXECUTE_LE)
  385. /* Impersonation Levels */
  386. #define IL_ANONYMOUS cpu_to_le32(0x00000000)
  387. #define IL_IDENTIFICATION cpu_to_le32(0x00000001)
  388. #define IL_IMPERSONATION cpu_to_le32(0x00000002)
  389. #define IL_DELEGATE cpu_to_le32(0x00000003)
  390. /* Create Context Values */
  391. #define SMB2_CREATE_EA_BUFFER "ExtA" /* extended attributes */
  392. #define SMB2_CREATE_SD_BUFFER "SecD" /* security descriptor */
  393. #define SMB2_CREATE_DURABLE_HANDLE_REQUEST "DHnQ"
  394. #define SMB2_CREATE_DURABLE_HANDLE_RECONNECT "DHnC"
  395. #define SMB2_CREATE_ALLOCATION_SIZE "AlSi"
  396. #define SMB2_CREATE_QUERY_MAXIMAL_ACCESS_REQUEST "MxAc"
  397. #define SMB2_CREATE_TIMEWARP_REQUEST "TWrp"
  398. #define SMB2_CREATE_QUERY_ON_DISK_ID "QFid"
  399. #define SMB2_CREATE_REQUEST_LEASE "RqLs"
  400. struct smb2_create_req {
  401. struct smb2_hdr hdr;
  402. __le16 StructureSize; /* Must be 57 */
  403. __u8 SecurityFlags;
  404. __u8 RequestedOplockLevel;
  405. __le32 ImpersonationLevel;
  406. __le64 SmbCreateFlags;
  407. __le64 Reserved;
  408. __le32 DesiredAccess;
  409. __le32 FileAttributes;
  410. __le32 ShareAccess;
  411. __le32 CreateDisposition;
  412. __le32 CreateOptions;
  413. __le16 NameOffset;
  414. __le16 NameLength;
  415. __le32 CreateContextsOffset;
  416. __le32 CreateContextsLength;
  417. __u8 Buffer[0];
  418. } __packed;
  419. struct smb2_create_rsp {
  420. struct smb2_hdr hdr;
  421. __le16 StructureSize; /* Must be 89 */
  422. __u8 OplockLevel;
  423. __u8 Reserved;
  424. __le32 CreateAction;
  425. __le64 CreationTime;
  426. __le64 LastAccessTime;
  427. __le64 LastWriteTime;
  428. __le64 ChangeTime;
  429. __le64 AllocationSize;
  430. __le64 EndofFile;
  431. __le32 FileAttributes;
  432. __le32 Reserved2;
  433. __u64 PersistentFileId; /* opaque endianness */
  434. __u64 VolatileFileId; /* opaque endianness */
  435. __le32 CreateContextsOffset;
  436. __le32 CreateContextsLength;
  437. __u8 Buffer[1];
  438. } __packed;
  439. struct create_context {
  440. __le32 Next;
  441. __le16 NameOffset;
  442. __le16 NameLength;
  443. __le16 Reserved;
  444. __le16 DataOffset;
  445. __le32 DataLength;
  446. __u8 Buffer[0];
  447. } __packed;
  448. #define SMB2_LEASE_READ_CACHING_HE 0x01
  449. #define SMB2_LEASE_HANDLE_CACHING_HE 0x02
  450. #define SMB2_LEASE_WRITE_CACHING_HE 0x04
  451. #define SMB2_LEASE_NONE __constant_cpu_to_le32(0x00)
  452. #define SMB2_LEASE_READ_CACHING __constant_cpu_to_le32(0x01)
  453. #define SMB2_LEASE_HANDLE_CACHING __constant_cpu_to_le32(0x02)
  454. #define SMB2_LEASE_WRITE_CACHING __constant_cpu_to_le32(0x04)
  455. #define SMB2_LEASE_FLAG_BREAK_IN_PROGRESS __constant_cpu_to_le32(0x02)
  456. #define SMB2_LEASE_KEY_SIZE 16
  457. struct lease_context {
  458. __le64 LeaseKeyLow;
  459. __le64 LeaseKeyHigh;
  460. __le32 LeaseState;
  461. __le32 LeaseFlags;
  462. __le64 LeaseDuration;
  463. } __packed;
  464. struct lease_context_v2 {
  465. __le64 LeaseKeyLow;
  466. __le64 LeaseKeyHigh;
  467. __le32 LeaseState;
  468. __le32 LeaseFlags;
  469. __le64 LeaseDuration;
  470. __le64 ParentLeaseKeyLow;
  471. __le64 ParentLeaseKeyHigh;
  472. __le16 Epoch;
  473. __le16 Reserved;
  474. } __packed;
  475. struct create_lease {
  476. struct create_context ccontext;
  477. __u8 Name[8];
  478. struct lease_context lcontext;
  479. } __packed;
  480. struct create_lease_v2 {
  481. struct create_context ccontext;
  482. __u8 Name[8];
  483. struct lease_context_v2 lcontext;
  484. __u8 Pad[4];
  485. } __packed;
  486. struct create_durable {
  487. struct create_context ccontext;
  488. __u8 Name[8];
  489. union {
  490. __u8 Reserved[16];
  491. struct {
  492. __u64 PersistentFileId;
  493. __u64 VolatileFileId;
  494. } Fid;
  495. } Data;
  496. } __packed;
  497. #define COPY_CHUNK_RES_KEY_SIZE 24
  498. struct resume_key_req {
  499. char ResumeKey[COPY_CHUNK_RES_KEY_SIZE];
  500. __le32 ContextLength; /* MBZ */
  501. char Context[0]; /* ignored, Windows sets to 4 bytes of zero */
  502. } __packed;
  503. /* this goes in the ioctl buffer when doing a copychunk request */
  504. struct copychunk_ioctl {
  505. char SourceKey[COPY_CHUNK_RES_KEY_SIZE];
  506. __le32 ChunkCount; /* we are only sending 1 */
  507. __le32 Reserved;
  508. /* array will only be one chunk long for us */
  509. __le64 SourceOffset;
  510. __le64 TargetOffset;
  511. __le32 Length; /* how many bytes to copy */
  512. __u32 Reserved2;
  513. } __packed;
  514. struct copychunk_ioctl_rsp {
  515. __le32 ChunksWritten;
  516. __le32 ChunkBytesWritten;
  517. __le32 TotalBytesWritten;
  518. } __packed;
  519. struct validate_negotiate_info_req {
  520. __le32 Capabilities;
  521. __u8 Guid[SMB2_CLIENT_GUID_SIZE];
  522. __le16 SecurityMode;
  523. __le16 DialectCount;
  524. __le16 Dialects[1]; /* dialect (someday maybe list) client asked for */
  525. } __packed;
  526. struct validate_negotiate_info_rsp {
  527. __le32 Capabilities;
  528. __u8 Guid[SMB2_CLIENT_GUID_SIZE];
  529. __le16 SecurityMode;
  530. __le16 Dialect; /* Dialect in use for the connection */
  531. } __packed;
  532. #define RSS_CAPABLE 0x00000001
  533. #define RDMA_CAPABLE 0x00000002
  534. struct network_interface_info_ioctl_rsp {
  535. __le32 Next; /* next interface. zero if this is last one */
  536. __le32 IfIndex;
  537. __le32 Capability; /* RSS or RDMA Capable */
  538. __le32 Reserved;
  539. __le64 LinkSpeed;
  540. char SockAddr_Storage[128];
  541. } __packed;
  542. #define NO_FILE_ID 0xFFFFFFFFFFFFFFFFULL /* general ioctls to srv not to file */
  543. struct compress_ioctl {
  544. __le16 CompressionState; /* See cifspdu.h for possible flag values */
  545. } __packed;
  546. struct smb2_ioctl_req {
  547. struct smb2_hdr hdr;
  548. __le16 StructureSize; /* Must be 57 */
  549. __u16 Reserved;
  550. __le32 CtlCode;
  551. __u64 PersistentFileId; /* opaque endianness */
  552. __u64 VolatileFileId; /* opaque endianness */
  553. __le32 InputOffset;
  554. __le32 InputCount;
  555. __le32 MaxInputResponse;
  556. __le32 OutputOffset;
  557. __le32 OutputCount;
  558. __le32 MaxOutputResponse;
  559. __le32 Flags;
  560. __u32 Reserved2;
  561. __u8 Buffer[0];
  562. } __packed;
  563. struct smb2_ioctl_rsp {
  564. struct smb2_hdr hdr;
  565. __le16 StructureSize; /* Must be 57 */
  566. __u16 Reserved;
  567. __le32 CtlCode;
  568. __u64 PersistentFileId; /* opaque endianness */
  569. __u64 VolatileFileId; /* opaque endianness */
  570. __le32 InputOffset;
  571. __le32 InputCount;
  572. __le32 OutputOffset;
  573. __le32 OutputCount;
  574. __le32 Flags;
  575. __u32 Reserved2;
  576. /* char * buffer[] */
  577. } __packed;
  578. /* Currently defined values for close flags */
  579. #define SMB2_CLOSE_FLAG_POSTQUERY_ATTRIB cpu_to_le16(0x0001)
  580. struct smb2_close_req {
  581. struct smb2_hdr hdr;
  582. __le16 StructureSize; /* Must be 24 */
  583. __le16 Flags;
  584. __le32 Reserved;
  585. __u64 PersistentFileId; /* opaque endianness */
  586. __u64 VolatileFileId; /* opaque endianness */
  587. } __packed;
  588. struct smb2_close_rsp {
  589. struct smb2_hdr hdr;
  590. __le16 StructureSize; /* 60 */
  591. __le16 Flags;
  592. __le32 Reserved;
  593. __le64 CreationTime;
  594. __le64 LastAccessTime;
  595. __le64 LastWriteTime;
  596. __le64 ChangeTime;
  597. __le64 AllocationSize; /* Beginning of FILE_STANDARD_INFO equivalent */
  598. __le64 EndOfFile;
  599. __le32 Attributes;
  600. } __packed;
  601. struct smb2_flush_req {
  602. struct smb2_hdr hdr;
  603. __le16 StructureSize; /* Must be 24 */
  604. __le16 Reserved1;
  605. __le32 Reserved2;
  606. __u64 PersistentFileId; /* opaque endianness */
  607. __u64 VolatileFileId; /* opaque endianness */
  608. } __packed;
  609. struct smb2_flush_rsp {
  610. struct smb2_hdr hdr;
  611. __le16 StructureSize;
  612. __le16 Reserved;
  613. } __packed;
  614. /* For read request Flags field below, following flag is defined for SMB3.02 */
  615. #define SMB2_READFLAG_READ_UNBUFFERED 0x01
  616. /* Channel field for read and write: exactly one of following flags can be set*/
  617. #define SMB2_CHANNEL_NONE 0x00000000
  618. #define SMB2_CHANNEL_RDMA_V1 0x00000001 /* SMB3 or later */
  619. #define SMB2_CHANNEL_RDMA_V1_INVALIDATE 0x00000001 /* SMB3.02 or later */
  620. struct smb2_read_req {
  621. struct smb2_hdr hdr;
  622. __le16 StructureSize; /* Must be 49 */
  623. __u8 Padding; /* offset from start of SMB2 header to place read */
  624. __u8 Flags; /* MBZ unless SMB3.02 or later */
  625. __le32 Length;
  626. __le64 Offset;
  627. __u64 PersistentFileId; /* opaque endianness */
  628. __u64 VolatileFileId; /* opaque endianness */
  629. __le32 MinimumCount;
  630. __le32 Channel; /* MBZ except for SMB3 or later */
  631. __le32 RemainingBytes;
  632. __le16 ReadChannelInfoOffset; /* Reserved MBZ */
  633. __le16 ReadChannelInfoLength; /* Reserved MBZ */
  634. __u8 Buffer[1];
  635. } __packed;
  636. struct smb2_read_rsp {
  637. struct smb2_hdr hdr;
  638. __le16 StructureSize; /* Must be 17 */
  639. __u8 DataOffset;
  640. __u8 Reserved;
  641. __le32 DataLength;
  642. __le32 DataRemaining;
  643. __u32 Reserved2;
  644. __u8 Buffer[1];
  645. } __packed;
  646. /* For write request Flags field below the following flags are defined: */
  647. #define SMB2_WRITEFLAG_WRITE_THROUGH 0x00000001 /* SMB2.1 or later */
  648. #define SMB2_WRITEFLAG_WRITE_UNBUFFERED 0x00000002 /* SMB3.02 or later */
  649. struct smb2_write_req {
  650. struct smb2_hdr hdr;
  651. __le16 StructureSize; /* Must be 49 */
  652. __le16 DataOffset; /* offset from start of SMB2 header to write data */
  653. __le32 Length;
  654. __le64 Offset;
  655. __u64 PersistentFileId; /* opaque endianness */
  656. __u64 VolatileFileId; /* opaque endianness */
  657. __le32 Channel; /* Reserved MBZ */
  658. __le32 RemainingBytes;
  659. __le16 WriteChannelInfoOffset; /* Reserved MBZ */
  660. __le16 WriteChannelInfoLength; /* Reserved MBZ */
  661. __le32 Flags;
  662. __u8 Buffer[1];
  663. } __packed;
  664. struct smb2_write_rsp {
  665. struct smb2_hdr hdr;
  666. __le16 StructureSize; /* Must be 17 */
  667. __u8 DataOffset;
  668. __u8 Reserved;
  669. __le32 DataLength;
  670. __le32 DataRemaining;
  671. __u32 Reserved2;
  672. __u8 Buffer[1];
  673. } __packed;
  674. #define SMB2_LOCKFLAG_SHARED_LOCK 0x0001
  675. #define SMB2_LOCKFLAG_EXCLUSIVE_LOCK 0x0002
  676. #define SMB2_LOCKFLAG_UNLOCK 0x0004
  677. #define SMB2_LOCKFLAG_FAIL_IMMEDIATELY 0x0010
  678. struct smb2_lock_element {
  679. __le64 Offset;
  680. __le64 Length;
  681. __le32 Flags;
  682. __le32 Reserved;
  683. } __packed;
  684. struct smb2_lock_req {
  685. struct smb2_hdr hdr;
  686. __le16 StructureSize; /* Must be 48 */
  687. __le16 LockCount;
  688. __le32 Reserved;
  689. __u64 PersistentFileId; /* opaque endianness */
  690. __u64 VolatileFileId; /* opaque endianness */
  691. /* Followed by at least one */
  692. struct smb2_lock_element locks[1];
  693. } __packed;
  694. struct smb2_lock_rsp {
  695. struct smb2_hdr hdr;
  696. __le16 StructureSize; /* Must be 4 */
  697. __le16 Reserved;
  698. } __packed;
  699. struct smb2_echo_req {
  700. struct smb2_hdr hdr;
  701. __le16 StructureSize; /* Must be 4 */
  702. __u16 Reserved;
  703. } __packed;
  704. struct smb2_echo_rsp {
  705. struct smb2_hdr hdr;
  706. __le16 StructureSize; /* Must be 4 */
  707. __u16 Reserved;
  708. } __packed;
  709. /* search (query_directory) Flags field */
  710. #define SMB2_RESTART_SCANS 0x01
  711. #define SMB2_RETURN_SINGLE_ENTRY 0x02
  712. #define SMB2_INDEX_SPECIFIED 0x04
  713. #define SMB2_REOPEN 0x10
  714. struct smb2_query_directory_req {
  715. struct smb2_hdr hdr;
  716. __le16 StructureSize; /* Must be 33 */
  717. __u8 FileInformationClass;
  718. __u8 Flags;
  719. __le32 FileIndex;
  720. __u64 PersistentFileId; /* opaque endianness */
  721. __u64 VolatileFileId; /* opaque endianness */
  722. __le16 FileNameOffset;
  723. __le16 FileNameLength;
  724. __le32 OutputBufferLength;
  725. __u8 Buffer[1];
  726. } __packed;
  727. struct smb2_query_directory_rsp {
  728. struct smb2_hdr hdr;
  729. __le16 StructureSize; /* Must be 9 */
  730. __le16 OutputBufferOffset;
  731. __le32 OutputBufferLength;
  732. __u8 Buffer[1];
  733. } __packed;
  734. /* Possible InfoType values */
  735. #define SMB2_O_INFO_FILE 0x01
  736. #define SMB2_O_INFO_FILESYSTEM 0x02
  737. #define SMB2_O_INFO_SECURITY 0x03
  738. #define SMB2_O_INFO_QUOTA 0x04
  739. struct smb2_query_info_req {
  740. struct smb2_hdr hdr;
  741. __le16 StructureSize; /* Must be 41 */
  742. __u8 InfoType;
  743. __u8 FileInfoClass;
  744. __le32 OutputBufferLength;
  745. __le16 InputBufferOffset;
  746. __u16 Reserved;
  747. __le32 InputBufferLength;
  748. __le32 AdditionalInformation;
  749. __le32 Flags;
  750. __u64 PersistentFileId; /* opaque endianness */
  751. __u64 VolatileFileId; /* opaque endianness */
  752. __u8 Buffer[1];
  753. } __packed;
  754. struct smb2_query_info_rsp {
  755. struct smb2_hdr hdr;
  756. __le16 StructureSize; /* Must be 9 */
  757. __le16 OutputBufferOffset;
  758. __le32 OutputBufferLength;
  759. __u8 Buffer[1];
  760. } __packed;
  761. struct smb2_set_info_req {
  762. struct smb2_hdr hdr;
  763. __le16 StructureSize; /* Must be 33 */
  764. __u8 InfoType;
  765. __u8 FileInfoClass;
  766. __le32 BufferLength;
  767. __le16 BufferOffset;
  768. __u16 Reserved;
  769. __le32 AdditionalInformation;
  770. __u64 PersistentFileId; /* opaque endianness */
  771. __u64 VolatileFileId; /* opaque endianness */
  772. __u8 Buffer[1];
  773. } __packed;
  774. struct smb2_set_info_rsp {
  775. struct smb2_hdr hdr;
  776. __le16 StructureSize; /* Must be 2 */
  777. } __packed;
  778. struct smb2_oplock_break {
  779. struct smb2_hdr hdr;
  780. __le16 StructureSize; /* Must be 24 */
  781. __u8 OplockLevel;
  782. __u8 Reserved;
  783. __le32 Reserved2;
  784. __u64 PersistentFid;
  785. __u64 VolatileFid;
  786. } __packed;
  787. #define SMB2_NOTIFY_BREAK_LEASE_FLAG_ACK_REQUIRED cpu_to_le32(0x01)
  788. struct smb2_lease_break {
  789. struct smb2_hdr hdr;
  790. __le16 StructureSize; /* Must be 44 */
  791. __le16 Reserved;
  792. __le32 Flags;
  793. __u8 LeaseKey[16];
  794. __le32 CurrentLeaseState;
  795. __le32 NewLeaseState;
  796. __le32 BreakReason;
  797. __le32 AccessMaskHint;
  798. __le32 ShareMaskHint;
  799. } __packed;
  800. struct smb2_lease_ack {
  801. struct smb2_hdr hdr;
  802. __le16 StructureSize; /* Must be 36 */
  803. __le16 Reserved;
  804. __le32 Flags;
  805. __u8 LeaseKey[16];
  806. __le32 LeaseState;
  807. __le64 LeaseDuration;
  808. } __packed;
  809. /*
  810. * PDU infolevel structure definitions
  811. * BB consider moving to a different header
  812. */
  813. /* File System Information Classes */
  814. #define FS_VOLUME_INFORMATION 1 /* Query */
  815. #define FS_LABEL_INFORMATION 2 /* Local only */
  816. #define FS_SIZE_INFORMATION 3 /* Query */
  817. #define FS_DEVICE_INFORMATION 4 /* Query */
  818. #define FS_ATTRIBUTE_INFORMATION 5 /* Query */
  819. #define FS_CONTROL_INFORMATION 6 /* Query, Set */
  820. #define FS_FULL_SIZE_INFORMATION 7 /* Query */
  821. #define FS_OBJECT_ID_INFORMATION 8 /* Query, Set */
  822. #define FS_DRIVER_PATH_INFORMATION 9 /* Local only */
  823. #define FS_VOLUME_FLAGS_INFORMATION 10 /* Local only */
  824. #define FS_SECTOR_SIZE_INFORMATION 11 /* SMB3 or later. Query */
  825. struct smb2_fs_full_size_info {
  826. __le64 TotalAllocationUnits;
  827. __le64 CallerAvailableAllocationUnits;
  828. __le64 ActualAvailableAllocationUnits;
  829. __le32 SectorsPerAllocationUnit;
  830. __le32 BytesPerSector;
  831. } __packed;
  832. #define SSINFO_FLAGS_ALIGNED_DEVICE 0x00000001
  833. #define SSINFO_FLAGS_PARTITION_ALIGNED_ON_DEVICE 0x00000002
  834. #define SSINFO_FLAGS_NO_SEEK_PENALTY 0x00000004
  835. #define SSINFO_FLAGS_TRIM_ENABLED 0x00000008
  836. /* sector size info struct */
  837. struct smb3_fs_ss_info {
  838. __le32 LogicalBytesPerSector;
  839. __le32 PhysicalBytesPerSectorForAtomicity;
  840. __le32 PhysicalBytesPerSectorForPerf;
  841. __le32 FileSystemEffectivePhysicalBytesPerSectorForAtomicity;
  842. __le32 Flags;
  843. __le32 ByteOffsetForSectorAlignment;
  844. __le32 ByteOffsetForPartitionAlignment;
  845. } __packed;
  846. /* partial list of QUERY INFO levels */
  847. #define FILE_DIRECTORY_INFORMATION 1
  848. #define FILE_FULL_DIRECTORY_INFORMATION 2
  849. #define FILE_BOTH_DIRECTORY_INFORMATION 3
  850. #define FILE_BASIC_INFORMATION 4
  851. #define FILE_STANDARD_INFORMATION 5
  852. #define FILE_INTERNAL_INFORMATION 6
  853. #define FILE_EA_INFORMATION 7
  854. #define FILE_ACCESS_INFORMATION 8
  855. #define FILE_NAME_INFORMATION 9
  856. #define FILE_RENAME_INFORMATION 10
  857. #define FILE_LINK_INFORMATION 11
  858. #define FILE_NAMES_INFORMATION 12
  859. #define FILE_DISPOSITION_INFORMATION 13
  860. #define FILE_POSITION_INFORMATION 14
  861. #define FILE_FULL_EA_INFORMATION 15
  862. #define FILE_MODE_INFORMATION 16
  863. #define FILE_ALIGNMENT_INFORMATION 17
  864. #define FILE_ALL_INFORMATION 18
  865. #define FILE_ALLOCATION_INFORMATION 19
  866. #define FILE_END_OF_FILE_INFORMATION 20
  867. #define FILE_ALTERNATE_NAME_INFORMATION 21
  868. #define FILE_STREAM_INFORMATION 22
  869. #define FILE_PIPE_INFORMATION 23
  870. #define FILE_PIPE_LOCAL_INFORMATION 24
  871. #define FILE_PIPE_REMOTE_INFORMATION 25
  872. #define FILE_MAILSLOT_QUERY_INFORMATION 26
  873. #define FILE_MAILSLOT_SET_INFORMATION 27
  874. #define FILE_COMPRESSION_INFORMATION 28
  875. #define FILE_OBJECT_ID_INFORMATION 29
  876. /* Number 30 not defined in documents */
  877. #define FILE_MOVE_CLUSTER_INFORMATION 31
  878. #define FILE_QUOTA_INFORMATION 32
  879. #define FILE_REPARSE_POINT_INFORMATION 33
  880. #define FILE_NETWORK_OPEN_INFORMATION 34
  881. #define FILE_ATTRIBUTE_TAG_INFORMATION 35
  882. #define FILE_TRACKING_INFORMATION 36
  883. #define FILEID_BOTH_DIRECTORY_INFORMATION 37
  884. #define FILEID_FULL_DIRECTORY_INFORMATION 38
  885. #define FILE_VALID_DATA_LENGTH_INFORMATION 39
  886. #define FILE_SHORT_NAME_INFORMATION 40
  887. #define FILE_SFIO_RESERVE_INFORMATION 44
  888. #define FILE_SFIO_VOLUME_INFORMATION 45
  889. #define FILE_HARD_LINK_INFORMATION 46
  890. #define FILE_NORMALIZED_NAME_INFORMATION 48
  891. #define FILEID_GLOBAL_TX_DIRECTORY_INFORMATION 50
  892. #define FILE_STANDARD_LINK_INFORMATION 54
  893. struct smb2_file_internal_info {
  894. __le64 IndexNumber;
  895. } __packed; /* level 6 Query */
  896. struct smb2_file_rename_info { /* encoding of request for level 10 */
  897. __u8 ReplaceIfExists; /* 1 = replace existing target with new */
  898. /* 0 = fail if target already exists */
  899. __u8 Reserved[7];
  900. __u64 RootDirectory; /* MBZ for network operations (why says spec?) */
  901. __le32 FileNameLength;
  902. char FileName[0]; /* New name to be assigned */
  903. } __packed; /* level 10 Set */
  904. struct smb2_file_link_info { /* encoding of request for level 11 */
  905. __u8 ReplaceIfExists; /* 1 = replace existing link with new */
  906. /* 0 = fail if link already exists */
  907. __u8 Reserved[7];
  908. __u64 RootDirectory; /* MBZ for network operations (why says spec?) */
  909. __le32 FileNameLength;
  910. char FileName[0]; /* Name to be assigned to new link */
  911. } __packed; /* level 11 Set */
  912. /*
  913. * This level 18, although with struct with same name is different from cifs
  914. * level 0x107. Level 0x107 has an extra u64 between AccessFlags and
  915. * CurrentByteOffset.
  916. */
  917. struct smb2_file_all_info { /* data block encoding of response to level 18 */
  918. __le64 CreationTime; /* Beginning of FILE_BASIC_INFO equivalent */
  919. __le64 LastAccessTime;
  920. __le64 LastWriteTime;
  921. __le64 ChangeTime;
  922. __le32 Attributes;
  923. __u32 Pad1; /* End of FILE_BASIC_INFO_INFO equivalent */
  924. __le64 AllocationSize; /* Beginning of FILE_STANDARD_INFO equivalent */
  925. __le64 EndOfFile; /* size ie offset to first free byte in file */
  926. __le32 NumberOfLinks; /* hard links */
  927. __u8 DeletePending;
  928. __u8 Directory;
  929. __u16 Pad2; /* End of FILE_STANDARD_INFO equivalent */
  930. __le64 IndexNumber;
  931. __le32 EASize;
  932. __le32 AccessFlags;
  933. __le64 CurrentByteOffset;
  934. __le32 Mode;
  935. __le32 AlignmentRequirement;
  936. __le32 FileNameLength;
  937. char FileName[1];
  938. } __packed; /* level 18 Query */
  939. struct smb2_file_eof_info { /* encoding of request for level 10 */
  940. __le64 EndOfFile; /* new end of file value */
  941. } __packed; /* level 20 Set */
  942. #endif /* _SMB2PDU_H */