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 2010 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 * Copyright (c) 2016 by Delphix. All rights reserved.
25 */
26
27 #ifndef _SMBSRV_NTIFS_H
28 #define _SMBSRV_NTIFS_H
29
30 /*
31 * This file provides definitions compatible with the NT Installable
32 * File System (IFS) interface. This header file also defines the Security
33 * Descriptor module from Windows.
34 */
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39
40 #include <sys/acl.h>
41 #include <sys/list.h>
42 #include <smbsrv/smb_sid.h>
43
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 */
251 FileIdGlobalTxDirectoryInformation, /* 50 */
252 FileInformationReserved51, /* 51 */
253 FileInformationReserved52, /* 52 */
254 FileInformationReserved53, /* 53 */
255 FileStandardLinkInformation, /* 54 */
256 FileMaximumInformation
257 } FILE_INFORMATION_CLASS;
258
259 /*
260 * Define the file system information class values.
261 */
262 typedef enum _FILE_FS_INFORMATION_CLASS {
263 FileFsVolumeInformation = 1,
264 FileFsLabelInformation, /* 2 */
265 FileFsSizeInformation, /* 3 */
266 FileFsDeviceInformation, /* 4 */
267 FileFsAttributeInformation, /* 5 */
268 FileFsControlInformation, /* 6 */
269 FileFsFullSizeInformation, /* 7 */
270 FileFsObjectIdInformation, /* 8 */
271 FileFsDriverPathInformation /* 9 */
272 } FILE_FS_INFORMATION_CLASS;
273
274 /*
275 * Discretionary Access Control List (DACL)
276 *
277 * A Discretionary Access Control List (DACL), often abbreviated to
278 * ACL, is a list of access controls which either allow or deny access
279 * for users or groups to a resource. There is a list header followed
280 * by a list of access control entries (ACE). Each ACE specifies the
281 * access allowed or denied to a single user or group (identified by
282 * a SID).
283 *
284 * There is another access control list object called a System Access
285 * Control List (SACL), which is used to control auditing, but no
286 * support is provideed for SACLs at this time.
287 *
288 * ACL header format:
289 *
290 * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
291 * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
|
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 2010 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 * Copyright 2017 Nexenta Systems, Inc. All rights reserved.
25 * Copyright (c) 2016 by Delphix. All rights reserved.
26 */
27
28 #ifndef _SMBSRV_NTIFS_H
29 #define _SMBSRV_NTIFS_H
30
31 /*
32 * This file provides definitions compatible with the NT Installable
33 * File System (IFS) interface. This header file also defines the Security
34 * Descriptor module from Windows.
35 */
36
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40
41 #include <sys/acl.h>
42 #include <sys/list.h>
43 #include <smbsrv/smb_sid.h>
44
174 #define FILE_SYNCHRONOUS_IO_ALERT 0x00000010
175 #define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020
176 #define FILE_NON_DIRECTORY_FILE 0x00000040
177 #define FILE_CREATE_TREE_CONNECTION 0x00000080
178
179 #define FILE_COMPLETE_IF_OPLOCKED 0x00000100
180 #define FILE_NO_EA_KNOWLEDGE 0x00000200
181 /* UNUSED 0x00000400 */
182 #define FILE_RANDOM_ACCESS 0x00000800
183
184 #define FILE_DELETE_ON_CLOSE 0x00001000
185 #define FILE_OPEN_BY_FILE_ID 0x00002000
186 #define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000
187 #define FILE_NO_COMPRESSION 0x00008000
188
189 #define FILE_RESERVE_OPFILTER 0x00100000
190 #define FILE_RESERVED0 0x00200000
191 #define FILE_RESERVED1 0x00400000
192 #define FILE_RESERVED2 0x00800000
193
194 #define FILE_VALID_OPTION_FLAGS 0x00ffffff
195 #define FILE_VALID_PIPE_OPTION_FLAGS 0x00000032
196 #define FILE_VALID_MAILSLOT_OPTION_FLAGS 0x00000032
197 #define FILE_VALID_SET_FLAGS 0x00000036
198
199 /*
200 * "Granular" oplock flags; [MS-FSA], WinDDK/ntifs.h
201 * Same as smb2.h SMB2_LEASE_...
202 */
203 #define OPLOCK_LEVEL_CACHE_READ 0x01
204 #define OPLOCK_LEVEL_CACHE_HANDLE 0x02
205 #define OPLOCK_LEVEL_CACHE_WRITE 0x04
206 #define OPLOCK_LEVEL_CACHE_MASK 0x07
207
208 /*
209 * [MS-FSA] oplock types (also "levels")
210 */
211 #define OPLOCK_LEVEL_NONE 0
212 #define OPLOCK_LEVEL_TWO 0x100
213 #define OPLOCK_LEVEL_ONE 0x200
214 #define OPLOCK_LEVEL_BATCH 0x400
215 #define OPLOCK_LEVEL_GRANULAR 0x800
216 #define OPLOCK_LEVEL_TYPE_MASK 0xf00
217
218 /*
219 * Define the file information class values used by the NT DDK and HAL.
220 */
221 typedef enum _FILE_INFORMATION_CLASS {
222 FileDirectoryInformation = 1,
223 FileFullDirectoryInformation, /* 2 */
224 FileBothDirectoryInformation, /* 3 */
225 FileBasicInformation, /* 4 */
226 FileStandardInformation, /* 5 */
227 FileInternalInformation, /* 6 */
228 FileEaInformation, /* 7 */
229 FileAccessInformation, /* 8 */
230 FileNameInformation, /* 9 */
231 FileRenameInformation, /* 10 */
232 FileLinkInformation, /* 11 */
233 FileNamesInformation, /* 12 */
234 FileDispositionInformation, /* 13 */
235 FilePositionInformation, /* 14 */
236 FileFullEaInformation, /* 15 */
237 FileModeInformation, /* 16 */
238 FileAlignmentInformation, /* 17 */
271 FileIdGlobalTxDirectoryInformation, /* 50 */
272 FileInformationReserved51, /* 51 */
273 FileInformationReserved52, /* 52 */
274 FileInformationReserved53, /* 53 */
275 FileStandardLinkInformation, /* 54 */
276 FileMaximumInformation
277 } FILE_INFORMATION_CLASS;
278
279 /*
280 * Define the file system information class values.
281 */
282 typedef enum _FILE_FS_INFORMATION_CLASS {
283 FileFsVolumeInformation = 1,
284 FileFsLabelInformation, /* 2 */
285 FileFsSizeInformation, /* 3 */
286 FileFsDeviceInformation, /* 4 */
287 FileFsAttributeInformation, /* 5 */
288 FileFsControlInformation, /* 6 */
289 FileFsFullSizeInformation, /* 7 */
290 FileFsObjectIdInformation, /* 8 */
291 FileFsDriverPathInformation, /* 9 */
292 FileFsVolumeFlagsInformation, /* A */
293 FileFsSectorSizeInformation /* B */
294 } FILE_FS_INFORMATION_CLASS;
295
296 /*
297 * Discretionary Access Control List (DACL)
298 *
299 * A Discretionary Access Control List (DACL), often abbreviated to
300 * ACL, is a list of access controls which either allow or deny access
301 * for users or groups to a resource. There is a list header followed
302 * by a list of access control entries (ACE). Each ACE specifies the
303 * access allowed or denied to a single user or group (identified by
304 * a SID).
305 *
306 * There is another access control list object called a System Access
307 * Control List (SACL), which is used to control auditing, but no
308 * support is provideed for SACLs at this time.
309 *
310 * ACL header format:
311 *
312 * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
313 * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
|