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 24#ifndef _SMB2PDU_H 25#define _SMB2PDU_H 26 27#include <net/sock.h> 28 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 88#define SMB2_PROTO_NUMBER cpu_to_le32(0x424d53fe) 89 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 */ 98 99#define SMB2_HEADER_STRUCTURE_SIZE cpu_to_le16(64) 100 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 __le64 MessageId; 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 120struct smb2_pdu { 121 struct smb2_hdr hdr; 122 __le16 StructureSize2; /* size of wct area (varies, request specific) */ 123} __packed; 124 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 cpu_to_le16(0x0001) 141 142/* 143 * SMB2 flag definitions 144 */ 145#define SMB2_FLAGS_SERVER_TO_REDIR cpu_to_le32(0x00000001) 146#define SMB2_FLAGS_ASYNC_COMMAND cpu_to_le32(0x00000002) 147#define SMB2_FLAGS_RELATED_OPERATIONS cpu_to_le32(0x00000004) 148#define SMB2_FLAGS_SIGNED cpu_to_le32(0x00000008) 149#define SMB2_FLAGS_DFS_OPERATIONS 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 */ 159 160#define SMB2_ERROR_STRUCTURE_SIZE2 cpu_to_le16(9) 161 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 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 184#define SMB2_CLIENT_GUID_SIZE 16 185 186struct smb2_negotiate_req { 187 struct smb2_hdr hdr; 188 __le16 StructureSize; /* Must be 36 */ 189 __le16 DialectCount; 190 __le16 SecurityMode; 191 __le16 Reserved; /* MBZ */ 192 __le32 Capabilities; 193 __u8 ClientGUID[SMB2_CLIENT_GUID_SIZE]; 194 __le64 ClientStartTime; /* MBZ */ 195 __le16 Dialects[1]; /* One dialect (vers=) at a time for now */ 196} __packed; 197 198/* Dialects */ 199#define SMB20_PROT_ID 0x0202 200#define SMB21_PROT_ID 0x0210 201#define SMB30_PROT_ID 0x0300 202#define SMB302_PROT_ID 0x0302 203#define BAD_PROT_ID 0xFFFF 204 205/* SecurityMode flags */ 206#define SMB2_NEGOTIATE_SIGNING_ENABLED 0x0001 207#define SMB2_NEGOTIATE_SIGNING_REQUIRED 0x0002 208/* Capabilities flags */ 209#define SMB2_GLOBAL_CAP_DFS 0x00000001 210#define SMB2_GLOBAL_CAP_LEASING 0x00000002 /* Resp only New to SMB2.1 */ 211#define SMB2_GLOBAL_CAP_LARGE_MTU 0X00000004 /* Resp only New to SMB2.1 */ 212#define SMB2_GLOBAL_CAP_MULTI_CHANNEL 0x00000008 /* New to SMB3 */ 213#define SMB2_GLOBAL_CAP_PERSISTENT_HANDLES 0x00000010 /* New to SMB3 */ 214#define SMB2_GLOBAL_CAP_DIRECTORY_LEASING 0x00000020 /* New to SMB3 */ 215#define SMB2_GLOBAL_CAP_ENCRYPTION 0x00000040 /* New to SMB3 */ 216/* Internal types */ 217#define SMB2_NT_FIND 0x00100000 218#define SMB2_LARGE_FILES 0x00200000 219 220struct smb2_negotiate_rsp { 221 struct smb2_hdr hdr; 222 __le16 StructureSize; /* Must be 65 */ 223 __le16 SecurityMode; 224 __le16 DialectRevision; 225 __le16 Reserved; /* MBZ */ 226 __u8 ServerGUID[16]; 227 __le32 Capabilities; 228 __le32 MaxTransactSize; 229 __le32 MaxReadSize; 230 __le32 MaxWriteSize; 231 __le64 SystemTime; /* MBZ */ 232 __le64 ServerStartTime; 233 __le16 SecurityBufferOffset; 234 __le16 SecurityBufferLength; 235 __le32 Reserved2; /* may be any value, ignore */ 236 __u8 Buffer[1]; /* variable length GSS security buffer */ 237} __packed; 238 239struct smb2_sess_setup_req { 240 struct smb2_hdr hdr; 241 __le16 StructureSize; /* Must be 25 */ 242 __u8 VcNumber; 243 __u8 SecurityMode; 244 __le32 Capabilities; 245 __le32 Channel; 246 __le16 SecurityBufferOffset; 247 __le16 SecurityBufferLength; 248 __le64 PreviousSessionId; 249 __u8 Buffer[1]; /* variable length GSS security buffer */ 250} __packed; 251 252/* Currently defined SessionFlags */ 253#define SMB2_SESSION_FLAG_IS_GUEST 0x0001 254#define SMB2_SESSION_FLAG_IS_NULL 0x0002 255#define SMB2_SESSION_FLAG_ENCRYPT_DATA 0x0004 256struct smb2_sess_setup_rsp { 257 struct smb2_hdr hdr; 258 __le16 StructureSize; /* Must be 9 */ 259 __le16 SessionFlags; 260 __le16 SecurityBufferOffset; 261 __le16 SecurityBufferLength; 262 __u8 Buffer[1]; /* variable length GSS security buffer */ 263} __packed; 264 265struct smb2_logoff_req { 266 struct smb2_hdr hdr; 267 __le16 StructureSize; /* Must be 4 */ 268 __le16 Reserved; 269} __packed; 270 271struct smb2_logoff_rsp { 272 struct smb2_hdr hdr; 273 __le16 StructureSize; /* Must be 4 */ 274 __le16 Reserved; 275} __packed; 276 277struct smb2_tree_connect_req { 278 struct smb2_hdr hdr; 279 __le16 StructureSize; /* Must be 9 */ 280 __le16 Reserved; 281 __le16 PathOffset; 282 __le16 PathLength; 283 __u8 Buffer[1]; /* variable length */ 284} __packed; 285 286struct smb2_tree_connect_rsp { 287 struct smb2_hdr hdr; 288 __le16 StructureSize; /* Must be 16 */ 289 __u8 ShareType; /* see below */ 290 __u8 Reserved; 291 __le32 ShareFlags; /* see below */ 292 __le32 Capabilities; /* see below */ 293 __le32 MaximalAccess; 294} __packed; 295 296/* Possible ShareType values */ 297#define SMB2_SHARE_TYPE_DISK 0x01 298#define SMB2_SHARE_TYPE_PIPE 0x02 299#define SMB2_SHARE_TYPE_PRINT 0x03 300 301/* 302 * Possible ShareFlags - exactly one and only one of the first 4 caching flags 303 * must be set (any of the remaining, SHI1005, flags may be set individually 304 * or in combination. 305 */ 306#define SMB2_SHAREFLAG_MANUAL_CACHING 0x00000000 307#define SMB2_SHAREFLAG_AUTO_CACHING 0x00000010 308#define SMB2_SHAREFLAG_VDO_CACHING 0x00000020 309#define SMB2_SHAREFLAG_NO_CACHING 0x00000030 310#define SHI1005_FLAGS_DFS 0x00000001 311#define SHI1005_FLAGS_DFS_ROOT 0x00000002 312#define SHI1005_FLAGS_RESTRICT_EXCLUSIVE_OPENS 0x00000100 313#define SHI1005_FLAGS_FORCE_SHARED_DELETE 0x00000200 314#define SHI1005_FLAGS_ALLOW_NAMESPACE_CACHING 0x00000400 315#define SHI1005_FLAGS_ACCESS_BASED_DIRECTORY_ENUM 0x00000800 316#define SHI1005_FLAGS_FORCE_LEVELII_OPLOCK 0x00001000 317#define SHI1005_FLAGS_ENABLE_HASH_V1 0x00002000 318#define SHI1005_FLAGS_ENABLE_HASH_V2 0x00004000 319#define SHI1005_FLAGS_ENCRYPT_DATA 0x00008000 320#define SHI1005_FLAGS_ALL 0x0000FF33 321 322/* Possible share capabilities */ 323#define SMB2_SHARE_CAP_DFS cpu_to_le32(0x00000008) /* all dialects */ 324#define SMB2_SHARE_CAP_CONTINUOUS_AVAILABILITY cpu_to_le32(0x00000010) /* 3.0 */ 325#define SMB2_SHARE_CAP_SCALEOUT cpu_to_le32(0x00000020) /* 3.0 */ 326#define SMB2_SHARE_CAP_CLUSTER cpu_to_le32(0x00000040) /* 3.0 */ 327#define SMB2_SHARE_CAP_ASYMMETRIC cpu_to_le32(0x00000080) /* 3.02 */ 328 329struct smb2_tree_disconnect_req { 330 struct smb2_hdr hdr; 331 __le16 StructureSize; /* Must be 4 */ 332 __le16 Reserved; 333} __packed; 334 335struct smb2_tree_disconnect_rsp { 336 struct smb2_hdr hdr; 337 __le16 StructureSize; /* Must be 4 */ 338 __le16 Reserved; 339} __packed; 340 341/* File Attrubutes */ 342#define FILE_ATTRIBUTE_READONLY 0x00000001 343#define FILE_ATTRIBUTE_HIDDEN 0x00000002 344#define FILE_ATTRIBUTE_SYSTEM 0x00000004 345#define FILE_ATTRIBUTE_DIRECTORY 0x00000010 346#define FILE_ATTRIBUTE_ARCHIVE 0x00000020 347#define FILE_ATTRIBUTE_NORMAL 0x00000080 348#define FILE_ATTRIBUTE_TEMPORARY 0x00000100 349#define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200 350#define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400 351#define FILE_ATTRIBUTE_COMPRESSED 0x00000800 352#define FILE_ATTRIBUTE_OFFLINE 0x00001000 353#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000 354#define FILE_ATTRIBUTE_ENCRYPTED 0x00004000 355#define FILE_ATTRIBUTE_INTEGRITY_STREAM 0x00008000 356#define FILE_ATTRIBUTE_NO_SCRUB_DATA 0x00020000 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 364/* Non-spec internal type */ 365#define SMB2_OPLOCK_LEVEL_NOCHANGE 0x99 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 "AISi" 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#define SMB2_CREATE_DURABLE_HANDLE_REQUEST_V2 "DH2Q" 446#define SMB2_CREATE_DURABLE_HANDLE_RECONNECT_V2 "DH2C" 447#define SMB2_CREATE_APP_INSTANCE_ID 0x45BCA66AEFA7F74A9008FA462E144D74 448#define SVHDX_OPEN_DEVICE_CONTEXT 0x83CE6F1AD851E0986E34401CC9BCFCE9 449 450struct smb2_create_req { 451 struct smb2_hdr hdr; 452 __le16 StructureSize; /* Must be 57 */ 453 __u8 SecurityFlags; 454 __u8 RequestedOplockLevel; 455 __le32 ImpersonationLevel; 456 __le64 SmbCreateFlags; 457 __le64 Reserved; 458 __le32 DesiredAccess; 459 __le32 FileAttributes; 460 __le32 ShareAccess; 461 __le32 CreateDisposition; 462 __le32 CreateOptions; 463 __le16 NameOffset; 464 __le16 NameLength; 465 __le32 CreateContextsOffset; 466 __le32 CreateContextsLength; 467 __u8 Buffer[0]; 468} __packed; 469 470struct smb2_create_rsp { 471 struct smb2_hdr hdr; 472 __le16 StructureSize; /* Must be 89 */ 473 __u8 OplockLevel; 474 __u8 Reserved; 475 __le32 CreateAction; 476 __le64 CreationTime; 477 __le64 LastAccessTime; 478 __le64 LastWriteTime; 479 __le64 ChangeTime; 480 __le64 AllocationSize; 481 __le64 EndofFile; 482 __le32 FileAttributes; 483 __le32 Reserved2; 484 __u64 PersistentFileId; /* opaque endianness */ 485 __u64 VolatileFileId; /* opaque endianness */ 486 __le32 CreateContextsOffset; 487 __le32 CreateContextsLength; 488 __u8 Buffer[1]; 489} __packed; 490 491struct create_context { 492 __le32 Next; 493 __le16 NameOffset; 494 __le16 NameLength; 495 __le16 Reserved; 496 __le16 DataOffset; 497 __le32 DataLength; 498 __u8 Buffer[0]; 499} __packed; 500 501#define SMB2_LEASE_READ_CACHING_HE 0x01 502#define SMB2_LEASE_HANDLE_CACHING_HE 0x02 503#define SMB2_LEASE_WRITE_CACHING_HE 0x04 504 505#define SMB2_LEASE_NONE cpu_to_le32(0x00) 506#define SMB2_LEASE_READ_CACHING cpu_to_le32(0x01) 507#define SMB2_LEASE_HANDLE_CACHING cpu_to_le32(0x02) 508#define SMB2_LEASE_WRITE_CACHING cpu_to_le32(0x04) 509 510#define SMB2_LEASE_FLAG_BREAK_IN_PROGRESS cpu_to_le32(0x02) 511 512#define SMB2_LEASE_KEY_SIZE 16 513 514struct lease_context { 515 __le64 LeaseKeyLow; 516 __le64 LeaseKeyHigh; 517 __le32 LeaseState; 518 __le32 LeaseFlags; 519 __le64 LeaseDuration; 520} __packed; 521 522struct lease_context_v2 { 523 __le64 LeaseKeyLow; 524 __le64 LeaseKeyHigh; 525 __le32 LeaseState; 526 __le32 LeaseFlags; 527 __le64 LeaseDuration; 528 __le64 ParentLeaseKeyLow; 529 __le64 ParentLeaseKeyHigh; 530 __le16 Epoch; 531 __le16 Reserved; 532} __packed; 533 534struct create_lease { 535 struct create_context ccontext; 536 __u8 Name[8]; 537 struct lease_context lcontext; 538} __packed; 539 540struct create_lease_v2 { 541 struct create_context ccontext; 542 __u8 Name[8]; 543 struct lease_context_v2 lcontext; 544 __u8 Pad[4]; 545} __packed; 546 547struct create_durable { 548 struct create_context ccontext; 549 __u8 Name[8]; 550 union { 551 __u8 Reserved[16]; 552 struct { 553 __u64 PersistentFileId; 554 __u64 VolatileFileId; 555 } Fid; 556 } Data; 557} __packed; 558 559#define COPY_CHUNK_RES_KEY_SIZE 24 560struct resume_key_req { 561 char ResumeKey[COPY_CHUNK_RES_KEY_SIZE]; 562 __le32 ContextLength; /* MBZ */ 563 char Context[0]; /* ignored, Windows sets to 4 bytes of zero */ 564} __packed; 565 566/* this goes in the ioctl buffer when doing a copychunk request */ 567struct copychunk_ioctl { 568 char SourceKey[COPY_CHUNK_RES_KEY_SIZE]; 569 __le32 ChunkCount; /* we are only sending 1 */ 570 __le32 Reserved; 571 /* array will only be one chunk long for us */ 572 __le64 SourceOffset; 573 __le64 TargetOffset; 574 __le32 Length; /* how many bytes to copy */ 575 __u32 Reserved2; 576} __packed; 577 578/* this goes in the ioctl buffer when doing FSCTL_SET_ZERO_DATA */ 579struct file_zero_data_information { 580 __le64 FileOffset; 581 __le64 BeyondFinalZero; 582} __packed; 583 584struct copychunk_ioctl_rsp { 585 __le32 ChunksWritten; 586 __le32 ChunkBytesWritten; 587 __le32 TotalBytesWritten; 588} __packed; 589 590struct validate_negotiate_info_req { 591 __le32 Capabilities; 592 __u8 Guid[SMB2_CLIENT_GUID_SIZE]; 593 __le16 SecurityMode; 594 __le16 DialectCount; 595 __le16 Dialects[1]; /* dialect (someday maybe list) client asked for */ 596} __packed; 597 598struct validate_negotiate_info_rsp { 599 __le32 Capabilities; 600 __u8 Guid[SMB2_CLIENT_GUID_SIZE]; 601 __le16 SecurityMode; 602 __le16 Dialect; /* Dialect in use for the connection */ 603} __packed; 604 605#define RSS_CAPABLE 0x00000001 606#define RDMA_CAPABLE 0x00000002 607 608struct network_interface_info_ioctl_rsp { 609 __le32 Next; /* next interface. zero if this is last one */ 610 __le32 IfIndex; 611 __le32 Capability; /* RSS or RDMA Capable */ 612 __le32 Reserved; 613 __le64 LinkSpeed; 614 char SockAddr_Storage[128]; 615} __packed; 616 617#define NO_FILE_ID 0xFFFFFFFFFFFFFFFFULL /* general ioctls to srv not to file */ 618 619struct compress_ioctl { 620 __le16 CompressionState; /* See cifspdu.h for possible flag values */ 621} __packed; 622 623struct smb2_ioctl_req { 624 struct smb2_hdr hdr; 625 __le16 StructureSize; /* Must be 57 */ 626 __u16 Reserved; 627 __le32 CtlCode; 628 __u64 PersistentFileId; /* opaque endianness */ 629 __u64 VolatileFileId; /* opaque endianness */ 630 __le32 InputOffset; 631 __le32 InputCount; 632 __le32 MaxInputResponse; 633 __le32 OutputOffset; 634 __le32 OutputCount; 635 __le32 MaxOutputResponse; 636 __le32 Flags; 637 __u32 Reserved2; 638 __u8 Buffer[0]; 639} __packed; 640 641struct smb2_ioctl_rsp { 642 struct smb2_hdr hdr; 643 __le16 StructureSize; /* Must be 57 */ 644 __u16 Reserved; 645 __le32 CtlCode; 646 __u64 PersistentFileId; /* opaque endianness */ 647 __u64 VolatileFileId; /* opaque endianness */ 648 __le32 InputOffset; 649 __le32 InputCount; 650 __le32 OutputOffset; 651 __le32 OutputCount; 652 __le32 Flags; 653 __u32 Reserved2; 654 /* char * buffer[] */ 655} __packed; 656 657/* Currently defined values for close flags */ 658#define SMB2_CLOSE_FLAG_POSTQUERY_ATTRIB cpu_to_le16(0x0001) 659struct smb2_close_req { 660 struct smb2_hdr hdr; 661 __le16 StructureSize; /* Must be 24 */ 662 __le16 Flags; 663 __le32 Reserved; 664 __u64 PersistentFileId; /* opaque endianness */ 665 __u64 VolatileFileId; /* opaque endianness */ 666} __packed; 667 668struct smb2_close_rsp { 669 struct smb2_hdr hdr; 670 __le16 StructureSize; /* 60 */ 671 __le16 Flags; 672 __le32 Reserved; 673 __le64 CreationTime; 674 __le64 LastAccessTime; 675 __le64 LastWriteTime; 676 __le64 ChangeTime; 677 __le64 AllocationSize; /* Beginning of FILE_STANDARD_INFO equivalent */ 678 __le64 EndOfFile; 679 __le32 Attributes; 680} __packed; 681 682struct smb2_flush_req { 683 struct smb2_hdr hdr; 684 __le16 StructureSize; /* Must be 24 */ 685 __le16 Reserved1; 686 __le32 Reserved2; 687 __u64 PersistentFileId; /* opaque endianness */ 688 __u64 VolatileFileId; /* opaque endianness */ 689} __packed; 690 691struct smb2_flush_rsp { 692 struct smb2_hdr hdr; 693 __le16 StructureSize; 694 __le16 Reserved; 695} __packed; 696 697/* For read request Flags field below, following flag is defined for SMB3.02 */ 698#define SMB2_READFLAG_READ_UNBUFFERED 0x01 699 700/* Channel field for read and write: exactly one of following flags can be set*/ 701#define SMB2_CHANNEL_NONE 0x00000000 702#define SMB2_CHANNEL_RDMA_V1 0x00000001 /* SMB3 or later */ 703#define SMB2_CHANNEL_RDMA_V1_INVALIDATE 0x00000001 /* SMB3.02 or later */ 704 705struct smb2_read_req { 706 struct smb2_hdr hdr; 707 __le16 StructureSize; /* Must be 49 */ 708 __u8 Padding; /* offset from start of SMB2 header to place read */ 709 __u8 Flags; /* MBZ unless SMB3.02 or later */ 710 __le32 Length; 711 __le64 Offset; 712 __u64 PersistentFileId; /* opaque endianness */ 713 __u64 VolatileFileId; /* opaque endianness */ 714 __le32 MinimumCount; 715 __le32 Channel; /* MBZ except for SMB3 or later */ 716 __le32 RemainingBytes; 717 __le16 ReadChannelInfoOffset; /* Reserved MBZ */ 718 __le16 ReadChannelInfoLength; /* Reserved MBZ */ 719 __u8 Buffer[1]; 720} __packed; 721 722struct smb2_read_rsp { 723 struct smb2_hdr hdr; 724 __le16 StructureSize; /* Must be 17 */ 725 __u8 DataOffset; 726 __u8 Reserved; 727 __le32 DataLength; 728 __le32 DataRemaining; 729 __u32 Reserved2; 730 __u8 Buffer[1]; 731} __packed; 732 733/* For write request Flags field below the following flags are defined: */ 734#define SMB2_WRITEFLAG_WRITE_THROUGH 0x00000001 /* SMB2.1 or later */ 735#define SMB2_WRITEFLAG_WRITE_UNBUFFERED 0x00000002 /* SMB3.02 or later */ 736 737struct smb2_write_req { 738 struct smb2_hdr hdr; 739 __le16 StructureSize; /* Must be 49 */ 740 __le16 DataOffset; /* offset from start of SMB2 header to write data */ 741 __le32 Length; 742 __le64 Offset; 743 __u64 PersistentFileId; /* opaque endianness */ 744 __u64 VolatileFileId; /* opaque endianness */ 745 __le32 Channel; /* Reserved MBZ */ 746 __le32 RemainingBytes; 747 __le16 WriteChannelInfoOffset; /* Reserved MBZ */ 748 __le16 WriteChannelInfoLength; /* Reserved MBZ */ 749 __le32 Flags; 750 __u8 Buffer[1]; 751} __packed; 752 753struct smb2_write_rsp { 754 struct smb2_hdr hdr; 755 __le16 StructureSize; /* Must be 17 */ 756 __u8 DataOffset; 757 __u8 Reserved; 758 __le32 DataLength; 759 __le32 DataRemaining; 760 __u32 Reserved2; 761 __u8 Buffer[1]; 762} __packed; 763 764#define SMB2_LOCKFLAG_SHARED_LOCK 0x0001 765#define SMB2_LOCKFLAG_EXCLUSIVE_LOCK 0x0002 766#define SMB2_LOCKFLAG_UNLOCK 0x0004 767#define SMB2_LOCKFLAG_FAIL_IMMEDIATELY 0x0010 768 769struct smb2_lock_element { 770 __le64 Offset; 771 __le64 Length; 772 __le32 Flags; 773 __le32 Reserved; 774} __packed; 775 776struct smb2_lock_req { 777 struct smb2_hdr hdr; 778 __le16 StructureSize; /* Must be 48 */ 779 __le16 LockCount; 780 __le32 Reserved; 781 __u64 PersistentFileId; /* opaque endianness */ 782 __u64 VolatileFileId; /* opaque endianness */ 783 /* Followed by at least one */ 784 struct smb2_lock_element locks[1]; 785} __packed; 786 787struct smb2_lock_rsp { 788 struct smb2_hdr hdr; 789 __le16 StructureSize; /* Must be 4 */ 790 __le16 Reserved; 791} __packed; 792 793struct smb2_echo_req { 794 struct smb2_hdr hdr; 795 __le16 StructureSize; /* Must be 4 */ 796 __u16 Reserved; 797} __packed; 798 799struct smb2_echo_rsp { 800 struct smb2_hdr hdr; 801 __le16 StructureSize; /* Must be 4 */ 802 __u16 Reserved; 803} __packed; 804 805/* search (query_directory) Flags field */ 806#define SMB2_RESTART_SCANS 0x01 807#define SMB2_RETURN_SINGLE_ENTRY 0x02 808#define SMB2_INDEX_SPECIFIED 0x04 809#define SMB2_REOPEN 0x10 810 811struct smb2_query_directory_req { 812 struct smb2_hdr hdr; 813 __le16 StructureSize; /* Must be 33 */ 814 __u8 FileInformationClass; 815 __u8 Flags; 816 __le32 FileIndex; 817 __u64 PersistentFileId; /* opaque endianness */ 818 __u64 VolatileFileId; /* opaque endianness */ 819 __le16 FileNameOffset; 820 __le16 FileNameLength; 821 __le32 OutputBufferLength; 822 __u8 Buffer[1]; 823} __packed; 824 825struct smb2_query_directory_rsp { 826 struct smb2_hdr hdr; 827 __le16 StructureSize; /* Must be 9 */ 828 __le16 OutputBufferOffset; 829 __le32 OutputBufferLength; 830 __u8 Buffer[1]; 831} __packed; 832 833/* Possible InfoType values */ 834#define SMB2_O_INFO_FILE 0x01 835#define SMB2_O_INFO_FILESYSTEM 0x02 836#define SMB2_O_INFO_SECURITY 0x03 837#define SMB2_O_INFO_QUOTA 0x04 838 839/* Security info type additionalinfo flags. See MS-SMB2 (2.2.37) or MS-DTYP */ 840#define OWNER_SECINFO 0x00000001 841#define GROUP_SECINFO 0x00000002 842#define DACL_SECINFO 0x00000004 843#define SACL_SECINFO 0x00000008 844#define LABEL_SECINFO 0x00000010 845#define ATTRIBUTE_SECINFO 0x00000020 846#define SCOPE_SECINFO 0x00000040 847#define BACKUP_SECINFO 0x00010000 848#define UNPROTECTED_SACL_SECINFO 0x10000000 849#define UNPROTECTED_DACL_SECINFO 0x20000000 850#define PROTECTED_SACL_SECINFO 0x40000000 851#define PROTECTED_DACL_SECINFO 0x80000000 852 853/* Flags used for FileFullEAinfo */ 854#define SL_RESTART_SCAN 0x00000001 855#define SL_RETURN_SINGLE_ENTRY 0x00000002 856#define SL_INDEX_SPECIFIED 0x00000004 857 858struct smb2_query_info_req { 859 struct smb2_hdr hdr; 860 __le16 StructureSize; /* Must be 41 */ 861 __u8 InfoType; 862 __u8 FileInfoClass; 863 __le32 OutputBufferLength; 864 __le16 InputBufferOffset; 865 __u16 Reserved; 866 __le32 InputBufferLength; 867 __le32 AdditionalInformation; 868 __le32 Flags; 869 __u64 PersistentFileId; /* opaque endianness */ 870 __u64 VolatileFileId; /* opaque endianness */ 871 __u8 Buffer[1]; 872} __packed; 873 874struct smb2_query_info_rsp { 875 struct smb2_hdr hdr; 876 __le16 StructureSize; /* Must be 9 */ 877 __le16 OutputBufferOffset; 878 __le32 OutputBufferLength; 879 __u8 Buffer[1]; 880} __packed; 881 882struct smb2_set_info_req { 883 struct smb2_hdr hdr; 884 __le16 StructureSize; /* Must be 33 */ 885 __u8 InfoType; 886 __u8 FileInfoClass; 887 __le32 BufferLength; 888 __le16 BufferOffset; 889 __u16 Reserved; 890 __le32 AdditionalInformation; 891 __u64 PersistentFileId; /* opaque endianness */ 892 __u64 VolatileFileId; /* opaque endianness */ 893 __u8 Buffer[1]; 894} __packed; 895 896struct smb2_set_info_rsp { 897 struct smb2_hdr hdr; 898 __le16 StructureSize; /* Must be 2 */ 899} __packed; 900 901struct smb2_oplock_break { 902 struct smb2_hdr hdr; 903 __le16 StructureSize; /* Must be 24 */ 904 __u8 OplockLevel; 905 __u8 Reserved; 906 __le32 Reserved2; 907 __u64 PersistentFid; 908 __u64 VolatileFid; 909} __packed; 910 911#define SMB2_NOTIFY_BREAK_LEASE_FLAG_ACK_REQUIRED cpu_to_le32(0x01) 912 913struct smb2_lease_break { 914 struct smb2_hdr hdr; 915 __le16 StructureSize; /* Must be 44 */ 916 __le16 Reserved; 917 __le32 Flags; 918 __u8 LeaseKey[16]; 919 __le32 CurrentLeaseState; 920 __le32 NewLeaseState; 921 __le32 BreakReason; 922 __le32 AccessMaskHint; 923 __le32 ShareMaskHint; 924} __packed; 925 926struct smb2_lease_ack { 927 struct smb2_hdr hdr; 928 __le16 StructureSize; /* Must be 36 */ 929 __le16 Reserved; 930 __le32 Flags; 931 __u8 LeaseKey[16]; 932 __le32 LeaseState; 933 __le64 LeaseDuration; 934} __packed; 935 936/* 937 * PDU infolevel structure definitions 938 * BB consider moving to a different header 939 */ 940 941/* File System Information Classes */ 942#define FS_VOLUME_INFORMATION 1 /* Query */ 943#define FS_LABEL_INFORMATION 2 /* Local only */ 944#define FS_SIZE_INFORMATION 3 /* Query */ 945#define FS_DEVICE_INFORMATION 4 /* Query */ 946#define FS_ATTRIBUTE_INFORMATION 5 /* Query */ 947#define FS_CONTROL_INFORMATION 6 /* Query, Set */ 948#define FS_FULL_SIZE_INFORMATION 7 /* Query */ 949#define FS_OBJECT_ID_INFORMATION 8 /* Query, Set */ 950#define FS_DRIVER_PATH_INFORMATION 9 /* Local only */ 951#define FS_VOLUME_FLAGS_INFORMATION 10 /* Local only */ 952#define FS_SECTOR_SIZE_INFORMATION 11 /* SMB3 or later. Query */ 953 954struct smb2_fs_full_size_info { 955 __le64 TotalAllocationUnits; 956 __le64 CallerAvailableAllocationUnits; 957 __le64 ActualAvailableAllocationUnits; 958 __le32 SectorsPerAllocationUnit; 959 __le32 BytesPerSector; 960} __packed; 961 962#define SSINFO_FLAGS_ALIGNED_DEVICE 0x00000001 963#define SSINFO_FLAGS_PARTITION_ALIGNED_ON_DEVICE 0x00000002 964#define SSINFO_FLAGS_NO_SEEK_PENALTY 0x00000004 965#define SSINFO_FLAGS_TRIM_ENABLED 0x00000008 966 967/* sector size info struct */ 968struct smb3_fs_ss_info { 969 __le32 LogicalBytesPerSector; 970 __le32 PhysicalBytesPerSectorForAtomicity; 971 __le32 PhysicalBytesPerSectorForPerf; 972 __le32 FileSystemEffectivePhysicalBytesPerSectorForAtomicity; 973 __le32 Flags; 974 __le32 ByteOffsetForSectorAlignment; 975 __le32 ByteOffsetForPartitionAlignment; 976} __packed; 977 978/* partial list of QUERY INFO levels */ 979#define FILE_DIRECTORY_INFORMATION 1 980#define FILE_FULL_DIRECTORY_INFORMATION 2 981#define FILE_BOTH_DIRECTORY_INFORMATION 3 982#define FILE_BASIC_INFORMATION 4 983#define FILE_STANDARD_INFORMATION 5 984#define FILE_INTERNAL_INFORMATION 6 985#define FILE_EA_INFORMATION 7 986#define FILE_ACCESS_INFORMATION 8 987#define FILE_NAME_INFORMATION 9 988#define FILE_RENAME_INFORMATION 10 989#define FILE_LINK_INFORMATION 11 990#define FILE_NAMES_INFORMATION 12 991#define FILE_DISPOSITION_INFORMATION 13 992#define FILE_POSITION_INFORMATION 14 993#define FILE_FULL_EA_INFORMATION 15 994#define FILE_MODE_INFORMATION 16 995#define FILE_ALIGNMENT_INFORMATION 17 996#define FILE_ALL_INFORMATION 18 997#define FILE_ALLOCATION_INFORMATION 19 998#define FILE_END_OF_FILE_INFORMATION 20 999#define FILE_ALTERNATE_NAME_INFORMATION 21 1000#define FILE_STREAM_INFORMATION 22 1001#define FILE_PIPE_INFORMATION 23 1002#define FILE_PIPE_LOCAL_INFORMATION 24 1003#define FILE_PIPE_REMOTE_INFORMATION 25 1004#define FILE_MAILSLOT_QUERY_INFORMATION 26 1005#define FILE_MAILSLOT_SET_INFORMATION 27 1006#define FILE_COMPRESSION_INFORMATION 28 1007#define FILE_OBJECT_ID_INFORMATION 29 1008/* Number 30 not defined in documents */ 1009#define FILE_MOVE_CLUSTER_INFORMATION 31 1010#define FILE_QUOTA_INFORMATION 32 1011#define FILE_REPARSE_POINT_INFORMATION 33 1012#define FILE_NETWORK_OPEN_INFORMATION 34 1013#define FILE_ATTRIBUTE_TAG_INFORMATION 35 1014#define FILE_TRACKING_INFORMATION 36 1015#define FILEID_BOTH_DIRECTORY_INFORMATION 37 1016#define FILEID_FULL_DIRECTORY_INFORMATION 38 1017#define FILE_VALID_DATA_LENGTH_INFORMATION 39 1018#define FILE_SHORT_NAME_INFORMATION 40 1019#define FILE_SFIO_RESERVE_INFORMATION 44 1020#define FILE_SFIO_VOLUME_INFORMATION 45 1021#define FILE_HARD_LINK_INFORMATION 46 1022#define FILE_NORMALIZED_NAME_INFORMATION 48 1023#define FILEID_GLOBAL_TX_DIRECTORY_INFORMATION 50 1024#define FILE_STANDARD_LINK_INFORMATION 54 1025 1026struct smb2_file_internal_info { 1027 __le64 IndexNumber; 1028} __packed; /* level 6 Query */ 1029 1030struct smb2_file_rename_info { /* encoding of request for level 10 */ 1031 __u8 ReplaceIfExists; /* 1 = replace existing target with new */ 1032 /* 0 = fail if target already exists */ 1033 __u8 Reserved[7]; 1034 __u64 RootDirectory; /* MBZ for network operations (why says spec?) */ 1035 __le32 FileNameLength; 1036 char FileName[0]; /* New name to be assigned */ 1037} __packed; /* level 10 Set */ 1038 1039struct smb2_file_link_info { /* encoding of request for level 11 */ 1040 __u8 ReplaceIfExists; /* 1 = replace existing link with new */ 1041 /* 0 = fail if link already exists */ 1042 __u8 Reserved[7]; 1043 __u64 RootDirectory; /* MBZ for network operations (why says spec?) */ 1044 __le32 FileNameLength; 1045 char FileName[0]; /* Name to be assigned to new link */ 1046} __packed; /* level 11 Set */ 1047 1048/* 1049 * This level 18, although with struct with same name is different from cifs 1050 * level 0x107. Level 0x107 has an extra u64 between AccessFlags and 1051 * CurrentByteOffset. 1052 */ 1053struct smb2_file_all_info { /* data block encoding of response to level 18 */ 1054 __le64 CreationTime; /* Beginning of FILE_BASIC_INFO equivalent */ 1055 __le64 LastAccessTime; 1056 __le64 LastWriteTime; 1057 __le64 ChangeTime; 1058 __le32 Attributes; 1059 __u32 Pad1; /* End of FILE_BASIC_INFO_INFO equivalent */ 1060 __le64 AllocationSize; /* Beginning of FILE_STANDARD_INFO equivalent */ 1061 __le64 EndOfFile; /* size ie offset to first free byte in file */ 1062 __le32 NumberOfLinks; /* hard links */ 1063 __u8 DeletePending; 1064 __u8 Directory; 1065 __u16 Pad2; /* End of FILE_STANDARD_INFO equivalent */ 1066 __le64 IndexNumber; 1067 __le32 EASize; 1068 __le32 AccessFlags; 1069 __le64 CurrentByteOffset; 1070 __le32 Mode; 1071 __le32 AlignmentRequirement; 1072 __le32 FileNameLength; 1073 char FileName[1]; 1074} __packed; /* level 18 Query */ 1075 1076struct smb2_file_eof_info { /* encoding of request for level 10 */ 1077 __le64 EndOfFile; /* new end of file value */ 1078} __packed; /* level 20 Set */ 1079 1080#endif /* _SMB2PDU_H */ 1081