xref: /titanic_53/usr/src/uts/common/smbsrv/ntifs.h (revision 2c2961f8403049d948b9f3e6c35d6488b6b7e1aa)
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*2c2961f8Sjose borrego  * Copyright 2009 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 /*
30da6c28aaSamw  * This file provides definitions compatible with the NT Installable
31da6c28aaSamw  * File System (IFS) interface.
32da6c28aaSamw  */
33da6c28aaSamw 
34da6c28aaSamw #ifdef __cplusplus
35da6c28aaSamw extern "C" {
36da6c28aaSamw #endif
37da6c28aaSamw 
38da6c28aaSamw /*
393db3f65cSamw  * The Volume and Directory bits are for SMB rather than NT.
403db3f65cSamw  * NT has an explicit Normal bit; this bit is implied in SMB
413db3f65cSamw  * when the Hidden, System and Directory bits are not set.
423db3f65cSamw  *
433db3f65cSamw  * File attributes and creation flags share the same 32-bit
443db3f65cSamw  * space.
45da6c28aaSamw  */
463db3f65cSamw #define	FILE_ATTRIBUTE_READONLY			0x00000001
473db3f65cSamw #define	FILE_ATTRIBUTE_HIDDEN			0x00000002
483db3f65cSamw #define	FILE_ATTRIBUTE_SYSTEM			0x00000004
493db3f65cSamw #define	FILE_ATTRIBUTE_VOLUME			0x00000008
503db3f65cSamw #define	FILE_ATTRIBUTE_DIRECTORY		0x00000010
513db3f65cSamw #define	FILE_ATTRIBUTE_ARCHIVE			0x00000020
523db3f65cSamw #define	FILE_ATTRIBUTE_DEVICE			0x00000040
533db3f65cSamw #define	FILE_ATTRIBUTE_NORMAL			0x00000080
543db3f65cSamw #define	FILE_ATTRIBUTE_TEMPORARY		0x00000100
553db3f65cSamw #define	FILE_ATTRIBUTE_SPARSE_FILE		0x00000200
563db3f65cSamw #define	FILE_ATTRIBUTE_REPARSE_POINT		0x00000400
573db3f65cSamw #define	FILE_ATTRIBUTE_COMPRESSED		0x00000800
583db3f65cSamw #define	FILE_ATTRIBUTE_OFFLINE			0x00001000
593db3f65cSamw #define	FILE_ATTRIBUTE_NOT_CONTENT_INDEXED	0x00002000
603db3f65cSamw #define	FILE_ATTRIBUTE_ENCRYPTED		0x00004000
613db3f65cSamw #define	FILE_ATTRIBUTE_VIRTUAL			0x00010000
62da6c28aaSamw #define	FILE_FLAG_OPEN_NO_RECALL		0x00100000
633db3f65cSamw #define	FILE_FLAG_OPEN_REPARSE_POINT		0x00200000
643db3f65cSamw #define	FILE_FLAG_POSIX_SEMANTICS		0x01000000
653db3f65cSamw #define	FILE_FLAG_BACKUP_SEMANTICS		0x02000000
663db3f65cSamw #define	FILE_FLAG_DELETE_ON_CLOSE		0x04000000
673db3f65cSamw #define	FILE_FLAG_SEQUENTIAL_SCAN		0x08000000
683db3f65cSamw #define	FILE_FLAG_RANDOM_ACCESS			0x10000000
693db3f65cSamw #define	FILE_FLAG_NO_BUFFERING			0x20000000
703db3f65cSamw #define	FILE_FLAG_OVERLAPPED			0x40000000
713db3f65cSamw #define	FILE_FLAG_WRITE_THROUGH			0x80000000
723db3f65cSamw 
733db3f65cSamw #define	FILE_ATTRIBUTE_VALID_FLAGS		0x00001fb7
743db3f65cSamw #define	FILE_ATTRIBUTE_VALID_SET_FLAGS		0x00001fa7
753db3f65cSamw #define	FILE_ATTRIBUTE_MASK			0x00003FFF
76da6c28aaSamw 
77da6c28aaSamw /*
78da6c28aaSamw  * The create/open option flags: used in NtCreateAndx and NtTransactCreate
79da6c28aaSamw  * SMB requests.
80da6c28aaSamw  *
81da6c28aaSamw  * The CreateOptions specify the options to be applied when creating or
82da6c28aaSamw  * opening the file, as a compatible combination of the following flags:
83da6c28aaSamw  *
84da6c28aaSamw  * FILE_DIRECTORY_FILE
85da6c28aaSamw  *	The file being created or opened is a directory file. With this
86da6c28aaSamw  *	flag, the Disposition parameter must be set to one of FILE_CREATE,
87da6c28aaSamw  *	FILE_OPEN, or FILE_OPEN_IF. With this flag, other compatible
88da6c28aaSamw  *	CreateOptions flags include only the following:
89da6c28aaSamw  *			FILE_SYNCHRONOUS_IO_ALERT
90da6c28aaSamw  *			FILE_SYNCHRONOUS_IO_NONALERT
91da6c28aaSamw  *			FILE_WRITE_THROUGH
92da6c28aaSamw  *			FILE_OPEN_FOR_BACKUP_INTENT
93da6c28aaSamw  *			FILE_OPEN_BY_FILE_ID
94da6c28aaSamw  *
95da6c28aaSamw  * FILE_NON_DIRECTORY_FILE
96da6c28aaSamw  *	The file being opened must not be a directory file or this call
97da6c28aaSamw  *	will fail. The file object being opened can represent a data file,
98da6c28aaSamw  *	a logical, virtual, or physical device, or a volume.
99da6c28aaSamw  *
100da6c28aaSamw  * FILE_WRITE_THROUGH
101da6c28aaSamw  *	System services, FSDs, and drivers that write data to the file must
102da6c28aaSamw  *	actually transfer the data into the file before any requested write
103da6c28aaSamw  *	operation is considered complete. This flag is automatically set if
104da6c28aaSamw  *	the CreateOptions flag FILE_NO_INTERMEDIATE _BUFFERING is set.
105da6c28aaSamw  *
106da6c28aaSamw  * FILE_SEQUENTIAL_ONLY
107da6c28aaSamw  *	All accesses to the file will be sequential.
108da6c28aaSamw  *
109da6c28aaSamw  * FILE_RANDOM_ACCESS
110da6c28aaSamw  *	Accesses to the file can be random, so no sequential read-ahead
111da6c28aaSamw  *	operations should be performed on the file by FSDs or the system.
112da6c28aaSamw  *	FILE_NO_INTERMEDIATE _BUFFERING	The file cannot be cached or
113da6c28aaSamw  *	buffered in a driver's internal buffers. This flag is incompatible
114da6c28aaSamw  *	with the DesiredAccess FILE_APPEND_DATA flag.
115da6c28aaSamw  *
116da6c28aaSamw  * FILE_SYNCHRONOUS_IO_ALERT
117da6c28aaSamw  *	All operations on the file are performed synchronously. Any wait
118da6c28aaSamw  *	on behalf of the caller is subject to premature termination from
119da6c28aaSamw  *	alerts. This flag also causes the I/O system to maintain the file
120da6c28aaSamw  *	position context. If this flag is set, the DesiredAccess
121da6c28aaSamw  *	SYNCHRONIZE flag also must be set.
122da6c28aaSamw  *
123da6c28aaSamw  * FILE_SYNCHRONOUS_IO _NONALERT
124da6c28aaSamw  *	All operations on the file are performed synchronously. Waits in
125da6c28aaSamw  *	the system to synchronize I/O queuing and completion are not subject
126da6c28aaSamw  *	to alerts. This flag also causes the I/O system to maintain the file
127da6c28aaSamw  *	position context. If this flag is set, the DesiredAccess SYNCHRONIZE
128da6c28aaSamw  *	flag also must be set.
129da6c28aaSamw  *
130da6c28aaSamw  * FILE_CREATE_TREE _CONNECTION
131da6c28aaSamw  *	Create a tree connection for this file in order to open it over the
132da6c28aaSamw  *	network. This flag is irrelevant to device and intermediate drivers.
133da6c28aaSamw  *
134da6c28aaSamw  * FILE_COMPLETE_IF_OPLOCKED
135da6c28aaSamw  *	Complete this operation immediately with an alternate success code
136da6c28aaSamw  *	if the target file is oplocked, rather than blocking the caller's
137da6c28aaSamw  *	thread. If the file is oplocked, another caller already has access
138da6c28aaSamw  *	to the file over the network. This flag is irrelevant to device and
139da6c28aaSamw  *	intermediate drivers.
140da6c28aaSamw  *
141da6c28aaSamw  * FILE_NO_EA_KNOWLEDGE
142da6c28aaSamw  *	If the extended attributes on an existing file being opened indicate
143da6c28aaSamw  *	that the caller must understand EAs to properly interpret the file,
144da6c28aaSamw  *	fail this request because the caller does not understand how to deal
145da6c28aaSamw  *	with EAs. Device and intermediate drivers can ignore this flag.
146da6c28aaSamw  *
147da6c28aaSamw  * FILE_DELETE_ON_CLOSE
148da6c28aaSamw  *	Delete the file when the last reference to it is passed to close.
149da6c28aaSamw  *
150da6c28aaSamw  * FILE_OPEN_BY_FILE_ID
151da6c28aaSamw  *	The file name contains the name of a device and a 64-bit ID to
152da6c28aaSamw  *	be used to open the file. This flag is irrelevant to device and
153da6c28aaSamw  *	intermediate drivers.
154da6c28aaSamw  *
155da6c28aaSamw  * FILE_OPEN_FOR_BACKUP _INTENT
156da6c28aaSamw  *	The file is being opened for backup intent, hence, the system should
157da6c28aaSamw  *	check for certain access rights and grant the caller the appropriate
158da6c28aaSamw  *	accesses to the file before checking the input DesiredAccess against
159da6c28aaSamw  *	the file's security descriptor. This flag is irrelevant to device
160da6c28aaSamw  *	and intermediate drivers.
161da6c28aaSamw  */
162da6c28aaSamw #define	FILE_DIRECTORY_FILE			0x00000001
163da6c28aaSamw #define	FILE_WRITE_THROUGH			0x00000002
164da6c28aaSamw #define	FILE_SEQUENTIAL_ONLY			0x00000004
165da6c28aaSamw #define	FILE_NO_INTERMEDIATE_BUFFERING		0x00000008
166da6c28aaSamw 
167da6c28aaSamw #define	FILE_SYNCHRONOUS_IO_ALERT		0x00000010
168da6c28aaSamw #define	FILE_SYNCHRONOUS_IO_NONALERT		0x00000020
169da6c28aaSamw #define	FILE_NON_DIRECTORY_FILE			0x00000040
170da6c28aaSamw #define	FILE_CREATE_TREE_CONNECTION		0x00000080
171da6c28aaSamw 
172da6c28aaSamw #define	FILE_COMPLETE_IF_OPLOCKED		0x00000100
173da6c28aaSamw #define	FILE_NO_EA_KNOWLEDGE			0x00000200
174da6c28aaSamw /* UNUSED					0x00000400 */
175da6c28aaSamw #define	FILE_RANDOM_ACCESS			0x00000800
176da6c28aaSamw 
177da6c28aaSamw #define	FILE_DELETE_ON_CLOSE			0x00001000
178da6c28aaSamw #define	FILE_OPEN_BY_FILE_ID			0x00002000
179da6c28aaSamw #define	FILE_OPEN_FOR_BACKUP_INTENT		0x00004000
180da6c28aaSamw #define	FILE_NO_COMPRESSION			0x00008000
181da6c28aaSamw 
182da6c28aaSamw #define	FILE_RESERVE_OPFILTER			0x00100000
183da6c28aaSamw #define	FILE_RESERVED0				0x00200000
184da6c28aaSamw #define	FILE_RESERVED1				0x00400000
185da6c28aaSamw #define	FILE_RESERVED2				0x00800000
186da6c28aaSamw 
187da6c28aaSamw #define	FILE_VALID_OPTION_FLAGS			0x007fffff
188da6c28aaSamw #define	FILE_VALID_PIPE_OPTION_FLAGS		0x00000032
189da6c28aaSamw #define	FILE_VALID_MAILSLOT_OPTION_FLAGS	0x00000032
190da6c28aaSamw #define	FILE_VALID_SET_FLAGS			0x00000036
191da6c28aaSamw 
192da6c28aaSamw /*
193da6c28aaSamw  * Define the file information class values used by the NT DDK and HAL.
194da6c28aaSamw  */
195da6c28aaSamw typedef enum _FILE_INFORMATION_CLASS {
196da6c28aaSamw 	FileDirectoryInformation	= 1,
197da6c28aaSamw 	FileFullDirectoryInformation,	/* 2 */
198da6c28aaSamw 	FileBothDirectoryInformation,	/* 3 */
199da6c28aaSamw 	FileBasicInformation,		/* 4 */
200da6c28aaSamw 	FileStandardInformation,	/* 5 */
201da6c28aaSamw 	FileInternalInformation,	/* 6 */
202da6c28aaSamw 	FileEaInformation,		/* 7 */
203da6c28aaSamw 	FileAccessInformation,		/* 8 */
204da6c28aaSamw 	FileNameInformation,		/* 9 */
205da6c28aaSamw 	FileRenameInformation,		/* 10 */
206da6c28aaSamw 	FileLinkInformation,		/* 11 */
207da6c28aaSamw 	FileNamesInformation,		/* 12 */
208da6c28aaSamw 	FileDispositionInformation,	/* 13 */
209da6c28aaSamw 	FilePositionInformation,	/* 14 */
210da6c28aaSamw 	FileFullEaInformation,		/* 15 */
211da6c28aaSamw 	FileModeInformation,		/* 16 */
212da6c28aaSamw 	FileAlignmentInformation,	/* 17 */
213da6c28aaSamw 	FileAllInformation,		/* 18 */
214da6c28aaSamw 	FileAllocationInformation,	/* 19 */
215da6c28aaSamw 	FileEndOfFileInformation,	/* 20 */
216da6c28aaSamw 	FileAlternateNameInformation,	/* 21 */
217da6c28aaSamw 	FileStreamInformation,		/* 22 */
218da6c28aaSamw 	FilePipeInformation,		/* 23 */
219da6c28aaSamw 	FilePipeLocalInformation,	/* 24 */
220da6c28aaSamw 	FilePipeRemoteInformation,	/* 25 */
221da6c28aaSamw 	FileMailslotQueryInformation,	/* 26 */
222da6c28aaSamw 	FileMailslotSetInformation,	/* 27 */
223da6c28aaSamw 	FileCompressionInformation,	/* 28 */
224da6c28aaSamw 	FileObjectIdInformation,	/* 29 */
225da6c28aaSamw 	FileCompletionInformation,	/* 30 */
226da6c28aaSamw 	FileMoveClusterInformation,	/* 31 */
227da6c28aaSamw 	FileInformationReserved32,	/* 32 */
228da6c28aaSamw 	FileInformationReserved33,	/* 33 */
229da6c28aaSamw 	FileNetworkOpenInformation,	/* 34 */
230*2c2961f8Sjose borrego 	FileAttributeTagInformation,	/* 35 */
231da6c28aaSamw 	FileMaximumInformation
232da6c28aaSamw } FILE_INFORMATION_CLASS;
233da6c28aaSamw 
234da6c28aaSamw #ifdef __cplusplus
235da6c28aaSamw }
236da6c28aaSamw #endif
237da6c28aaSamw 
238da6c28aaSamw #endif /* _SMBSRV_NTIFS_H */
239