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