OpenAFS
OpenAFS distributed network file system
/cygdrive/c/src/openafs/openafs.git/repo/src/WINNT/afsrdr/common/AFSUserDefines.h
00001 /*
00002  * Copyright (c) 2008-2011 Kernel Drivers, LLC.
00003  * Copyright (c) 2009-2011 Your File System, Inc.
00004  * All rights reserved.
00005  *
00006  * Redistribution and use in source and binary forms, with or without
00007  * modification, are permitted provided that the following conditions
00008  * are met:
00009  *
00010  * - Redistributions of source code must retain the above copyright notice,
00011  *   this list of conditions and the following disclaimer.
00012  * - Redistributions in binary form must reproduce the above copyright
00013  *   notice,
00014  *   this list of conditions and the following disclaimer in the
00015  *   documentation
00016  *   and/or other materials provided with the distribution.
00017  * - Neither the name of Kernel Drivers, LLC nor the names of its
00018  *   contributors may be
00019  *   used to endorse or promote products derived from this software without
00020  *   specific prior written permission from Kernel Drivers, LLC
00021  *   and Your File System, Inc.
00022  *
00023  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00024  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
00025  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
00026  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
00027  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00028  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00029  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00030  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00031  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00032  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00033  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00034  */
00035 
00036 #ifndef _AFS_USER_DEFINE_H
00037 #define _AFS_USER_DEFINE_H
00038 
00039 //
00040 // Symbolic link name
00041 //
00042 
00043 #define AFS_SYMLINK                    "\\\\.\\AFSRedirector"
00044 #define AFS_SYMLINK_W                 L"\\\\.\\AFSRedirector"
00045 
00046 #define AFS_PIOCTL_FILE_INTERFACE_NAME  L"_._AFS_IOCTL_._"
00047 #define AFS_GLOBAL_ROOT_SHARE_NAME      L"ALL"
00048 
00049 //
00050 // Payload buffer length
00051 //
00052 
00053 #define AFS_PAYLOAD_BUFFER_SIZE       (16 * 1024)
00054 
00055 
00056 //
00057 // Request types
00058 //
00059 
00060 #define AFS_REQUEST_TYPE_DIR_ENUM                0x00000001
00061 #define AFS_REQUEST_TYPE_CREATE_FILE             0x00000002
00062 #define AFS_REQUEST_TYPE_REQUEST_FILE_EXTENTS    0x00000003
00063 #define AFS_REQUEST_TYPE_RELEASE_FILE_EXTENTS    0x00000004
00064 #define AFS_REQUEST_TYPE_UPDATE_FILE             0x00000005
00065 #define AFS_REQUEST_TYPE_DELETE_FILE             0x00000006
00066 #define AFS_REQUEST_TYPE_RENAME_FILE             0x00000007
00067 #define AFS_REQUEST_TYPE_FLUSH_FILE              0x00000008
00068 #define AFS_REQUEST_TYPE_OPEN_FILE               0x00000009
00069 #define AFS_REQUEST_TYPE_EVAL_TARGET_BY_ID       0x0000000A
00070 #define AFS_REQUEST_TYPE_EVAL_TARGET_BY_NAME     0x0000000B
00071 #define AFS_REQUEST_TYPE_PIOCTL_READ             0x0000000C
00072 #define AFS_REQUEST_TYPE_PIOCTL_WRITE            0x0000000D
00073 #define AFS_REQUEST_TYPE_PIOCTL_OPEN             0x0000000E
00074 #define AFS_REQUEST_TYPE_PIOCTL_CLOSE            0x0000000F
00075 #define AFS_REQUEST_TYPE_BYTE_RANGE_LOCK         0x00000010  // Takes AFSByteRangeLockRequestCB as INPUT
00076 #define AFS_REQUEST_TYPE_BYTE_RANGE_UNLOCK       0x00000011  // Takes AFSByteRangeUnlockRequestCB as INPUT
00077 #define AFS_REQUEST_TYPE_BYTE_RANGE_UNLOCK_ALL   0x00000012  // Takes AFSByteRangeUnlockRequestCB as INPUT
00078 #define AFS_REQUEST_TYPE_GET_VOLUME_INFO         0x00000013
00079 #define AFS_REQUEST_TYPE_HOLD_FID                0x00000014
00080 #define AFS_REQUEST_TYPE_RELEASE_FID             0x00000015
00081 #define AFS_REQUEST_TYPE_PIPE_TRANSCEIVE         0x00000016
00082 #define AFS_REQUEST_TYPE_PIPE_READ               0x00000017
00083 #define AFS_REQUEST_TYPE_PIPE_WRITE              0x00000018
00084 #define AFS_REQUEST_TYPE_PIPE_OPEN               0x00000019
00085 #define AFS_REQUEST_TYPE_PIPE_CLOSE              0x0000001A
00086 #define AFS_REQUEST_TYPE_PIPE_QUERY_INFO         0x0000001B
00087 #define AFS_REQUEST_TYPE_PIPE_SET_INFO           0x0000001C
00088 #define AFS_REQUEST_TYPE_CLEANUP_PROCESSING      0x0000001D
00089 #define AFS_REQUEST_TYPE_CREATE_LINK             0x0000001E
00090 #define AFS_REQUEST_TYPE_CREATE_MOUNTPOINT       0x0000001F
00091 #define AFS_REQUEST_TYPE_CREATE_SYMLINK          0x00000020
00092 #define AFS_REQUEST_TYPE_RELEASE_FILE_ACCESS     0x00000021
00093 #define AFS_REQUEST_TYPE_GET_VOLUME_SIZE_INFO    0x00000022
00094 
00095 //
00096 // Request Flags, these are passed up from the file system
00097 //
00098 
00099 #define AFS_REQUEST_FLAG_SYNCHRONOUS             0x00000001 // The service must call back through the
00100                                                             // IOCTL_AFS_PROCESS_IRP_RESULT IOCtl to ack
00101                                                             // the request with a response. The absense of
00102                                                             // this flag indicates no call should be made to
00103                                                             // the IOCTL_AFS_PROCESS_IRP_RESULT IOCtl and if a
00104                                                             // response is required for the call it is to be made
00105                                                             // through an IOCtl call
00106 
00107 #define AFS_REQUEST_FLAG_CASE_SENSITIVE          0x00000002
00108 
00109 #define AFS_REQUEST_FLAG_WOW64                   0x00000004 // On 64-bit systems, set if the request
00110                                                             // originated from a WOW64 process
00111 
00112 #define AFS_REQUEST_FLAG_FAST_REQUEST            0x00000008 // if this flag is set, the cache manager
00113                                                             // responds to the request using a minimum
00114                                                             // of file server interaction
00115 
00116 #define AFS_REQUEST_FLAG_HOLD_FID                0x00000010 // if this flag is set, the cache manager
00117                                                             // maintains a reference count on the
00118                                                             // evaluated file object just as if
00119                                                             // AFS_REQUEST_TYPE_HOLD_FID was issued.
00120                                                             // The reference count must be released
00121                                                             // using AFS_REQUEST_TYPE_RELEASE_FID.
00122                                                             // This flag is only valid on
00123                                                             // AFS_REQUEST_TYPE_EVALUATE_BY_NAME,
00124                                                             // AFS_REQUEST_TYPE_EVALUATE_BY_ID,
00125                                                             // AFS_REQUEST_TYPE_CREATE_FILE, and
00126                                                             // AFS_REQUEST_TYPE_OPEN_FILE.
00127 
00128 #define AFS_REQUEST_FLAG_FLUSH_FILE              0x00000020 // Passed as a flag to the AFS_REQUEST_TYPE_CLEANUP_PROCESSING
00129                                                             // request when the last handle is closed.  This flag tells the
00130                                                             // to flush all dirty data before returning.
00131 
00132 #define AFS_REQUEST_FLAG_FILE_DELETED            0x00000040 // Passed as a flag to the AFS_REQUEST_TYPE_CLEANUP_PROCESSING
00133                                                             // request to indicate the file has been marked for deletion.
00134 
00135 #define AFS_REQUEST_FLAG_BYTE_RANGE_UNLOCK_ALL   0x00000080 // Passed as a flag to the AFS_REQUEST_TYPE_CLEANUP_PROCESSING
00136                                                             // request to indicate to release all BR locks on the file for the
00137                                                             // given process.
00138 
00139 #define AFS_REQUEST_FLAG_CHECK_ONLY              0x00000100 // Do not perform the action, just check if the action is possible
00140                                                             // Only used with AFS_REQUEST_TYPE_DELETE_FILE.
00141 
00142 #define AFS_REQUEST_LOCAL_SYSTEM_PAG             0x00000200 // Indicates that the caller is or was at some point a system
00143                                                             // process
00144 
00145 //
00146 // Request Flags, these are passed down from the sevice
00147 //
00148 
00149 #define AFS_REQUEST_RELEASE_THREAD                 0x00000001 // Set on threads which are dedicated extent release threads
00150 
00151 //
00152 // Status codes that can returned for various requests
00153 //
00154 
00155 #if !defined(AFS_KERNEL_MODE) && !defined(STATUS_SUCCESS)
00156 
00157 #define STATUS_SUCCESS                   0x00000000
00158 #define STATUS_MORE_ENTRIES              0x00000105
00159 #define STATUS_NO_MORE_FILES             0x80000006
00160 
00161 #endif
00162 
00163 //
00164 // Trace Levels
00165 //
00166 
00167 #define AFS_TRACE_LEVEL_ERROR               0x00000001
00168 #define AFS_TRACE_LEVEL_WARNING             0x00000002
00169 #define AFS_TRACE_LEVEL_VERBOSE             0x00000003
00170 #define AFS_TRACE_LEVEL_VERBOSE_2           0x00000004
00171 #define AFS_TRACE_LEVEL_MAXIMUM             0x00000004
00172 
00173 //
00174 // Trace Subsystem Classes
00175 //
00176 
00177 #define AFS_SUBSYSTEM_IO_PROCESSING         0x00000001  // Includes IO subsystem
00178 #define AFS_SUBSYSTEM_FILE_PROCESSING       0x00000002  // Includes Fcb and name processing
00179 #define AFS_SUBSYSTEM_LOCK_PROCESSING       0x00000004  // All lock processing, level must be set to VERBOSE
00180 #define AFS_SUBSYSTEM_EXTENT_PROCESSING     0x00000008  // Specific extent processing
00181 #define AFS_SUBSYSTEM_WORKER_PROCESSING     0x00000010  // All worker processing
00182 #define AFS_SUBSYSTEM_DIRENTRY_REF_COUNTING 0x00000020  // Reference counting directory entries
00183 #define AFS_SUBSYSTEM_OBJECT_REF_COUNTING   0x00000040  // Reference counting objects
00184 #define AFS_SUBSYSTEM_VOLUME_REF_COUNTING   0x00000080  // Reference counting volumes
00185 #define AFS_SUBSYSTEM_FCB_REF_COUNTING      0x00000100  // Reference counting fcbs
00186 #define AFS_SUBSYSTEM_CLEANUP_PROCESSING    0x00000200  // Garbage collection of objects, dir entries, fcbs, etc.
00187 #define AFS_SUBSYSTEM_PIPE_PROCESSING       0x00000400  // Pipe and share processing
00188 #define AFS_SUBSYSTEM_DIR_NOTIF_PROCESSING  0x00000800  // Directory notification interface
00189 #define AFS_SUBSYSTEM_NETWORK_PROVIDER      0x00001000  // Network provier interactions
00190 #define AFS_SUBSYSTEM_DIR_NODE_COUNT        0x00002000  // Dir node count processing
00191 #define AFS_SUBSYSTEM_PIOCTL_PROCESSING     0x00004000  // PIOCtl processing
00192 #define AFS_SUBSYSTEM_AUTHGROUP_PROCESSING  0x00008000  // Auth group creation/assignment
00193 #define AFS_SUBSYSTEM_LOAD_LIBRARY          0x00010000  // Library load and unload, request queuing
00194 #define AFS_SUBSYSTEM_PROCESS_PROCESSING    0x00010000  // Process creation and destruction
00195 #define AFS_SUBSYSTEM_EXTENT_ACTIVE_COUNTING 0x00020000 // Extent Active Counts
00196 #define AFS_SUBSYSTEM_INIT_PROCESSING       0x00040000  // Redirector Initialization
00197 #define AFS_SUBSYSTEM_NAME_ARRAY_PROCESSING 0x00080000  // Name Array Processing
00198 
00199 //
00200 // Invalidation Reasons
00201 //
00202 
00203 #define AFS_INVALIDATE_EXPIRED          1  /* Set RE_VALIDATE */
00204 #define AFS_INVALIDATE_FLUSHED          2  /* Set RE-VALIDATE */
00205 #define AFS_INVALIDATE_CALLBACK         3  /* Set VERIFY Reset dir enumeration */
00206 #define AFS_INVALIDATE_SMB              4  /* Set VERIFY Reset dir enumeration */
00207 #define AFS_INVALIDATE_CREDS            5  /* Set VERIFY - User credentials changed */
00208 #define AFS_INVALIDATE_DATA_VERSION     6  /* Set VERIFY */
00209 #define AFS_INVALIDATE_DELETED          7  /* Requires top level locks */
00210 
00211 //
00212 // Flags which can be specified for each extent in the AFSFileExtentCB structure
00213 //
00214 
00215 #define AFS_EXTENT_FLAG_DIRTY   1   // The specified extent requires flushing, this can be
00216                                     // specified by the file system during a release of the
00217                                     // extent
00218 
00219 #define AFS_EXTENT_FLAG_RELEASE 2   // The presence of this flag during a AFS_REQUEST_TYPE_RELEASE_FILE_EXTENTS
00220                                     // call from the file system indicates to the service that the file system
00221                                     // no longer requires the extents and they can be completely released. The
00222                                     // absense of this flag tells the service that the extent should not be
00223                                     // dereferenced; this is usually the case when the file system tells the
00224                                     // service to flush a range of exents but do not release them
00225 
00226 #define AFS_EXTENT_FLAG_CLEAN   4   // The presence of this flag during a AFS_REQUEST_TYPE_REQUEST_FILE_EXTENTS
00227                                     // call from the file system indicates to the server that the file system
00228                                     // is going to completely overwrite the contents of the extent and the
00229                                     // service should therefore not bother to obtain the current version
00230                                     // from the file server.
00231 
00232 #define AFS_EXTENT_FLAG_FLUSH   8   // The presence of this flag indicates that the service should perform
00233                                     // the equivalent of a FLUSH ioctl on the file after processing the
00234                                     // extents.
00235 
00236 #define AFS_EXTENT_FLAG_IN_USE  0x10 // The extent is currenty in use by the fs and cannot be released
00237 
00238 #define AFS_EXTENT_FLAG_UNKNOWN 0x20 // The extent is unknown to the fs
00239 
00240 #define AFS_EXTENT_FLAG_MD5_SET 0x40 // The extent MD5 field has been set
00241 
00242 //
00243 // Volume Information Characteristics
00244 //
00245 
00246 #ifndef AFS_KERNEL_MODE
00247 
00248 #define FILE_REMOVABLE_MEDIA            0x00000001
00249 #define FILE_READ_ONLY_DEVICE           0x00000002
00250 #define FILE_REMOTE_DEVICE              0x00000010
00251 
00252 //
00253 // File attributes
00254 //
00255 
00256 #define FILE_ATTRIBUTE_READONLY             0x00000001  // winnt
00257 #define FILE_ATTRIBUTE_HIDDEN               0x00000002  // winnt
00258 #define FILE_ATTRIBUTE_SYSTEM               0x00000004  // winnt
00259 
00260 #define FILE_ATTRIBUTE_DIRECTORY            0x00000010  // winnt
00261 #define FILE_ATTRIBUTE_ARCHIVE              0x00000020  // winnt
00262 #define FILE_ATTRIBUTE_DEVICE               0x00000040  // winnt
00263 #define FILE_ATTRIBUTE_NORMAL               0x00000080  // winnt
00264 
00265 //
00266 // Filesystem attributes
00267 //
00268 
00269 #define FILE_CASE_PRESERVED_NAMES       0x00000002  // winnt
00270 #define FILE_UNICODE_ON_DISK            0x00000004  // winnt
00271 #define FILE_PERSISTENT_ACLS            0x00000008  // winnt
00272 #define FILE_VOLUME_QUOTAS              0x00000020  // winnt
00273 #define FILE_SUPPORTS_REPARSE_POINTS    0x00000080  // winnt
00274 #define FILE_SUPPORTS_OBJECT_IDS        0x00010000  // winnt
00275 
00276 #endif
00277 
00278 //
00279 // AFS File Types
00280 //
00281 
00282 #define AFS_FILE_TYPE_UNKNOWN            0    /* an unknown object */
00283 #define AFS_FILE_TYPE_FILE               1    /* a file */
00284 #define AFS_FILE_TYPE_DIRECTORY          2    /* a dir */
00285 #define AFS_FILE_TYPE_SYMLINK            3    /* a symbolic link */
00286 #define AFS_FILE_TYPE_MOUNTPOINT         4    /* a mount point */
00287 #define AFS_FILE_TYPE_DFSLINK            5    /* a Microsoft Dfs link */
00288 #define AFS_FILE_TYPE_INVALID            99   /* an invalid link */
00289 
00290 //
00291 // AFS File types specific to Windows
00292 //
00293 
00294 #define AFS_FILE_TYPE_SPECIAL_SHARE_NAME    -1
00295 #define AFS_FILE_TYPE_PIOCTL                -2
00296 #define AFS_FILE_TYPE_PIPE                  -3
00297 
00298 //
00299 // AFS SysName Constants
00300 //
00301 
00302 #define AFS_MAX_SYSNAME_LENGTH 128
00303 #define AFS_SYSNAME_ARCH_32BIT 0
00304 #define AFS_SYSNAME_ARCH_64BIT 1
00305 
00306 //
00307 // Server file access granted to callers on open
00308 //
00309 
00310 #define AFS_FILE_ACCESS_NOLOCK          0x00000000
00311 #define AFS_FILE_ACCESS_EXCLUSIVE       0x00000001
00312 #define AFS_FILE_ACCESS_SHARED          0x00000002
00313 
00314 #endif /* _AFS_USER_DEFINE_H */
 All Data Structures Files Functions Variables