ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

ext2fsd.h
Go to the documentation of this file.
00001 /*************************************************************************
00002 *
00003 * File: ext2fsd.h
00004 *
00005 * Module: Ext2 File System Driver (Kernel mode execution only)
00006 *
00007 * Description:
00008 *   The main include file for the Ext2 file system driver.
00009 *
00010 * Author: Manoj Paul Joseph
00011 *
00012 *
00013 *************************************************************************/
00014 
00015 
00016 #ifndef _EXT2_FSD_H_
00017 #define _EXT2_FSD_H_
00018 
00019 #define EXT2_POOL_WITH_TAG
00020 
00021 
00022 // some constant definitions
00023 #define EXT2_PANIC_IDENTIFIER       (0x86427531)
00024 
00025 // any directory information EXT2 obtains from the local file system
00026 //  will use a buffer of the following size ... (in KB)
00027 #define EXT2_READ_DIR_BUFFER_LENGTH (512)
00028 #define EXT2_MAXCLOSABLE_FCBS_UL    20
00029 #define EXT2_MAXCLOSABLE_FCBS_LL    10
00030 
00031 //  Some type definitions...
00032 //  These are used later...
00033 
00034 typedef unsigned int    UINT;
00035 typedef unsigned char   BYTE;
00036 
00037 // Common include files - should be in the include dir of the MS supplied IFS Kit
00038 #include    <ntifs.h>
00039 #include <ntdddisk.h>
00040 
00041 
00042 /* REACTOS FIXME */
00043 #undef DeleteFile
00044 /* This is deprecated and should be changed in the EXT2FS driver. */
00045 
00046 /* FIXME : Those two definitions already exist in wdm.h
00047 #define RtlLargeIntegerLessThan(a, b) (a).QuadPart < (b).QuadPart
00048 #define RtlLargeIntegerGreaterThan(a, b) (a).QuadPart > (b).QuadPart
00049 */
00050 
00051 
00052 // the following include files should be in the inc sub-dir associated with this driver
00053 #include    "ext2metadata.h"
00054 #include    "struct.h"
00055 #include    "protos.h"
00056 #include    "errmsg.h"
00057 
00058 
00059 // global variables - minimize these
00060 extern Ext2Data             Ext2GlobalData;
00061 
00062 // try-finally simulation
00063 #define try_return(S)   { S; goto try_exit; }
00064 #define try_return1(S)  { S; goto try_exit1; }
00065 #define try_return2(S)  { S; goto try_exit2; }
00066 
00067 // some global (helpful) macros
00068 #define Ext2IsFlagOn(Flags,SingleFlag) ((BOOLEAN)((((Flags) & (SingleFlag)) != 0)))
00069 #define Ext2SetFlag(Flag, Value)    ((Flag) |= (Value))
00070 #define Ext2ClearFlag(Flag, Value)  ((Flag) &= ~(Value))
00071 
00072 #define Ext2QuadAlign(Value)            ((((uint32)(Value)) + 7) & 0xfffffff8)
00073 
00074 // to perform a bug-check (panic), the following macro is used
00075 #define Ext2Panic(arg1, arg2, arg3)                 \
00076     (KeBugCheckEx(EXT2_PANIC_IDENTIFIER, EXT2_BUG_CHECK_ID | __LINE__, (uint32)(arg1), (uint32)(arg2), (uint32)(arg3)))
00077 
00078 // a convenient macro (must be invoked in the context of the thread that acquired the resource)
00079 #define Ext2ReleaseResource(Resource)   \
00080     (ExReleaseResourceForThreadLite((Resource), ExGetCurrentResourceThread()))
00081 
00082 // each file has a unique bug-check identifier associated with it.
00083 //  Here is a list of constant definitions for these identifiers
00084 #define EXT2_FILE_INIT                                  (0x00000001)
00085 #define EXT2_FILE_REGISTRY                              (0x00000002)
00086 #define EXT2_FILE_CREATE                                (0x00000003)
00087 #define EXT2_FILE_CLEANUP                               (0x00000004)
00088 #define EXT2_FILE_CLOSE                                 (0x00000005)
00089 #define EXT2_FILE_READ                                  (0x00000006)
00090 #define EXT2_FILE_WRITE                                 (0x00000007)
00091 #define EXT2_FILE_INFORMATION                           (0x00000008)
00092 #define EXT2_FILE_FLUSH                                 (0x00000009)
00093 #define EXT2_FILE_VOL_INFORMATION                       (0x0000000A)
00094 #define EXT2_FILE_DIR_CONTROL                           (0x0000000B)
00095 #define EXT2_FILE_FILE_CONTROL                          (0x0000000C)
00096 #define EXT2_FILE_DEVICE_CONTROL                        (0x0000000D)
00097 #define EXT2_FILE_SHUTDOWN                              (0x0000000E)
00098 #define EXT2_FILE_LOCK_CONTROL                          (0x0000000F)
00099 #define EXT2_FILE_SECURITY                              (0x00000010)
00100 #define EXT2_FILE_EXT_ATTR                              (0x00000011)
00101 #define EXT2_FILE_MISC                                  (0x00000012)
00102 #define EXT2_FILE_FAST_IO                               (0x00000013)
00103 #define EXT2_FILE_IO                                    (0x00000014)
00104 #define EXT2_FILE_METADATA_IO                           (0x00000015)
00105 
00106 
00107 
00108 #if DBG
00109 #define Ext2BreakPoint()    DbgBreakPoint()
00110 #else
00111 #define Ext2BreakPoint()
00112 #endif
00113 
00114 #define Ext2RaiseStatus(IRPCONTEXT,STATUS)      \
00115 {                                               \
00116     (IRPCONTEXT)->ExceptionStatus = (STATUS);   \
00117     ExRaiseStatus( (STATUS) );                  \
00118 }
00119 
00120 #ifdef EXT2_POOL_WITH_TAG
00121     #define Ext2AllocatePool(PoolType,NumberOfBytes)    \
00122         ExAllocatePoolWithTag( PoolType, NumberOfBytes, '2txE' ) 
00123 #else
00124     #define Ext2AllocatePool(PoolType,NumberOfBytes)    \
00125         ExAllocatePool( PoolType, NumberOfBytes ) 
00126 #endif
00127 
00128 
00129 #if DBG
00130 
00131 //
00132 //  Trace types...
00133 //  Any number of these may be enabled...
00134 //
00135 #define DEBUG_TRACE_IRQL                 (0x00000001)
00136 #define DEBUG_TRACE_IRP_ENTRY            (0x00000002)
00137 #define DEBUG_TRACE_RESOURCE_ACQUIRE     (0x00000004)
00138 #define DEBUG_TRACE_RESOURCE_RELEASE     (0x00000008)
00139 #define DEBUG_TRACE_RESOURCE_RETRY       (0x00000010)
00140 #define DEBUG_TRACE_ASYNC                (0x00000020)
00141 #define DEBUG_TRACE_MOUNT                (0x00000040)
00142 #define DEBUG_TRACE_RESOURCE_STATE       (0x00000080)
00143 #define DEBUG_TRACE_MISC                 (0x00000100)
00144 #define DEBUG_TRACE_FILE_OBJ             (0x00000200)
00145 #define DEBUG_TRACE_FILE_NAME            (0x00000400)
00146 #define DEBUG_TRACE_SPECIAL              (0x00000800)
00147 #define DEBUG_TRACE_ERROR                (0x00001000)
00148 #define DEBUG_TRACE_READ_DETAILS         (0x00002000)
00149 #define DEBUG_TRACE_WRITE_DETAILS        (0x00004000)
00150 #define DEBUG_TRACE_FILEINFO             (0x00008000)
00151 #define DEBUG_TRACE_DIRINFO              (0x00010000)
00152 #define DEBUG_TRACE_REFERENCE            (0x00020000)
00153 #define DEBUG_TRACE_FSCTRL               (0x00040000)
00154 #define DEBUG_TRACE_FREE                 (0x00080000)
00155 #define DEBUG_TRACE_LINENO               (0x00100000)
00156 #define DEBUG_TRACE_TRIPLE               (0x00200000)
00157 
00158 #define DEBUG_TRACE_ALL                  (0xffffffff)
00159 #define DEBUG_TRACE_NONE                      0
00160 //
00161 //  The permitted DebugTrace types...
00162 //
00163 #define PERMITTED_DEBUG_TRACE_TYPES     DEBUG_TRACE_NONE
00164 /*
00165 #define PERMITTED_DEBUG_TRACE_TYPES     DEBUG_TRACE_ERROR | DEBUG_TRACE_IRP_ENTRY |     \
00166                                         DEBUG_TRACE_FILE_NAME | DEBUG_TRACE_SPECIAL |   \
00167                                         DEBUG_TRACE_ASYNC
00168 
00169 */
00170 
00171 
00172 #define DebugTrace( TYPE, X, Y )                                            \
00173 {                                                                           \
00174     if( ( TYPE ) & ( PERMITTED_DEBUG_TRACE_TYPES ) )                        \
00175     {                                                                       \
00176         if( ( DEBUG_TRACE_LINENO ) & ( PERMITTED_DEBUG_TRACE_TYPES ) )      \
00177         {                                                                   \
00178             DbgPrint("(%s:%ld) ", __FILE__, __LINE__ );                     \
00179         }                                                                   \
00180         DbgPrint(X,Y);                                                      \
00181         if( ( DEBUG_TRACE_IRQL ) & ( PERMITTED_DEBUG_TRACE_TYPES ) )        \
00182         {                                                                   \
00183             DbgPrint( ",IRQL = %d ", KeGetCurrentIrql( ) );                 \
00184         }                                                                   \
00185         DbgPrint("\n");                                                     \
00186     }                                                                       \
00187 }
00188 
00189 
00190 #define DebugTraceState( STR, X1, X2, X3)                                                       \
00191 {                                                                                               \
00192     if( ( DEBUG_TRACE_RESOURCE_STATE ) & ( PERMITTED_DEBUG_TRACE_TYPES ) )                      \
00193     {                                                                                           \
00194         DbgPrint("\nState: ");                                                                  \
00195         DbgPrint( STR, X1, X2, X3 );                                                            \
00196         if( ( DEBUG_TRACE_IRQL ) & ( PERMITTED_DEBUG_TRACE_TYPES ) )                            \
00197         {                                                                                       \
00198             DbgPrint( "  IRQL = %d ", KeGetCurrentIrql( ) );                                    \
00199         }                                                                                       \
00200     }                                                                                           \
00201 }
00202 
00203 #define AssertFCB( PtrFCB )                                                     \
00204 {                                                                               \
00205     if( !(PtrFCB) || (PtrFCB)->NodeIdentifier.NodeType != EXT2_NODE_TYPE_FCB )  \
00206     {                                                                           \
00207         Ext2BreakPoint();                                                       \
00208     }                                                                           \
00209 }
00210 
00211 #define AssertVCB( PtrVCB )                                                     \
00212 {                                                                               \
00213     if( !(PtrVCB) || (PtrVCB)->NodeIdentifier.NodeType != EXT2_NODE_TYPE_VCB )  \
00214     {                                                                           \
00215         Ext2BreakPoint();                                                       \
00216     }                                                                           \
00217 }
00218 
00219 #define AssertFCBorVCB( PtrVCBorFCB )                                           \
00220 {                                                                               \
00221     if( !(PtrVCBorFCB) ||                                                       \
00222         ( (PtrVCBorFCB)->NodeIdentifier.NodeType != EXT2_NODE_TYPE_VCB &&       \
00223           (PtrVCBorFCB)->NodeIdentifier.NodeType != EXT2_NODE_TYPE_FCB ) )      \
00224     {                                                                           \
00225         Ext2BreakPoint();                                                       \
00226     }                                                                           \
00227 }
00228 
00229 #else
00230     #define DebugTrace( TYPE, X, Y ) 
00231     #define DebugTraceState( STR, X1, X2, X3 )
00232     #define AssertFCB( PtrFCB )
00233     #define AssertVCB( PtrVCB )
00234     #define AssertFCBorVCB( PtrVCBorFCB )
00235 
00236 #endif
00237 
00238 #endif  // _EXT2_FSD_H_

Generated on Sat May 26 2012 04:26:17 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.