Windows: Redirector must query volume size when asked
[openafs.git] / src / WINNT / afsrdr / common / AFSUserDefines.h
1 /*
2  * Copyright (c) 2008-2011 Kernel Drivers, LLC.
3  * Copyright (c) 2009-2011 Your File System, Inc.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  * - Redistributions of source code must retain the above copyright notice,
11  *   this list of conditions and the following disclaimer.
12  * - Redistributions in binary form must reproduce the above copyright
13  *   notice,
14  *   this list of conditions and the following disclaimer in the
15  *   documentation
16  *   and/or other materials provided with the distribution.
17  * - Neither the name of Kernel Drivers, LLC nor the names of its
18  *   contributors may be
19  *   used to endorse or promote products derived from this software without
20  *   specific prior written permission from Kernel Drivers, LLC
21  *   and Your File System, Inc.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
26  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
27  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
29  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  */
35
36 #ifndef _AFS_USER_DEFINE_H
37 #define _AFS_USER_DEFINE_H
38
39 //
40 // Symbolic link name
41 //
42
43 #define AFS_SYMLINK                    "\\\\.\\AFSRedirector"
44 #define AFS_SYMLINK_W                 L"\\\\.\\AFSRedirector"
45
46 #define AFS_PIOCTL_FILE_INTERFACE_NAME  L"_._AFS_IOCTL_._"
47 #define AFS_GLOBAL_ROOT_SHARE_NAME      L"ALL"
48
49 //
50 // Payload buffer length
51 //
52
53 #define AFS_PAYLOAD_BUFFER_SIZE       (16 * 1024)
54
55
56 //
57 // Request types
58 //
59
60 #define AFS_REQUEST_TYPE_DIR_ENUM                0x00000001
61 #define AFS_REQUEST_TYPE_CREATE_FILE             0x00000002
62 #define AFS_REQUEST_TYPE_REQUEST_FILE_EXTENTS    0x00000003
63 #define AFS_REQUEST_TYPE_RELEASE_FILE_EXTENTS    0x00000004
64 #define AFS_REQUEST_TYPE_UPDATE_FILE             0x00000005
65 #define AFS_REQUEST_TYPE_DELETE_FILE             0x00000006
66 #define AFS_REQUEST_TYPE_RENAME_FILE             0x00000007
67 #define AFS_REQUEST_TYPE_FLUSH_FILE              0x00000008
68 #define AFS_REQUEST_TYPE_OPEN_FILE               0x00000009
69 #define AFS_REQUEST_TYPE_EVAL_TARGET_BY_ID       0x0000000A
70 #define AFS_REQUEST_TYPE_EVAL_TARGET_BY_NAME     0x0000000B
71 #define AFS_REQUEST_TYPE_PIOCTL_READ             0x0000000C
72 #define AFS_REQUEST_TYPE_PIOCTL_WRITE            0x0000000D
73 #define AFS_REQUEST_TYPE_PIOCTL_OPEN             0x0000000E
74 #define AFS_REQUEST_TYPE_PIOCTL_CLOSE            0x0000000F
75 #define AFS_REQUEST_TYPE_BYTE_RANGE_LOCK         0x00000010  // Takes AFSByteRangeLockRequestCB as INPUT
76 #define AFS_REQUEST_TYPE_BYTE_RANGE_UNLOCK       0x00000011  // Takes AFSByteRangeUnlockRequestCB as INPUT
77 #define AFS_REQUEST_TYPE_BYTE_RANGE_UNLOCK_ALL   0x00000012  // Takes AFSByteRangeUnlockRequestCB as INPUT
78 #define AFS_REQUEST_TYPE_GET_VOLUME_INFO         0x00000013
79 #define AFS_REQUEST_TYPE_HOLD_FID                0x00000014
80 #define AFS_REQUEST_TYPE_RELEASE_FID             0x00000015
81 #define AFS_REQUEST_TYPE_PIPE_TRANSCEIVE         0x00000016
82 #define AFS_REQUEST_TYPE_PIPE_READ               0x00000017
83 #define AFS_REQUEST_TYPE_PIPE_WRITE              0x00000018
84 #define AFS_REQUEST_TYPE_PIPE_OPEN               0x00000019
85 #define AFS_REQUEST_TYPE_PIPE_CLOSE              0x0000001A
86 #define AFS_REQUEST_TYPE_PIPE_QUERY_INFO         0x0000001B
87 #define AFS_REQUEST_TYPE_PIPE_SET_INFO           0x0000001C
88 #define AFS_REQUEST_TYPE_CLEANUP_PROCESSING      0x0000001D
89 #define AFS_REQUEST_TYPE_CREATE_LINK             0x0000001E
90 #define AFS_REQUEST_TYPE_CREATE_MOUNTPOINT       0x0000001F
91 #define AFS_REQUEST_TYPE_CREATE_SYMLINK          0x00000020
92 #define AFS_REQUEST_TYPE_RELEASE_FILE_ACCESS     0x00000021
93 #define AFS_REQUEST_TYPE_GET_VOLUME_SIZE_INFO    0x00000022
94
95 //
96 // Request Flags, these are passed up from the file system
97 //
98
99 #define AFS_REQUEST_FLAG_SYNCHRONOUS             0x00000001 // The service must call back through the
100                                                             // IOCTL_AFS_PROCESS_IRP_RESULT IOCtl to ack
101                                                             // the request with a response. The absense of
102                                                             // this flag indicates no call should be made to
103                                                             // the IOCTL_AFS_PROCESS_IRP_RESULT IOCtl and if a
104                                                             // response is required for the call it is to be made
105                                                             // through an IOCtl call
106
107 #define AFS_REQUEST_FLAG_CASE_SENSITIVE          0x00000002
108
109 #define AFS_REQUEST_FLAG_WOW64                   0x00000004 // On 64-bit systems, set if the request
110                                                             // originated from a WOW64 process
111
112 #define AFS_REQUEST_FLAG_FAST_REQUEST            0x00000008 // if this flag is set, the cache manager
113                                                             // responds to the request using a minimum
114                                                             // of file server interaction
115
116 #define AFS_REQUEST_FLAG_HOLD_FID                0x00000010 // if this flag is set, the cache manager
117                                                             // maintains a reference count on the
118                                                             // evaluated file object just as if
119                                                             // AFS_REQUEST_TYPE_HOLD_FID was issued.
120                                                             // The reference count must be released
121                                                             // using AFS_REQUEST_TYPE_RELEASE_FID.
122                                                             // This flag is only valid on
123                                                             // AFS_REQUEST_TYPE_EVALUATE_BY_NAME,
124                                                             // AFS_REQUEST_TYPE_EVALUATE_BY_ID,
125                                                             // AFS_REQUEST_TYPE_CREATE_FILE, and
126                                                             // AFS_REQUEST_TYPE_OPEN_FILE.
127
128 #define AFS_REQUEST_FLAG_FLUSH_FILE              0x00000020 // Passed as a flag to the AFS_REQUEST_TYPE_CLEANUP_PROCESSING
129                                                             // request when the last handle is closed.  This flag tells the
130                                                             // to flush all dirty data before returning.
131
132 #define AFS_REQUEST_FLAG_FILE_DELETED            0x00000040 // Passed as a flag to the AFS_REQUEST_TYPE_CLEANUP_PROCESSING
133                                                             // request to indicate the file has been marked for deletion.
134
135 #define AFS_REQUEST_FLAG_BYTE_RANGE_UNLOCK_ALL   0x00000080 // Passed as a flag to the AFS_REQUEST_TYPE_CLEANUP_PROCESSING
136                                                             // request to indicate to release all BR locks on the file for the
137                                                             // given process.
138
139 #define AFS_REQUEST_FLAG_CHECK_ONLY              0x00000100 // Do not perform the action, just check if the action is possible
140                                                             // Only used with AFS_REQUEST_TYPE_DELETE_FILE.
141
142 #define AFS_REQUEST_LOCAL_SYSTEM_PAG             0x00000200 // Indicates that the caller is or was at some point a system
143                                                             // process
144
145 //
146 // Request Flags, these are passed down from the sevice
147 //
148
149 #define AFS_REQUEST_RELEASE_THREAD                 0x00000001 // Set on threads which are dedicated extent release threads
150
151 //
152 // Status codes that can returned for various requests
153 //
154
155 #if !defined(AFS_KERNEL_MODE) && !defined(STATUS_SUCCESS)
156
157 #define STATUS_SUCCESS                   0x00000000
158 #define STATUS_MORE_ENTRIES              0x00000105
159 #define STATUS_NO_MORE_FILES             0x80000006
160
161 #endif
162
163 //
164 // Trace Levels
165 //
166
167 #define AFS_TRACE_LEVEL_ERROR               0x00000001
168 #define AFS_TRACE_LEVEL_WARNING             0x00000002
169 #define AFS_TRACE_LEVEL_VERBOSE             0x00000003
170 #define AFS_TRACE_LEVEL_VERBOSE_2           0x00000004
171 #define AFS_TRACE_LEVEL_MAXIMUM             0x00000004
172
173 //
174 // Trace Subsystem Classes
175 //
176
177 #define AFS_SUBSYSTEM_IO_PROCESSING         0x00000001  // Includes IO subsystem
178 #define AFS_SUBSYSTEM_FILE_PROCESSING       0x00000002  // Includes Fcb and name processing
179 #define AFS_SUBSYSTEM_LOCK_PROCESSING       0x00000004  // All lock processing, level must be set to VERBOSE
180 #define AFS_SUBSYSTEM_EXTENT_PROCESSING     0x00000008  // Specific extent processing
181 #define AFS_SUBSYSTEM_WORKER_PROCESSING     0x00000010  // All worker processing
182 #define AFS_SUBSYSTEM_DIRENTRY_REF_COUNTING 0x00000020  // Reference counting directory entries
183 #define AFS_SUBSYSTEM_OBJECT_REF_COUNTING   0x00000040  // Reference counting objects
184 #define AFS_SUBSYSTEM_VOLUME_REF_COUNTING   0x00000080  // Reference counting volumes
185 #define AFS_SUBSYSTEM_FCB_REF_COUNTING      0x00000100  // Reference counting fcbs
186 #define AFS_SUBSYSTEM_CLEANUP_PROCESSING    0x00000200  // Garbage collection of objects, dir entries, fcbs, etc.
187 #define AFS_SUBSYSTEM_PIPE_PROCESSING       0x00000400  // Pipe and share processing
188 #define AFS_SUBSYSTEM_DIR_NOTIF_PROCESSING  0x00000800  // Directory notification interface
189 #define AFS_SUBSYSTEM_NETWORK_PROVIDER      0x00001000  // Network provier interactions
190 #define AFS_SUBSYSTEM_DIR_NODE_COUNT        0x00002000  // Dir node count processing
191 #define AFS_SUBSYSTEM_PIOCTL_PROCESSING     0x00004000  // PIOCtl processing
192 #define AFS_SUBSYSTEM_AUTHGROUP_PROCESSING  0x00008000  // Auth group creation/assignment
193 #define AFS_SUBSYSTEM_LOAD_LIBRARY          0x00010000  // Library load and unload, request queuing
194 #define AFS_SUBSYSTEM_PROCESS_PROCESSING    0x00010000  // Process creation and destruction
195 #define AFS_SUBSYSTEM_EXTENT_ACTIVE_COUNTING 0x00020000 // Extent Active Counts
196 #define AFS_SUBSYSTEM_INIT_PROCESSING       0x00040000  // Redirector Initialization
197 #define AFS_SUBSYSTEM_NAME_ARRAY_PROCESSING 0x00080000  // Name Array Processing
198
199 //
200 // Invalidation Reasons
201 //
202
203 #define AFS_INVALIDATE_EXPIRED          1  /* Set RE_VALIDATE */
204 #define AFS_INVALIDATE_FLUSHED          2  /* Set RE-VALIDATE */
205 #define AFS_INVALIDATE_CALLBACK         3  /* Set VERIFY Reset dir enumeration */
206 #define AFS_INVALIDATE_SMB              4  /* Set VERIFY Reset dir enumeration */
207 #define AFS_INVALIDATE_CREDS            5  /* Set VERIFY - User credentials changed */
208 #define AFS_INVALIDATE_DATA_VERSION     6  /* Set VERIFY */
209 #define AFS_INVALIDATE_DELETED          7  /* Requires top level locks */
210
211 //
212 // Flags which can be specified for each extent in the AFSFileExtentCB structure
213 //
214
215 #define AFS_EXTENT_FLAG_DIRTY   1   // The specified extent requires flushing, this can be
216                                     // specified by the file system during a release of the
217                                     // extent
218
219 #define AFS_EXTENT_FLAG_RELEASE 2   // The presence of this flag during a AFS_REQUEST_TYPE_RELEASE_FILE_EXTENTS
220                                     // call from the file system indicates to the service that the file system
221                                     // no longer requires the extents and they can be completely released. The
222                                     // absense of this flag tells the service that the extent should not be
223                                     // dereferenced; this is usually the case when the file system tells the
224                                     // service to flush a range of exents but do not release them
225
226 #define AFS_EXTENT_FLAG_CLEAN   4   // The presence of this flag during a AFS_REQUEST_TYPE_REQUEST_FILE_EXTENTS
227                                     // call from the file system indicates to the server that the file system
228                                     // is going to completely overwrite the contents of the extent and the
229                                     // service should therefore not bother to obtain the current version
230                                     // from the file server.
231
232 #define AFS_EXTENT_FLAG_FLUSH   8   // The presence of this flag indicates that the service should perform
233                                     // the equivalent of a FLUSH ioctl on the file after processing the
234                                     // extents.
235
236 #define AFS_EXTENT_FLAG_IN_USE  0x10 // The extent is currenty in use by the fs and cannot be released
237
238 #define AFS_EXTENT_FLAG_UNKNOWN 0x20 // The extent is unknown to the fs
239
240 #define AFS_EXTENT_FLAG_MD5_SET 0x40 // The extent MD5 field has been set
241
242 //
243 // Volume Information Characteristics
244 //
245
246 #ifndef AFS_KERNEL_MODE
247
248 #define FILE_REMOVABLE_MEDIA            0x00000001
249 #define FILE_READ_ONLY_DEVICE           0x00000002
250 #define FILE_REMOTE_DEVICE              0x00000010
251
252 //
253 // File attributes
254 //
255
256 #define FILE_ATTRIBUTE_READONLY             0x00000001  // winnt
257 #define FILE_ATTRIBUTE_HIDDEN               0x00000002  // winnt
258 #define FILE_ATTRIBUTE_SYSTEM               0x00000004  // winnt
259
260 #define FILE_ATTRIBUTE_DIRECTORY            0x00000010  // winnt
261 #define FILE_ATTRIBUTE_ARCHIVE              0x00000020  // winnt
262 #define FILE_ATTRIBUTE_DEVICE               0x00000040  // winnt
263 #define FILE_ATTRIBUTE_NORMAL               0x00000080  // winnt
264
265 //
266 // Filesystem attributes
267 //
268
269 #define FILE_CASE_PRESERVED_NAMES       0x00000002  // winnt
270 #define FILE_UNICODE_ON_DISK            0x00000004  // winnt
271 #define FILE_PERSISTENT_ACLS            0x00000008  // winnt
272 #define FILE_VOLUME_QUOTAS              0x00000020  // winnt
273 #define FILE_SUPPORTS_REPARSE_POINTS    0x00000080  // winnt
274 #define FILE_SUPPORTS_OBJECT_IDS        0x00010000  // winnt
275
276 #endif
277
278 //
279 // AFS File Types
280 //
281
282 #define AFS_FILE_TYPE_UNKNOWN            0    /* an unknown object */
283 #define AFS_FILE_TYPE_FILE               1    /* a file */
284 #define AFS_FILE_TYPE_DIRECTORY          2    /* a dir */
285 #define AFS_FILE_TYPE_SYMLINK            3    /* a symbolic link */
286 #define AFS_FILE_TYPE_MOUNTPOINT         4    /* a mount point */
287 #define AFS_FILE_TYPE_DFSLINK            5    /* a Microsoft Dfs link */
288 #define AFS_FILE_TYPE_INVALID            99   /* an invalid link */
289
290 //
291 // AFS File types specific to Windows
292 //
293
294 #define AFS_FILE_TYPE_SPECIAL_SHARE_NAME    -1
295 #define AFS_FILE_TYPE_PIOCTL                -2
296 #define AFS_FILE_TYPE_PIPE                  -3
297
298 //
299 // AFS SysName Constants
300 //
301
302 #define AFS_MAX_SYSNAME_LENGTH 128
303 #define AFS_SYSNAME_ARCH_32BIT 0
304 #define AFS_SYSNAME_ARCH_64BIT 1
305
306 //
307 // Server file access granted to callers on open
308 //
309
310 #define AFS_FILE_ACCESS_NOLOCK          0x00000000
311 #define AFS_FILE_ACCESS_EXCLUSIVE       0x00000001
312 #define AFS_FILE_ACCESS_SHARED          0x00000002
313
314 #endif /* _AFS_USER_DEFINE_H */