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