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