1 /* SPDX-License-Identifier: LGPL-2.1 */
4 * Copyright (c) International Business Machines Corp., 2009, 2013
17 /* 52 transform hdr + 64 hdr + 88 create rsp */
18 #define SMB2_TRANSFORM_HEADER_SIZE 52
19 #define MAX_SMB2_HDR_SIZE 204
21 /* The total header size for SMB2 read and write */
22 #define SMB2_READWRITE_PDU_HEADER_SIZE (48 + sizeof(struct smb2_hdr))
24 /* See MS-SMB2 2.2.43 */
25 struct smb2_rdma_transform {
26 __le16 RdmaDescriptorOffset;
27 __le16 RdmaDescriptorLength;
28 __le32 Channel; /* for values see channel description in smb2 read above */
29 __le16 TransformCount;
35 #define SMB2_RDMA_TRANSFORM_TYPE_ENCRYPTION 0x0001
36 #define SMB2_RDMA_TRANSFORM_TYPE_SIGNING 0x0002
38 struct smb2_rdma_crypto_transform {
40 __le16 SignatureLength;
43 __u8 Signature[]; /* variable length */
45 /* followed by padding */
49 * Definitions for SMB2 Protocol Data Units (network frames)
51 * See MS-SMB2.PDF specification for protocol details.
52 * The Naming convention is the lower case version of the SMB2
53 * command code name for the struct. Note that structures must be packed.
57 #define COMPOUND_FID 0xFFFFFFFFFFFFFFFFULL
59 #define SMB2_ERROR_STRUCTURE_SIZE2 cpu_to_le16(9)
64 __le16 Reserved; /* MBZ */
65 __le32 ByteCount; /* even if zero, at least one byte follows */
66 __u8 ErrorData[1]; /* variable length */
69 #define SYMLINK_ERROR_TAG 0x4c4d5953
71 struct smb2_symlink_err_rsp {
73 __le32 SymLinkErrorTag;
75 __le16 ReparseDataLength;
76 __le16 UnparsedPathLength;
77 __le16 SubstituteNameOffset;
78 __le16 SubstituteNameLength;
79 __le16 PrintNameOffset;
80 __le16 PrintNameLength;
85 /* SMB 3.1.1 and later dialects. See MS-SMB2 section 2.2.2.1 */
86 struct smb2_error_context_rsp {
87 __le32 ErrorDataLength;
89 __u8 ErrorContextData; /* ErrorDataLength long array */
93 #define SMB2_ERROR_ID_DEFAULT 0x00000000
94 #define SMB2_ERROR_ID_SHARE_REDIRECT cpu_to_le32(0x72645253) /* "rdRS" */
96 /* Defines for Type field below (see MS-SMB2 2.2.2.2.2.1) */
97 #define MOVE_DST_IPADDR_V4 cpu_to_le32(0x00000001)
98 #define MOVE_DST_IPADDR_V6 cpu_to_le32(0x00000002)
100 struct move_dst_ipaddr {
103 __u8 address[16]; /* IPv4 followed by 12 bytes rsvd or IPv6 address */
106 struct share_redirect_error_context_rsp {
107 __le32 StructureSize;
108 __le32 NotificationType;
109 __le32 ResourceNameOffset;
110 __le32 ResourceNameLength;
114 struct move_dst_ipaddr IpAddrMoveList[];
115 /* __u8 ResourceName[] */ /* Name of share as counted Unicode string */
119 * Maximum number of iovs we need for an open/create request.
120 * [0] : struct smb2_create_req
122 * [2] : lease context
123 * [3] : durable context
124 * [4] : posix context
125 * [5] : time warp context
126 * [6] : query id context
127 * [7] : compound padding
129 #define SMB2_CREATE_IOV_SIZE 8
132 * Maximum size of a SMB2_CREATE response is 64 (smb2 header) +
133 * 88 (fixed part of create response) + 520 (path) + 208 (contexts) +
134 * 2 bytes of padding.
136 #define MAX_SMB2_CREATE_RESPONSE_SIZE 880
138 #define SMB2_LEASE_READ_CACHING_HE 0x01
139 #define SMB2_LEASE_HANDLE_CACHING_HE 0x02
140 #define SMB2_LEASE_WRITE_CACHING_HE 0x04
142 #define SMB2_LEASE_NONE cpu_to_le32(0x00)
143 #define SMB2_LEASE_READ_CACHING cpu_to_le32(0x01)
144 #define SMB2_LEASE_HANDLE_CACHING cpu_to_le32(0x02)
145 #define SMB2_LEASE_WRITE_CACHING cpu_to_le32(0x04)
147 #define SMB2_LEASE_FLAG_BREAK_IN_PROGRESS cpu_to_le32(0x00000002)
148 #define SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET cpu_to_le32(0x00000004)
150 #define SMB2_LEASE_KEY_SIZE 16
152 struct lease_context {
153 u8 LeaseKey[SMB2_LEASE_KEY_SIZE];
156 __le64 LeaseDuration;
159 struct lease_context_v2 {
160 u8 LeaseKey[SMB2_LEASE_KEY_SIZE];
163 __le64 LeaseDuration;
164 __le64 ParentLeaseKeyLow;
165 __le64 ParentLeaseKeyHigh;
170 struct create_lease {
171 struct create_context ccontext;
173 struct lease_context lcontext;
176 struct create_lease_v2 {
177 struct create_context ccontext;
179 struct lease_context_v2 lcontext;
183 struct create_durable {
184 struct create_context ccontext;
189 __u64 PersistentFileId;
190 __u64 VolatileFileId;
195 struct create_posix {
196 struct create_context ccontext;
202 /* See MS-SMB2 2.2.13.2.11 */
204 #define SMB2_DHANDLE_FLAG_PERSISTENT 0x00000002
205 struct durable_context_v2 {
212 struct create_durable_v2 {
213 struct create_context ccontext;
215 struct durable_context_v2 dcontext;
218 /* See MS-SMB2 2.2.13.2.12 */
219 struct durable_reconnect_context_v2 {
221 __u64 PersistentFileId;
222 __u64 VolatileFileId;
225 __le32 Flags; /* see above DHANDLE_FLAG_PERSISTENT */
228 /* See MS-SMB2 2.2.14.2.9 */
229 struct create_on_disk_id {
230 struct create_context ccontext;
237 /* See MS-SMB2 2.2.14.2.12 */
238 struct durable_reconnect_context_v2_rsp {
240 __le32 Flags; /* see above DHANDLE_FLAG_PERSISTENT */
243 struct create_durable_handle_reconnect_v2 {
244 struct create_context ccontext;
246 struct durable_reconnect_context_v2 dcontext;
250 /* See MS-SMB2 2.2.13.2.5 */
251 struct crt_twarp_ctxt {
252 struct create_context ccontext;
258 /* See MS-SMB2 2.2.13.2.9 */
259 struct crt_query_id_ctxt {
260 struct create_context ccontext;
265 struct create_context ccontext;
271 #define COPY_CHUNK_RES_KEY_SIZE 24
272 struct resume_key_req {
273 char ResumeKey[COPY_CHUNK_RES_KEY_SIZE];
274 __le32 ContextLength; /* MBZ */
275 char Context[]; /* ignored, Windows sets to 4 bytes of zero */
278 /* this goes in the ioctl buffer when doing a copychunk request */
279 struct copychunk_ioctl {
280 char SourceKey[COPY_CHUNK_RES_KEY_SIZE];
281 __le32 ChunkCount; /* we are only sending 1 */
283 /* array will only be one chunk long for us */
286 __le32 Length; /* how many bytes to copy */
290 /* this goes in the ioctl buffer when doing FSCTL_SET_ZERO_DATA */
291 struct file_zero_data_information {
293 __le64 BeyondFinalZero;
296 struct copychunk_ioctl_rsp {
297 __le32 ChunksWritten;
298 __le32 ChunkBytesWritten;
299 __le32 TotalBytesWritten;
302 /* See MS-FSCC 2.3.29 and 2.3.30 */
303 struct get_retrieval_pointer_count_req {
304 __le64 StartingVcn; /* virtual cluster number (signed) */
307 struct get_retrieval_pointer_count_rsp {
312 * See MS-FSCC 2.3.33 and 2.3.34
313 * request is the same as get_retrieval_point_count_req struct above
315 struct smb3_extents {
317 __le64 Lcn; /* logical cluster number */
320 struct get_retrieval_pointers_refcount_rsp {
324 struct smb3_extents extents[];
327 struct fsctl_set_integrity_information_req {
328 __le16 ChecksumAlgorithm;
333 struct fsctl_get_integrity_information_rsp {
334 __le16 ChecksumAlgorithm;
337 __le32 ChecksumChunkSizeInBytes;
338 __le32 ClusterSizeInBytes;
341 struct file_allocated_range_buffer {
346 /* Integrity ChecksumAlgorithm choices for above */
347 #define CHECKSUM_TYPE_NONE 0x0000
348 #define CHECKSUM_TYPE_CRC64 0x0002
349 #define CHECKSUM_TYPE_UNCHANGED 0xFFFF /* set only */
351 /* Integrity flags for above */
352 #define FSCTL_INTEGRITY_FLAG_CHECKSUM_ENFORCEMENT_OFF 0x00000001
354 /* Reparse structures - see MS-FSCC 2.1.2 */
356 /* struct fsctl_reparse_info_req is empty, only response structs (see below) */
358 struct reparse_data_buffer {
360 __le16 ReparseDataLength;
362 __u8 DataBuffer[]; /* Variable Length */
365 struct reparse_guid_data_buffer {
367 __le16 ReparseDataLength;
369 __u8 ReparseGuid[16];
370 __u8 DataBuffer[]; /* Variable Length */
373 struct reparse_mount_point_data_buffer {
375 __le16 ReparseDataLength;
377 __le16 SubstituteNameOffset;
378 __le16 SubstituteNameLength;
379 __le16 PrintNameOffset;
380 __le16 PrintNameLength;
381 __u8 PathBuffer[]; /* Variable Length */
384 #define SYMLINK_FLAG_RELATIVE 0x00000001
386 struct reparse_symlink_data_buffer {
388 __le16 ReparseDataLength;
390 __le16 SubstituteNameOffset;
391 __le16 SubstituteNameLength;
392 __le16 PrintNameOffset;
393 __le16 PrintNameLength;
395 __u8 PathBuffer[]; /* Variable Length */
398 /* See MS-FSCC 2.1.2.6 and cifspdu.h for struct reparse_posix_data */
401 /* See MS-DFSC 2.2.2 */
402 struct fsctl_get_dfs_referral_req {
403 __le16 MaxReferralLevel;
404 __u8 RequestFileName[];
407 /* DFS response is struct get_dfs_refer_rsp */
409 /* See MS-SMB2 2.2.31.3 */
410 struct network_resiliency_req {
414 /* There is no buffer for the response ie no struct network_resiliency_rsp */
417 struct validate_negotiate_info_req {
419 __u8 Guid[SMB2_CLIENT_GUID_SIZE];
422 __le16 Dialects[4]; /* BB expand this if autonegotiate > 4 dialects */
425 struct validate_negotiate_info_rsp {
427 __u8 Guid[SMB2_CLIENT_GUID_SIZE];
429 __le16 Dialect; /* Dialect in use for the connection */
432 #define RSS_CAPABLE cpu_to_le32(0x00000001)
433 #define RDMA_CAPABLE cpu_to_le32(0x00000002)
435 #define INTERNETWORK cpu_to_le16(0x0002)
436 #define INTERNETWORKV6 cpu_to_le16(0x0017)
438 struct network_interface_info_ioctl_rsp {
439 __le32 Next; /* next interface. zero if this is last one */
441 __le32 Capability; /* RSS or RDMA Capable */
448 struct iface_info_ipv4 {
454 struct iface_info_ipv6 {
457 __u8 IPv6Address[16];
461 #define NO_FILE_ID 0xFFFFFFFFFFFFFFFFULL /* general ioctls to srv not to file */
463 struct compress_ioctl {
464 __le16 CompressionState; /* See cifspdu.h for possible flag values */
467 struct duplicate_extents_to_file {
468 __u64 PersistentFileHandle; /* source file handle, opaque endianness */
469 __u64 VolatileFileHandle;
470 __le64 SourceFileOffset;
471 __le64 TargetFileOffset;
472 __le64 ByteCount; /* Bytes to be copied */
476 * Maximum number of iovs we need for an ioctl request.
477 * [0] : struct smb2_ioctl_req
480 #define SMB2_IOCTL_IOV_SIZE 2
482 struct smb2_ioctl_req {
484 __le16 StructureSize; /* Must be 57 */
487 __u64 PersistentFileId; /* opaque endianness */
488 __u64 VolatileFileId; /* opaque endianness */
491 __le32 MaxInputResponse;
494 __le32 MaxOutputResponse;
500 struct smb2_ioctl_rsp {
502 __le16 StructureSize; /* Must be 57 */
505 __u64 PersistentFileId; /* opaque endianness */
506 __u64 VolatileFileId; /* opaque endianness */
513 /* char * buffer[] */
516 #define SMB2_LOCKFLAG_SHARED_LOCK 0x0001
517 #define SMB2_LOCKFLAG_EXCLUSIVE_LOCK 0x0002
518 #define SMB2_LOCKFLAG_UNLOCK 0x0004
519 #define SMB2_LOCKFLAG_FAIL_IMMEDIATELY 0x0010
521 struct smb2_lock_element {
528 struct smb2_lock_req {
530 __le16 StructureSize; /* Must be 48 */
533 * The least significant four bits are the index, the other 28 bits are
534 * the lock sequence number (0 to 64). See MS-SMB2 2.2.26
536 __le32 LockSequenceNumber;
537 __u64 PersistentFileId; /* opaque endianness */
538 __u64 VolatileFileId; /* opaque endianness */
539 /* Followed by at least one */
540 struct smb2_lock_element locks[1];
543 struct smb2_lock_rsp {
545 __le16 StructureSize; /* Must be 4 */
549 struct smb2_echo_req {
551 __le16 StructureSize; /* Must be 4 */
555 struct smb2_echo_rsp {
557 __le16 StructureSize; /* Must be 4 */
561 /* search (query_directory) Flags field */
562 #define SMB2_RESTART_SCANS 0x01
563 #define SMB2_RETURN_SINGLE_ENTRY 0x02
564 #define SMB2_INDEX_SPECIFIED 0x04
565 #define SMB2_REOPEN 0x10
567 #define SMB2_QUERY_DIRECTORY_IOV_SIZE 2
570 * Valid FileInformation classes.
572 * Note that these are a subset of the (file) QUERY_INFO levels defined
573 * later in this file (but since QUERY_DIRECTORY uses equivalent numbers
574 * we do not redefine them here)
576 * FileDirectoryInfomation 0x01
577 * FileFullDirectoryInformation 0x02
578 * FileIdFullDirectoryInformation 0x26
579 * FileBothDirectoryInformation 0x03
580 * FileIdBothDirectoryInformation 0x25
581 * FileNamesInformation 0x0C
582 * FileIdExtdDirectoryInformation 0x3C
585 struct smb2_query_directory_req {
587 __le16 StructureSize; /* Must be 33 */
588 __u8 FileInformationClass;
591 __u64 PersistentFileId; /* opaque endianness */
592 __u64 VolatileFileId; /* opaque endianness */
593 __le16 FileNameOffset;
594 __le16 FileNameLength;
595 __le32 OutputBufferLength;
599 struct smb2_query_directory_rsp {
601 __le16 StructureSize; /* Must be 9 */
602 __le16 OutputBufferOffset;
603 __le32 OutputBufferLength;
607 /* Possible InfoType values */
608 #define SMB2_O_INFO_FILE 0x01
609 #define SMB2_O_INFO_FILESYSTEM 0x02
610 #define SMB2_O_INFO_SECURITY 0x03
611 #define SMB2_O_INFO_QUOTA 0x04
613 /* Security info type additionalinfo flags. See MS-SMB2 (2.2.37) or MS-DTYP */
614 #define OWNER_SECINFO 0x00000001
615 #define GROUP_SECINFO 0x00000002
616 #define DACL_SECINFO 0x00000004
617 #define SACL_SECINFO 0x00000008
618 #define LABEL_SECINFO 0x00000010
619 #define ATTRIBUTE_SECINFO 0x00000020
620 #define SCOPE_SECINFO 0x00000040
621 #define BACKUP_SECINFO 0x00010000
622 #define UNPROTECTED_SACL_SECINFO 0x10000000
623 #define UNPROTECTED_DACL_SECINFO 0x20000000
624 #define PROTECTED_SACL_SECINFO 0x40000000
625 #define PROTECTED_DACL_SECINFO 0x80000000
627 /* Flags used for FileFullEAinfo */
628 #define SL_RESTART_SCAN 0x00000001
629 #define SL_RETURN_SINGLE_ENTRY 0x00000002
630 #define SL_INDEX_SPECIFIED 0x00000004
632 struct smb2_query_info_req {
634 __le16 StructureSize; /* Must be 41 */
637 __le32 OutputBufferLength;
638 __le16 InputBufferOffset;
640 __le32 InputBufferLength;
641 __le32 AdditionalInformation;
643 __u64 PersistentFileId; /* opaque endianness */
644 __u64 VolatileFileId; /* opaque endianness */
648 struct smb2_query_info_rsp {
650 __le16 StructureSize; /* Must be 9 */
651 __le16 OutputBufferOffset;
652 __le32 OutputBufferLength;
657 * Maximum number of iovs we need for a set-info request.
658 * The largest one is rename/hardlink
659 * [0] : struct smb2_set_info_req + smb2_file_[rename|link]_info
661 * [2] : compound padding
663 #define SMB2_SET_INFO_IOV_SIZE 3
665 struct smb2_set_info_req {
667 __le16 StructureSize; /* Must be 33 */
673 __le32 AdditionalInformation;
674 __u64 PersistentFileId; /* opaque endianness */
675 __u64 VolatileFileId; /* opaque endianness */
679 struct smb2_set_info_rsp {
681 __le16 StructureSize; /* Must be 2 */
684 struct smb2_oplock_break {
686 __le16 StructureSize; /* Must be 24 */
694 #define SMB2_NOTIFY_BREAK_LEASE_FLAG_ACK_REQUIRED cpu_to_le32(0x01)
696 struct smb2_lease_break {
698 __le16 StructureSize; /* Must be 44 */
702 __le32 CurrentLeaseState;
703 __le32 NewLeaseState;
705 __le32 AccessMaskHint;
706 __le32 ShareMaskHint;
709 struct smb2_lease_ack {
711 __le16 StructureSize; /* Must be 36 */
716 __le64 LeaseDuration;
720 * PDU infolevel structure definitions
721 * BB consider moving to a different header
724 /* File System Information Classes */
725 #define FS_VOLUME_INFORMATION 1 /* Query */
726 #define FS_LABEL_INFORMATION 2 /* Local only */
727 #define FS_SIZE_INFORMATION 3 /* Query */
728 #define FS_DEVICE_INFORMATION 4 /* Query */
729 #define FS_ATTRIBUTE_INFORMATION 5 /* Query */
730 #define FS_CONTROL_INFORMATION 6 /* Query, Set */
731 #define FS_FULL_SIZE_INFORMATION 7 /* Query */
732 #define FS_OBJECT_ID_INFORMATION 8 /* Query, Set */
733 #define FS_DRIVER_PATH_INFORMATION 9 /* Local only */
734 #define FS_VOLUME_FLAGS_INFORMATION 10 /* Local only */
735 #define FS_SECTOR_SIZE_INFORMATION 11 /* SMB3 or later. Query */
736 #define FS_POSIX_INFORMATION 100 /* SMB3.1.1 POSIX. Query */
738 struct smb2_fs_full_size_info {
739 __le64 TotalAllocationUnits;
740 __le64 CallerAvailableAllocationUnits;
741 __le64 ActualAvailableAllocationUnits;
742 __le32 SectorsPerAllocationUnit;
743 __le32 BytesPerSector;
746 #define SSINFO_FLAGS_ALIGNED_DEVICE 0x00000001
747 #define SSINFO_FLAGS_PARTITION_ALIGNED_ON_DEVICE 0x00000002
748 #define SSINFO_FLAGS_NO_SEEK_PENALTY 0x00000004
749 #define SSINFO_FLAGS_TRIM_ENABLED 0x00000008
751 /* sector size info struct */
752 struct smb3_fs_ss_info {
753 __le32 LogicalBytesPerSector;
754 __le32 PhysicalBytesPerSectorForAtomicity;
755 __le32 PhysicalBytesPerSectorForPerf;
756 __le32 FileSystemEffectivePhysicalBytesPerSectorForAtomicity;
758 __le32 ByteOffsetForSectorAlignment;
759 __le32 ByteOffsetForPartitionAlignment;
762 /* volume info struct - see MS-FSCC 2.5.9 */
763 #define MAX_VOL_LABEL_LEN 32
764 struct smb3_fs_vol_info {
765 __le64 VolumeCreationTime;
766 __u32 VolumeSerialNumber;
767 __le32 VolumeLabelLength; /* includes trailing null */
768 __u8 SupportsObjects; /* True if eg like NTFS, supports objects */
770 __u8 VolumeLabel[]; /* variable len */
773 /* partial list of QUERY INFO levels */
774 #define FILE_DIRECTORY_INFORMATION 1
775 #define FILE_FULL_DIRECTORY_INFORMATION 2
776 #define FILE_BOTH_DIRECTORY_INFORMATION 3
777 #define FILE_BASIC_INFORMATION 4
778 #define FILE_STANDARD_INFORMATION 5
779 #define FILE_INTERNAL_INFORMATION 6
780 #define FILE_EA_INFORMATION 7
781 #define FILE_ACCESS_INFORMATION 8
782 #define FILE_NAME_INFORMATION 9
783 #define FILE_RENAME_INFORMATION 10
784 #define FILE_LINK_INFORMATION 11
785 #define FILE_NAMES_INFORMATION 12
786 #define FILE_DISPOSITION_INFORMATION 13
787 #define FILE_POSITION_INFORMATION 14
788 #define FILE_FULL_EA_INFORMATION 15
789 #define FILE_MODE_INFORMATION 16
790 #define FILE_ALIGNMENT_INFORMATION 17
791 #define FILE_ALL_INFORMATION 18
792 #define FILE_ALLOCATION_INFORMATION 19
793 #define FILE_END_OF_FILE_INFORMATION 20
794 #define FILE_ALTERNATE_NAME_INFORMATION 21
795 #define FILE_STREAM_INFORMATION 22
796 #define FILE_PIPE_INFORMATION 23
797 #define FILE_PIPE_LOCAL_INFORMATION 24
798 #define FILE_PIPE_REMOTE_INFORMATION 25
799 #define FILE_MAILSLOT_QUERY_INFORMATION 26
800 #define FILE_MAILSLOT_SET_INFORMATION 27
801 #define FILE_COMPRESSION_INFORMATION 28
802 #define FILE_OBJECT_ID_INFORMATION 29
803 /* Number 30 not defined in documents */
804 #define FILE_MOVE_CLUSTER_INFORMATION 31
805 #define FILE_QUOTA_INFORMATION 32
806 #define FILE_REPARSE_POINT_INFORMATION 33
807 #define FILE_NETWORK_OPEN_INFORMATION 34
808 #define FILE_ATTRIBUTE_TAG_INFORMATION 35
809 #define FILE_TRACKING_INFORMATION 36
810 #define FILEID_BOTH_DIRECTORY_INFORMATION 37
811 #define FILEID_FULL_DIRECTORY_INFORMATION 38
812 #define FILE_VALID_DATA_LENGTH_INFORMATION 39
813 #define FILE_SHORT_NAME_INFORMATION 40
814 #define FILE_SFIO_RESERVE_INFORMATION 44
815 #define FILE_SFIO_VOLUME_INFORMATION 45
816 #define FILE_HARD_LINK_INFORMATION 46
817 #define FILE_NORMALIZED_NAME_INFORMATION 48
818 #define FILEID_GLOBAL_TX_DIRECTORY_INFORMATION 50
819 #define FILE_STANDARD_LINK_INFORMATION 54
820 #define FILE_ID_INFORMATION 59
821 #define FILE_ID_EXTD_DIRECTORY_INFORMATION 60
823 struct smb2_file_internal_info {
825 } __packed; /* level 6 Query */
827 struct smb2_file_rename_info { /* encoding of request for level 10 */
828 __u8 ReplaceIfExists; /* 1 = replace existing target with new */
829 /* 0 = fail if target already exists */
831 __u64 RootDirectory; /* MBZ for network operations (why says spec?) */
832 __le32 FileNameLength;
833 char FileName[]; /* New name to be assigned */
834 /* padding - overall struct size must be >= 24 so filename + pad >= 6 */
835 } __packed; /* level 10 Set */
837 struct smb2_file_link_info { /* encoding of request for level 11 */
838 __u8 ReplaceIfExists; /* 1 = replace existing link with new */
839 /* 0 = fail if link already exists */
841 __u64 RootDirectory; /* MBZ for network operations (why says spec?) */
842 __le32 FileNameLength;
843 char FileName[]; /* Name to be assigned to new link */
844 } __packed; /* level 11 Set */
846 struct smb2_file_full_ea_info { /* encoding of response for level 15 */
847 __le32 next_entry_offset;
850 __le16 ea_value_length;
851 char ea_data[]; /* \0 terminated name plus value */
852 } __packed; /* level 15 Set */
855 * This level 18, although with struct with same name is different from cifs
856 * level 0x107. Level 0x107 has an extra u64 between AccessFlags and
859 struct smb2_file_all_info { /* data block encoding of response to level 18 */
860 __le64 CreationTime; /* Beginning of FILE_BASIC_INFO equivalent */
861 __le64 LastAccessTime;
862 __le64 LastWriteTime;
865 __u32 Pad1; /* End of FILE_BASIC_INFO_INFO equivalent */
866 __le64 AllocationSize; /* Beginning of FILE_STANDARD_INFO equivalent */
867 __le64 EndOfFile; /* size ie offset to first free byte in file */
868 __le32 NumberOfLinks; /* hard links */
871 __u16 Pad2; /* End of FILE_STANDARD_INFO equivalent */
875 __le64 CurrentByteOffset;
877 __le32 AlignmentRequirement;
878 __le32 FileNameLength;
880 } __packed; /* level 18 Query */
882 struct smb2_file_eof_info { /* encoding of request for level 10 */
883 __le64 EndOfFile; /* new end of file value */
884 } __packed; /* level 20 Set */
886 struct smb2_file_reparse_point_info {
891 struct smb2_file_network_open_info {
893 __le64 LastAccessTime;
894 __le64 LastWriteTime;
896 __le64 AllocationSize;
900 } __packed; /* level 34 Query also similar returned in close rsp and open rsp */
902 /* See MS-FSCC 2.4.21 */
903 struct smb2_file_id_information {
904 __le64 VolumeSerialNumber;
905 __u64 PersistentFileId; /* opaque endianness */
906 __u64 VolatileFileId; /* opaque endianness */
907 } __packed; /* level 59 */
909 /* See MS-FSCC 2.4.18 */
910 struct smb2_file_id_extd_directory_info {
911 __le32 NextEntryOffset;
914 __le64 LastAccessTime;
915 __le64 LastWriteTime;
918 __le64 AllocationSize;
919 __le32 FileAttributes;
920 __le32 FileNameLength;
921 __le32 EaSize; /* EA size */
922 __le32 ReparsePointTag; /* valid if FILE_ATTR_REPARSE_POINT set in FileAttributes */
923 __le64 UniqueId; /* inode num - le since Samba puts ino in low 32 bit */
925 } __packed; /* level 60 */
927 extern char smb2_padding[7];
929 /* equivalent of the contents of SMB3.1.1 POSIX open context response */
930 struct create_posix_rsp {
934 struct cifs_sid owner; /* var-sized on the wire */
935 struct cifs_sid group; /* var-sized on the wire */
939 * SMB2-only POSIX info level for query dir
941 * See posix_info_sid_size(), posix_info_extra_size() and
942 * posix_info_parse() to help with the handling of this struct.
944 struct smb2_posix_info {
945 __le32 NextEntryOffset;
948 __le64 LastAccessTime;
949 __le64 LastWriteTime;
952 __le64 AllocationSize;
953 __le32 DosAttributes;
957 /* beginning of POSIX Create Context Response */
962 * var sized owner SID
963 * var sized group SID
964 * le32 filenamelength
969 /* Level 100 query info */
970 struct smb311_posix_qinfo {
972 __le64 LastAccessTime;
973 __le64 LastWriteTime;
976 __le64 AllocationSize;
977 __le32 DosAttributes;
981 /* beginning of POSIX Create Context Response */
987 * var sized owner SID
988 * var sized group SID
989 * le32 filenamelength
995 * Parsed version of the above struct. Allows direct access to the
996 * variable length fields
998 struct smb2_posix_info_parsed {
999 const struct smb2_posix_info *base;
1001 struct cifs_sid owner;
1002 struct cifs_sid group;
1007 #endif /* _SMB2PDU_H */