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