smb2pdu.h 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992
  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. /*
  113. * SMB2 flag definitions
  114. */
  115. #define SMB2_FLAGS_SERVER_TO_REDIR __constant_cpu_to_le32(0x00000001)
  116. #define SMB2_FLAGS_ASYNC_COMMAND __constant_cpu_to_le32(0x00000002)
  117. #define SMB2_FLAGS_RELATED_OPERATIONS __constant_cpu_to_le32(0x00000004)
  118. #define SMB2_FLAGS_SIGNED __constant_cpu_to_le32(0x00000008)
  119. #define SMB2_FLAGS_DFS_OPERATIONS __constant_cpu_to_le32(0x10000000)
  120. /*
  121. * Definitions for SMB2 Protocol Data Units (network frames)
  122. *
  123. * See MS-SMB2.PDF specification for protocol details.
  124. * The Naming convention is the lower case version of the SMB2
  125. * command code name for the struct. Note that structures must be packed.
  126. *
  127. */
  128. #define SMB2_ERROR_STRUCTURE_SIZE2 __constant_cpu_to_le16(9)
  129. struct smb2_err_rsp {
  130. struct smb2_hdr hdr;
  131. __le16 StructureSize;
  132. __le16 Reserved; /* MBZ */
  133. __le32 ByteCount; /* even if zero, at least one byte follows */
  134. __u8 ErrorData[1]; /* variable length */
  135. } __packed;
  136. struct smb2_symlink_err_rsp {
  137. __le32 SymLinkLength;
  138. __le32 SymLinkErrorTag;
  139. __le32 ReparseTag;
  140. __le16 ReparseDataLength;
  141. __le16 UnparsedPathLength;
  142. __le16 SubstituteNameOffset;
  143. __le16 SubstituteNameLength;
  144. __le16 PrintNameOffset;
  145. __le16 PrintNameLength;
  146. __le32 Flags;
  147. __u8 PathBuffer[0];
  148. } __packed;
  149. #define SMB2_CLIENT_GUID_SIZE 16
  150. extern __u8 cifs_client_guid[SMB2_CLIENT_GUID_SIZE];
  151. struct smb2_negotiate_req {
  152. struct smb2_hdr hdr;
  153. __le16 StructureSize; /* Must be 36 */
  154. __le16 DialectCount;
  155. __le16 SecurityMode;
  156. __le16 Reserved; /* MBZ */
  157. __le32 Capabilities;
  158. __u8 ClientGUID[SMB2_CLIENT_GUID_SIZE];
  159. __le64 ClientStartTime; /* MBZ */
  160. __le16 Dialects[1]; /* One dialect (vers=) at a time for now */
  161. } __packed;
  162. /* Dialects */
  163. #define SMB20_PROT_ID 0x0202
  164. #define SMB21_PROT_ID 0x0210
  165. #define SMB30_PROT_ID 0x0300
  166. #define SMB302_PROT_ID 0x0302
  167. #define BAD_PROT_ID 0xFFFF
  168. /* SecurityMode flags */
  169. #define SMB2_NEGOTIATE_SIGNING_ENABLED 0x0001
  170. #define SMB2_NEGOTIATE_SIGNING_REQUIRED 0x0002
  171. /* Capabilities flags */
  172. #define SMB2_GLOBAL_CAP_DFS 0x00000001
  173. #define SMB2_GLOBAL_CAP_LEASING 0x00000002 /* Resp only New to SMB2.1 */
  174. #define SMB2_GLOBAL_CAP_LARGE_MTU 0X00000004 /* Resp only New to SMB2.1 */
  175. #define SMB2_GLOBAL_CAP_MULTI_CHANNEL 0x00000008 /* New to SMB3 */
  176. #define SMB2_GLOBAL_CAP_PERSISTENT_HANDLES 0x00000010 /* New to SMB3 */
  177. #define SMB2_GLOBAL_CAP_DIRECTORY_LEASING 0x00000020 /* New to SMB3 */
  178. #define SMB2_GLOBAL_CAP_ENCRYPTION 0x00000040 /* New to SMB3 */
  179. /* Internal types */
  180. #define SMB2_NT_FIND 0x00100000
  181. #define SMB2_LARGE_FILES 0x00200000
  182. struct smb2_negotiate_rsp {
  183. struct smb2_hdr hdr;
  184. __le16 StructureSize; /* Must be 65 */
  185. __le16 SecurityMode;
  186. __le16 DialectRevision;
  187. __le16 Reserved; /* MBZ */
  188. __u8 ServerGUID[16];
  189. __le32 Capabilities;
  190. __le32 MaxTransactSize;
  191. __le32 MaxReadSize;
  192. __le32 MaxWriteSize;
  193. __le64 SystemTime; /* MBZ */
  194. __le64 ServerStartTime;
  195. __le16 SecurityBufferOffset;
  196. __le16 SecurityBufferLength;
  197. __le32 Reserved2; /* may be any value, ignore */
  198. __u8 Buffer[1]; /* variable length GSS security buffer */
  199. } __packed;
  200. struct smb2_sess_setup_req {
  201. struct smb2_hdr hdr;
  202. __le16 StructureSize; /* Must be 25 */
  203. __u8 VcNumber;
  204. __u8 SecurityMode;
  205. __le32 Capabilities;
  206. __le32 Channel;
  207. __le16 SecurityBufferOffset;
  208. __le16 SecurityBufferLength;
  209. __le64 PreviousSessionId;
  210. __u8 Buffer[1]; /* variable length GSS security buffer */
  211. } __packed;
  212. /* Currently defined SessionFlags */
  213. #define SMB2_SESSION_FLAG_IS_GUEST 0x0001
  214. #define SMB2_SESSION_FLAG_IS_NULL 0x0002
  215. struct smb2_sess_setup_rsp {
  216. struct smb2_hdr hdr;
  217. __le16 StructureSize; /* Must be 9 */
  218. __le16 SessionFlags;
  219. __le16 SecurityBufferOffset;
  220. __le16 SecurityBufferLength;
  221. __u8 Buffer[1]; /* variable length GSS security buffer */
  222. } __packed;
  223. struct smb2_logoff_req {
  224. struct smb2_hdr hdr;
  225. __le16 StructureSize; /* Must be 4 */
  226. __le16 Reserved;
  227. } __packed;
  228. struct smb2_logoff_rsp {
  229. struct smb2_hdr hdr;
  230. __le16 StructureSize; /* Must be 4 */
  231. __le16 Reserved;
  232. } __packed;
  233. struct smb2_tree_connect_req {
  234. struct smb2_hdr hdr;
  235. __le16 StructureSize; /* Must be 9 */
  236. __le16 Reserved;
  237. __le16 PathOffset;
  238. __le16 PathLength;
  239. __u8 Buffer[1]; /* variable length */
  240. } __packed;
  241. struct smb2_tree_connect_rsp {
  242. struct smb2_hdr hdr;
  243. __le16 StructureSize; /* Must be 16 */
  244. __u8 ShareType; /* see below */
  245. __u8 Reserved;
  246. __le32 ShareFlags; /* see below */
  247. __le32 Capabilities; /* see below */
  248. __le32 MaximalAccess;
  249. } __packed;
  250. /* Possible ShareType values */
  251. #define SMB2_SHARE_TYPE_DISK 0x01
  252. #define SMB2_SHARE_TYPE_PIPE 0x02
  253. #define SMB2_SHARE_TYPE_PRINT 0x03
  254. /*
  255. * Possible ShareFlags - exactly one and only one of the first 4 caching flags
  256. * must be set (any of the remaining, SHI1005, flags may be set individually
  257. * or in combination.
  258. */
  259. #define SMB2_SHAREFLAG_MANUAL_CACHING 0x00000000
  260. #define SMB2_SHAREFLAG_AUTO_CACHING 0x00000010
  261. #define SMB2_SHAREFLAG_VDO_CACHING 0x00000020
  262. #define SMB2_SHAREFLAG_NO_CACHING 0x00000030
  263. #define SHI1005_FLAGS_DFS 0x00000001
  264. #define SHI1005_FLAGS_DFS_ROOT 0x00000002
  265. #define SHI1005_FLAGS_RESTRICT_EXCLUSIVE_OPENS 0x00000100
  266. #define SHI1005_FLAGS_FORCE_SHARED_DELETE 0x00000200
  267. #define SHI1005_FLAGS_ALLOW_NAMESPACE_CACHING 0x00000400
  268. #define SHI1005_FLAGS_ACCESS_BASED_DIRECTORY_ENUM 0x00000800
  269. #define SHI1005_FLAGS_FORCE_LEVELII_OPLOCK 0x00001000
  270. #define SHI1005_FLAGS_ENABLE_HASH_V1 0x00002000
  271. #define SHI1005_FLAGS_ENABLE_HASH_V2 0x00004000
  272. #define SHI1005_FLAGS_ENCRYPT_DATA 0x00008000
  273. #define SHI1005_FLAGS_ALL 0x0000FF33
  274. /* Possible share capabilities */
  275. #define SMB2_SHARE_CAP_DFS cpu_to_le32(0x00000008) /* all dialects */
  276. #define SMB2_SHARE_CAP_CONTINUOUS_AVAILABILITY cpu_to_le32(0x00000010) /* 3.0 */
  277. #define SMB2_SHARE_CAP_SCALEOUT cpu_to_le32(0x00000020) /* 3.0 */
  278. #define SMB2_SHARE_CAP_CLUSTER cpu_to_le32(0x00000040) /* 3.0 */
  279. #define SMB2_SHARE_CAP_ASYMMETRIC cpu_to_le32(0x00000080) /* 3.02 */
  280. struct smb2_tree_disconnect_req {
  281. struct smb2_hdr hdr;
  282. __le16 StructureSize; /* Must be 4 */
  283. __le16 Reserved;
  284. } __packed;
  285. struct smb2_tree_disconnect_rsp {
  286. struct smb2_hdr hdr;
  287. __le16 StructureSize; /* Must be 4 */
  288. __le16 Reserved;
  289. } __packed;
  290. /* File Attrubutes */
  291. #define FILE_ATTRIBUTE_READONLY 0x00000001
  292. #define FILE_ATTRIBUTE_HIDDEN 0x00000002
  293. #define FILE_ATTRIBUTE_SYSTEM 0x00000004
  294. #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
  295. #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
  296. #define FILE_ATTRIBUTE_NORMAL 0x00000080
  297. #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
  298. #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
  299. #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
  300. #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
  301. #define FILE_ATTRIBUTE_OFFLINE 0x00001000
  302. #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
  303. #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
  304. /* Oplock levels */
  305. #define SMB2_OPLOCK_LEVEL_NONE 0x00
  306. #define SMB2_OPLOCK_LEVEL_II 0x01
  307. #define SMB2_OPLOCK_LEVEL_EXCLUSIVE 0x08
  308. #define SMB2_OPLOCK_LEVEL_BATCH 0x09
  309. #define SMB2_OPLOCK_LEVEL_LEASE 0xFF
  310. /* Non-spec internal type */
  311. #define SMB2_OPLOCK_LEVEL_NOCHANGE 0x99
  312. /* Desired Access Flags */
  313. #define FILE_READ_DATA_LE cpu_to_le32(0x00000001)
  314. #define FILE_WRITE_DATA_LE cpu_to_le32(0x00000002)
  315. #define FILE_APPEND_DATA_LE cpu_to_le32(0x00000004)
  316. #define FILE_READ_EA_LE cpu_to_le32(0x00000008)
  317. #define FILE_WRITE_EA_LE cpu_to_le32(0x00000010)
  318. #define FILE_EXECUTE_LE cpu_to_le32(0x00000020)
  319. #define FILE_READ_ATTRIBUTES_LE cpu_to_le32(0x00000080)
  320. #define FILE_WRITE_ATTRIBUTES_LE cpu_to_le32(0x00000100)
  321. #define FILE_DELETE_LE cpu_to_le32(0x00010000)
  322. #define FILE_READ_CONTROL_LE cpu_to_le32(0x00020000)
  323. #define FILE_WRITE_DAC_LE cpu_to_le32(0x00040000)
  324. #define FILE_WRITE_OWNER_LE cpu_to_le32(0x00080000)
  325. #define FILE_SYNCHRONIZE_LE cpu_to_le32(0x00100000)
  326. #define FILE_ACCESS_SYSTEM_SECURITY_LE cpu_to_le32(0x01000000)
  327. #define FILE_MAXIMAL_ACCESS_LE cpu_to_le32(0x02000000)
  328. #define FILE_GENERIC_ALL_LE cpu_to_le32(0x10000000)
  329. #define FILE_GENERIC_EXECUTE_LE cpu_to_le32(0x20000000)
  330. #define FILE_GENERIC_WRITE_LE cpu_to_le32(0x40000000)
  331. #define FILE_GENERIC_READ_LE cpu_to_le32(0x80000000)
  332. /* ShareAccess Flags */
  333. #define FILE_SHARE_READ_LE cpu_to_le32(0x00000001)
  334. #define FILE_SHARE_WRITE_LE cpu_to_le32(0x00000002)
  335. #define FILE_SHARE_DELETE_LE cpu_to_le32(0x00000004)
  336. #define FILE_SHARE_ALL_LE cpu_to_le32(0x00000007)
  337. /* CreateDisposition Flags */
  338. #define FILE_SUPERSEDE_LE cpu_to_le32(0x00000000)
  339. #define FILE_OPEN_LE cpu_to_le32(0x00000001)
  340. #define FILE_CREATE_LE cpu_to_le32(0x00000002)
  341. #define FILE_OPEN_IF_LE cpu_to_le32(0x00000003)
  342. #define FILE_OVERWRITE_LE cpu_to_le32(0x00000004)
  343. #define FILE_OVERWRITE_IF_LE cpu_to_le32(0x00000005)
  344. /* CreateOptions Flags */
  345. #define FILE_DIRECTORY_FILE_LE cpu_to_le32(0x00000001)
  346. /* same as #define CREATE_NOT_FILE_LE cpu_to_le32(0x00000001) */
  347. #define FILE_WRITE_THROUGH_LE cpu_to_le32(0x00000002)
  348. #define FILE_SEQUENTIAL_ONLY_LE cpu_to_le32(0x00000004)
  349. #define FILE_NO_INTERMEDIATE_BUFFERRING_LE cpu_to_le32(0x00000008)
  350. #define FILE_SYNCHRONOUS_IO_ALERT_LE cpu_to_le32(0x00000010)
  351. #define FILE_SYNCHRONOUS_IO_NON_ALERT_LE cpu_to_le32(0x00000020)
  352. #define FILE_NON_DIRECTORY_FILE_LE cpu_to_le32(0x00000040)
  353. #define FILE_COMPLETE_IF_OPLOCKED_LE cpu_to_le32(0x00000100)
  354. #define FILE_NO_EA_KNOWLEDGE_LE cpu_to_le32(0x00000200)
  355. #define FILE_RANDOM_ACCESS_LE cpu_to_le32(0x00000800)
  356. #define FILE_DELETE_ON_CLOSE_LE cpu_to_le32(0x00001000)
  357. #define FILE_OPEN_BY_FILE_ID_LE cpu_to_le32(0x00002000)
  358. #define FILE_OPEN_FOR_BACKUP_INTENT_LE cpu_to_le32(0x00004000)
  359. #define FILE_NO_COMPRESSION_LE cpu_to_le32(0x00008000)
  360. #define FILE_RESERVE_OPFILTER_LE cpu_to_le32(0x00100000)
  361. #define FILE_OPEN_REPARSE_POINT_LE cpu_to_le32(0x00200000)
  362. #define FILE_OPEN_NO_RECALL_LE cpu_to_le32(0x00400000)
  363. #define FILE_OPEN_FOR_FREE_SPACE_QUERY_LE cpu_to_le32(0x00800000)
  364. #define FILE_READ_RIGHTS_LE (FILE_READ_DATA_LE | FILE_READ_EA_LE \
  365. | FILE_READ_ATTRIBUTES_LE)
  366. #define FILE_WRITE_RIGHTS_LE (FILE_WRITE_DATA_LE | FILE_APPEND_DATA_LE \
  367. | FILE_WRITE_EA_LE | FILE_WRITE_ATTRIBUTES_LE)
  368. #define FILE_EXEC_RIGHTS_LE (FILE_EXECUTE_LE)
  369. /* Impersonation Levels */
  370. #define IL_ANONYMOUS cpu_to_le32(0x00000000)
  371. #define IL_IDENTIFICATION cpu_to_le32(0x00000001)
  372. #define IL_IMPERSONATION cpu_to_le32(0x00000002)
  373. #define IL_DELEGATE cpu_to_le32(0x00000003)
  374. /* Create Context Values */
  375. #define SMB2_CREATE_EA_BUFFER "ExtA" /* extended attributes */
  376. #define SMB2_CREATE_SD_BUFFER "SecD" /* security descriptor */
  377. #define SMB2_CREATE_DURABLE_HANDLE_REQUEST "DHnQ"
  378. #define SMB2_CREATE_DURABLE_HANDLE_RECONNECT "DHnC"
  379. #define SMB2_CREATE_ALLOCATION_SIZE "AlSi"
  380. #define SMB2_CREATE_QUERY_MAXIMAL_ACCESS_REQUEST "MxAc"
  381. #define SMB2_CREATE_TIMEWARP_REQUEST "TWrp"
  382. #define SMB2_CREATE_QUERY_ON_DISK_ID "QFid"
  383. #define SMB2_CREATE_REQUEST_LEASE "RqLs"
  384. struct smb2_create_req {
  385. struct smb2_hdr hdr;
  386. __le16 StructureSize; /* Must be 57 */
  387. __u8 SecurityFlags;
  388. __u8 RequestedOplockLevel;
  389. __le32 ImpersonationLevel;
  390. __le64 SmbCreateFlags;
  391. __le64 Reserved;
  392. __le32 DesiredAccess;
  393. __le32 FileAttributes;
  394. __le32 ShareAccess;
  395. __le32 CreateDisposition;
  396. __le32 CreateOptions;
  397. __le16 NameOffset;
  398. __le16 NameLength;
  399. __le32 CreateContextsOffset;
  400. __le32 CreateContextsLength;
  401. __u8 Buffer[0];
  402. } __packed;
  403. struct smb2_create_rsp {
  404. struct smb2_hdr hdr;
  405. __le16 StructureSize; /* Must be 89 */
  406. __u8 OplockLevel;
  407. __u8 Reserved;
  408. __le32 CreateAction;
  409. __le64 CreationTime;
  410. __le64 LastAccessTime;
  411. __le64 LastWriteTime;
  412. __le64 ChangeTime;
  413. __le64 AllocationSize;
  414. __le64 EndofFile;
  415. __le32 FileAttributes;
  416. __le32 Reserved2;
  417. __u64 PersistentFileId; /* opaque endianness */
  418. __u64 VolatileFileId; /* opaque endianness */
  419. __le32 CreateContextsOffset;
  420. __le32 CreateContextsLength;
  421. __u8 Buffer[1];
  422. } __packed;
  423. struct create_context {
  424. __le32 Next;
  425. __le16 NameOffset;
  426. __le16 NameLength;
  427. __le16 Reserved;
  428. __le16 DataOffset;
  429. __le32 DataLength;
  430. __u8 Buffer[0];
  431. } __packed;
  432. #define SMB2_LEASE_READ_CACHING_HE 0x01
  433. #define SMB2_LEASE_HANDLE_CACHING_HE 0x02
  434. #define SMB2_LEASE_WRITE_CACHING_HE 0x04
  435. #define SMB2_LEASE_NONE __constant_cpu_to_le32(0x00)
  436. #define SMB2_LEASE_READ_CACHING __constant_cpu_to_le32(0x01)
  437. #define SMB2_LEASE_HANDLE_CACHING __constant_cpu_to_le32(0x02)
  438. #define SMB2_LEASE_WRITE_CACHING __constant_cpu_to_le32(0x04)
  439. #define SMB2_LEASE_FLAG_BREAK_IN_PROGRESS __constant_cpu_to_le32(0x02)
  440. #define SMB2_LEASE_KEY_SIZE 16
  441. struct lease_context {
  442. __le64 LeaseKeyLow;
  443. __le64 LeaseKeyHigh;
  444. __le32 LeaseState;
  445. __le32 LeaseFlags;
  446. __le64 LeaseDuration;
  447. } __packed;
  448. struct lease_context_v2 {
  449. __le64 LeaseKeyLow;
  450. __le64 LeaseKeyHigh;
  451. __le32 LeaseState;
  452. __le32 LeaseFlags;
  453. __le64 LeaseDuration;
  454. __le64 ParentLeaseKeyLow;
  455. __le64 ParentLeaseKeyHigh;
  456. __le16 Epoch;
  457. __le16 Reserved;
  458. } __packed;
  459. struct create_lease {
  460. struct create_context ccontext;
  461. __u8 Name[8];
  462. struct lease_context lcontext;
  463. } __packed;
  464. struct create_lease_v2 {
  465. struct create_context ccontext;
  466. __u8 Name[8];
  467. struct lease_context_v2 lcontext;
  468. __u8 Pad[4];
  469. } __packed;
  470. struct create_durable {
  471. struct create_context ccontext;
  472. __u8 Name[8];
  473. union {
  474. __u8 Reserved[16];
  475. struct {
  476. __u64 PersistentFileId;
  477. __u64 VolatileFileId;
  478. } Fid;
  479. } Data;
  480. } __packed;
  481. /* this goes in the ioctl buffer when doing a copychunk request */
  482. struct copychunk_ioctl {
  483. char SourceKey[24];
  484. __le32 ChunkCount; /* we are only sending 1 */
  485. __le32 Reserved;
  486. /* array will only be one chunk long for us */
  487. __le64 SourceOffset;
  488. __le64 TargetOffset;
  489. __le32 Length; /* how many bytes to copy */
  490. __u32 Reserved2;
  491. } __packed;
  492. /* Response and Request are the same format */
  493. struct validate_negotiate_info {
  494. __le32 Capabilities;
  495. __u8 Guid[SMB2_CLIENT_GUID_SIZE];
  496. __le16 SecurityMode;
  497. __le16 DialectCount;
  498. __le16 Dialect[1];
  499. } __packed;
  500. #define RSS_CAPABLE 0x00000001
  501. #define RDMA_CAPABLE 0x00000002
  502. struct network_interface_info_ioctl_rsp {
  503. __le32 Next; /* next interface. zero if this is last one */
  504. __le32 IfIndex;
  505. __le32 Capability; /* RSS or RDMA Capable */
  506. __le32 Reserved;
  507. __le64 LinkSpeed;
  508. char SockAddr_Storage[128];
  509. } __packed;
  510. #define NO_FILE_ID 0xFFFFFFFFFFFFFFFFULL /* general ioctls to srv not to file */
  511. struct smb2_ioctl_req {
  512. struct smb2_hdr hdr;
  513. __le16 StructureSize; /* Must be 57 */
  514. __u16 Reserved;
  515. __le32 CtlCode;
  516. __u64 PersistentFileId; /* opaque endianness */
  517. __u64 VolatileFileId; /* opaque endianness */
  518. __le32 InputOffset;
  519. __le32 InputCount;
  520. __le32 MaxInputResponse;
  521. __le32 OutputOffset;
  522. __le32 OutputCount;
  523. __le32 MaxOutputResponse;
  524. __le32 Flags;
  525. __u32 Reserved2;
  526. char Buffer[0];
  527. } __packed;
  528. struct smb2_ioctl_rsp {
  529. struct smb2_hdr hdr;
  530. __le16 StructureSize; /* Must be 57 */
  531. __u16 Reserved;
  532. __le32 CtlCode;
  533. __u64 PersistentFileId; /* opaque endianness */
  534. __u64 VolatileFileId; /* opaque endianness */
  535. __le32 InputOffset;
  536. __le32 InputCount;
  537. __le32 OutputOffset;
  538. __le32 OutputCount;
  539. __le32 Flags;
  540. __u32 Reserved2;
  541. /* char * buffer[] */
  542. } __packed;
  543. /* Currently defined values for close flags */
  544. #define SMB2_CLOSE_FLAG_POSTQUERY_ATTRIB cpu_to_le16(0x0001)
  545. struct smb2_close_req {
  546. struct smb2_hdr hdr;
  547. __le16 StructureSize; /* Must be 24 */
  548. __le16 Flags;
  549. __le32 Reserved;
  550. __u64 PersistentFileId; /* opaque endianness */
  551. __u64 VolatileFileId; /* opaque endianness */
  552. } __packed;
  553. struct smb2_close_rsp {
  554. struct smb2_hdr hdr;
  555. __le16 StructureSize; /* 60 */
  556. __le16 Flags;
  557. __le32 Reserved;
  558. __le64 CreationTime;
  559. __le64 LastAccessTime;
  560. __le64 LastWriteTime;
  561. __le64 ChangeTime;
  562. __le64 AllocationSize; /* Beginning of FILE_STANDARD_INFO equivalent */
  563. __le64 EndOfFile;
  564. __le32 Attributes;
  565. } __packed;
  566. struct smb2_flush_req {
  567. struct smb2_hdr hdr;
  568. __le16 StructureSize; /* Must be 24 */
  569. __le16 Reserved1;
  570. __le32 Reserved2;
  571. __u64 PersistentFileId; /* opaque endianness */
  572. __u64 VolatileFileId; /* opaque endianness */
  573. } __packed;
  574. struct smb2_flush_rsp {
  575. struct smb2_hdr hdr;
  576. __le16 StructureSize;
  577. __le16 Reserved;
  578. } __packed;
  579. /* For read request Flags field below, following flag is defined for SMB3.02 */
  580. #define SMB2_READFLAG_READ_UNBUFFERED 0x01
  581. /* Channel field for read and write: exactly one of following flags can be set*/
  582. #define SMB2_CHANNEL_NONE 0x00000000
  583. #define SMB2_CHANNEL_RDMA_V1 0x00000001 /* SMB3 or later */
  584. #define SMB2_CHANNEL_RDMA_V1_INVALIDATE 0x00000001 /* SMB3.02 or later */
  585. struct smb2_read_req {
  586. struct smb2_hdr hdr;
  587. __le16 StructureSize; /* Must be 49 */
  588. __u8 Padding; /* offset from start of SMB2 header to place read */
  589. __u8 Flags; /* MBZ unless SMB3.02 or later */
  590. __le32 Length;
  591. __le64 Offset;
  592. __u64 PersistentFileId; /* opaque endianness */
  593. __u64 VolatileFileId; /* opaque endianness */
  594. __le32 MinimumCount;
  595. __le32 Channel; /* MBZ except for SMB3 or later */
  596. __le32 RemainingBytes;
  597. __le16 ReadChannelInfoOffset; /* Reserved MBZ */
  598. __le16 ReadChannelInfoLength; /* Reserved MBZ */
  599. __u8 Buffer[1];
  600. } __packed;
  601. struct smb2_read_rsp {
  602. struct smb2_hdr hdr;
  603. __le16 StructureSize; /* Must be 17 */
  604. __u8 DataOffset;
  605. __u8 Reserved;
  606. __le32 DataLength;
  607. __le32 DataRemaining;
  608. __u32 Reserved2;
  609. __u8 Buffer[1];
  610. } __packed;
  611. /* For write request Flags field below the following flags are defined: */
  612. #define SMB2_WRITEFLAG_WRITE_THROUGH 0x00000001 /* SMB2.1 or later */
  613. #define SMB2_WRITEFLAG_WRITE_UNBUFFERED 0x00000002 /* SMB3.02 or later */
  614. struct smb2_write_req {
  615. struct smb2_hdr hdr;
  616. __le16 StructureSize; /* Must be 49 */
  617. __le16 DataOffset; /* offset from start of SMB2 header to write data */
  618. __le32 Length;
  619. __le64 Offset;
  620. __u64 PersistentFileId; /* opaque endianness */
  621. __u64 VolatileFileId; /* opaque endianness */
  622. __le32 Channel; /* Reserved MBZ */
  623. __le32 RemainingBytes;
  624. __le16 WriteChannelInfoOffset; /* Reserved MBZ */
  625. __le16 WriteChannelInfoLength; /* Reserved MBZ */
  626. __le32 Flags;
  627. __u8 Buffer[1];
  628. } __packed;
  629. struct smb2_write_rsp {
  630. struct smb2_hdr hdr;
  631. __le16 StructureSize; /* Must be 17 */
  632. __u8 DataOffset;
  633. __u8 Reserved;
  634. __le32 DataLength;
  635. __le32 DataRemaining;
  636. __u32 Reserved2;
  637. __u8 Buffer[1];
  638. } __packed;
  639. #define SMB2_LOCKFLAG_SHARED_LOCK 0x0001
  640. #define SMB2_LOCKFLAG_EXCLUSIVE_LOCK 0x0002
  641. #define SMB2_LOCKFLAG_UNLOCK 0x0004
  642. #define SMB2_LOCKFLAG_FAIL_IMMEDIATELY 0x0010
  643. struct smb2_lock_element {
  644. __le64 Offset;
  645. __le64 Length;
  646. __le32 Flags;
  647. __le32 Reserved;
  648. } __packed;
  649. struct smb2_lock_req {
  650. struct smb2_hdr hdr;
  651. __le16 StructureSize; /* Must be 48 */
  652. __le16 LockCount;
  653. __le32 Reserved;
  654. __u64 PersistentFileId; /* opaque endianness */
  655. __u64 VolatileFileId; /* opaque endianness */
  656. /* Followed by at least one */
  657. struct smb2_lock_element locks[1];
  658. } __packed;
  659. struct smb2_lock_rsp {
  660. struct smb2_hdr hdr;
  661. __le16 StructureSize; /* Must be 4 */
  662. __le16 Reserved;
  663. } __packed;
  664. struct smb2_echo_req {
  665. struct smb2_hdr hdr;
  666. __le16 StructureSize; /* Must be 4 */
  667. __u16 Reserved;
  668. } __packed;
  669. struct smb2_echo_rsp {
  670. struct smb2_hdr hdr;
  671. __le16 StructureSize; /* Must be 4 */
  672. __u16 Reserved;
  673. } __packed;
  674. /* search (query_directory) Flags field */
  675. #define SMB2_RESTART_SCANS 0x01
  676. #define SMB2_RETURN_SINGLE_ENTRY 0x02
  677. #define SMB2_INDEX_SPECIFIED 0x04
  678. #define SMB2_REOPEN 0x10
  679. struct smb2_query_directory_req {
  680. struct smb2_hdr hdr;
  681. __le16 StructureSize; /* Must be 33 */
  682. __u8 FileInformationClass;
  683. __u8 Flags;
  684. __le32 FileIndex;
  685. __u64 PersistentFileId; /* opaque endianness */
  686. __u64 VolatileFileId; /* opaque endianness */
  687. __le16 FileNameOffset;
  688. __le16 FileNameLength;
  689. __le32 OutputBufferLength;
  690. __u8 Buffer[1];
  691. } __packed;
  692. struct smb2_query_directory_rsp {
  693. struct smb2_hdr hdr;
  694. __le16 StructureSize; /* Must be 9 */
  695. __le16 OutputBufferOffset;
  696. __le32 OutputBufferLength;
  697. __u8 Buffer[1];
  698. } __packed;
  699. /* Possible InfoType values */
  700. #define SMB2_O_INFO_FILE 0x01
  701. #define SMB2_O_INFO_FILESYSTEM 0x02
  702. #define SMB2_O_INFO_SECURITY 0x03
  703. #define SMB2_O_INFO_QUOTA 0x04
  704. struct smb2_query_info_req {
  705. struct smb2_hdr hdr;
  706. __le16 StructureSize; /* Must be 41 */
  707. __u8 InfoType;
  708. __u8 FileInfoClass;
  709. __le32 OutputBufferLength;
  710. __le16 InputBufferOffset;
  711. __u16 Reserved;
  712. __le32 InputBufferLength;
  713. __le32 AdditionalInformation;
  714. __le32 Flags;
  715. __u64 PersistentFileId; /* opaque endianness */
  716. __u64 VolatileFileId; /* opaque endianness */
  717. __u8 Buffer[1];
  718. } __packed;
  719. struct smb2_query_info_rsp {
  720. struct smb2_hdr hdr;
  721. __le16 StructureSize; /* Must be 9 */
  722. __le16 OutputBufferOffset;
  723. __le32 OutputBufferLength;
  724. __u8 Buffer[1];
  725. } __packed;
  726. struct smb2_set_info_req {
  727. struct smb2_hdr hdr;
  728. __le16 StructureSize; /* Must be 33 */
  729. __u8 InfoType;
  730. __u8 FileInfoClass;
  731. __le32 BufferLength;
  732. __le16 BufferOffset;
  733. __u16 Reserved;
  734. __le32 AdditionalInformation;
  735. __u64 PersistentFileId; /* opaque endianness */
  736. __u64 VolatileFileId; /* opaque endianness */
  737. __u8 Buffer[1];
  738. } __packed;
  739. struct smb2_set_info_rsp {
  740. struct smb2_hdr hdr;
  741. __le16 StructureSize; /* Must be 2 */
  742. } __packed;
  743. struct smb2_oplock_break {
  744. struct smb2_hdr hdr;
  745. __le16 StructureSize; /* Must be 24 */
  746. __u8 OplockLevel;
  747. __u8 Reserved;
  748. __le32 Reserved2;
  749. __u64 PersistentFid;
  750. __u64 VolatileFid;
  751. } __packed;
  752. #define SMB2_NOTIFY_BREAK_LEASE_FLAG_ACK_REQUIRED cpu_to_le32(0x01)
  753. struct smb2_lease_break {
  754. struct smb2_hdr hdr;
  755. __le16 StructureSize; /* Must be 44 */
  756. __le16 Reserved;
  757. __le32 Flags;
  758. __u8 LeaseKey[16];
  759. __le32 CurrentLeaseState;
  760. __le32 NewLeaseState;
  761. __le32 BreakReason;
  762. __le32 AccessMaskHint;
  763. __le32 ShareMaskHint;
  764. } __packed;
  765. struct smb2_lease_ack {
  766. struct smb2_hdr hdr;
  767. __le16 StructureSize; /* Must be 36 */
  768. __le16 Reserved;
  769. __le32 Flags;
  770. __u8 LeaseKey[16];
  771. __le32 LeaseState;
  772. __le64 LeaseDuration;
  773. } __packed;
  774. /*
  775. * PDU infolevel structure definitions
  776. * BB consider moving to a different header
  777. */
  778. /* File System Information Classes */
  779. #define FS_VOLUME_INFORMATION 1 /* Query */
  780. #define FS_LABEL_INFORMATION 2 /* Set */
  781. #define FS_SIZE_INFORMATION 3 /* Query */
  782. #define FS_DEVICE_INFORMATION 4 /* Query */
  783. #define FS_ATTRIBUTE_INFORMATION 5 /* Query */
  784. #define FS_CONTROL_INFORMATION 6 /* Query, Set */
  785. #define FS_FULL_SIZE_INFORMATION 7 /* Query */
  786. #define FS_OBJECT_ID_INFORMATION 8 /* Query, Set */
  787. #define FS_DRIVER_PATH_INFORMATION 9 /* Query */
  788. struct smb2_fs_full_size_info {
  789. __le64 TotalAllocationUnits;
  790. __le64 CallerAvailableAllocationUnits;
  791. __le64 ActualAvailableAllocationUnits;
  792. __le32 SectorsPerAllocationUnit;
  793. __le32 BytesPerSector;
  794. } __packed;
  795. /* partial list of QUERY INFO levels */
  796. #define FILE_DIRECTORY_INFORMATION 1
  797. #define FILE_FULL_DIRECTORY_INFORMATION 2
  798. #define FILE_BOTH_DIRECTORY_INFORMATION 3
  799. #define FILE_BASIC_INFORMATION 4
  800. #define FILE_STANDARD_INFORMATION 5
  801. #define FILE_INTERNAL_INFORMATION 6
  802. #define FILE_EA_INFORMATION 7
  803. #define FILE_ACCESS_INFORMATION 8
  804. #define FILE_NAME_INFORMATION 9
  805. #define FILE_RENAME_INFORMATION 10
  806. #define FILE_LINK_INFORMATION 11
  807. #define FILE_NAMES_INFORMATION 12
  808. #define FILE_DISPOSITION_INFORMATION 13
  809. #define FILE_POSITION_INFORMATION 14
  810. #define FILE_FULL_EA_INFORMATION 15
  811. #define FILE_MODE_INFORMATION 16
  812. #define FILE_ALIGNMENT_INFORMATION 17
  813. #define FILE_ALL_INFORMATION 18
  814. #define FILE_ALLOCATION_INFORMATION 19
  815. #define FILE_END_OF_FILE_INFORMATION 20
  816. #define FILE_ALTERNATE_NAME_INFORMATION 21
  817. #define FILE_STREAM_INFORMATION 22
  818. #define FILE_PIPE_INFORMATION 23
  819. #define FILE_PIPE_LOCAL_INFORMATION 24
  820. #define FILE_PIPE_REMOTE_INFORMATION 25
  821. #define FILE_MAILSLOT_QUERY_INFORMATION 26
  822. #define FILE_MAILSLOT_SET_INFORMATION 27
  823. #define FILE_COMPRESSION_INFORMATION 28
  824. #define FILE_OBJECT_ID_INFORMATION 29
  825. /* Number 30 not defined in documents */
  826. #define FILE_MOVE_CLUSTER_INFORMATION 31
  827. #define FILE_QUOTA_INFORMATION 32
  828. #define FILE_REPARSE_POINT_INFORMATION 33
  829. #define FILE_NETWORK_OPEN_INFORMATION 34
  830. #define FILE_ATTRIBUTE_TAG_INFORMATION 35
  831. #define FILE_TRACKING_INFORMATION 36
  832. #define FILEID_BOTH_DIRECTORY_INFORMATION 37
  833. #define FILEID_FULL_DIRECTORY_INFORMATION 38
  834. #define FILE_VALID_DATA_LENGTH_INFORMATION 39
  835. #define FILE_SHORT_NAME_INFORMATION 40
  836. #define FILE_SFIO_RESERVE_INFORMATION 44
  837. #define FILE_SFIO_VOLUME_INFORMATION 45
  838. #define FILE_HARD_LINK_INFORMATION 46
  839. #define FILE_NORMALIZED_NAME_INFORMATION 48
  840. #define FILEID_GLOBAL_TX_DIRECTORY_INFORMATION 50
  841. #define FILE_STANDARD_LINK_INFORMATION 54
  842. struct smb2_file_internal_info {
  843. __le64 IndexNumber;
  844. } __packed; /* level 6 Query */
  845. struct smb2_file_rename_info { /* encoding of request for level 10 */
  846. __u8 ReplaceIfExists; /* 1 = replace existing target with new */
  847. /* 0 = fail if target already exists */
  848. __u8 Reserved[7];
  849. __u64 RootDirectory; /* MBZ for network operations (why says spec?) */
  850. __le32 FileNameLength;
  851. char FileName[0]; /* New name to be assigned */
  852. } __packed; /* level 10 Set */
  853. struct smb2_file_link_info { /* encoding of request for level 11 */
  854. __u8 ReplaceIfExists; /* 1 = replace existing link with new */
  855. /* 0 = fail if link already exists */
  856. __u8 Reserved[7];
  857. __u64 RootDirectory; /* MBZ for network operations (why says spec?) */
  858. __le32 FileNameLength;
  859. char FileName[0]; /* Name to be assigned to new link */
  860. } __packed; /* level 11 Set */
  861. /*
  862. * This level 18, although with struct with same name is different from cifs
  863. * level 0x107. Level 0x107 has an extra u64 between AccessFlags and
  864. * CurrentByteOffset.
  865. */
  866. struct smb2_file_all_info { /* data block encoding of response to level 18 */
  867. __le64 CreationTime; /* Beginning of FILE_BASIC_INFO equivalent */
  868. __le64 LastAccessTime;
  869. __le64 LastWriteTime;
  870. __le64 ChangeTime;
  871. __le32 Attributes;
  872. __u32 Pad1; /* End of FILE_BASIC_INFO_INFO equivalent */
  873. __le64 AllocationSize; /* Beginning of FILE_STANDARD_INFO equivalent */
  874. __le64 EndOfFile; /* size ie offset to first free byte in file */
  875. __le32 NumberOfLinks; /* hard links */
  876. __u8 DeletePending;
  877. __u8 Directory;
  878. __u16 Pad2; /* End of FILE_STANDARD_INFO equivalent */
  879. __le64 IndexNumber;
  880. __le32 EASize;
  881. __le32 AccessFlags;
  882. __le64 CurrentByteOffset;
  883. __le32 Mode;
  884. __le32 AlignmentRequirement;
  885. __le32 FileNameLength;
  886. char FileName[1];
  887. } __packed; /* level 18 Query */
  888. struct smb2_file_eof_info { /* encoding of request for level 10 */
  889. __le64 EndOfFile; /* new end of file value */
  890. } __packed; /* level 20 Set */
  891. #endif /* _SMB2PDU_H */