Windows: AFS Redirector Support Headers

This patchset includes all of the common headers upon which
all of the subsequent submissions depend.

Co-authored by Jeffrey Altman <jaltman@your-file-system.com>

Change-Id: I3b2ba6fe0a9a5231801db2cd1a340b9c518b9be4
Reviewed-on: http://gerrit.openafs.org/5431
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Tested-by: Rod Widdowson <rdw@steadingsoftware.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
This commit is contained in:
Peter Scott 2011-09-15 01:07:03 -04:00 committed by Jeffrey Altman
parent a82c206398
commit f03cef68fb
7 changed files with 2768 additions and 0 deletions

View File

@ -0,0 +1,113 @@
/*
* Copyright (c) 2008-2011 Kernel Drivers, LLC.
* Copyright (c) 2009-2011 Your File System, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice,
* this list of conditions and the following disclaimer in the
* documentation
* and/or other materials provided with the distribution.
* - Neither the name of Kernel Drivers, LLC nor the names of its
* contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission from Kernel Drivers, LLC
* and Your File System, Inc.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _AFS_PROVIDER_H
#define _AFS_PROVIDER_H
//
// Network provider interface header
//
//
// Redirector device name
//
#define AFS_RDR_DEVICE_NAME L"\\Device\\AFSRedirector"
//
// Provider specific IOCtl requests
//
#define IOCTL_AFS_ADD_CONNECTION CTL_CODE( FILE_DEVICE_DISK_FILE_SYSTEM, 0x2001, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AFS_CANCEL_CONNECTION CTL_CODE( FILE_DEVICE_DISK_FILE_SYSTEM, 0x2002, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AFS_GET_CONNECTION CTL_CODE( FILE_DEVICE_DISK_FILE_SYSTEM, 0x2003, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AFS_LIST_CONNECTIONS CTL_CODE( FILE_DEVICE_DISK_FILE_SYSTEM, 0x2004, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AFS_GET_CONNECTION_INFORMATION CTL_CODE( FILE_DEVICE_DISK_FILE_SYSTEM, 0x2005, METHOD_BUFFERED, FILE_ANY_ACCESS)
//
// Versions for the following structures
//
#define AFS_NETWORKPROVIDER_INTERFACE_VERSION_1 0x00000001
#pragma pack(push, 1)
typedef struct _AFS_NETWORKPROVIDER_CONNECTION_CB
{
ULONG Version;
ULONG CurrentIndex;
ULONG Type;
ULONG Scope;
ULONG DisplayType;
ULONG Usage;
ULONG CommentOffset; // From the beginning of this structure
ULONG CommentLength;
ULONG RemainingPathOffset; // From the beginning of this structure
ULONG RemainingPathLength;
ULONG RemoteNameLength;
LARGE_INTEGER AuthenticationId;
WCHAR LocalName;
WCHAR RemoteName[ 1];
} AFSNetworkProviderConnectionCB;
typedef struct _AFS_CANCEL_CONNECTION_RESULT_CB
{
ULONG Version;
ULONG Status;
WCHAR LocalName;
} AFSCancelConnectionResultCB;
#pragma pack(pop)
#endif

View File

@ -0,0 +1,237 @@
/*
* Copyright (c) 2008-2011 Kernel Drivers, LLC.
* Copyright (c) 2009-2011 Your File System, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice,
* this list of conditions and the following disclaimer in the
* documentation
* and/or other materials provided with the distribution.
* - Neither the name of Kernel Drivers, LLC nor the names of its
* contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission from Kernel Drivers, LLC
* and Your File System, Inc.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _AFS_REDIR_COMMON_DEFINES_H
#define _AFS_REDIR_COMMON_DEFINES_H
//
// Allocation defines
//
#define AFS_GENERIC_MEMORY_1_TAG '1GFA'
#define AFS_GENERIC_MEMORY_2_TAG '2GFA'
#define AFS_GENERIC_MEMORY_3_TAG '3GFA'
#define AFS_GENERIC_MEMORY_4_TAG '4GFA'
#define AFS_GENERIC_MEMORY_5_TAG '5GFA'
#define AFS_GENERIC_MEMORY_6_TAG '6GFA'
#define AFS_GENERIC_MEMORY_7_TAG '7GFA'
#define AFS_GENERIC_MEMORY_8_TAG '8GFA'
#define AFS_GENERIC_MEMORY_9_TAG '9GFA'
#define AFS_GENERIC_MEMORY_10_TAG 'AGFA'
#define AFS_GENERIC_MEMORY_11_TAG 'BGFA'
#define AFS_GENERIC_MEMORY_12_TAG 'CGFA'
#define AFS_GENERIC_MEMORY_13_TAG 'DGFA'
#define AFS_GENERIC_MEMORY_14_TAG 'EGFA'
#define AFS_GENERIC_MEMORY_15_TAG 'FGFA'
#define AFS_GENERIC_MEMORY_16_TAG 'GGFA'
#define AFS_GENERIC_MEMORY_17_TAG 'HGFA'
#define AFS_GENERIC_MEMORY_18_TAG 'IGFA'
#define AFS_GENERIC_MEMORY_19_TAG 'JGFA'
#define AFS_GENERIC_MEMORY_20_TAG 'KGFA'
#define AFS_GENERIC_MEMORY_21_TAG 'LGFA'
#define AFS_GENERIC_MEMORY_22_TAG 'MGFA'
#define AFS_GENERIC_MEMORY_23_TAG 'NGFA'
#define AFS_GENERIC_MEMORY_24_TAG 'OGFA'
#define AFS_GENERIC_MEMORY_25_TAG 'PGFA'
#define AFS_GENERIC_MEMORY_26_TAG 'QGFA'
#define AFS_GENERIC_MEMORY_27_TAG 'RGFA'
#define AFS_GENERIC_MEMORY_28_TAG 'SGFA'
#define AFS_GENERIC_MEMORY_29_TAG 'TGFA'
#define AFS_FCB_ALLOCATION_TAG 'AFFA'
#define AFS_FCB_NP_ALLOCATION_TAG 'NFFA'
#define AFS_VCB_ALLOCATION_TAG 'CVFA'
#define AFS_VCB_NP_ALLOCATION_TAG 'NVFA'
#define AFS_CCB_ALLOCATION_TAG 'CCFA'
#define AFS_WORKER_CB_TAG 'CWFA'
#define AFS_WORK_ITEM_TAG 'IWFA'
#define AFS_POOL_ENTRY_TAG 'EPFA'
#define AFS_PROCESS_CB_TAG 'CPFA'
#define AFS_DIR_BUFFER_TAG 'BDFA'
#define AFS_DIR_ENTRY_TAG 'EDFA'
#define AFS_NAME_BUFFER_ONE_TAG '1NFA'
#define AFS_NAME_BUFFER_TWO_TAG '2NFA'
#define AFS_NAME_BUFFER_THREE_TAG '3NFA'
#define AFS_NAME_BUFFER_FOUR_TAG '4NFA'
#define AFS_NAME_BUFFER_FIVE_TAG '5NFA'
#define AFS_NAME_BUFFER_SIX_TAG '6NFA'
#define AFS_NAME_BUFFER_SEVEN_TAG '7NFA'
#define AFS_NAME_BUFFER_EIGHT_TAG '8NFA'
#define AFS_NAME_BUFFER_NINE_TAG '9NFA'
#define AFS_NAME_BUFFER_TEN_TAG 'ANFA'
#define AFS_SUBST_BUFFER_TAG 'SBFA'
#define AFS_FILE_CREATE_BUFFER_TAG 'CFFA'
#define AFS_RENAME_REQUEST_TAG 'RFFA'
#define AFS_DIR_ENTRY_NP_TAG 'NDFA'
#define AFS_PROVIDER_CB 'PNFA'
#define AFS_EXTENT_TAG 'xSFA'
#define AFS_EXTENT_REQUEST_TAG 'XSFA'
#define AFS_EXTENT_RELEASE_TAG 'LSFA'
#define AFS_IO_RUN_TAG 'iSFA'
#define AFS_GATHER_TAG 'gSFA'
#define AFS_UPDATE_RESULT_TAG 'RUFA'
#define AFS_EXTENTS_RESULT_TAG 'XEFA'
#define AFS_SYS_NAME_NODE_TAG 'NSFA'
#define AFS_REPARSE_NAME_TAG 'NRFA'
#define AFS_NAME_ARRAY_TAG 'ANFA'
#define AFS_OBJECT_INFO_TAG 'IOFA'
#define AFS_NP_OBJECT_INFO_TAG 'ONFA'
#define AFS_DIR_SNAPSHOT_TAG 'SSFA'
#define AFS_LIBRARY_QUEUE_TAG 'QLFA'
#define AFS_NETWORK_PROVIDER_1_TAG '1ZFA'
#define AFS_NETWORK_PROVIDER_2_TAG '2ZFA'
#define AFS_NETWORK_PROVIDER_3_TAG '3ZFA'
#define AFS_NETWORK_PROVIDER_4_TAG '4ZFA'
#define AFS_NETWORK_PROVIDER_5_TAG '5ZFA'
#define AFS_NETWORK_PROVIDER_6_TAG '6ZFA'
#define AFS_NETWORK_PROVIDER_7_TAG '7ZFA'
#define AFS_NETWORK_PROVIDER_8_TAG '8ZFA'
#define AFS_NETWORK_PROVIDER_9_TAG '9ZFA'
#define AFS_NETWORK_PROVIDER_10_TAG 'AZFA'
#define AFS_NETWORK_PROVIDER_11_TAG 'BZFA'
#define AFS_AG_ENTRY_CB_TAG 'GAFA'
#define AFS_PROCESS_AG_CB_TAG 'APFA'
#define __Enter
#define try_return(S) { S; goto try_exit; }
//
// Object types allocated
//
#define AFS_FILE_FCB 0x0001
#define AFS_DIRECTORY_FCB 0x0002
#define AFS_NON_PAGED_FCB 0x0003
#define AFS_CCB 0x0004
#define AFS_ROOT_FCB 0x0006
#define AFS_VCB 0x0007
#define AFS_NON_PAGED_VCB 0x0008
#define AFS_ROOT_ALL 0x0009
#define AFS_IOCTL_FCB 0x000A
#define AFS_MOUNT_POINT_FCB 0x000B
#define AFS_SYMBOLIC_LINK_FCB 0x000C
#define AFS_SPECIAL_SHARE_FCB 0x000D
#define AFS_DFS_LINK_FCB 0x000E
#define AFS_INVALID_FCB 0x00FF
//
// Debug information
//
#define AFS_DBG_FLAG_BREAK_ON_ENTRY 0x00000001 // Only enabled in checked build
#define AFS_DBG_TRACE_TO_DEBUGGER 0x00000002
#define AFS_DBG_FLAG_ENABLE_FORCE_CRASH 0x00000004 // Only enabled in checked build
#define AFS_DBG_BUGCHECK_EXCEPTION 0x00000008
#define AFS_DBG_CLEAN_SHUTDOWN 0x00000010
#define AFS_DBG_REQUIRE_CLEAN_SHUTDOWN 0x00000020
//
// Pool state
//
#define POOL_UNKNOWN 0
#define POOL_INACTIVE 1
#define POOL_ACTIVE 2
//
// Volume flags
//
#define AFS_VOLUME_FLAGS_OFFLINE 0x00000001
#define AFS_VOLUME_PRIVATE_WOKER_INITIALIZED 0x00000002
#define AFS_VOLUME_INSERTED_HASH_TREE 0x00000004
#define AFS_VOLUME_ACTIVE_GLOBAL_ROOT 0x00000008
//
// Need this to handle the break point definition
//
typedef
void
(*PAFSDumpTraceFiles)( void);
extern PAFSDumpTraceFiles AFSDumpTraceFilesFnc;
//
// Debug information
//
static inline void AFS_ASSERT() {
AFSDumpTraceFilesFnc();
}
#if DBG
//#define AFS_VALIDATE_EXTENTS 0
static inline void AFSBreakPoint() {
AFSDumpTraceFilesFnc();
#if !defined(KD_DEBUGGER_ENABLED)
#define KD_DEBUGGER_ENABLED DBG
#endif // KD_DEBUGGER_ENABLED
#if (NTDDI_VERSION >= NTDDI_WS03)
KdRefreshDebuggerNotPresent();
#endif
#if defined(KD_DEBUGGER_NOT_PRESENT)
if (KD_DEBUGGER_NOT_PRESENT == FALSE)
DbgBreakPoint();
#endif // KD_DEBUGGER_NOT_PRESENT
}
#define AFSPrint DbgPrint
#else
static inline void AFSBreakPoint() {
AFSDumpTraceFilesFnc();
}
#define AFSPrint
#endif
//
// Library control device name
//
#define AFS_LIBRARY_CONTROL_DEVICE_NAME L"\\Device\\AFSLibraryControlDevice"
#define AFS_REDIR_LIBRARY_SERVICE_ENTRY L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\AFSLibrary"
#endif

View File

@ -0,0 +1,813 @@
/*
* Copyright (c) 2008-2011 Kernel Drivers, LLC.
* Copyright (c) 2009-2011 Your File System, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice,
* this list of conditions and the following disclaimer in the
* documentation
* and/or other materials provided with the distribution.
* - Neither the name of Kernel Drivers, LLC nor the names of its
* contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission from Kernel Drivers, LLC
* and Your File System, Inc.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _AFS_REDIR_COMMON_STRUCTS_H
#define _AFS_REDIR_COMMON_STRUCTS_H
//
// BTree Entry
//
typedef struct AFS_BTREE_ENTRY
{
void *parentLink;
void *leftLink;
void *rightLink;
ULONGLONG HashIndex;
} AFSBTreeEntry, *PAFSBTreeEntry;
typedef struct AFS_LIST_ENTRY
{
void *fLink;
void *bLink;
} AFSListEntry;
typedef struct _AFS_TREE_HDR
{
AFSBTreeEntry *TreeHead;
ERESOURCE *TreeLock;
} AFSTreeHdr;
//
// Sys Name Information CB
//
typedef struct _AFS_SYS_NAME_CB
{
struct _AFS_SYS_NAME_CB *fLink;
UNICODE_STRING SysName;
} AFSSysNameCB;
//
// Communication service control structures
//
typedef struct _AFSFSD_SRVC_CONTROL_BLOCK
{
ULONG IrpPoolRequestIndex;
struct _POOL_ENTRY *RequestPoolHead;
struct _POOL_ENTRY *RequestPoolTail;
ERESOURCE IrpPoolLock;
struct _POOL_ENTRY *ResultPoolHead;
struct _POOL_ENTRY *ResultPoolTail;
ERESOURCE ResultPoolLock;
KEVENT IrpPoolHasEntries;
KEVENT IrpPoolHasReleaseEntries;
ULONG IrpPoolControlFlag;
LONG QueueCount;
} AFSCommSrvcCB, *PAFSCommSrvcCB;
//
// Irp Pool entry
//
typedef struct _POOL_ENTRY
{
struct _POOL_ENTRY *fLink;
struct _POOL_ENTRY *bLink;
KEVENT Event;
GUID AuthGroup;
AFSFileID FileId;
UNICODE_STRING FileName;
ULONG RequestType;
ULONG RequestIndex;
ULONG RequestFlags;
ULONG DataLength;
void *Data;
ULONG ResultStatus;
void *ResultBuffer;
ULONG *ResultBufferLength;
} AFSPoolEntry;
//
// The first portion is the non-paged section of the Fcb
//
typedef struct _AFS_NONPAGED_FCB
{
USHORT Size;
USHORT Type;
//
// Ranking - File Resource first, then Paging Resource
//
ERESOURCE Resource;
ERESOURCE PagingResource;
//
// The section object pointer
//
SECTION_OBJECT_POINTERS SectionObjectPointers;
FAST_MUTEX AdvancedHdrMutex;
union
{
struct
{
ERESOURCE ExtentsResource;
//
// This is set when an Extents Request completes. Do not wait for this
// with the Extents resource held!
//
KEVENT ExtentsRequestComplete;
NTSTATUS ExtentsRequestStatus;
struct _AFS_FSD_EXTENT *DirtyListHead;
struct _AFS_FSD_EXTENT *DirtyListTail;
ERESOURCE DirtyExtentsListLock;
KEVENT FlushEvent;
//
// Queued Flush event. This event is set when the queued flush count
// is zero, cleared otherwise.
KEVENT QueuedFlushEvent;
} File;
struct
{
KEVENT DirectoryEnumEvent;
LONG DirectoryEnumCount;
} Directory;
} Specific;
} AFSNonPagedFcb, *PAFSNonPagedFcb;
typedef struct _AFS_FSD_EXTENT
{
//
// Linked list first - the extents and then the skip list
//
LIST_ENTRY Lists[AFS_NUM_EXTENT_LISTS];
AFSListEntry DirtyList;
//
// And the extent itself
//
LARGE_INTEGER FileOffset;
LARGE_INTEGER CacheOffset;
ULONG Size;
ULONG Flags;
LONG ActiveCount;
#if GEN_MD5
UCHAR MD5[16];
#endif
} AFSExtent, *PAFSExtent;
typedef struct AFS_FCB
{
FSRTL_ADVANCED_FCB_HEADER Header;
//
// This is the linked list of nodes processed asynchronously by the respective worker thread
//
AFSListEntry ListEntry;
//
// The NP portion of the Fcb
//
AFSNonPagedFcb *NPFcb;
//
// Fcb flags
//
ULONG Flags;
//
// Share access mapping
//
SHARE_ACCESS ShareAccess;
//
// Open pointer count on this file
//
LONG OpenReferenceCount;
//
// Open handle count on this file
//
LONG OpenHandleCount;
//
// Object info block
//
struct _AFS_OBJECT_INFORMATION_CB *ObjectInformation;
//
// Authentication group GUID
//
GUID AuthGroup;
//
// Union for node type specific information
//
union
{
struct
{
//
// We set this when a flush has been sent to the
// server sucessfully. We use this to influence when we
// write the flush.
//
LARGE_INTEGER LastServerFlush;
//
// We set this when the extent ref count goes to zero.
// we use this to influence which files to purge
//
LARGE_INTEGER LastExtentAccess;
//
// If there has been a RELEASE_FILE_EXTENTS - this is
// where we stopped last time this stops us from
// constantly refreeing the same extents and then grabbing
// them again.
//
LARGE_INTEGER LastPurgePoint;
//
// File lock
//
FILE_LOCK FileLock;
//
// The extents
//
LIST_ENTRY ExtentsLists[AFS_NUM_EXTENT_LISTS];
//
// There is only ever one request active, so we embed it
//
AFSRequestExtentsCB ExtentsRequest;
//
// Last PID that requested extents, NOT the system process
//
ULONGLONG ExtentRequestProcessId;
//
// Dirty extent count
//
LONG ExtentsDirtyCount;
//
// Extent count for this file
//
LONG ExtentCount;
//
// The Lazy writer thread
//
PETHREAD LazyWriterThread;
//
// Current count of queued flush items for the file
//
LONG QueuedFlushCount;
//
// Cache space currently held by extents for the file
//
LONG ExtentLength; // in KBs
} File;
struct
{
ULONG Reserved;
} Directory;
} Specific;
} AFSFcb, *PAFSFcb;
typedef struct _AFS_DEVICE_EXTENSION
{
//
// Self pointer
//
PDEVICE_OBJECT Self;
//
// List of device isntances
//
struct _AFS_DEVICE_EXTENSION *DeviceLink;
//
// Device flags
//
ULONG DeviceFlags;
union
{
struct
{
//
// Volume worker tracking information
//
KEVENT VolumeWorkerCloseEvent;
LONG VolumeWorkerThreadCount;
//
// Fcb lifetime & flush time tickcount. This is calculated
// in DriverEntry() for the control device.
//
LARGE_INTEGER ObjectLifeTimeCount;
LARGE_INTEGER FcbFlushTimeCount;
LARGE_INTEGER FcbPurgeTimeCount;
LARGE_INTEGER ExtentRequestTimeCount;
//
// Comm interface
//
AFSCommSrvcCB CommServiceCB;
//
// Extent Release Interface
//
ERESOURCE ExtentReleaseResource;
KEVENT ExtentReleaseEvent;
ULONG ExtentReleaseSequence;
PKPROCESS ServiceProcess;
//
// SysName information control block
//
ERESOURCE SysName32ListLock;
AFSSysNameCB *SysName32ListHead;
AFSSysNameCB *SysName32ListTail;
ERESOURCE SysName64ListLock;
AFSSysNameCB *SysName64ListHead;
AFSSysNameCB *SysName64ListTail;
//
// Our process tree information
//
AFSTreeHdr ProcessTree;
ERESOURCE ProcessTreeLock;
//
// SID Entry tree
//
AFSTreeHdr AuthGroupTree;
ERESOURCE AuthGroupTreeLock;
//
// Notificaiton information. This is used for change notification
//
LIST_ENTRY DirNotifyList;
PNOTIFY_SYNC NotifySync;
//
// Library load information
//
KEVENT LoadLibraryEvent;
ULONG LibraryState;
ERESOURCE LibraryStateLock;
LONG InflightLibraryRequests;
KEVENT InflightLibraryEvent;
ERESOURCE LibraryQueueLock;
struct _AFS_LIBRARY_QUEUE_REQUEST_CB *LibraryQueueHead;
struct _AFS_LIBRARY_QUEUE_REQUEST_CB *LibraryQueueTail;
UNICODE_STRING LibraryServicePath;
DEVICE_OBJECT *LibraryDeviceObject;
FILE_OBJECT *LibraryFileObject;
//
// Extent processing information within the library
//
LONG ExtentCount;
LONG ExtentsHeldLength;
KEVENT ExtentsHeldEvent;
//
// Outstanding service request information
//
LONG OutstandingServiceRequestCount;
KEVENT OutstandingServiceRequestEvent;
} Control;
struct
{
//
// Cache file information
//
HANDLE CacheFileHandle;
PFILE_OBJECT CacheFileObject;
ULONG CacheBlockSize;
UNICODE_STRING CacheFile;
LARGE_INTEGER CacheBlockCount; // Total number of cache blocks in the cache file
void *CacheBaseAddress;
LARGE_INTEGER CacheLength;
PMDL CacheMdl;
//
// Throttles on behavior
//
LARGE_INTEGER MaxIo;
LARGE_INTEGER MaxDirty;
//
// Maximum RPC length that is issued by the service. We should limit our
// data requests such as for extents to thsi length
//
ULONG MaximumRPCLength;
//
// Volume tree
//
AFSTreeHdr VolumeTree;
ERESOURCE VolumeTreeLock;
struct _AFS_VOLUME_CB *VolumeListHead;
struct _AFS_VOLUME_CB *VolumeListTail;
ERESOURCE VolumeListLock;
//
// Queued extent release count and event
//
LONG QueuedReleaseExtentCount;
KEVENT QueuedReleaseExtentEvent;
//
// Name array related information
//
ULONG NameArrayLength;
ULONG MaxLinkCount;
//
// Our root cell tree
//
AFSTreeHdr RootCellTree;
ERESOURCE RootCellTreeLock;
//
// Cache file object access
//
ERESOURCE CacheFileLock;
//
// NP Connection list information
//
ERESOURCE ProviderListLock;
struct _AFSFSD_PROVIDER_CONNECTION_CB *ProviderConnectionList;
struct _AFSFSD_PROVIDER_CONNECTION_CB *ProviderEnumerationList;
} RDR;
struct
{
//
// Worker pool information
//
ULONG WorkerCount;
struct _AFS_WORKER_QUEUE_HDR *PoolHead;
ERESOURCE QueueLock;
struct _AFS_WORK_ITEM *QueueHead;
struct _AFS_WORK_ITEM *QueueTail;
KEVENT WorkerQueueHasItems;
LONG QueueItemCount;
//
// IO Worker queue
//
ULONG IOWorkerCount;
struct _AFS_WORKER_QUEUE_HDR *IOPoolHead;
ERESOURCE IOQueueLock;
struct _AFS_WORK_ITEM *IOQueueHead;
struct _AFS_WORK_ITEM *IOQueueTail;
KEVENT IOWorkerQueueHasItems;
LONG IOQueueItemCount;
} Library;
} Specific;
} AFSDeviceExt, *PAFSDeviceExt;
//
// Network provider connection cb
//
#pragma pack(push, 1)
typedef struct _AFSFSD_PROVIDER_CONNECTION_CB
{
struct _AFSFSD_PROVIDER_CONNECTION_CB *fLink;
struct _AFSFSD_PROVIDER_CONNECTION_CB *EnumerationList;
ULONG Flags;
ULONG Type;
ULONG Scope;
ULONG DisplayType;
ULONG Usage;
LARGE_INTEGER AuthenticationId;
WCHAR LocalName;
UNICODE_STRING RemoteName;
UNICODE_STRING ComponentName;
UNICODE_STRING Comment;
} AFSProviderConnectionCB;
#pragma pack(pop)
//
// Callbacks defined in the framework
//
typedef
NTSTATUS
(*PAFSProcessRequest)( IN ULONG RequestType,
IN ULONG RequestFlags,
IN GUID *AuthGroup,
IN PUNICODE_STRING FileName,
IN AFSFileID *FileId,
IN void *Data,
IN ULONG DataLength,
IN OUT void *ResultBuffer,
IN OUT PULONG ResultBufferLength);
typedef
NTSTATUS
(*PAFSDbgLogMsg)( IN ULONG Subsystem,
IN ULONG Level,
IN PCCH Format,
...);
typedef
NTSTATUS
(*PAFSAddConnectionEx)( IN UNICODE_STRING *RemoteName,
IN ULONG DisplayType,
IN ULONG Flags);
typedef
void *
(*PAFSExAllocatePoolWithTag)( IN POOL_TYPE PoolType,
IN SIZE_T NumberOfBytes,
IN ULONG Tag);
typedef
void
(*PAFSExFreePool)( IN void *Pointer);
typedef
void
(*PAFSRetrieveAuthGroup)( IN ULONGLONG ProcessId,
IN ULONGLONG ThreadId,
OUT GUID *AuthGroup);
typedef struct _AFS_LIBRARY_INIT_CB
{
PDEVICE_OBJECT AFSControlDeviceObject;
PDEVICE_OBJECT AFSRDRDeviceObject;
UNICODE_STRING AFSServerName;
ULONG AFSDebugFlags;
AFSFileID GlobalRootFid;
CACHE_MANAGER_CALLBACKS *AFSCacheManagerCallbacks;
void *AFSCacheBaseAddress;
LARGE_INTEGER AFSCacheLength;
//
// Callbacks in the framework
//
PAFSProcessRequest AFSProcessRequest;
PAFSDbgLogMsg AFSDbgLogMsg;
PAFSAddConnectionEx AFSAddConnectionEx;
PAFSExAllocatePoolWithTag AFSExAllocatePoolWithTag;
PAFSExFreePool AFSExFreePool;
PAFSDumpTraceFiles AFSDumpTraceFiles;
PAFSRetrieveAuthGroup AFSRetrieveAuthGroup;
} AFSLibraryInitCB;
#endif

View File

@ -0,0 +1,304 @@
/*
* Copyright (c) 2008-2011 Kernel Drivers, LLC.
* Copyright (c) 2009-2011 Your File System, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice,
* this list of conditions and the following disclaimer in the
* documentation
* and/or other materials provided with the distribution.
* - Neither the name of Kernel Drivers, LLC nor the names of its
* contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission from Kernel Drivers, LLC
* and Your File System, Inc.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _AFS_USER_DEFINE_H
#define _AFS_USER_DEFINE_H
//
// Symbolic link name
//
#define AFS_SYMLINK "\\\\.\\AFSRedirector"
#define AFS_SYMLINK_W L"\\\\.\\AFSRedirector"
#define AFS_PIOCTL_FILE_INTERFACE_NAME L"_._AFS_IOCTL_._"
#define AFS_GLOBAL_ROOT_SHARE_NAME L"ALL"
//
// Payload buffer length
//
#define AFS_PAYLOAD_BUFFER_SIZE (16 * 1024)
//
// Request types
//
#define AFS_REQUEST_TYPE_DIR_ENUM 0x00000001
#define AFS_REQUEST_TYPE_CREATE_FILE 0x00000002
#define AFS_REQUEST_TYPE_REQUEST_FILE_EXTENTS 0x00000003
#define AFS_REQUEST_TYPE_RELEASE_FILE_EXTENTS 0x00000004
#define AFS_REQUEST_TYPE_UPDATE_FILE 0x00000005
#define AFS_REQUEST_TYPE_DELETE_FILE 0x00000006
#define AFS_REQUEST_TYPE_RENAME_FILE 0x00000007
#define AFS_REQUEST_TYPE_FLUSH_FILE 0x00000008
#define AFS_REQUEST_TYPE_OPEN_FILE 0x00000009
#define AFS_REQUEST_TYPE_EVAL_TARGET_BY_ID 0x0000000A
#define AFS_REQUEST_TYPE_EVAL_TARGET_BY_NAME 0x0000000B
#define AFS_REQUEST_TYPE_PIOCTL_READ 0x0000000C
#define AFS_REQUEST_TYPE_PIOCTL_WRITE 0x0000000D
#define AFS_REQUEST_TYPE_PIOCTL_OPEN 0x0000000E
#define AFS_REQUEST_TYPE_PIOCTL_CLOSE 0x0000000F
#define AFS_REQUEST_TYPE_BYTE_RANGE_LOCK 0x00000010 // Takes AFSByteRangeLockRequestCB as INPUT
#define AFS_REQUEST_TYPE_BYTE_RANGE_UNLOCK 0x00000011 // Takes AFSByteRangeUnlockRequestCB as INPUT
#define AFS_REQUEST_TYPE_BYTE_RANGE_UNLOCK_ALL 0x00000012 // Takes AFSByteRangeUnlockRequestCB as INPUT
#define AFS_REQUEST_TYPE_GET_VOLUME_INFO 0x00000013
#define AFS_REQUEST_TYPE_HOLD_FID 0x00000014
#define AFS_REQUEST_TYPE_RELEASE_FID 0x00000015
#define AFS_REQUEST_TYPE_PIPE_TRANSCEIVE 0x00000016
#define AFS_REQUEST_TYPE_PIPE_READ 0x00000017
#define AFS_REQUEST_TYPE_PIPE_WRITE 0x00000018
#define AFS_REQUEST_TYPE_PIPE_OPEN 0x00000019
#define AFS_REQUEST_TYPE_PIPE_CLOSE 0x0000001A
#define AFS_REQUEST_TYPE_PIPE_QUERY_INFO 0x0000001B
#define AFS_REQUEST_TYPE_PIPE_SET_INFO 0x0000001C
#define AFS_REQUEST_TYPE_CLEANUP_PROCESSING 0x0000001D
#define AFS_REQUEST_TYPE_CREATE_LINK 0x0000001E
#define AFS_REQUEST_TYPE_CREATE_MOUNTPOINT 0x0000001F
#define AFS_REQUEST_TYPE_CREATE_SYMLINK 0x00000020
//
// Request Flags, these are passed up from the file system
//
#define AFS_REQUEST_FLAG_SYNCHRONOUS 0x00000001 // The service must call back through the
// IOCTL_AFS_PROCESS_IRP_RESULT IOCtl to ack
// the request with a response. The absense of
// this flag indicates no call should be made to
// the IOCTL_AFS_PROCESS_IRP_RESULT IOCtl and if a
// response is required for the call it is to be made
// through an IOCtl call
#define AFS_REQUEST_FLAG_CASE_SENSITIVE 0x00000002
#define AFS_REQUEST_FLAG_WOW64 0x00000004 // On 64-bit systems, set if the request
// originated from a WOW64 process
#define AFS_REQUEST_FLAG_FAST_REQUEST 0x00000008 // if this flag is set, the cache manager
// responds to the request using a minimum
// of file server interaction
#define AFS_REQUEST_FLAG_HOLD_FID 0x00000010 // if this flag is set, the cache manager
// maintains a reference count on the
// evaluated file object just as if
// AFS_REQUEST_TYPE_HOLD_FID was issued.
// The reference count must be released
// using AFS_REQUEST_TYPE_RELEASE_FID.
// This flag is only valid on
// AFS_REQUEST_TYPE_EVALUATE_BY_NAME,
// AFS_REQUEST_TYPE_EVALUATE_BY_ID,
// AFS_REQUEST_TYPE_CREATE_FILE, and
// AFS_REQUEST_TYPE_OPEN_FILE.
#define AFS_REQUEST_FLAG_FLUSH_FILE 0x00000020 // Passed as a flag to the AFS_REQUEST_TYPE_CLEANUP_PROCESSING
// request when the last handle is closed. This flag tells the
// to flush all dirty data before returning.
#define AFS_REQUEST_FLAG_FILE_DELETED 0x00000040 // Passed as a flag to the AFS_REQUEST_TYPE_CLEANUP_PROCESSING
// request to indicate the file has been marked for deletion.
#define AFS_REQUEST_FLAG_BYTE_RANGE_UNLOCK_ALL 0x00000080 // Passed as a flag to the AFS_REQUEST_TYPE_CLEANUP_PROCESSING
// request to indicate to release all BR locks on the file for the
// given process.
#define AFS_REQUEST_FLAG_CHECK_ONLY 0x00000100 // Do not perform the action, just check if the action is possible
// Only used with AFS_REQUEST_TYPE_DELETE_FILE.
#define AFS_REQUEST_LOCAL_SYSTEM_PAG 0x00000200 // Indicates that the caller is or was at some point a system
// process
//
// Request Flags, these are passed down from the sevice
//
#define AFS_REQUEST_RELEASE_THREAD 0x00000001 // Set on threads which are dedicated extent release threads
//
// Status codes that can returned for various requests
//
#if !defined(AFS_KERNEL_MODE) && !defined(STATUS_SUCCESS)
#define STATUS_SUCCESS 0x00000000
#define STATUS_MORE_ENTRIES 0x00000105
#define STATUS_NO_MORE_FILES 0x80000006
#endif
//
// Trace Levels
//
#define AFS_TRACE_LEVEL_ERROR 0x00000001
#define AFS_TRACE_LEVEL_WARNING 0x00000002
#define AFS_TRACE_LEVEL_VERBOSE 0x00000003
#define AFS_TRACE_LEVEL_VERBOSE_2 0x00000004
#define AFS_TRACE_LEVEL_MAXIMUM 0x00000004
//
// Trace Subsystem Classes
//
#define AFS_SUBSYSTEM_IO_PROCESSING 0x00000001 // Includes IO subsystem
#define AFS_SUBSYSTEM_FILE_PROCESSING 0x00000002 // Includes Fcb and name processing
#define AFS_SUBSYSTEM_LOCK_PROCESSING 0x00000004 // All lock processing, level must be set to VERBOSE
#define AFS_SUBSYSTEM_EXTENT_PROCESSING 0x00000008 // Specific extent processing
#define AFS_SUBSYSTEM_WORKER_PROCESSING 0x00000010 // All worker processing
#define AFS_SUBSYSTEM_DIRENTRY_REF_COUNTING 0x00000020 // Reference counting directory entries
#define AFS_SUBSYSTEM_OBJECT_REF_COUNTING 0x00000040 // Reference counting objects
#define AFS_SUBSYSTEM_VOLUME_REF_COUNTING 0x00000080 // Reference counting volumes
#define AFS_SUBSYSTEM_FCB_REF_COUNTING 0x00000100 // Reference counting fcbs
#define AFS_SUBSYSTEM_CLEANUP_PROCESSING 0x00000200 // Garbage collection of objects, dir entries, fcbs, etc.
#define AFS_SUBSYSTEM_PIPE_PROCESSING 0x00000400 // Pipe and share processing
#define AFS_SUBSYSTEM_DIR_NOTIF_PROCESSING 0x00000800 // Directory notification interface
#define AFS_SUBSYSTEM_NETWORK_PROVIDER 0x00001000 // Network provier interactions
#define AFS_SUBSYSTEM_DIR_NODE_COUNT 0x00002000 // Dir node count processing
#define AFS_SUBSYSTEM_PIOCTL_PROCESSING 0x00004000 // PIOCtl processing
#define AFS_SUBSYSTEM_AUTHGROUP_PROCESSING 0x00008000 // Auth group creation/assignment
#define AFS_SUBSYSTEM_LOAD_LIBRARY 0x00010000 // Library load and unload, request queuing
#define AFS_SUBSYSTEM_PROCESS_PROCESSING 0x00010000 // Process creation and destruction
#define AFS_SUBSYSTEM_EXTENT_ACTIVE_COUNTING 0x00020000 // Extent Active Counts
#define AFS_SUBSYSTEM_INIT_PROCESSING 0x00040000 // Redirector Initialization
//
// Invalidation Reasons
//
#define AFS_INVALIDATE_EXPIRED 1 /* Set RE_VALIDATE */
#define AFS_INVALIDATE_FLUSHED 2 /* Set RE-VALIDATE */
#define AFS_INVALIDATE_CALLBACK 3 /* Set VERIFY Reset dir enumeration */
#define AFS_INVALIDATE_SMB 4 /* Set VERIFY Reset dir enumeration */
#define AFS_INVALIDATE_CREDS 5 /* Set VERIFY - User credentials changed */
#define AFS_INVALIDATE_DATA_VERSION 6 /* Set VERIFY */
#define AFS_INVALIDATE_DELETED 7 /* Requires top level locks */
//
// Flags which can be specified for each extent in the AFSFileExtentCB structure
//
#define AFS_EXTENT_FLAG_DIRTY 1 // The specified extent requires flushing, this can be
// specified by the file system during a release of the
// extent
#define AFS_EXTENT_FLAG_RELEASE 2 // The presence of this flag during a AFS_REQUEST_TYPE_RELEASE_FILE_EXTENTS
// call from the file system indicates to the service that the file system
// no longer requires the extents and they can be completely released. The
// absense of this flag tells the service that the extent should not be
// dereferenced; this is usually the case when the file system tells the
// service to flush a range of exents but do not release them
#define AFS_EXTENT_FLAG_CLEAN 4 // The presence of this flag during a AFS_REQUEST_TYPE_REQUEST_FILE_EXTENTS
// call from the file system indicates to the server that the file system
// is going to completely overwrite the contents of the extent and the
// service should therefore not bother to obtain the current version
// from the file server.
#define AFS_EXTENT_FLAG_FLUSH 8 // The presence of this flag indicates that the service should perform
// the equivalent of a FLUSH ioctl on the file after processing the
// extents.
#define AFS_EXTENT_FLAG_IN_USE 0x10 // The extent is currenty in use by the fs and cannot be released
#define AFS_EXTENT_FLAG_UNKNOWN 0x20 // The extent is unknown to the fs
#define AFS_EXTENT_FLAG_MD5_SET 0x40 // The extent MD5 field has been set
//
// Volume Information Characteristics
//
#ifndef AFS_KERNEL_MODE
#define FILE_REMOVABLE_MEDIA 0x00000001
#define FILE_READ_ONLY_DEVICE 0x00000002
#define FILE_REMOTE_DEVICE 0x00000010
//
// File attributes
//
#define FILE_ATTRIBUTE_READONLY 0x00000001 // winnt
#define FILE_ATTRIBUTE_HIDDEN 0x00000002 // winnt
#define FILE_ATTRIBUTE_SYSTEM 0x00000004 // winnt
#define FILE_ATTRIBUTE_DIRECTORY 0x00000010 // winnt
#define FILE_ATTRIBUTE_ARCHIVE 0x00000020 // winnt
#define FILE_ATTRIBUTE_DEVICE 0x00000040 // winnt
#define FILE_ATTRIBUTE_NORMAL 0x00000080 // winnt
//
// Filesystem attributes
//
#define FILE_CASE_PRESERVED_NAMES 0x00000002 // winnt
#define FILE_UNICODE_ON_DISK 0x00000004 // winnt
#define FILE_PERSISTENT_ACLS 0x00000008 // winnt
#define FILE_VOLUME_QUOTAS 0x00000020 // winnt
#define FILE_SUPPORTS_REPARSE_POINTS 0x00000080 // winnt
#define FILE_SUPPORTS_OBJECT_IDS 0x00010000 // winnt
#endif
//
// AFS File Types
//
#define AFS_FILE_TYPE_UNKNOWN 0 /* an unknown object */
#define AFS_FILE_TYPE_FILE 1 /* a file */
#define AFS_FILE_TYPE_DIRECTORY 2 /* a dir */
#define AFS_FILE_TYPE_SYMLINK 3 /* a symbolic link */
#define AFS_FILE_TYPE_MOUNTPOINT 4 /* a mount point */
#define AFS_FILE_TYPE_DFSLINK 5 /* a Microsoft Dfs link */
#define AFS_FILE_TYPE_INVALID 99 /* an invalid link */
//
// AFS File types specific to Windows
//
#define AFS_FILE_TYPE_SPECIAL_SHARE_NAME -1
#define AFS_FILE_TYPE_PIOCTL -2
#define AFS_FILE_TYPE_PIPE -3
//
// AFS SysName Constants
//
#define AFS_MAX_SYSNAME_LENGTH 128
#define AFS_SYSNAME_ARCH_32BIT 0
#define AFS_SYSNAME_ARCH_64BIT 1
#endif /* _AFS_USER_DEFINE_H */

View File

@ -0,0 +1,95 @@
/*
* Copyright (c) 2008-2011 Kernel Drivers, LLC.
* Copyright (c) 2009-2011 Your File System, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice,
* this list of conditions and the following disclaimer in the
* documentation
* and/or other materials provided with the distribution.
* - Neither the name of Kernel Drivers, LLC nor the names of its
* contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission from Kernel Drivers, LLC
* and Your File System, Inc.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _AFS_USER_IOCTL_H
#define _AFS_USER_IOCTL_H
//
// IOCtl definitions
//
#define IOCTL_AFS_INITIALIZE_CONTROL_DEVICE CTL_CODE( FILE_DEVICE_DISK_FILE_SYSTEM, 0x1001, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AFS_INITIALIZE_REDIRECTOR_DEVICE CTL_CODE( FILE_DEVICE_DISK_FILE_SYSTEM, 0x1002, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AFS_PROCESS_IRP_REQUEST CTL_CODE( FILE_DEVICE_DISK_FILE_SYSTEM, 0x1003, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AFS_PROCESS_IRP_RESULT CTL_CODE( FILE_DEVICE_DISK_FILE_SYSTEM, 0x1004, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AFS_SET_FILE_EXTENTS CTL_CODE( FILE_DEVICE_DISK_FILE_SYSTEM, 0x1005, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AFS_RELEASE_FILE_EXTENTS CTL_CODE( FILE_DEVICE_DISK_FILE_SYSTEM, 0x1006, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AFS_INVALIDATE_CACHE CTL_CODE( FILE_DEVICE_DISK_FILE_SYSTEM, 0x1007, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AFS_SET_FILE_EXTENT_FAILURE CTL_CODE( FILE_DEVICE_DISK_FILE_SYSTEM, 0x1008, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AFS_NETWORK_STATUS CTL_CODE( FILE_DEVICE_DISK_FILE_SYSTEM, 0x1009, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AFS_VOLUME_STATUS CTL_CODE( FILE_DEVICE_DISK_FILE_SYSTEM, 0x100A, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AFS_SHUTDOWN CTL_CODE( FILE_DEVICE_DISK_FILE_SYSTEM, 0x100B, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AFS_SYSNAME_NOTIFICATION CTL_CODE( FILE_DEVICE_DISK_FILE_SYSTEM, 0x100C, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AFS_STATUS_REQUEST CTL_CODE( FILE_DEVICE_DISK_FILE_SYSTEM, 0x100D, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AFS_SET_BYTE_RANGE_LOCKS CTL_CODE( FILE_DEVICE_DISK_FILE_SYSTEM, 0x100E, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AFS_CONFIGURE_DEBUG_TRACE CTL_CODE( FILE_DEVICE_DISK_FILE_SYSTEM, 0x100F, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AFS_GET_TRACE_BUFFER CTL_CODE( FILE_DEVICE_DISK_FILE_SYSTEM, 0x1010, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AFS_FORCE_CRASH CTL_CODE( FILE_DEVICE_DISK_FILE_SYSTEM, 0x1011, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AFS_INITIALIZE_LIBRARY_DEVICE CTL_CODE( FILE_DEVICE_DISK_FILE_SYSTEM, 0x1012, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AFS_GET_OBJECT_INFORMATION CTL_CODE( FILE_DEVICE_DISK_FILE_SYSTEM, 0x1013, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AFS_AUTHGROUP_CREATE_AND_SET CTL_CODE( FILE_DEVICE_DISK_FILE_SYSTEM, 0x1014, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AFS_AUTHGROUP_QUERY CTL_CODE( FILE_DEVICE_DISK_FILE_SYSTEM, 0x1015, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AFS_AUTHGROUP_SET CTL_CODE( FILE_DEVICE_DISK_FILE_SYSTEM, 0x1016, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AFS_AUTHGROUP_RESET CTL_CODE( FILE_DEVICE_DISK_FILE_SYSTEM, 0x1017, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AFS_AUTHGROUP_SID_CREATE CTL_CODE( FILE_DEVICE_DISK_FILE_SYSTEM, 0x1018, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AFS_AUTHGROUP_SID_QUERY CTL_CODE( FILE_DEVICE_DISK_FILE_SYSTEM, 0x1019, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_AFS_AUTHGROUP_LOGON_CREATE CTL_CODE( FILE_DEVICE_DISK_FILE_SYSTEM, 0x101A, METHOD_BUFFERED, FILE_ANY_ACCESS)
#endif /* _AFS_USER_IOCTL_H */

View File

@ -0,0 +1,64 @@
/*
* Copyright (c) 2008-2011 Kernel Drivers, LLC.
* Copyright (c) 2009-2011 Your File System, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice,
* this list of conditions and the following disclaimer in the
* documentation
* and/or other materials provided with the distribution.
* - Neither the name of Kernel Drivers, LLC nor the names of its
* contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission from Kernel Drivers, LLC
* and Your File System, Inc.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
extern DWORD RDR_RequestExtentRelease(cm_fid_t *fidp, LARGE_INTEGER numOfHeldExtents,
DWORD numOfExtents, AFSFileExtentCB *extentList);
extern DWORD RDR_Initialize( void);
extern DWORD RDR_ShutdownNotify( void);
extern DWORD RDR_ShutdownFinal( void);
extern DWORD RDR_NetworkStatus( IN BOOLEAN status);
extern DWORD RDR_VolumeStatus( IN ULONG cellID, IN ULONG volID, IN BOOLEAN online);
extern DWORD RDR_NetworkAddrChange(void);
extern DWORD RDR_InvalidateVolume( IN ULONG cellID, IN ULONG volID, IN ULONG reason);
extern DWORD RDR_SetFileStatus( IN cm_fid_t *pFileId, IN DWORD dwStatus);
extern DWORD
RDR_InvalidateObject( IN ULONG cellID, IN ULONG volID, IN ULONG vnode,
IN ULONG uniq, IN ULONG hash, IN ULONG filetype, IN ULONG reason);
extern DWORD
RDR_SysName(ULONG Architecture, ULONG Count, WCHAR **NameList);
extern afs_int32
RDR_BkgFetch(cm_scache_t *scp, afs_uint32 p1, afs_uint32 p2, afs_uint32 p3, afs_uint32 p4,
cm_user_t *userp, cm_req_t *reqp);

File diff suppressed because it is too large Load Diff