xref: /titanic_53/usr/src/uts/common/smbsrv/ntifs.h (revision 3db3f65c6274eb042354801a308c8e9bc4994553)
1da6c28aaSamw /*
2da6c28aaSamw  * CDDL HEADER START
3da6c28aaSamw  *
4da6c28aaSamw  * The contents of this file are subject to the terms of the
5da6c28aaSamw  * Common Development and Distribution License (the "License").
6da6c28aaSamw  * You may not use this file except in compliance with the License.
7da6c28aaSamw  *
8da6c28aaSamw  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9da6c28aaSamw  * or http://www.opensolaris.org/os/licensing.
10da6c28aaSamw  * See the License for the specific language governing permissions
11da6c28aaSamw  * and limitations under the License.
12da6c28aaSamw  *
13da6c28aaSamw  * When distributing Covered Code, include this CDDL HEADER in each
14da6c28aaSamw  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15da6c28aaSamw  * If applicable, add the following below this CDDL HEADER, with the
16da6c28aaSamw  * fields enclosed by brackets "[]" replaced with your own identifying
17da6c28aaSamw  * information: Portions Copyright [yyyy] [name of copyright owner]
18da6c28aaSamw  *
19da6c28aaSamw  * CDDL HEADER END
20da6c28aaSamw  */
21da6c28aaSamw /*
22*3db3f65cSamw  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23da6c28aaSamw  * Use is subject to license terms.
24da6c28aaSamw  */
25da6c28aaSamw 
26da6c28aaSamw #ifndef _SMBSRV_NTIFS_H
27da6c28aaSamw #define	_SMBSRV_NTIFS_H
28da6c28aaSamw 
29da6c28aaSamw #pragma ident	"%Z%%M%	%I%	%E% SMI"
30da6c28aaSamw 
31da6c28aaSamw /*
32da6c28aaSamw  * This file provides definitions compatible with the NT Installable
33da6c28aaSamw  * File System (IFS) interface.
34da6c28aaSamw  */
35da6c28aaSamw 
36da6c28aaSamw #ifdef __cplusplus
37da6c28aaSamw extern "C" {
38da6c28aaSamw #endif
39da6c28aaSamw 
40da6c28aaSamw /*
41*3db3f65cSamw  * The Volume and Directory bits are for SMB rather than NT.
42*3db3f65cSamw  * NT has an explicit Normal bit; this bit is implied in SMB
43*3db3f65cSamw  * when the Hidden, System and Directory bits are not set.
44*3db3f65cSamw  *
45*3db3f65cSamw  * File attributes and creation flags share the same 32-bit
46*3db3f65cSamw  * space.
47da6c28aaSamw  */
48*3db3f65cSamw #define	FILE_ATTRIBUTE_READONLY			0x00000001
49*3db3f65cSamw #define	FILE_ATTRIBUTE_HIDDEN			0x00000002
50*3db3f65cSamw #define	FILE_ATTRIBUTE_SYSTEM			0x00000004
51*3db3f65cSamw #define	FILE_ATTRIBUTE_VOLUME			0x00000008
52*3db3f65cSamw #define	FILE_ATTRIBUTE_DIRECTORY		0x00000010
53*3db3f65cSamw #define	FILE_ATTRIBUTE_ARCHIVE			0x00000020
54*3db3f65cSamw #define	FILE_ATTRIBUTE_DEVICE			0x00000040
55*3db3f65cSamw #define	FILE_ATTRIBUTE_NORMAL			0x00000080
56*3db3f65cSamw #define	FILE_ATTRIBUTE_TEMPORARY		0x00000100
57*3db3f65cSamw #define	FILE_ATTRIBUTE_SPARSE_FILE		0x00000200
58*3db3f65cSamw #define	FILE_ATTRIBUTE_REPARSE_POINT		0x00000400
59*3db3f65cSamw #define	FILE_ATTRIBUTE_COMPRESSED		0x00000800
60*3db3f65cSamw #define	FILE_ATTRIBUTE_OFFLINE			0x00001000
61*3db3f65cSamw #define	FILE_ATTRIBUTE_NOT_CONTENT_INDEXED	0x00002000
62*3db3f65cSamw #define	FILE_ATTRIBUTE_ENCRYPTED		0x00004000
63*3db3f65cSamw #define	FILE_ATTRIBUTE_VIRTUAL			0x00010000
64da6c28aaSamw #define	FILE_FLAG_OPEN_NO_RECALL		0x00100000
65*3db3f65cSamw #define	FILE_FLAG_OPEN_REPARSE_POINT		0x00200000
66*3db3f65cSamw #define	FILE_FLAG_POSIX_SEMANTICS		0x01000000
67*3db3f65cSamw #define	FILE_FLAG_BACKUP_SEMANTICS		0x02000000
68*3db3f65cSamw #define	FILE_FLAG_DELETE_ON_CLOSE		0x04000000
69*3db3f65cSamw #define	FILE_FLAG_SEQUENTIAL_SCAN		0x08000000
70*3db3f65cSamw #define	FILE_FLAG_RANDOM_ACCESS			0x10000000
71*3db3f65cSamw #define	FILE_FLAG_NO_BUFFERING			0x20000000
72*3db3f65cSamw #define	FILE_FLAG_OVERLAPPED			0x40000000
73*3db3f65cSamw #define	FILE_FLAG_WRITE_THROUGH			0x80000000
74*3db3f65cSamw 
75*3db3f65cSamw #define	FILE_ATTRIBUTE_VALID_FLAGS		0x00001fb7
76*3db3f65cSamw #define	FILE_ATTRIBUTE_VALID_SET_FLAGS		0x00001fa7
77*3db3f65cSamw #define	FILE_ATTRIBUTE_MASK			0x00003FFF
78da6c28aaSamw 
79da6c28aaSamw /*
80da6c28aaSamw  * The create/open option flags: used in NtCreateAndx and NtTransactCreate
81da6c28aaSamw  * SMB requests.
82da6c28aaSamw  *
83da6c28aaSamw  * The CreateOptions specify the options to be applied when creating or
84da6c28aaSamw  * opening the file, as a compatible combination of the following flags:
85da6c28aaSamw  *
86da6c28aaSamw  * FILE_DIRECTORY_FILE
87da6c28aaSamw  *	The file being created or opened is a directory file. With this
88da6c28aaSamw  *	flag, the Disposition parameter must be set to one of FILE_CREATE,
89da6c28aaSamw  *	FILE_OPEN, or FILE_OPEN_IF. With this flag, other compatible
90da6c28aaSamw  *	CreateOptions flags include only the following:
91da6c28aaSamw  *			FILE_SYNCHRONOUS_IO_ALERT
92da6c28aaSamw  *			FILE_SYNCHRONOUS_IO_NONALERT
93da6c28aaSamw  *			FILE_WRITE_THROUGH
94da6c28aaSamw  *			FILE_OPEN_FOR_BACKUP_INTENT
95da6c28aaSamw  *			FILE_OPEN_BY_FILE_ID
96da6c28aaSamw  *
97da6c28aaSamw  * FILE_NON_DIRECTORY_FILE
98da6c28aaSamw  *	The file being opened must not be a directory file or this call
99da6c28aaSamw  *	will fail. The file object being opened can represent a data file,
100da6c28aaSamw  *	a logical, virtual, or physical device, or a volume.
101da6c28aaSamw  *
102da6c28aaSamw  * FILE_WRITE_THROUGH
103da6c28aaSamw  *	System services, FSDs, and drivers that write data to the file must
104da6c28aaSamw  *	actually transfer the data into the file before any requested write
105da6c28aaSamw  *	operation is considered complete. This flag is automatically set if
106da6c28aaSamw  *	the CreateOptions flag FILE_NO_INTERMEDIATE _BUFFERING is set.
107da6c28aaSamw  *
108da6c28aaSamw  * FILE_SEQUENTIAL_ONLY
109da6c28aaSamw  *	All accesses to the file will be sequential.
110da6c28aaSamw  *
111da6c28aaSamw  * FILE_RANDOM_ACCESS
112da6c28aaSamw  *	Accesses to the file can be random, so no sequential read-ahead
113da6c28aaSamw  *	operations should be performed on the file by FSDs or the system.
114da6c28aaSamw  *	FILE_NO_INTERMEDIATE _BUFFERING	The file cannot be cached or
115da6c28aaSamw  *	buffered in a driver's internal buffers. This flag is incompatible
116da6c28aaSamw  *	with the DesiredAccess FILE_APPEND_DATA flag.
117da6c28aaSamw  *
118da6c28aaSamw  * FILE_SYNCHRONOUS_IO_ALERT
119da6c28aaSamw  *	All operations on the file are performed synchronously. Any wait
120da6c28aaSamw  *	on behalf of the caller is subject to premature termination from
121da6c28aaSamw  *	alerts. This flag also causes the I/O system to maintain the file
122da6c28aaSamw  *	position context. If this flag is set, the DesiredAccess
123da6c28aaSamw  *	SYNCHRONIZE flag also must be set.
124da6c28aaSamw  *
125da6c28aaSamw  * FILE_SYNCHRONOUS_IO _NONALERT
126da6c28aaSamw  *	All operations on the file are performed synchronously. Waits in
127da6c28aaSamw  *	the system to synchronize I/O queuing and completion are not subject
128da6c28aaSamw  *	to alerts. This flag also causes the I/O system to maintain the file
129da6c28aaSamw  *	position context. If this flag is set, the DesiredAccess SYNCHRONIZE
130da6c28aaSamw  *	flag also must be set.
131da6c28aaSamw  *
132da6c28aaSamw  * FILE_CREATE_TREE _CONNECTION
133da6c28aaSamw  *	Create a tree connection for this file in order to open it over the
134da6c28aaSamw  *	network. This flag is irrelevant to device and intermediate drivers.
135da6c28aaSamw  *
136da6c28aaSamw  * FILE_COMPLETE_IF_OPLOCKED
137da6c28aaSamw  *	Complete this operation immediately with an alternate success code
138da6c28aaSamw  *	if the target file is oplocked, rather than blocking the caller's
139da6c28aaSamw  *	thread. If the file is oplocked, another caller already has access
140da6c28aaSamw  *	to the file over the network. This flag is irrelevant to device and
141da6c28aaSamw  *	intermediate drivers.
142da6c28aaSamw  *
143da6c28aaSamw  * FILE_NO_EA_KNOWLEDGE
144da6c28aaSamw  *	If the extended attributes on an existing file being opened indicate
145da6c28aaSamw  *	that the caller must understand EAs to properly interpret the file,
146da6c28aaSamw  *	fail this request because the caller does not understand how to deal
147da6c28aaSamw  *	with EAs. Device and intermediate drivers can ignore this flag.
148da6c28aaSamw  *
149da6c28aaSamw  * FILE_DELETE_ON_CLOSE
150da6c28aaSamw  *	Delete the file when the last reference to it is passed to close.
151da6c28aaSamw  *
152da6c28aaSamw  * FILE_OPEN_BY_FILE_ID
153da6c28aaSamw  *	The file name contains the name of a device and a 64-bit ID to
154da6c28aaSamw  *	be used to open the file. This flag is irrelevant to device and
155da6c28aaSamw  *	intermediate drivers.
156da6c28aaSamw  *
157da6c28aaSamw  * FILE_OPEN_FOR_BACKUP _INTENT
158da6c28aaSamw  *	The file is being opened for backup intent, hence, the system should
159da6c28aaSamw  *	check for certain access rights and grant the caller the appropriate
160da6c28aaSamw  *	accesses to the file before checking the input DesiredAccess against
161da6c28aaSamw  *	the file's security descriptor. This flag is irrelevant to device
162da6c28aaSamw  *	and intermediate drivers.
163da6c28aaSamw  */
164da6c28aaSamw #define	FILE_DIRECTORY_FILE			0x00000001
165da6c28aaSamw #define	FILE_WRITE_THROUGH			0x00000002
166da6c28aaSamw #define	FILE_SEQUENTIAL_ONLY			0x00000004
167da6c28aaSamw #define	FILE_NO_INTERMEDIATE_BUFFERING		0x00000008
168da6c28aaSamw 
169da6c28aaSamw #define	FILE_SYNCHRONOUS_IO_ALERT		0x00000010
170da6c28aaSamw #define	FILE_SYNCHRONOUS_IO_NONALERT		0x00000020
171da6c28aaSamw #define	FILE_NON_DIRECTORY_FILE			0x00000040
172da6c28aaSamw #define	FILE_CREATE_TREE_CONNECTION		0x00000080
173da6c28aaSamw 
174da6c28aaSamw #define	FILE_COMPLETE_IF_OPLOCKED		0x00000100
175da6c28aaSamw #define	FILE_NO_EA_KNOWLEDGE			0x00000200
176da6c28aaSamw /* UNUSED					0x00000400 */
177da6c28aaSamw #define	FILE_RANDOM_ACCESS			0x00000800
178da6c28aaSamw 
179da6c28aaSamw #define	FILE_DELETE_ON_CLOSE			0x00001000
180da6c28aaSamw #define	FILE_OPEN_BY_FILE_ID			0x00002000
181da6c28aaSamw #define	FILE_OPEN_FOR_BACKUP_INTENT		0x00004000
182da6c28aaSamw #define	FILE_NO_COMPRESSION			0x00008000
183da6c28aaSamw 
184da6c28aaSamw #define	FILE_RESERVE_OPFILTER			0x00100000
185da6c28aaSamw #define	FILE_RESERVED0				0x00200000
186da6c28aaSamw #define	FILE_RESERVED1				0x00400000
187da6c28aaSamw #define	FILE_RESERVED2				0x00800000
188da6c28aaSamw 
189da6c28aaSamw #define	FILE_VALID_OPTION_FLAGS			0x007fffff
190da6c28aaSamw #define	FILE_VALID_PIPE_OPTION_FLAGS		0x00000032
191da6c28aaSamw #define	FILE_VALID_MAILSLOT_OPTION_FLAGS	0x00000032
192da6c28aaSamw #define	FILE_VALID_SET_FLAGS			0x00000036
193da6c28aaSamw 
194da6c28aaSamw /*
195da6c28aaSamw  * Define the file information class values used by the NT DDK and HAL.
196da6c28aaSamw  */
197da6c28aaSamw typedef enum _FILE_INFORMATION_CLASS {
198da6c28aaSamw 	FileDirectoryInformation	= 1,
199da6c28aaSamw 	FileFullDirectoryInformation,	/* 2 */
200da6c28aaSamw 	FileBothDirectoryInformation,	/* 3 */
201da6c28aaSamw 	FileBasicInformation,		/* 4 */
202da6c28aaSamw 	FileStandardInformation,	/* 5 */
203da6c28aaSamw 	FileInternalInformation,	/* 6 */
204da6c28aaSamw 	FileEaInformation,		/* 7 */
205da6c28aaSamw 	FileAccessInformation,		/* 8 */
206da6c28aaSamw 	FileNameInformation,		/* 9 */
207da6c28aaSamw 	FileRenameInformation,		/* 10 */
208da6c28aaSamw 	FileLinkInformation,		/* 11 */
209da6c28aaSamw 	FileNamesInformation,		/* 12 */
210da6c28aaSamw 	FileDispositionInformation,	/* 13 */
211da6c28aaSamw 	FilePositionInformation,	/* 14 */
212da6c28aaSamw 	FileFullEaInformation,		/* 15 */
213da6c28aaSamw 	FileModeInformation,		/* 16 */
214da6c28aaSamw 	FileAlignmentInformation,	/* 17 */
215da6c28aaSamw 	FileAllInformation,		/* 18 */
216da6c28aaSamw 	FileAllocationInformation,	/* 19 */
217da6c28aaSamw 	FileEndOfFileInformation,	/* 20 */
218da6c28aaSamw 	FileAlternateNameInformation,	/* 21 */
219da6c28aaSamw 	FileStreamInformation,		/* 22 */
220da6c28aaSamw 	FilePipeInformation,		/* 23 */
221da6c28aaSamw 	FilePipeLocalInformation,	/* 24 */
222da6c28aaSamw 	FilePipeRemoteInformation,	/* 25 */
223da6c28aaSamw 	FileMailslotQueryInformation,	/* 26 */
224da6c28aaSamw 	FileMailslotSetInformation,	/* 27 */
225da6c28aaSamw 	FileCompressionInformation,	/* 28 */
226da6c28aaSamw 	FileObjectIdInformation,	/* 29 */
227da6c28aaSamw 	FileCompletionInformation,	/* 30 */
228da6c28aaSamw 	FileMoveClusterInformation,	/* 31 */
229da6c28aaSamw 	FileInformationReserved32,	/* 32 */
230da6c28aaSamw 	FileInformationReserved33,	/* 33 */
231da6c28aaSamw 	FileNetworkOpenInformation,	/* 34 */
232da6c28aaSamw 	FileMaximumInformation
233da6c28aaSamw } FILE_INFORMATION_CLASS;
234da6c28aaSamw 
235da6c28aaSamw #ifdef __cplusplus
236da6c28aaSamw }
237da6c28aaSamw #endif
238da6c28aaSamw 
239da6c28aaSamw #endif /* _SMBSRV_NTIFS_H */
240