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