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