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