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