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