1 /* SPDX-License-Identifier: LGPL-2.1 */ 2 /* 3 * 4 * Copyright (c) International Business Machines Corp., 2009, 2013 5 * Etersoft, 2012 6 * 2018 Samsung Electronics Co., Ltd. 7 * Author(s): Steve French (sfrench@us.ibm.com) 8 * Pavel Shilovsky (pshilovsky@samba.org) 2012 9 * Namjae Jeon (linkinjeon@kernel.org) 10 * 11 */ 12 #ifndef _COMMON_SMB_FSCC_H 13 #define _COMMON_SMB_FSCC_H 14 15 /* Reparse structures - see MS-FSCC 2.1.2 */ 16 17 /* struct fsctl_reparse_info_req is empty, only response structs (see below) */ 18 struct reparse_data_buffer { 19 __le32 ReparseTag; 20 __le16 ReparseDataLength; 21 __u16 Reserved; 22 __u8 DataBuffer[]; /* Variable Length */ 23 } __packed; 24 25 struct reparse_guid_data_buffer { 26 __le32 ReparseTag; 27 __le16 ReparseDataLength; 28 __u16 Reserved; 29 __u8 ReparseGuid[16]; 30 __u8 DataBuffer[]; /* Variable Length */ 31 } __packed; 32 33 struct reparse_mount_point_data_buffer { 34 __le32 ReparseTag; 35 __le16 ReparseDataLength; 36 __u16 Reserved; 37 __le16 SubstituteNameOffset; 38 __le16 SubstituteNameLength; 39 __le16 PrintNameOffset; 40 __le16 PrintNameLength; 41 __u8 PathBuffer[]; /* Variable Length */ 42 } __packed; 43 44 #define SYMLINK_FLAG_RELATIVE 0x00000001 45 46 struct reparse_symlink_data_buffer { 47 __le32 ReparseTag; 48 __le16 ReparseDataLength; 49 __u16 Reserved; 50 __le16 SubstituteNameOffset; 51 __le16 SubstituteNameLength; 52 __le16 PrintNameOffset; 53 __le16 PrintNameLength; 54 __le32 Flags; 55 __u8 PathBuffer[]; /* Variable Length */ 56 } __packed; 57 58 /* For IO_REPARSE_TAG_NFS - see MS-FSCC 2.1.2.6 */ 59 #define NFS_SPECFILE_LNK 0x00000000014B4E4C 60 #define NFS_SPECFILE_CHR 0x0000000000524843 61 #define NFS_SPECFILE_BLK 0x00000000004B4C42 62 #define NFS_SPECFILE_FIFO 0x000000004F464946 63 #define NFS_SPECFILE_SOCK 0x000000004B434F53 64 struct reparse_nfs_data_buffer { 65 __le32 ReparseTag; 66 __le16 ReparseDataLength; 67 __u16 Reserved; 68 __le64 InodeType; /* NFS_SPECFILE_* */ 69 __u8 DataBuffer[]; 70 } __packed; 71 72 /* For IO_REPARSE_TAG_LX_SYMLINK - see MS-FSCC 2.1.2.7 */ 73 struct reparse_wsl_symlink_data_buffer { 74 __le32 ReparseTag; 75 __le16 ReparseDataLength; 76 __u16 Reserved; 77 __le32 Version; /* Always 2 */ 78 __u8 Target[]; /* Variable Length UTF-8 string without nul-term */ 79 } __packed; 80 81 /* See MS-FSCC 2.3.7 */ 82 struct duplicate_extents_to_file { 83 __u64 PersistentFileHandle; /* source file handle, opaque endianness */ 84 __u64 VolatileFileHandle; 85 __le64 SourceFileOffset; 86 __le64 TargetFileOffset; 87 __le64 ByteCount; /* Bytes to be copied */ 88 } __packed; 89 90 /* See MS-FSCC 2.3.9 */ 91 #define DUPLICATE_EXTENTS_DATA_EX_SOURCE_ATOMIC 0x00000001 92 struct duplicate_extents_to_file_ex { 93 __le64 StructureSize; /* MUST be set to 0x30 */ 94 __u64 PersistentFileHandle; /* source file handle, opaque endianness */ 95 __u64 VolatileFileHandle; 96 __le64 SourceFileOffset; 97 __le64 TargetFileOffset; 98 __le64 ByteCount; /* Bytes to be copied */ 99 __le32 Flags; 100 __le32 Reserved; 101 } __packed; 102 103 /* See MS-FSCC 2.3.20 */ 104 struct fsctl_get_integrity_information_rsp { 105 __le16 ChecksumAlgorithm; 106 __le16 Reserved; 107 __le32 Flags; 108 __le32 ChecksumChunkSizeInBytes; 109 __le32 ClusterSizeInBytes; 110 } __packed; 111 112 /* See MS-FSCC 2.3.52 */ 113 struct file_allocated_range_buffer { 114 __le64 file_offset; 115 __le64 length; 116 } __packed; 117 118 /* See MS-FSCC 2.3.55 */ 119 struct fsctl_query_file_regions_req { 120 __le64 FileOffset; 121 __le64 Length; 122 __le32 DesiredUsage; 123 __le32 Reserved; 124 } __packed; 125 126 /* DesiredUsage flags see MS-FSCC 2.3.56.1 */ 127 #define FILE_USAGE_INVALID_RANGE 0x00000000 128 #define FILE_USAGE_VALID_CACHED_DATA 0x00000001 129 #define FILE_USAGE_NONCACHED_DATA 0x00000002 130 struct file_region_info { 131 __le64 FileOffset; 132 __le64 Length; 133 __le32 DesiredUsage; 134 __le32 Reserved; 135 } __packed; 136 137 /* See MS-FSCC 2.3.56 */ 138 struct fsctl_query_file_region_rsp { 139 __le32 Flags; 140 __le32 TotalRegionEntryCount; 141 __le32 RegionEntryCount; 142 __u32 Reserved; 143 struct file_region_info Regions[]; 144 } __packed; 145 146 /* See MS-FSCC 2.3.58 */ 147 struct fsctl_query_on_disk_vol_info_rsp { 148 __le64 DirectoryCount; 149 __le64 FileCount; 150 __le16 FsFormatMajVersion; 151 __le16 FsFormatMinVersion; 152 __u8 FsFormatName[24]; 153 __le64 FormatTime; 154 __le64 LastUpdateTime; 155 __u8 CopyrightInfo[68]; 156 __u8 AbstractInfo[68]; 157 __u8 FormatImplInfo[68]; 158 __u8 LastModifyImplInfo[68]; 159 } __packed; 160 161 /* See MS-FSCC 2.3.73 */ 162 struct fsctl_set_integrity_information_req { 163 __le16 ChecksumAlgorithm; 164 __le16 Reserved; 165 __le32 Flags; 166 } __packed; 167 168 /* See MS-FSCC 2.3.75 */ 169 struct fsctl_set_integrity_info_ex_req { 170 __u8 EnableIntegrity; 171 __u8 KeepState; 172 __u16 Reserved; 173 __le32 Flags; 174 __u8 Version; 175 __u8 Reserved2[7]; 176 } __packed; 177 178 /* 179 * this goes in the ioctl buffer when doing FSCTL_SET_ZERO_DATA 180 * See MS-FSCC 2.3.85 181 */ 182 struct file_zero_data_information { 183 __le64 FileOffset; 184 __le64 BeyondFinalZero; 185 } __packed; 186 187 /* 188 * This level 18, although with struct with same name is different from cifs 189 * level 0x107. Level 0x107 has an extra u64 between AccessFlags and 190 * CurrentByteOffset. 191 * See MS-FSCC 2.4.2 192 */ 193 struct smb2_file_all_info { /* data block encoding of response to level 18 */ 194 __le64 CreationTime; /* Beginning of FILE_BASIC_INFO equivalent */ 195 __le64 LastAccessTime; 196 __le64 LastWriteTime; 197 __le64 ChangeTime; 198 __le32 Attributes; 199 __u32 Pad1; /* End of FILE_BASIC_INFO_INFO equivalent */ 200 __le64 AllocationSize; /* Beginning of FILE_STANDARD_INFO equivalent */ 201 __le64 EndOfFile; /* size ie offset to first free byte in file */ 202 __le32 NumberOfLinks; /* hard links */ 203 __u8 DeletePending; 204 __u8 Directory; 205 __u16 Pad2; /* End of FILE_STANDARD_INFO equivalent */ 206 __le64 IndexNumber; 207 __le32 EASize; 208 __le32 AccessFlags; 209 __le64 CurrentByteOffset; 210 __le32 Mode; 211 __le32 AlignmentRequirement; 212 __le32 FileNameLength; 213 union { 214 char __pad; /* Legacy structure padding */ 215 DECLARE_FLEX_ARRAY(char, FileName); 216 }; 217 } __packed; /* level 18 Query */ 218 219 /* See MS-FSCC 2.4.7 */ 220 typedef struct file_basic_info { /* data block encoding of response to level 18 */ 221 __le64 CreationTime; 222 __le64 LastAccessTime; 223 __le64 LastWriteTime; 224 __le64 ChangeTime; 225 __le32 Attributes; 226 __u32 Pad; 227 } __packed FILE_BASIC_INFO; /* size info, level 0x101 */ 228 229 /* See MS-FSCC 2.4.8 */ 230 typedef struct { 231 __le32 NextEntryOffset; 232 __u32 FileIndex; 233 __le64 CreationTime; 234 __le64 LastAccessTime; 235 __le64 LastWriteTime; 236 __le64 ChangeTime; 237 __le64 EndOfFile; 238 __le64 AllocationSize; 239 __le32 ExtFileAttributes; 240 __le32 FileNameLength; 241 __le32 EaSize; /* length of the xattrs */ 242 __u8 ShortNameLength; 243 __u8 Reserved; 244 __u8 ShortName[24]; 245 char FileName[]; 246 } __packed FILE_BOTH_DIRECTORY_INFO; /* level 0x104 FFrsp data */ 247 248 /* See MS-FSCC 2.4.10 */ 249 typedef struct { 250 __le32 NextEntryOffset; 251 __u32 FileIndex; 252 __le64 CreationTime; 253 __le64 LastAccessTime; 254 __le64 LastWriteTime; 255 __le64 ChangeTime; 256 __le64 EndOfFile; 257 __le64 AllocationSize; 258 __le32 ExtFileAttributes; 259 __le32 FileNameLength; 260 char FileName[]; 261 } __packed FILE_DIRECTORY_INFO; /* level 0x101 FF resp data */ 262 263 /* See MS-FSCC 2.4.13 */ 264 struct smb2_file_eof_info { /* encoding of request for level 10 */ 265 __le64 EndOfFile; /* new end of file value */ 266 } __packed; /* level 20 Set */ 267 268 /* See MS-FSCC 2.4.14 */ 269 typedef struct { 270 __le32 NextEntryOffset; 271 __u32 FileIndex; 272 __le64 CreationTime; 273 __le64 LastAccessTime; 274 __le64 LastWriteTime; 275 __le64 ChangeTime; 276 __le64 EndOfFile; 277 __le64 AllocationSize; 278 __le32 ExtFileAttributes; 279 __le32 FileNameLength; 280 __le32 EaSize; /* length of the xattrs */ 281 char FileName[]; 282 } __packed FILE_FULL_DIRECTORY_INFO; /* level 0x102 rsp data */ 283 284 /* See MS-FSCC 2.4.24 */ 285 typedef struct { 286 __le32 NextEntryOffset; 287 __u32 FileIndex; 288 __le64 CreationTime; 289 __le64 LastAccessTime; 290 __le64 LastWriteTime; 291 __le64 ChangeTime; 292 __le64 EndOfFile; 293 __le64 AllocationSize; 294 __le32 ExtFileAttributes; 295 __le32 FileNameLength; 296 __le32 EaSize; /* EA size */ 297 __le32 Reserved; 298 __le64 UniqueId; /* inode num - le since Samba puts ino in low 32 bit*/ 299 char FileName[]; 300 } __packed FILE_ID_FULL_DIR_INFO; /* level 0x105 FF rsp data */ 301 302 /* See MS-FSCC 2.4.27 */ 303 struct smb2_file_internal_info { 304 __le64 IndexNumber; 305 } __packed; /* level 6 Query */ 306 307 /* See MS-FSCC 2.4.28.2 */ 308 struct smb2_file_link_info { /* encoding of request for level 11 */ 309 /* New members MUST be added within the struct_group() macro below. */ 310 __struct_group(smb2_file_link_info_hdr, __hdr, __packed, 311 __u8 ReplaceIfExists; /* 1 = replace existing link with new */ 312 /* 0 = fail if link already exists */ 313 __u8 Reserved[7]; 314 __u64 RootDirectory; /* MBZ for network operations (why says spec?) */ 315 __le32 FileNameLength; 316 ); 317 char FileName[]; /* Name to be assigned to new link */ 318 } __packed; /* level 11 Set */ 319 static_assert(offsetof(struct smb2_file_link_info, FileName) == sizeof(struct smb2_file_link_info_hdr), 320 "struct member likely outside of __struct_group()"); 321 322 /* See MS-FSCC 2.4.34 */ 323 struct smb2_file_network_open_info { 324 struct_group_attr(network_open_info, __packed, 325 __le64 CreationTime; 326 __le64 LastAccessTime; 327 __le64 LastWriteTime; 328 __le64 ChangeTime; 329 __le64 AllocationSize; 330 __le64 EndOfFile; 331 __le32 Attributes; 332 ); 333 __le32 Reserved; 334 } __packed; /* level 34 Query also similar returned in close rsp and open rsp */ 335 336 /* See MS-FSCC 2.4.42.2 */ 337 struct smb2_file_rename_info { /* encoding of request for level 10 */ 338 /* New members MUST be added within the struct_group() macro below. */ 339 __struct_group(smb2_file_rename_info_hdr, __hdr, __packed, 340 __u8 ReplaceIfExists; /* 1 = replace existing target with new */ 341 /* 0 = fail if target already exists */ 342 __u8 Reserved[7]; 343 __u64 RootDirectory; /* MBZ for network operations (why says spec?) */ 344 __le32 FileNameLength; 345 ); 346 char FileName[]; /* New name to be assigned */ 347 /* padding - overall struct size must be >= 24 so filename + pad >= 6 */ 348 } __packed; /* level 10 Set */ 349 static_assert(offsetof(struct smb2_file_rename_info, FileName) == sizeof(struct smb2_file_rename_info_hdr), 350 "struct member likely outside of __struct_group()"); 351 352 /* File System Information Classes */ 353 /* See MS-FSCC 2.5 */ 354 #define FS_VOLUME_INFORMATION 1 /* Query */ 355 #define FS_LABEL_INFORMATION 2 /* Set */ 356 #define FS_SIZE_INFORMATION 3 /* Query */ 357 #define FS_DEVICE_INFORMATION 4 /* Query */ 358 #define FS_ATTRIBUTE_INFORMATION 5 /* Query */ 359 #define FS_CONTROL_INFORMATION 6 /* Query, Set */ 360 #define FS_FULL_SIZE_INFORMATION 7 /* Query */ 361 #define FS_OBJECT_ID_INFORMATION 8 /* Query, Set */ 362 #define FS_DRIVER_PATH_INFORMATION 9 /* Query */ 363 #define FS_SECTOR_SIZE_INFORMATION 11 /* SMB3 or later. Query */ 364 /* See POSIX Extensions to MS-FSCC 2.3.1.1 */ 365 #define FS_POSIX_INFORMATION 100 /* SMB3.1.1 POSIX. Query */ 366 367 /* See MS-FSCC 2.5.1 */ 368 #define MAX_FS_NAME_LEN 52 369 typedef struct { 370 __le32 Attributes; 371 __le32 MaxPathNameComponentLength; 372 __le32 FileSystemNameLen; 373 __le16 FileSystemName[]; /* do not have to save this - get subset? */ 374 } __packed FILE_SYSTEM_ATTRIBUTE_INFO; 375 376 /* List of FileSystemAttributes - see MS-FSCC 2.5.1 */ 377 #define FILE_SUPPORTS_SPARSE_VDL 0x10000000 /* faster nonsparse extend */ 378 #define FILE_SUPPORTS_BLOCK_REFCOUNTING 0x08000000 /* allow ioctl dup extents */ 379 #define FILE_SUPPORT_INTEGRITY_STREAMS 0x04000000 380 #define FILE_SUPPORTS_USN_JOURNAL 0x02000000 381 #define FILE_SUPPORTS_OPEN_BY_FILE_ID 0x01000000 382 #define FILE_SUPPORTS_EXTENDED_ATTRIBUTES 0x00800000 383 #define FILE_SUPPORTS_HARD_LINKS 0x00400000 384 #define FILE_SUPPORTS_TRANSACTIONS 0x00200000 385 #define FILE_SEQUENTIAL_WRITE_ONCE 0x00100000 386 #define FILE_READ_ONLY_VOLUME 0x00080000 387 #define FILE_NAMED_STREAMS 0x00040000 388 #define FILE_SUPPORTS_ENCRYPTION 0x00020000 389 #define FILE_SUPPORTS_OBJECT_IDS 0x00010000 390 #define FILE_VOLUME_IS_COMPRESSED 0x00008000 391 #define FILE_SUPPORTS_POSIX_UNLINK_RENAME 0x00000400 392 #define FILE_RETURNS_CLEANUP_RESULT_INFO 0x00000200 393 #define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100 394 #define FILE_SUPPORTS_REPARSE_POINTS 0x00000080 395 #define FILE_SUPPORTS_SPARSE_FILES 0x00000040 396 #define FILE_VOLUME_QUOTAS 0x00000020 397 #define FILE_FILE_COMPRESSION 0x00000010 398 #define FILE_PERSISTENT_ACLS 0x00000008 399 #define FILE_UNICODE_ON_DISK 0x00000004 400 #define FILE_CASE_PRESERVED_NAMES 0x00000002 401 #define FILE_CASE_SENSITIVE_SEARCH 0x00000001 402 403 /* 404 * File System Control Information 405 * See MS-FSCC 2.5.2 406 */ 407 struct smb2_fs_control_info { 408 __le64 FreeSpaceStartFiltering; 409 __le64 FreeSpaceThreshold; 410 __le64 FreeSpaceStopFiltering; 411 __le64 DefaultQuotaThreshold; 412 __le64 DefaultQuotaLimit; 413 __le32 FileSystemControlFlags; 414 __le32 Padding; 415 } __packed; 416 417 /* See MS-FSCC 2.5.4 */ 418 struct smb2_fs_full_size_info { 419 __le64 TotalAllocationUnits; 420 __le64 CallerAvailableAllocationUnits; 421 __le64 ActualAvailableAllocationUnits; 422 __le32 SectorsPerAllocationUnit; 423 __le32 BytesPerSector; 424 } __packed; 425 426 /* See MS-FSCC 2.5.7 */ 427 #define SSINFO_FLAGS_ALIGNED_DEVICE 0x00000001 428 #define SSINFO_FLAGS_PARTITION_ALIGNED_ON_DEVICE 0x00000002 429 #define SSINFO_FLAGS_NO_SEEK_PENALTY 0x00000004 430 #define SSINFO_FLAGS_TRIM_ENABLED 0x00000008 431 /* sector size info struct */ 432 struct smb3_fs_ss_info { 433 __le32 LogicalBytesPerSector; 434 __le32 PhysicalBytesPerSectorForAtomicity; 435 __le32 PhysicalBytesPerSectorForPerf; 436 __le32 FSEffPhysicalBytesPerSectorForAtomicity; 437 __le32 Flags; 438 __le32 ByteOffsetForSectorAlignment; 439 __le32 ByteOffsetForPartitionAlignment; 440 } __packed; 441 442 /* See MS-FSCC 2.5.8 */ 443 typedef struct { 444 __le64 TotalAllocationUnits; 445 __le64 AvailableAllocationUnits; 446 __le32 SectorsPerAllocationUnit; 447 __le32 BytesPerSector; 448 } __packed FILE_SYSTEM_SIZE_INFO; /* size info, level 0x103 */ 449 450 /* volume info struct - see MS-FSCC 2.5.9 */ 451 #define MAX_VOL_LABEL_LEN 32 452 struct filesystem_vol_info { 453 __le64 VolumeCreationTime; 454 __le32 VolumeSerialNumber; 455 __le32 VolumeLabelLength; /* includes trailing null */ 456 __u8 SupportsObjects; /* True if eg like NTFS, supports objects */ 457 __u8 Reserved; 458 __u8 VolumeLabel[]; /* variable len */ 459 } __packed; 460 461 /* See MS-FSCC 2.5.10 */ 462 typedef struct { 463 __le32 DeviceType; 464 __le32 DeviceCharacteristics; 465 } __packed FILE_SYSTEM_DEVICE_INFO; /* device info level 0x104 */ 466 467 /* 468 * File Attributes 469 * See MS-FSCC 2.6 470 */ 471 #define FILE_ATTRIBUTE_READONLY 0x00000001 472 #define FILE_ATTRIBUTE_HIDDEN 0x00000002 473 #define FILE_ATTRIBUTE_SYSTEM 0x00000004 474 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010 475 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020 476 #define FILE_ATTRIBUTE_NORMAL 0x00000080 477 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100 478 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200 479 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400 480 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800 481 #define FILE_ATTRIBUTE_OFFLINE 0x00001000 482 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000 483 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000 484 #define FILE_ATTRIBUTE_INTEGRITY_STREAM 0x00008000 485 #define FILE_ATTRIBUTE_NO_SCRUB_DATA 0x00020000 486 #define FILE_ATTRIBUTE_MASK (FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_HIDDEN | \ 487 FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_DIRECTORY | \ 488 FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_NORMAL | \ 489 FILE_ATTRIBUTE_TEMPORARY | FILE_ATTRIBUTE_SPARSE_FILE | \ 490 FILE_ATTRIBUTE_REPARSE_POINT | FILE_ATTRIBUTE_COMPRESSED | \ 491 FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_NOT_CONTENT_INDEXED | \ 492 FILE_ATTRIBUTE_ENCRYPTED | FILE_ATTRIBUTE_INTEGRITY_STREAM | \ 493 FILE_ATTRIBUTE_NO_SCRUB_DATA) 494 495 #define FILE_ATTRIBUTE_READONLY_LE cpu_to_le32(FILE_ATTRIBUTE_READONLY) 496 #define FILE_ATTRIBUTE_HIDDEN_LE cpu_to_le32(FILE_ATTRIBUTE_HIDDEN) 497 #define FILE_ATTRIBUTE_SYSTEM_LE cpu_to_le32(FILE_ATTRIBUTE_SYSTEM) 498 #define FILE_ATTRIBUTE_DIRECTORY_LE cpu_to_le32(FILE_ATTRIBUTE_DIRECTORY) 499 #define FILE_ATTRIBUTE_ARCHIVE_LE cpu_to_le32(FILE_ATTRIBUTE_ARCHIVE) 500 #define FILE_ATTRIBUTE_NORMAL_LE cpu_to_le32(FILE_ATTRIBUTE_NORMAL) 501 #define FILE_ATTRIBUTE_TEMPORARY_LE cpu_to_le32(FILE_ATTRIBUTE_TEMPORARY) 502 #define FILE_ATTRIBUTE_SPARSE_FILE_LE cpu_to_le32(FILE_ATTRIBUTE_SPARSE_FILE) 503 #define FILE_ATTRIBUTE_REPARSE_POINT_LE cpu_to_le32(FILE_ATTRIBUTE_REPARSE_POINT) 504 #define FILE_ATTRIBUTE_COMPRESSED_LE cpu_to_le32(FILE_ATTRIBUTE_COMPRESSED) 505 #define FILE_ATTRIBUTE_OFFLINE_LE cpu_to_le32(FILE_ATTRIBUTE_OFFLINE) 506 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED_LE cpu_to_le32(FILE_ATTRIBUTE_NOT_CONTENT_INDEXED) 507 #define FILE_ATTRIBUTE_ENCRYPTED_LE cpu_to_le32(FILE_ATTRIBUTE_ENCRYPTED) 508 #define FILE_ATTRIBUTE_INTEGRITY_STREAM_LE cpu_to_le32(FILE_ATTRIBUTE_INTEGRITY_STREAM) 509 #define FILE_ATTRIBUTE_NO_SCRUB_DATA_LE cpu_to_le32(FILE_ATTRIBUTE_NO_SCRUB_DATA) 510 #define FILE_ATTRIBUTE_MASK_LE cpu_to_le32(FILE_ATTRIBUTE_MASK) 511 512 /* 513 * SMB2 Notify Action Flags 514 * See MS-FSCC 2.7.1 515 */ 516 #define FILE_ACTION_ADDED 0x00000001 517 #define FILE_ACTION_REMOVED 0x00000002 518 #define FILE_ACTION_MODIFIED 0x00000003 519 #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004 520 #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005 521 #define FILE_ACTION_ADDED_STREAM 0x00000006 522 #define FILE_ACTION_REMOVED_STREAM 0x00000007 523 #define FILE_ACTION_MODIFIED_STREAM 0x00000008 524 #define FILE_ACTION_REMOVED_BY_DELETE 0x00000009 525 #define FILE_ACTION_ID_NOT_TUNNELLED 0x0000000A 526 #define FILE_ACTION_TUNNELLED_ID_COLLISION 0x0000000B 527 528 /* 529 * Response contains array of the following structures 530 * See MS-FSCC 2.7.1 531 */ 532 struct file_notify_information { 533 __le32 NextEntryOffset; 534 __le32 Action; 535 __le32 FileNameLength; 536 __u8 FileName[]; 537 } __packed; 538 539 /* 540 * See POSIX Extensions to MS-FSCC 2.3.2.1 541 * Link: https://gitlab.com/samba-team/smb3-posix-spec/-/blob/master/fscc_posix_extensions.md 542 */ 543 typedef struct { 544 /* For undefined recommended transfer size return -1 in that field */ 545 __le32 OptimalTransferSize; /* bsize on some os, iosize on other os */ 546 __le32 BlockSize; 547 /* The next three fields are in terms of the block size. 548 * (above). If block size is unknown, 4096 would be a 549 * reasonable block size for a server to report. 550 * Note that returning the blocks/blocksavail removes need 551 * to make a second call (to QFSInfo level 0x103 to get this info. 552 * UserBlockAvail is typically less than or equal to BlocksAvail, 553 * if no distinction is made return the same value in each 554 */ 555 __le64 TotalBlocks; 556 __le64 BlocksAvail; /* bfree */ 557 __le64 UserBlocksAvail; /* bavail */ 558 /* For undefined Node fields or FSID return -1 */ 559 __le64 TotalFileNodes; 560 __le64 FreeFileNodes; 561 __le64 FileSysIdentifier; /* fsid */ 562 /* NB Namelen comes from FILE_SYSTEM_ATTRIBUTE_INFO call */ 563 /* NB flags can come from FILE_SYSTEM_DEVICE_INFO call */ 564 } __packed FILE_SYSTEM_POSIX_INFO; 565 566 #endif /* _COMMON_SMB_FSCC_H */ 567