1 /* 2 * COPYRIGHT: See COPYRIGHT.TXT 3 * PROJECT: Ext2 File System Driver for WinNT/2K/XP 4 * FILE: Ext2fs.h 5 * PURPOSE: Header file: ext2 structures 6 * PROGRAMMER: Matt Wu <mattwu@163.com> 7 * HOMEPAGE: http://www.ext2fsd.com 8 * UPDATE HISTORY: 9 */ 10 11 #ifndef _EXT2_HEADER_ 12 #define _EXT2_HEADER_ 13 14 /* INCLUDES *************************************************************/ 15 #include <linux/module.h> 16 #include <ntdddisk.h> 17 #ifdef __REACTOS__ 18 #include <ndk/rtlfuncs.h> 19 #include <pseh/pseh2.h> 20 #endif 21 #include <stdio.h> 22 #include <time.h> 23 #include <string.h> 24 #include <linux/ext2_fs.h> 25 #include <linux/ext3_fs.h> 26 #include <linux/ext3_fs_i.h> 27 #include <linux/ext4.h> 28 29 /* DEBUG ****************************************************************/ 30 #if DBG 31 # define EXT2_DEBUG 1 32 #else 33 # define EXT2_DEBUG 0 34 #endif 35 36 #define EXT_DEBUG_BREAKPOINT FALSE 37 38 #if EXT2_DEBUG && EXT_DEBUG_BREAKPOINT 39 //#if _X86_ 40 //#define DbgBreak() __asm int 3 41 //#else 42 #define DbgBreak() KdBreakPoint() 43 //#endif 44 #else 45 #define DbgBreak() 46 #endif 47 48 /* STRUCTS & CONSTS******************************************************/ 49 50 #define EXT2FSD_VERSION "0.63" 51 52 53 /* WDK DEFINITIONS ******************************************************/ 54 55 56 /* COMPILER SWITCH / OPTIONS ********************************************/ 57 58 // 59 // Ext2Fsd build options 60 // 61 62 // To support driver dynamics unload 63 64 #define EXT2_UNLOAD FALSE 65 66 // To support inode size expansion (fallocate) 67 68 #define EXT2_PRE_ALLOCATION_SUPPORT TRUE 69 70 // 71 // Constants 72 // 73 74 #define EXT2_MAX_NESTED_LINKS (8) 75 #define EXT2_LINKLEN_IN_INODE (60) 76 #define EXT2_BLOCK_TYPES (0x04) 77 78 #define MAXIMUM_RECORD_LENGTH (0x10000) 79 80 #define SECTOR_BITS (Vcb->SectorBits) 81 #define SECTOR_SIZE (Vcb->DiskGeometry.BytesPerSector) 82 #define DEFAULT_SECTOR_SIZE (0x200) 83 84 #define SUPER_BLOCK_OFFSET (0x400) 85 #define SUPER_BLOCK_SIZE (0x400) 86 87 #define READ_AHEAD_GRANULARITY (0x10000) 88 89 #define SUPER_BLOCK (Vcb->SuperBlock) 90 91 #define INODE_SIZE (Vcb->InodeSize) 92 #define BLOCK_SIZE (Vcb->BlockSize) 93 #define BLOCK_BITS (SUPER_BLOCK->s_log_block_size + 10) 94 #define GROUP_DESC_SIZE (Vcb->sbi.s_desc_size) 95 96 #define INODES_COUNT (Vcb->SuperBlock->s_inodes_count) 97 98 #define INODES_PER_GROUP (SUPER_BLOCK->s_inodes_per_group) 99 #define BLOCKS_PER_GROUP (SUPER_BLOCK->s_blocks_per_group) 100 #define TOTAL_BLOCKS (ext3_blocks_count(SUPER_BLOCK)) 101 102 #define EXT2_FIRST_DATA_BLOCK (SUPER_BLOCK->s_first_data_block) 103 104 typedef struct ext3_super_block EXT2_SUPER_BLOCK, *PEXT2_SUPER_BLOCK; 105 typedef struct ext3_inode EXT2_INODE, *PEXT2_INODE; 106 typedef struct ext4_group_desc EXT2_GROUP_DESC, *PEXT2_GROUP_DESC; 107 typedef struct ext3_dir_entry EXT2_DIR_ENTRY, *PEXT2_DIR_ENTRY; 108 typedef struct ext3_dir_entry_2 EXT2_DIR_ENTRY2, *PEXT2_DIR_ENTRY2; 109 110 #define CEILING_ALIGNED(T, A, B) (((A) + (B) - 1) & (~((T)(B) - 1))) 111 #define COCKLOFT_ALIGNED(T, A, B) (((A) + (B)) & (~((T)(B) - 1))) 112 113 /* File System Releated *************************************************/ 114 115 #define DRIVER_NAME "Ext2Fsd" 116 #define DEVICE_NAME L"\\Ext2Fsd" 117 #define CDROM_NAME L"\\Ext2CdFsd" 118 119 // Registry 120 121 #define PARAMETERS_KEY L"\\Parameters" 122 #define VOLUMES_KEY L"\\Volumes" 123 124 #define READING_ONLY L"Readonly" 125 #define WRITING_SUPPORT L"WritingSupport" 126 #define CHECKING_BITMAP L"CheckingBitmap" 127 #define EXT3_FORCEWRITING L"Ext3ForceWriting" 128 #define CODEPAGE_NAME L"CodePage" 129 #define HIDING_PREFIX L"HidingPrefix" 130 #define HIDING_SUFFIX L"HidingSuffix" 131 #define AUTO_MOUNT L"AutoMount" 132 #define MOUNT_POINT L"MountPoint" 133 134 #define DOS_DEVICE_NAME L"\\DosDevices\\Ext2Fsd" 135 136 // To support ext2fsd unload routine 137 #if EXT2_UNLOAD 138 // 139 // Private IOCTL to make the driver ready to unload 140 // 141 #define IOCTL_PREPARE_TO_UNLOAD \ 142 CTL_CODE(FILE_DEVICE_UNKNOWN, 2048, METHOD_NEITHER, FILE_WRITE_ACCESS) 143 144 #endif // EXT2_UNLOAD 145 146 #include "common.h" 147 148 #ifndef _GNU_NTIFS_ 149 typedef IO_STACK_LOCATION EXTENDED_IO_STACK_LOCATION, *PEXTENDED_IO_STACK_LOCATION; 150 #endif 151 152 #define IsFlagOn(a,b) ((BOOLEAN)(FlagOn(a,b) == b)) 153 #ifndef FlagOn 154 #define FlagOn(_F,_SF) ((_F) & (_SF)) 155 #endif 156 157 #ifndef BooleanFlagOn 158 #define BooleanFlagOn(F,SF) ((BOOLEAN)(((F) & (SF)) != 0)) 159 #endif 160 161 #ifndef SetFlag 162 #define SetFlag(_F,_SF) ((_F) |= (_SF)) 163 #endif 164 165 #ifndef ClearFlag 166 #define ClearFlag(_F,_SF) ((_F) &= ~(_SF)) 167 #endif 168 169 #ifndef min 170 #define min(a,b) (((a) < (b)) ? (a) : (b)) 171 #endif 172 173 #ifndef max 174 #define max(a,b) (((a) > (b)) ? (a) : (b)) 175 #endif 176 177 #ifdef _WIN2K_TARGET_ 178 #define InterlockedOr _InterlockedOr 179 LONG 180 _InterlockedAnd ( 181 IN OUT LONG volatile *Target, 182 IN LONG Set 183 ); 184 185 #pragma intrinsic (_InterlockedAnd) 186 #define InterlockedAnd _InterlockedAnd 187 188 LONG 189 _InterlockedXor ( 190 IN OUT LONG volatile *Target, 191 IN LONG Set 192 ); 193 194 #pragma intrinsic (_InterlockedXor) 195 #define InterlockedXor _InterlockedXor 196 197 #endif /* only for win2k */ 198 199 #if EXT2_DEBUG 200 201 #define SetLongFlag(_F,_SF) Ext2SetFlag((PULONG)&(_F), (ULONG)(_SF)) 202 #define ClearLongFlag(_F,_SF) Ext2ClearFlag((PULONG)&(_F), (ULONG)(_SF)) 203 204 #ifdef __REACTOS__ 205 static 206 #endif 207 __inline 208 VOID 209 Ext2SetFlag(PULONG Flags, ULONG FlagBit) 210 { 211 ULONG _ret = InterlockedOr(Flags, FlagBit); 212 ASSERT(*Flags == (_ret | FlagBit)); 213 } 214 215 #ifdef __REACTOS__ 216 static 217 #endif 218 __inline 219 VOID 220 Ext2ClearFlag(PULONG Flags, ULONG FlagBit) 221 { 222 ULONG _ret = InterlockedAnd(Flags, ~FlagBit); 223 ASSERT(*Flags == (_ret & (~FlagBit))); 224 } 225 226 #else 227 228 #define SetLongFlag(_F,_SF) InterlockedOr(&(_F), (ULONG)(_SF)) 229 #define ClearLongFlag(_F,_SF) InterlockedAnd(&(_F), ~((ULONG)(_SF))) 230 231 #endif /* release */ 232 233 #define Ext2RaiseStatus(IRPCONTEXT,STATUS) { \ 234 (IRPCONTEXT)->ExceptionCode = (STATUS); \ 235 ExRaiseStatus((STATUS)); \ 236 } 237 238 #define Ext2NormalizeAndRaiseStatus(IRPCONTEXT,STATUS) { \ 239 (IRPCONTEXT)->ExceptionCode = STATUS; \ 240 if ((STATUS) == STATUS_VERIFY_REQUIRED) { ExRaiseStatus((STATUS)); } \ 241 ExRaiseStatus(FsRtlNormalizeNtstatus((STATUS),STATUS_UNEXPECTED_IO_ERROR)); \ 242 } 243 244 // 245 // Define IsWritingToEof for write (append) operations 246 // 247 248 #define FILE_WRITE_TO_END_OF_FILE 0xffffffff 249 250 #define IsWritingToEof(Pos) (((Pos).LowPart == FILE_WRITE_TO_END_OF_FILE) && \ 251 ((Pos).HighPart == -1 )) 252 253 #define IsDirectory(Fcb) IsMcbDirectory((Fcb)->Mcb) 254 #define IsSpecialFile(Fcb) IsMcbSpecialFile((Fcb)->Mcb) 255 #define IsSymLink(Fcb) IsMcbSymLink((Fcb)->Mcb) 256 #define IsInodeSymLink(I) S_ISLNK((I)->i_mode) 257 #define IsRoot(Fcb) IsMcbRoot((Fcb)->Mcb) 258 259 // 260 // Pool Tags 261 // 262 263 #define TAG_VPB ' bpV' 264 #define VPB_SIZE sizeof(VPB) 265 266 #define EXT2_DATA_MAGIC 'BD2E' 267 #define EXT2_INAME_MAGIC 'NI2E' 268 #define EXT2_FNAME_MAGIC 'NF2E' 269 #define EXT2_VNAME_MAGIC 'NV2E' 270 #define EXT2_DENTRY_MAGIC 'ED2E' 271 #define EXT2_DIRSP_MAGIC 'SD2E' 272 #define EXT2_SB_MAGIC 'BS2E' 273 #define EXT2_GD_MAGIC 'DG2E' 274 #define EXT2_FLIST_MAGIC 'LF2E' 275 #define EXT2_PARAM_MAGIC 'PP2E' 276 #define EXT2_RWC_MAGIC 'WR2E' 277 278 // 279 // Bug Check Codes Definitions 280 // 281 282 #define EXT2_FILE_SYSTEM (FILE_SYSTEM) 283 284 #define EXT2_BUGCHK_BLOCK (0x00010000) 285 #define EXT2_BUGCHK_CLEANUP (0x00020000) 286 #define EXT2_BUGCHK_CLOSE (0x00030000) 287 #define EXT2_BUGCHK_CMCB (0x00040000) 288 #define EXT2_BUGCHK_CREATE (0x00050000) 289 #define EXT2_BUGCHK_DEBUG (0x00060000) 290 #define EXT2_BUGCHK_DEVCTL (0x00070000) 291 #define EXT2_BUGCHK_DIRCTL (0x00080000) 292 #define EXT2_BUGCHK_DISPATCH (0x00090000) 293 #define EXT2_BUGCHK_EXCEPT (0x000A0000) 294 #define EXT2_BUGCHK_EXT2 (0x000B0000) 295 #define EXT2_BUGCHK_FASTIO (0x000C0000) 296 #define EXT2_BUGCHK_FILEINFO (0x000D0000) 297 #define EXT2_BUGCHK_FLUSH (0x000E0000) 298 #define EXT2_BUGCHK_FSCTL (0x000F0000) 299 #define EXT2_BUGCHK_INIT (0x00100000) 300 #define EXT2_BUGCHK_LOCK (0x0011000) 301 #define EXT2_BUGCHK_MEMORY (0x0012000) 302 #define EXT2_BUGCHK_MISC (0x0013000) 303 #define EXT2_BUGCHK_READ (0x00140000) 304 #define EXT2_BUGCHK_SHUTDOWN (0x00150000) 305 #define EXT2_BUGCHK_VOLINFO (0x00160000) 306 #define EXT2_BUGCHK_WRITE (0x00170000) 307 308 #define EXT2_BUGCHK_LAST (0x00170000) 309 310 #define Ext2BugCheck(A,B,C,D) { KeBugCheckEx(EXT2_FILE_SYSTEM, A | __LINE__, B, C, D ); } 311 312 313 /* Ext2 file system definions *******************************************/ 314 315 // 316 // The second extended file system magic number 317 // 318 319 #define EXT2_SUPER_MAGIC 0xEF53 320 321 #define EXT2_MIN_BLOCK 1024 322 #define EXT2_MIN_FRAG 1024 323 #define EXT2_MAX_USER_BLKSIZE 65536 324 // 325 // Inode flags (Linux uses octad number, but why ? strange!!!) 326 // 327 328 #define S_IFMT 0x0F000 /* 017 0000 */ 329 #define S_IFSOCK 0x0C000 /* 014 0000 */ 330 #define S_IFLNK 0x0A000 /* 012 0000 */ 331 #define S_IFREG 0x08000 /* 010 0000 */ 332 #define S_IFBLK 0x06000 /* 006 0000 */ 333 #define S_IFDIR 0x04000 /* 004 0000 */ 334 #define S_IFCHR 0x02000 /* 002 0000 */ 335 #define S_IFIFO 0x01000 /* 001 0000 */ 336 337 #define S_ISUID 0x00800 /* 000 4000 */ 338 #define S_ISGID 0x00400 /* 000 2000 */ 339 #define S_ISVTX 0x00200 /* 000 1000 */ 340 341 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) 342 #define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) 343 #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) 344 #define S_ISFIL(m) (((m) & S_IFMT) == S_IFFIL) 345 #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) 346 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) 347 #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) 348 #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) 349 350 #define S_IPERMISSION_MASK 0x1FF /* */ 351 352 #define S_IRWXU 0x1C0 /* 0 0700 */ 353 #define S_IRWNU 0x180 /* 0 0600 */ 354 #define S_IRUSR 0x100 /* 0 0400 */ 355 #define S_IWUSR 0x080 /* 0 0200 */ 356 #define S_IXUSR 0x040 /* 0 0100 */ 357 358 #define S_IRWXG 0x038 /* 0 0070 */ 359 #define S_IRWNG 0x030 /* 0 0060 */ 360 #define S_IRGRP 0x020 /* 0 0040 */ 361 #define S_IWGRP 0x010 /* 0 0020 */ 362 #define S_IXGRP 0x008 /* 0 0010 */ 363 364 #define S_IRWXO 0x007 /* 0 0007 */ 365 #define S_IRWNO 0x006 /* 0 0006 */ 366 #define S_IROTH 0x004 /* 0 0004 */ 367 #define S_IWOTH 0x002 /* 0 0002 */ 368 #define S_IXOTH 0x001 /* 0 0001 */ 369 370 #define S_IRWXUGO (S_IRWXU|S_IRWXG|S_IRWXO) 371 #define S_IALLUGO (S_ISUID|S_ISGID|S_ISVTX|S_IRWXUGO) 372 #define S_IRUGO (S_IRUSR|S_IRGRP|S_IROTH) 373 #define S_IWUGO (S_IWUSR|S_IWGRP|S_IWOTH) 374 #define S_IXUGO (S_IXUSR|S_IXGRP|S_IXOTH) 375 #define S_IFATTR (S_IRWNU|S_IRWNG|S_IRWNO) 376 377 #define S_ISREADABLE(m) (((m) & S_IPERMISSION_MASK) == (S_IRUSR | S_IRGRP | S_IROTH)) 378 #define S_ISWRITABLE(m) (((m) & S_IPERMISSION_MASK) == (S_IWUSR | S_IWGRP | S_IWOTH)) 379 380 #define Ext2SetReadable(m) do {(m) = (m) | (S_IRUSR | S_IRGRP | S_IROTH);} while(0) 381 #define Ext2SetWritable(m) do {(m) = (m) | (S_IWUSR | S_IWGRP | S_IWOTH);} while(0) 382 383 #define Ext2SetOwnerWritable(m) do {(m) |= S_IWUSR;} while(0) 384 #define Ext2SetOwnerReadOnly(m) do {(m) &= ~S_IWUSR;} while(0) 385 386 #define Ext2IsOwnerWritable(m) (((m) & S_IWUSR) == S_IWUSR) 387 #define Ext2IsOwnerReadable(m) (((m) & S_IRUSR) == S_IRUSR) 388 #define Ext2IsOwnerReadOnly(m) (!(Ext2IsOwnerWritable(m)) && Ext2IsOwnerReadable(m)) 389 390 #define Ext2IsGroupWritable(m) (((m) & S_IWGRP) == S_IWGRP) 391 #define Ext2IsGroupReadable(m) (((m) & S_IRGRP) == S_IRGRP) 392 #define Ext2IsGroupReadOnly(m) (!(Ext2IsGroupWritable(m)) && Ext2IsGroupReadable(m)) 393 394 #define Ext2IsOtherWritable(m) (((m) & S_IWOTH) == S_IWOTH) 395 #define Ext2IsOtherReadable(m) (((m) & S_IROTH) == S_IROTH) 396 #define Ext2IsOtherReadOnly(m) (!(Ext2IsOtherWritable(m)) && Ext2IsOtherReadable(m)) 397 398 #define Ext2SetReadOnly(m) do {(m) &= ~(S_IWUSR | S_IWGRP | S_IWOTH);} while(0) 399 400 401 #define Ext2FileCanRead (0x1) 402 #define Ext2FileCanWrite (0x2) 403 #define Ext2FileCanExecute (0x4) 404 405 406 /* 407 * We need 8-bytes aligned for all the sturctures 408 * It's a must for all ERESOURCE allocations 409 */ 410 411 // 412 // Ext2Fsd Driver Definitions 413 // 414 415 // 416 // EXT2_IDENTIFIER_TYPE 417 // 418 // Identifiers used to mark the structures 419 // 420 421 typedef enum _EXT2_IDENTIFIER_TYPE { 422 #ifdef _MSC_VER 423 EXT2FGD = ':DGF', 424 EXT2VCB = ':BCV', 425 EXT2FCB = ':BCF', 426 EXT2CCB = ':BCC', 427 EXT2ICX = ':XCI', 428 EXT2FSD = ':DSF', 429 EXT2MCB = ':BCM' 430 #else 431 EXT2FGD = 0xE2FD0001, 432 EXT2VCB = 0xE2FD0002, 433 EXT2FCB = 0xE2FD0003, 434 EXT2CCB = 0xE2FD0004, 435 EXT2ICX = 0xE2FD0005, 436 EXT2FSD = 0xE2FD0006, 437 EXT2MCB = 0xE2FD0007 438 #endif 439 } EXT2_IDENTIFIER_TYPE; 440 441 // 442 // EXT2_IDENTIFIER 443 // 444 // Header used to mark the structures 445 // 446 typedef struct _EXT2_IDENTIFIER { 447 EXT2_IDENTIFIER_TYPE Type; 448 ULONG Size; 449 } EXT2_IDENTIFIER, *PEXT2_IDENTIFIER; 450 451 452 #define NodeType(Ptr) (*((EXT2_IDENTIFIER_TYPE *)(Ptr))) 453 454 typedef struct _EXT2_MCB EXT2_MCB, *PEXT2_MCB; 455 456 457 typedef PVOID PBCB; 458 459 // 460 461 // 462 // EXT2_GLOBAL_DATA 463 // 464 // Data that is not specific to a mounted volume 465 // 466 467 typedef struct _EXT2_GLOBAL { 468 469 /* Identifier for this structure */ 470 EXT2_IDENTIFIER Identifier; 471 472 /* Syncronization primitive for this structure */ 473 ERESOURCE Resource; 474 475 /* Global flags for the driver: I put it since 476 FastIoDispatch isn't 8bytes aligned. */ 477 ULONG Flags; 478 479 /* Table of pointers to the fast I/O entry points */ 480 FAST_IO_DISPATCH FastIoDispatch; 481 482 /* Table of pointers to the Cache Manager callbacks */ 483 CACHE_MANAGER_CALLBACKS CacheManagerCallbacks; 484 CACHE_MANAGER_CALLBACKS CacheManagerNoOpCallbacks; 485 486 /* Pointer to the driver object */ 487 PDRIVER_OBJECT DriverObject; 488 489 /* Pointer to the disk device object */ 490 PDEVICE_OBJECT DiskdevObject; 491 492 /* Pointer to the cdrom device object */ 493 PDEVICE_OBJECT CdromdevObject; 494 495 /* List of mounted volumes */ 496 LIST_ENTRY VcbList; 497 498 /* Cleaning thread related: resource cleaner */ 499 struct { 500 KEVENT Engine; 501 KEVENT Wait; 502 } Reaper; 503 504 /* Look Aside table of IRP_CONTEXT, FCB, MCB, CCB */ 505 NPAGED_LOOKASIDE_LIST Ext2IrpContextLookasideList; 506 NPAGED_LOOKASIDE_LIST Ext2FcbLookasideList; 507 NPAGED_LOOKASIDE_LIST Ext2CcbLookasideList; 508 NPAGED_LOOKASIDE_LIST Ext2McbLookasideList; 509 NPAGED_LOOKASIDE_LIST Ext2ExtLookasideList; 510 NPAGED_LOOKASIDE_LIST Ext2DentryLookasideList; 511 USHORT MaxDepth; 512 513 /* User specified global codepage name */ 514 struct { 515 UCHAR AnsiName[CODEPAGE_MAXLEN]; 516 struct nls_table * PageTable; 517 } Codepage; 518 519 /* global hiding patterns */ 520 BOOLEAN bHidingPrefix; 521 CHAR sHidingPrefix[HIDINGPAT_LEN]; 522 BOOLEAN bHidingSuffix; 523 CHAR sHidingSuffix[HIDINGPAT_LEN]; 524 525 /* Registery path */ 526 UNICODE_STRING RegistryPath; 527 528 /* global memory and i/o statistics and memory allocations 529 of various sturctures */ 530 531 EXT2_PERF_STATISTICS_V2 PerfStat; 532 533 } EXT2_GLOBAL, *PEXT2_GLOBAL; 534 535 // 536 // Flags for EXT2_GLOBAL_DATA 537 // 538 539 #define EXT2_UNLOAD_PENDING 0x00000001 540 #define EXT2_SUPPORT_WRITING 0x00000002 541 #define EXT3_FORCE_WRITING 0x00000004 542 #define EXT2_CHECKING_BITMAP 0x00000008 543 #define EXT2_AUTO_MOUNT 0x00000010 544 545 // 546 // Glboal Ext2Fsd Memory Block 547 // 548 549 extern PEXT2_GLOBAL Ext2Global; 550 551 // 552 // memory allocation statistics 553 // 554 555 556 #define INC_MEM_COUNT(_i, _p, _s) do { ASSERT(_p); Ext2TraceMemory(TRUE, (int) (_i), (PVOID)(_p), (LONG)(_s)); } while(0) 557 #define DEC_MEM_COUNT(_i, _p, _s) do { ASSERT(_p); Ext2TraceMemory(FALSE, (int) (_i), (PVOID)(_p), (LONG)(_s)); } while(0) 558 #define INC_IRP_COUNT(IrpContext) Ext2TraceIrpContext(TRUE, (IrpContext)) 559 #define DEC_IRP_COUNT(IrpContext) Ext2TraceIrpContext(FALSE, (IrpContext)) 560 561 // 562 // Driver Extension define 563 // 564 565 #define IsExt2FsDevice(DO) ((DO == Ext2Global->DiskdevObject) || \ 566 (DO == Ext2Global->CdromdevObject) ) 567 568 #ifdef _WIN2K_TARGET_ 569 #define FSRTL_ADVANCED_FCB_HEADER FSRTL_COMMON_FCB_HEADER 570 #endif 571 572 typedef struct _EXT2_FCBVCB { 573 574 // Command header for Vcb and Fcb 575 FSRTL_ADVANCED_FCB_HEADER Header; 576 577 #ifndef _WIN2K_TARGET_ 578 FAST_MUTEX Mutex; 579 #endif 580 581 // Ext2Fsd identifier 582 EXT2_IDENTIFIER Identifier; 583 584 585 // Locking resources 586 ERESOURCE MainResource; 587 ERESOURCE PagingIoResource; 588 589 } EXT2_FCBVCB, *PEXT2_FCBVCB; 590 591 // 592 // EXT2_VCB Volume Control Block 593 // 594 // Data that represents a mounted logical volume 595 // It is allocated as the device extension of the volume device object 596 // 597 typedef struct _EXT2_VCB { 598 599 /* Common header */ 600 EXT2_FCBVCB; 601 602 // Resource for metadata (super block, tables) 603 ERESOURCE MetaLock; 604 605 // Resource for Mcb (Meta data control block) 606 ERESOURCE McbLock; 607 608 // Entry of Mcb Tree (Root Node) 609 PEXT2_MCB McbTree; 610 611 // Mcb list 612 LIST_ENTRY McbList; 613 ULONG NumOfMcb; 614 615 // Link list to Global 616 LIST_ENTRY Next; 617 618 // Section objects 619 SECTION_OBJECT_POINTERS SectionObject; 620 621 // Dirty Mcbs of modifications for volume stream 622 LARGE_MCB Extents; 623 624 // List of FCBs for open files on this volume 625 ULONG FcbCount; 626 LIST_ENTRY FcbList; 627 KSPIN_LOCK FcbLock; 628 629 // Share Access for the file object 630 SHARE_ACCESS ShareAccess; 631 632 // Incremented on IRP_MJ_CREATE, decremented on IRP_MJ_CLOSE 633 // for both files on this volume and open instances of the 634 // volume itself. 635 ULONG ReferenceCount; /* total ref count */ 636 ULONG OpenHandleCount; /* all handles */ 637 638 ULONG OpenVolumeCount; /* volume handle */ 639 640 // Disk change count 641 ULONG ChangeCount; 642 643 // Pointer to the VPB in the target device object 644 PVPB Vpb; 645 PVPB Vpb2; 646 647 // The FileObject of Volume used to lock the volume 648 PFILE_OBJECT LockFile; 649 650 // List of IRPs pending on directory change notify requests 651 LIST_ENTRY NotifyList; 652 653 // Pointer to syncronization primitive for this list 654 PNOTIFY_SYNC NotifySync; 655 656 // This volumes device object 657 PDEVICE_OBJECT DeviceObject; 658 659 // The physical device object (the disk) 660 PDEVICE_OBJECT TargetDeviceObject; 661 662 // The physical device object (the disk) 663 PDEVICE_OBJECT RealDevice; 664 665 // Information about the physical device object 666 DISK_GEOMETRY DiskGeometry; 667 PARTITION_INFORMATION PartitionInformation; 668 669 BOOLEAN IsExt3fs; 670 PEXT2_SUPER_BLOCK SuperBlock; 671 672 /* 673 // Bitmap Block per group 674 PRTL_BITMAP BlockBitMaps; 675 PRTL_BITMAP InodeBitMaps; 676 */ 677 678 // Block / Cluster size 679 ULONG BlockSize; 680 681 // Sector size in bits 682 ULONG SectorBits; 683 684 // Aligned size (Page or Block) 685 ULONGLONG IoUnitSize; 686 687 // Bits of aligned size 688 ULONG IoUnitBits; 689 690 // Inode size 691 ULONG InodeSize; 692 693 // Inode lookaside list 694 NPAGED_LOOKASIDE_LIST InodeLookasideList; 695 696 // Flags for the volume 697 ULONG Flags; 698 699 // Streaming File Object 700 PFILE_OBJECT Volume; 701 702 // User specified codepage name per volume 703 struct { 704 UCHAR AnsiName[CODEPAGE_MAXLEN]; 705 struct nls_table * PageTable; 706 } Codepage; 707 708 /* patterns to hiding files */ 709 BOOLEAN bHidingPrefix; 710 CHAR sHidingPrefix[HIDINGPAT_LEN]; 711 BOOLEAN bHidingSuffix; 712 CHAR sHidingSuffix[HIDINGPAT_LEN]; 713 714 /* User to impersanate */ 715 uid_t uid; 716 gid_t gid; 717 718 /* User to act as */ 719 uid_t euid; 720 gid_t egid; 721 722 /* mountpoint: symlink to DesDevices */ 723 UCHAR DrvLetter; 724 725 struct block_device bd; 726 struct super_block sb; 727 struct ext3_sb_info sbi; 728 729 /* Maximum file size in blocks ... */ 730 ULONG max_blocks_per_layer[EXT2_BLOCK_TYPES]; 731 ULONG max_data_blocks; 732 loff_t max_bitmap_bytes; 733 loff_t max_bytes; 734 } EXT2_VCB, *PEXT2_VCB; 735 736 // 737 // Flags for EXT2_VCB 738 // 739 #define VCB_INITIALIZED 0x00000001 740 #define VCB_VOLUME_LOCKED 0x00000002 741 #define VCB_MOUNTED 0x00000004 742 #define VCB_DISMOUNT_PENDING 0x00000008 743 #define VCB_NEW_VPB 0x00000010 744 #define VCB_BEING_CLOSED 0x00000020 745 #define VCB_USER_IDS 0x00000040 /* uid/gid specified by user */ 746 #define VCB_USER_EIDS 0x00000080 /* euid/egid specified by user */ 747 748 #define VCB_FORCE_WRITING 0x00004000 749 #define VCB_DEVICE_REMOVED 0x00008000 750 #define VCB_JOURNAL_RECOVER 0x00080000 751 #define VCB_ARRIVAL_NOTIFIED 0x00800000 752 #define VCB_READ_ONLY 0x08000000 753 #define VCB_WRITE_PROTECTED 0x10000000 754 #define VCB_FLOPPY_DISK 0x20000000 755 #define VCB_REMOVAL_PREVENTED 0x40000000 756 #define VCB_REMOVABLE_MEDIA 0x80000000 757 758 759 #define IsVcbInited(Vcb) (IsFlagOn((Vcb)->Flags, VCB_INITIALIZED)) 760 #define IsMounted(Vcb) (IsFlagOn((Vcb)->Flags, VCB_MOUNTED)) 761 #define IsDispending(Vcb) (IsFlagOn((Vcb)->Flags, VCB_DISMOUNT_PENDING)) 762 #define IsVcbReadOnly(Vcb) (IsFlagOn((Vcb)->Flags, VCB_READ_ONLY) || \ 763 IsFlagOn((Vcb)->Flags, VCB_WRITE_PROTECTED)) 764 765 766 #define IsExt3ForceWrite() (IsFlagOn(Ext2Global->Flags, EXT3_FORCE_WRITING)) 767 #define IsVcbForceWrite(Vcb) (IsFlagOn((Vcb)->Flags, VCB_FORCE_WRITING)) 768 #define CanIWrite(Vcb) (IsExt3ForceWrite() || (!IsVcbReadOnly(Vcb) && IsVcbForceWrite(Vcb))) 769 #define IsLazyWriter(Fcb) ((Fcb)->LazyWriterThread == PsGetCurrentThread()) 770 // 771 // EXT2_FCB File Control Block 772 // 773 // Data that represents an open file 774 // There is a single instance of the FCB for every open file 775 // 776 typedef struct _EXT2_FCB { 777 778 /* Common header */ 779 EXT2_FCBVCB; 780 781 // List of FCBs for this volume 782 LIST_ENTRY Next; 783 784 SECTION_OBJECT_POINTERS SectionObject; 785 786 // Share Access for the file object 787 SHARE_ACCESS ShareAccess; 788 789 // List of byte-range locks for this file 790 FILE_LOCK FileLockAnchor; 791 792 // oplock information management structure 793 OPLOCK Oplock; 794 795 // Lazy writer thread context 796 PETHREAD LazyWriterThread; 797 798 // Incremented on IRP_MJ_CREATE, decremented on IRP_MJ_CLEANUP 799 ULONG OpenHandleCount; 800 801 // Incremented on IRP_MJ_CREATE, decremented on IRP_MJ_CLOSE 802 ULONG ReferenceCount; 803 804 // Incremented on IRP_MJ_CREATE, decremented on IRP_MJ_CLEANUP 805 // But only for Files with FO_NO_INTERMEDIATE_BUFFERING flag 806 ULONG NonCachedOpenCount; 807 808 // Flags for the FCB 809 ULONG Flags; 810 811 // Pointer to the inode 812 struct inode *Inode; 813 814 // Vcb 815 PEXT2_VCB Vcb; 816 817 // Mcb Node ... 818 PEXT2_MCB Mcb; 819 820 } EXT2_FCB, *PEXT2_FCB; 821 822 // 823 // Flags for EXT2_FCB 824 // 825 826 #define FCB_FROM_POOL 0x00000001 827 #define FCB_PAGE_FILE 0x00000002 828 #define FCB_FILE_MODIFIED 0x00000020 829 #define FCB_STATE_BUSY 0x00000040 830 #define FCB_ALLOC_IN_CREATE 0x00000080 831 #define FCB_ALLOC_IN_WRITE 0x00000100 832 #define FCB_ALLOC_IN_SETINFO 0x00000200 833 834 #define FCB_DELETE_PENDING 0x80000000 835 836 // 837 // Mcb Node 838 // 839 840 struct _EXT2_MCB { 841 842 // Identifier for this structure 843 EXT2_IDENTIFIER Identifier; 844 845 // Flags 846 ULONG Flags; 847 848 // Link List Info 849 PEXT2_MCB Parent; // Parent 850 PEXT2_MCB Next; // Siblings 851 852 union { 853 PEXT2_MCB Child; // Children Mcb nodes 854 PEXT2_MCB Target; // Target Mcb of symlink 855 }; 856 857 // Mcb Node Info 858 859 // -> Fcb 860 PEXT2_FCB Fcb; 861 862 // Short name 863 UNICODE_STRING ShortName; 864 865 // Full name with path 866 UNICODE_STRING FullName; 867 868 // File attribute 869 ULONG FileAttr; 870 871 // reference count 872 ULONG Refercount; 873 874 // Extents zone 875 LARGE_MCB Extents; 876 877 // Metablocks 878 LARGE_MCB MetaExts; 879 880 // Time stamps 881 LARGE_INTEGER CreationTime; 882 LARGE_INTEGER LastWriteTime; 883 LARGE_INTEGER ChangeTime; 884 LARGE_INTEGER LastAccessTime; 885 886 // List Link to Vcb->McbList 887 LIST_ENTRY Link; 888 889 struct inode Inode; 890 struct dentry *de; 891 }; 892 893 // 894 // Flags for MCB 895 // 896 #define MCB_FROM_POOL 0x00000001 897 #define MCB_VCB_LINK 0x00000002 898 #define MCB_ENTRY_TREE 0x00000004 899 #define MCB_FILE_DELETED 0x00000008 900 901 #define MCB_ZONE_INITED 0x20000000 902 #define MCB_TYPE_SPECIAL 0x40000000 /* unresolved symlink + device node */ 903 #define MCB_TYPE_SYMLINK 0x80000000 904 905 #define IsMcbUsed(Mcb) ((Mcb)->Refercount > 0) 906 #define IsMcbSymLink(Mcb) IsFlagOn((Mcb)->Flags, MCB_TYPE_SYMLINK) 907 #define IsZoneInited(Mcb) IsFlagOn((Mcb)->Flags, MCB_ZONE_INITED) 908 #define IsMcbSpecialFile(Mcb) IsFlagOn((Mcb)->Flags, MCB_TYPE_SPECIAL) 909 #define IsMcbRoot(Mcb) ((Mcb)->Inode.i_ino == EXT2_ROOT_INO) 910 #define IsMcbReadonly(Mcb) IsFlagOn((Mcb)->FileAttr, FILE_ATTRIBUTE_READONLY) 911 #define IsMcbDirectory(Mcb) IsFlagOn((Mcb)->FileAttr, FILE_ATTRIBUTE_DIRECTORY) 912 #define IsFileDeleted(Mcb) IsFlagOn((Mcb)->Flags, MCB_FILE_DELETED) 913 914 #define IsLinkInvalid(Mcb) (IsMcbSymLink(Mcb) && IsFileDeleted(Mcb->Target)) 915 916 /* 917 * routines for reference count management 918 */ 919 920 #define Ext2ReferXcb(_C) InterlockedIncrement(_C) 921 #define Ext2DerefXcb(_C) DEC_OBJ_CNT(_C) 922 923 #ifdef __REACTOS__ 924 static 925 #endif 926 __inline ULONG DEC_OBJ_CNT(PULONG _C) { 927 if (*_C > 0) { 928 return InterlockedDecrement(_C); 929 } else { 930 DbgBreak(); 931 } 932 return 0; 933 } 934 935 #if EXT2_DEBUG 936 VOID 937 Ext2TraceMcb(PCHAR fn, USHORT lc, USHORT add, PEXT2_MCB Mcb); 938 #define Ext2ReferMcb(Mcb) Ext2TraceMcb(__FUNCTION__, __LINE__, TRUE, Mcb) 939 #define Ext2DerefMcb(Mcb) Ext2TraceMcb(__FUNCTION__, __LINE__, FALSE, Mcb) 940 #else 941 #define Ext2ReferMcb(Mcb) Ext2ReferXcb(&Mcb->Refercount) 942 #define Ext2DerefMcb(Mcb) Ext2DerefXcb(&Mcb->Refercount) 943 #endif 944 945 // 946 // EXT2_CCB Context Control Block 947 // 948 // Data that represents one instance of an open file 949 // There is one instance of the CCB for every instance of an open file 950 // 951 typedef struct _EXT2_CCB { 952 953 // Identifier for this structure 954 EXT2_IDENTIFIER Identifier; 955 956 // Flags 957 ULONG Flags; 958 959 // Mcb of it's symbol link 960 PEXT2_MCB SymLink; 961 962 // State that may need to be maintained 963 UNICODE_STRING DirectorySearchPattern; 964 965 /* Open handle control block */ 966 struct file filp; 967 968 } EXT2_CCB, *PEXT2_CCB; 969 970 // 971 // Flags for CCB 972 // 973 974 #define CCB_FROM_POOL 0x00000001 975 #define CCB_VOLUME_DASD_PURGE 0x00000002 976 #define CCB_LAST_WRITE_UPDATED 0x00000004 977 #define CCB_OPEN_REPARSE_POINT 0x00000008 978 #define CCB_DELETE_ON_CLOSE 0x00000010 979 980 #define CCB_ALLOW_EXTENDED_DASD_IO 0x80000000 981 982 // 983 // EXT2_IRP_CONTEXT 984 // 985 // Used to pass information about a request between the drivers functions 986 // 987 typedef struct ext2_icb { 988 989 // Identifier for this structure 990 EXT2_IDENTIFIER Identifier; 991 992 // Pointer to the IRP this request describes 993 PIRP Irp; 994 995 // Flags 996 ULONG Flags; 997 998 // The major and minor function code for the request 999 UCHAR MajorFunction; 1000 UCHAR MinorFunction; 1001 1002 // The device object 1003 PDEVICE_OBJECT DeviceObject; 1004 1005 // The real device object 1006 PDEVICE_OBJECT RealDevice; 1007 1008 // The file object 1009 PFILE_OBJECT FileObject; 1010 1011 PEXT2_FCB Fcb; 1012 PEXT2_CCB Ccb; 1013 1014 // If the request is top level 1015 BOOLEAN IsTopLevel; 1016 1017 // Used if the request needs to be queued for later processing 1018 WORK_QUEUE_ITEM WorkQueueItem; 1019 1020 // If an exception is currently in progress 1021 BOOLEAN ExceptionInProgress; 1022 1023 // The exception code when an exception is in progress 1024 NTSTATUS ExceptionCode; 1025 1026 } EXT2_IRP_CONTEXT, *PEXT2_IRP_CONTEXT; 1027 1028 1029 #define IRP_CONTEXT_FLAG_FROM_POOL (0x00000001) 1030 #define IRP_CONTEXT_FLAG_WAIT (0x00000002) 1031 #define IRP_CONTEXT_FLAG_WRITE_THROUGH (0x00000004) 1032 #define IRP_CONTEXT_FLAG_FLOPPY (0x00000008) 1033 #define IRP_CONTEXT_FLAG_DISABLE_POPUPS (0x00000020) 1034 #define IRP_CONTEXT_FLAG_DEFERRED (0x00000040) 1035 #define IRP_CONTEXT_FLAG_VERIFY_READ (0x00000080) 1036 #define IRP_CONTEXT_STACK_IO_CONTEXT (0x00000100) 1037 #define IRP_CONTEXT_FLAG_REQUEUED (0x00000200) 1038 #define IRP_CONTEXT_FLAG_USER_IO (0x00000400) 1039 #define IRP_CONTEXT_FLAG_DELAY_CLOSE (0x00000800) 1040 #define IRP_CONTEXT_FLAG_FILE_BUSY (0x00001000) 1041 1042 1043 #define Ext2CanIWait() (!IrpContext || IsFlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT)) 1044 1045 // 1046 // EXT2_ALLOC_HEADER 1047 // 1048 // In the checked version of the driver this header is put in the beginning of 1049 // every memory allocation 1050 // 1051 typedef struct _EXT2_ALLOC_HEADER { 1052 EXT2_IDENTIFIER Identifier; 1053 } EXT2_ALLOC_HEADER, *PEXT2_ALLOC_HEADER; 1054 1055 typedef struct _FCB_LIST_ENTRY { 1056 PEXT2_FCB Fcb; 1057 LIST_ENTRY Next; 1058 } FCB_LIST_ENTRY, *PFCB_LIST_ENTRY; 1059 1060 1061 // Block Description List 1062 typedef struct _EXT2_EXTENT { 1063 LONGLONG Lba; 1064 ULONG Offset; 1065 ULONG Length; 1066 PIRP Irp; 1067 struct _EXT2_EXTENT * Next; 1068 } EXT2_EXTENT, *PEXT2_EXTENT; 1069 1070 1071 /* FUNCTIONS DECLARATION *****************************************************/ 1072 1073 // Include this so we don't need the latest WDK to build the driver. 1074 #ifndef FSCTL_GET_RETRIEVAL_POINTER_BASE 1075 #define FSCTL_GET_RETRIEVAL_POINTER_BASE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 141, METHOD_BUFFERED, FILE_ANY_ACCESS) // RETRIEVAL_POINTER_BASE 1076 #endif 1077 1078 // 1079 // The following macro is used to determine if an FSD thread can block 1080 // for I/O or wait for a resource. It returns TRUE if the thread can 1081 // block and FALSE otherwise. This attribute can then be used to call 1082 // the FSD & FSP common work routine with the proper wait value. 1083 // 1084 1085 #define CanExt2Wait(IRP) IoIsOperationSynchronous(Irp) 1086 1087 // 1088 // memory allocation statistics 1089 // 1090 1091 #ifdef __REACTOS__ 1092 static 1093 #endif 1094 __inline 1095 VOID 1096 Ext2TraceMemory(BOOLEAN _n, int _i, PVOID _p, LONG _s) 1097 { 1098 if (_n) { 1099 InterlockedIncrement(&Ext2Global->PerfStat.Current.Slot[_i]); 1100 InterlockedIncrement(&Ext2Global->PerfStat.Total.Slot[_i]); 1101 InterlockedExchangeAdd(&Ext2Global->PerfStat.Size.Slot[_i], _s); 1102 } else { 1103 InterlockedDecrement(&Ext2Global->PerfStat.Current.Slot[_i]); 1104 InterlockedExchangeAdd(&Ext2Global->PerfStat.Size.Slot[_i], -1 * _s); 1105 } 1106 } 1107 1108 #ifdef __REACTOS__ 1109 static 1110 #endif 1111 __inline 1112 VOID 1113 Ext2TraceIrpContext(BOOLEAN _n, PEXT2_IRP_CONTEXT IrpContext) 1114 { 1115 if (_n) { 1116 INC_MEM_COUNT(PS_IRP_CONTEXT, IrpContext, sizeof(EXT2_IRP_CONTEXT)); 1117 InterlockedIncrement(&(Ext2Global->PerfStat.Irps[IrpContext->MajorFunction].Current)); 1118 } else { 1119 DEC_MEM_COUNT(PS_IRP_CONTEXT, IrpContext, sizeof(EXT2_IRP_CONTEXT)); 1120 InterlockedIncrement(&Ext2Global->PerfStat.Irps[IrpContext->MajorFunction].Processed); 1121 InterlockedDecrement(&Ext2Global->PerfStat.Irps[IrpContext->MajorFunction].Current); 1122 } 1123 } 1124 1125 typedef struct _EXT2_FILLDIR_CONTEXT { 1126 PEXT2_IRP_CONTEXT efc_irp; 1127 PUCHAR efc_buf; 1128 ULONG efc_size; 1129 ULONG efc_start; 1130 ULONG efc_prev; 1131 NTSTATUS efc_status; 1132 FILE_INFORMATION_CLASS efc_fi; 1133 BOOLEAN efc_single; 1134 } EXT2_FILLDIR_CONTEXT, *PEXT2_FILLDIR_CONTEXT; 1135 1136 // 1137 // Access.c 1138 // 1139 1140 1141 int Ext2CheckInodeAccess(PEXT2_VCB Vcb, struct inode *in, int attempt); 1142 int Ext2CheckFileAccess (PEXT2_VCB Vcb, PEXT2_MCB Mcb, int attempt); 1143 1144 // 1145 // Block.c 1146 // 1147 1148 PMDL 1149 Ext2CreateMdl ( 1150 IN PVOID Buffer, 1151 IN BOOLEAN bPaged, 1152 IN ULONG Length, 1153 IN LOCK_OPERATION Operation 1154 ); 1155 1156 VOID 1157 Ext2DestroyMdl (IN PMDL Mdl); 1158 1159 NTSTATUS 1160 Ext2LockUserBuffer ( 1161 IN PIRP Irp, 1162 IN ULONG Length, 1163 IN LOCK_OPERATION Operation); 1164 PVOID 1165 Ext2GetUserBuffer (IN PIRP Irp); 1166 1167 1168 NTSTATUS 1169 Ext2ReadWriteBlocks( 1170 IN PEXT2_IRP_CONTEXT IrpContext, 1171 IN PEXT2_VCB Vcb, 1172 IN PEXT2_EXTENT Extent, 1173 IN ULONG Length 1174 ); 1175 1176 NTSTATUS 1177 Ext2ReadSync( 1178 IN PEXT2_VCB Vcb, 1179 IN ULONGLONG Offset, 1180 IN ULONG Length, 1181 OUT PVOID Buffer, 1182 IN BOOLEAN bVerify ); 1183 1184 NTSTATUS 1185 Ext2ReadDisk( 1186 IN PEXT2_VCB Vcb, 1187 IN ULONGLONG Offset, 1188 IN ULONG Size, 1189 IN PVOID Buffer, 1190 IN BOOLEAN bVerify ); 1191 1192 NTSTATUS 1193 Ext2DiskIoControl ( 1194 IN PDEVICE_OBJECT DeviceOjbect, 1195 IN ULONG IoctlCode, 1196 IN PVOID InputBuffer, 1197 IN ULONG InputBufferSize, 1198 IN OUT PVOID OutputBuffer, 1199 IN OUT PULONG OutputBufferSize ); 1200 1201 VOID 1202 Ext2MediaEjectControl ( 1203 IN PEXT2_IRP_CONTEXT IrpContext, 1204 IN PEXT2_VCB Vcb, 1205 IN BOOLEAN bPrevent ); 1206 1207 NTSTATUS 1208 Ext2DiskShutDown(PEXT2_VCB Vcb); 1209 1210 1211 // 1212 // Cleanup.c 1213 // 1214 1215 NTSTATUS 1216 Ext2Cleanup (IN PEXT2_IRP_CONTEXT IrpContext); 1217 1218 // 1219 // Close.c 1220 // 1221 1222 NTSTATUS 1223 Ext2Close (IN PEXT2_IRP_CONTEXT IrpContext); 1224 1225 VOID 1226 Ext2QueueCloseRequest (IN PEXT2_IRP_CONTEXT IrpContext); 1227 1228 VOID NTAPI 1229 Ext2DeQueueCloseRequest (IN PVOID Context); 1230 1231 // 1232 // Cmcb.c 1233 // 1234 1235 BOOLEAN NTAPI 1236 Ext2AcquireForLazyWrite ( 1237 IN PVOID Context, 1238 IN BOOLEAN Wait ); 1239 VOID NTAPI 1240 Ext2ReleaseFromLazyWrite (IN PVOID Context); 1241 1242 BOOLEAN NTAPI 1243 Ext2AcquireForReadAhead ( 1244 IN PVOID Context, 1245 IN BOOLEAN Wait ); 1246 1247 VOID NTAPI 1248 Ext2ReleaseFromReadAhead (IN PVOID Context); 1249 1250 BOOLEAN NTAPI 1251 Ext2NoOpAcquire ( 1252 IN PVOID Fcb, 1253 IN BOOLEAN Wait ); 1254 1255 VOID NTAPI 1256 Ext2NoOpRelease (IN PVOID Fcb); 1257 1258 VOID NTAPI 1259 Ext2AcquireForCreateSection ( 1260 IN PFILE_OBJECT FileObject 1261 ); 1262 1263 VOID NTAPI 1264 Ext2ReleaseForCreateSection ( 1265 IN PFILE_OBJECT FileObject 1266 ); 1267 1268 NTSTATUS NTAPI 1269 Ext2AcquireFileForModWrite ( 1270 IN PFILE_OBJECT FileObject, 1271 IN PLARGE_INTEGER EndingOffset, 1272 OUT PERESOURCE *ResourceToRelease, 1273 IN PDEVICE_OBJECT DeviceObject 1274 ); 1275 1276 NTSTATUS NTAPI 1277 Ext2ReleaseFileForModWrite ( 1278 IN PFILE_OBJECT FileObject, 1279 IN PERESOURCE ResourceToRelease, 1280 IN PDEVICE_OBJECT DeviceObject 1281 ); 1282 1283 NTSTATUS NTAPI 1284 Ext2AcquireFileForCcFlush ( 1285 IN PFILE_OBJECT FileObject, 1286 IN PDEVICE_OBJECT DeviceObject 1287 ); 1288 1289 NTSTATUS NTAPI 1290 Ext2ReleaseFileForCcFlush ( 1291 IN PFILE_OBJECT FileObject, 1292 IN PDEVICE_OBJECT DeviceObject 1293 ); 1294 1295 1296 // 1297 // Create.c 1298 // 1299 1300 1301 BOOLEAN 1302 Ext2IsNameValid(PUNICODE_STRING FileName); 1303 1304 NTSTATUS 1305 Ext2FollowLink ( 1306 IN PEXT2_IRP_CONTEXT IrpContext, 1307 IN PEXT2_VCB Vcb, 1308 IN PEXT2_MCB Parent, 1309 IN PEXT2_MCB Mcb, 1310 IN ULONG Linkdep 1311 ); 1312 1313 NTSTATUS 1314 Ext2ScanDir ( 1315 IN PEXT2_IRP_CONTEXT IrpContext, 1316 IN PEXT2_VCB Vcb, 1317 IN PEXT2_MCB Parent, 1318 IN PUNICODE_STRING FileName, 1319 OUT PULONG Inode, 1320 struct dentry **dentry 1321 ); 1322 1323 BOOLEAN 1324 Ext2IsSpecialSystemFile( 1325 IN PUNICODE_STRING FileName, 1326 IN BOOLEAN bDirectory 1327 ); 1328 1329 #define EXT2_LOOKUP_FLAG_MASK (0xFF00000) 1330 #define EXT2_LOOKUP_NOT_FOLLOW (0x8000000) 1331 1332 NTSTATUS 1333 Ext2LookupFile ( 1334 IN PEXT2_IRP_CONTEXT IrpContext, 1335 IN PEXT2_VCB Vcb, 1336 IN PUNICODE_STRING FullName, 1337 IN PEXT2_MCB Parent, 1338 OUT PEXT2_MCB * Ext2Mcb, 1339 IN ULONG Linkdep 1340 ); 1341 1342 NTSTATUS 1343 Ext2CreateFile( 1344 IN PEXT2_IRP_CONTEXT IrpContext, 1345 IN PEXT2_VCB Vcb, 1346 OUT PBOOLEAN OpPostIrp 1347 ); 1348 1349 NTSTATUS 1350 Ext2CreateVolume( 1351 IN PEXT2_IRP_CONTEXT IrpContext, 1352 IN PEXT2_VCB Vcb ); 1353 1354 NTSTATUS 1355 Ext2Create (IN PEXT2_IRP_CONTEXT IrpContext); 1356 1357 NTSTATUS 1358 Ext2CreateInode( 1359 IN PEXT2_IRP_CONTEXT IrpContext, 1360 IN PEXT2_VCB Vcb, 1361 IN PEXT2_FCB pParentFcb, 1362 IN ULONG Type, 1363 IN ULONG FileAttr, 1364 IN PUNICODE_STRING FileName); 1365 1366 1367 NTSTATUS 1368 Ext2SupersedeOrOverWriteFile( 1369 IN PEXT2_IRP_CONTEXT IrpContext, 1370 IN PFILE_OBJECT FileObject, 1371 IN PEXT2_VCB Vcb, 1372 IN PEXT2_FCB Fcb, 1373 IN PLARGE_INTEGER AllocationSize, 1374 IN ULONG Disposition 1375 ); 1376 1377 // 1378 // Debug.c 1379 // 1380 1381 /* debug levels */ 1382 #define DL_NVR 0 1383 #define DL_VIT 0x00000001 1384 #define DL_ERR 0x00000002 1385 #define DL_DBG 0x00000004 1386 #define DL_INF 0x00000008 1387 #define DL_FUN 0x00000010 1388 #define DL_LOW 0x00000020 1389 #define DL_REN 0x00000040 /* renaming operation */ 1390 #define DL_RES 0x00000080 /* entry reference managment */ 1391 #define DL_BLK 0x00000100 /* data block allocation / free */ 1392 #define DL_CP 0x00000200 /* code pages (create, querydir) */ 1393 #define DL_EXT 0x00000400 /* mcb extents */ 1394 #define DL_MAP 0x00000800 /* retrieval points */ 1395 #define DL_JNL 0x00001000 /* dump journal operations */ 1396 #define DL_HTI 0x00002000 /* htree index */ 1397 #define DL_WRN 0x00004000 /* warning */ 1398 #define DL_BH 0x00008000 /* buffer head */ 1399 #define DL_PNP 0x00010000 /* pnp */ 1400 #define DL_IO 0x00020000 /* file i/o */ 1401 1402 #define DL_ALL (DL_ERR|DL_VIT|DL_DBG|DL_INF|DL_FUN|DL_LOW|DL_REN|DL_RES|DL_BLK|DL_CP|DL_EXT|DL_MAP|DL_JNL|DL_HTI|DL_WRN|DL_BH|DL_PNP|DL_IO) 1403 1404 #if EXT2_DEBUG && defined(__REACTOS__) 1405 #define DL_DEFAULT (DL_ERR|DL_VIT|DL_DBG|DL_INF|DL_FUN|DL_LOW|DL_WRN) 1406 #else 1407 #define DL_DEFAULT (DL_ERR|DL_VIT) 1408 #endif 1409 1410 #if EXT2_DEBUG 1411 extern ULONG DebugFilter; 1412 1413 VOID 1414 __cdecl 1415 Ext2NiPrintf( 1416 PCHAR DebugMessage, 1417 ... 1418 ); 1419 1420 #define DEBUG(_DL, arg) do {if ((_DL) & DebugFilter) Ext2Printf arg;} while(0) 1421 #define DEBUGNI(_DL, arg) do {if ((_DL) & DebugFilter) Ext2NiPrintf arg;} while(0) 1422 1423 #define Ext2CompleteRequest(Irp, bPrint, PriorityBoost) \ 1424 Ext2DbgPrintComplete(Irp, bPrint); \ 1425 IoCompleteRequest(Irp, PriorityBoost) 1426 1427 #else 1428 1429 #define DEBUG(_DL, arg) do {if ((_DL) & DL_ERR) DbgPrint arg;} while(0) 1430 1431 #define Ext2CompleteRequest(Irp, bPrint, PriorityBoost) \ 1432 IoCompleteRequest(Irp, PriorityBoost) 1433 1434 #endif // EXT2_DEBUG 1435 1436 VOID 1437 __cdecl 1438 Ext2Printf( 1439 PCHAR DebugMessage, 1440 ... 1441 ); 1442 1443 extern ULONG ProcessNameOffset; 1444 1445 #define Ext2GetCurrentProcessName() ( \ 1446 (PUCHAR) PsGetCurrentProcess() + ProcessNameOffset \ 1447 ) 1448 1449 ULONG 1450 Ext2GetProcessNameOffset (VOID); 1451 1452 VOID 1453 Ext2DbgPrintCall ( 1454 IN PDEVICE_OBJECT DeviceObject, 1455 IN PIRP Irp ); 1456 1457 VOID 1458 Ext2DbgPrintComplete ( 1459 IN PIRP Irp, 1460 IN BOOLEAN bPrint 1461 ); 1462 1463 PUCHAR 1464 Ext2NtStatusToString (IN NTSTATUS Status ); 1465 1466 PVOID Ext2AllocatePool( 1467 IN POOL_TYPE PoolType, 1468 IN SIZE_T NumberOfBytes, 1469 IN ULONG Tag 1470 ); 1471 1472 VOID 1473 Ext2FreePool( 1474 IN PVOID P, 1475 IN ULONG Tag 1476 ); 1477 1478 // 1479 // Devctl.c 1480 // 1481 1482 NTSTATUS 1483 Ext2ProcessGlobalProperty( 1484 IN PDEVICE_OBJECT DeviceObject, 1485 IN PEXT2_VOLUME_PROPERTY2 Property, 1486 IN ULONG Length 1487 ); 1488 1489 NTSTATUS 1490 Ext2ProcessVolumeProperty( 1491 IN PEXT2_VCB Vcb, 1492 IN PEXT2_VOLUME_PROPERTY2 Property, 1493 IN ULONG Length 1494 ); 1495 1496 NTSTATUS 1497 Ext2ProcessUserProperty( 1498 IN PEXT2_IRP_CONTEXT IrpContext, 1499 IN PEXT2_VOLUME_PROPERTY2 Property, 1500 IN ULONG Length 1501 ); 1502 1503 NTSTATUS 1504 Ex2ProcessUserPerfStat( 1505 IN PEXT2_IRP_CONTEXT IrpContext, 1506 IN PEXT2_QUERY_PERFSTAT QueryPerf, 1507 IN ULONG Length 1508 ); 1509 1510 NTSTATUS 1511 Ex2ProcessMountPoint( 1512 IN PEXT2_IRP_CONTEXT IrpContext, 1513 IN PEXT2_MOUNT_POINT MountPoint, 1514 IN ULONG Length 1515 ); 1516 1517 NTSTATUS 1518 Ext2DeviceControlNormal (IN PEXT2_IRP_CONTEXT IrpContext); 1519 1520 NTSTATUS 1521 Ext2PrepareToUnload (IN PEXT2_IRP_CONTEXT IrpContext); 1522 1523 NTSTATUS 1524 Ext2DeviceControl (IN PEXT2_IRP_CONTEXT IrpContext); 1525 1526 // 1527 // Dirctl.c 1528 // 1529 1530 ULONG 1531 Ext2GetInfoLength(IN FILE_INFORMATION_CLASS FileInformationClass); 1532 1533 NTSTATUS 1534 Ext2ProcessEntry( 1535 IN PEXT2_IRP_CONTEXT IrpContext, 1536 IN PEXT2_VCB Vcb, 1537 IN PEXT2_FCB Dcb, 1538 IN FILE_INFORMATION_CLASS FileInformationClass, 1539 IN ULONG in, 1540 IN PVOID Buffer, 1541 IN ULONG UsedLength, 1542 IN ULONG Length, 1543 IN ULONG FileIndex, 1544 IN PUNICODE_STRING pName, 1545 OUT PULONG EntrySize, 1546 IN BOOLEAN Single 1547 ); 1548 1549 BOOLEAN 1550 Ext2IsWearingCloak( 1551 IN PEXT2_VCB Vcb, 1552 IN POEM_STRING OeName 1553 ); 1554 1555 NTSTATUS Ext2QueryDirectory (IN PEXT2_IRP_CONTEXT IrpContext); 1556 1557 NTSTATUS 1558 Ext2NotifyChangeDirectory ( 1559 IN PEXT2_IRP_CONTEXT IrpContext 1560 ); 1561 1562 VOID 1563 Ext2NotifyReportChange ( 1564 IN PEXT2_IRP_CONTEXT IrpContext, 1565 IN PEXT2_VCB Vcb, 1566 IN PEXT2_MCB Mcb, 1567 IN ULONG Filter, 1568 IN ULONG Action 1569 ); 1570 1571 NTSTATUS 1572 Ext2DirectoryControl (IN PEXT2_IRP_CONTEXT IrpContext); 1573 1574 BOOLEAN 1575 Ext2IsDirectoryEmpty ( 1576 IN PEXT2_IRP_CONTEXT IrpContext, 1577 IN PEXT2_VCB Vcb, 1578 IN PEXT2_MCB Mcb 1579 ); 1580 1581 // 1582 // Dispatch.c 1583 // 1584 1585 VOID NTAPI 1586 Ext2OplockComplete ( 1587 IN PVOID Context, 1588 IN PIRP Irp 1589 ); 1590 1591 VOID NTAPI 1592 Ext2LockIrp ( 1593 IN PVOID Context, 1594 IN PIRP Irp 1595 ); 1596 1597 NTSTATUS 1598 Ext2QueueRequest (IN PEXT2_IRP_CONTEXT IrpContext); 1599 1600 VOID NTAPI 1601 Ext2DeQueueRequest (IN PVOID Context); 1602 1603 NTSTATUS 1604 Ext2DispatchRequest (IN PEXT2_IRP_CONTEXT IrpContext); 1605 1606 NTSTATUS NTAPI 1607 Ext2BuildRequest ( 1608 IN PDEVICE_OBJECT DeviceObject, 1609 IN PIRP Irp 1610 ); 1611 1612 // 1613 // Except.c 1614 // 1615 1616 NTSTATUS 1617 Ext2ExceptionFilter ( 1618 IN PEXT2_IRP_CONTEXT IrpContext, 1619 IN PEXCEPTION_POINTERS ExceptionPointer 1620 ); 1621 1622 NTSTATUS 1623 Ext2ExceptionHandler (IN PEXT2_IRP_CONTEXT IrpContext); 1624 1625 1626 // 1627 // Extents.c 1628 // 1629 1630 1631 NTSTATUS 1632 Ext2MapExtent( 1633 IN PEXT2_IRP_CONTEXT IrpContext, 1634 IN PEXT2_VCB Vcb, 1635 IN PEXT2_MCB Mcb, 1636 IN ULONG Index, 1637 IN BOOLEAN Alloc, 1638 OUT PULONG Block, 1639 OUT PULONG Number 1640 ); 1641 1642 NTSTATUS 1643 Ext2ExpandExtent( 1644 PEXT2_IRP_CONTEXT IrpContext, 1645 PEXT2_VCB Vcb, 1646 PEXT2_MCB Mcb, 1647 ULONG Start, 1648 ULONG End, 1649 PLARGE_INTEGER Size 1650 ); 1651 1652 NTSTATUS 1653 Ext2TruncateExtent( 1654 PEXT2_IRP_CONTEXT IrpContext, 1655 PEXT2_VCB Vcb, 1656 PEXT2_MCB Mcb, 1657 PLARGE_INTEGER Size 1658 ); 1659 1660 1661 // 1662 // generic.c 1663 // 1664 1665 static inline ext3_fsblk_t ext3_blocks_count(struct ext3_super_block *es) 1666 { 1667 return ((ext3_fsblk_t)le32_to_cpu(es->s_blocks_count_hi) << 32) | 1668 le32_to_cpu(es->s_blocks_count); 1669 } 1670 1671 static inline ext3_fsblk_t ext3_r_blocks_count(struct ext3_super_block *es) 1672 { 1673 return ((ext3_fsblk_t)le32_to_cpu(es->s_r_blocks_count_hi) << 32) | 1674 le32_to_cpu(es->s_r_blocks_count); 1675 } 1676 1677 static inline ext3_fsblk_t ext3_free_blocks_count(struct ext3_super_block *es) 1678 { 1679 return ((ext3_fsblk_t)le32_to_cpu(es->s_free_blocks_count_hi) << 32) | 1680 le32_to_cpu(es->s_free_blocks_count); 1681 } 1682 1683 static inline void ext3_blocks_count_set(struct ext3_super_block *es, 1684 ext3_fsblk_t blk) 1685 { 1686 es->s_blocks_count = cpu_to_le32((u32)blk); 1687 es->s_blocks_count_hi = cpu_to_le32(blk >> 32); 1688 } 1689 1690 static inline void ext3_free_blocks_count_set(struct ext3_super_block *es, 1691 ext3_fsblk_t blk) 1692 { 1693 es->s_free_blocks_count = cpu_to_le32((u32)blk); 1694 es->s_free_blocks_count_hi = cpu_to_le32(blk >> 32); 1695 } 1696 1697 static inline void ext3_r_blocks_count_set(struct ext3_super_block *es, 1698 ext3_fsblk_t blk) 1699 { 1700 es->s_r_blocks_count = cpu_to_le32((u32)blk); 1701 es->s_r_blocks_count_hi = cpu_to_le32(blk >> 32); 1702 } 1703 1704 blkcnt_t ext3_inode_blocks(struct ext3_inode *raw_inode, 1705 struct inode *inode); 1706 1707 int ext3_inode_blocks_set(struct ext3_inode *raw_inode, 1708 struct inode * inode); 1709 ext4_fsblk_t ext4_block_bitmap(struct super_block *sb, 1710 struct ext4_group_desc *bg); 1711 1712 ext4_fsblk_t ext4_inode_bitmap(struct super_block *sb, 1713 struct ext4_group_desc *bg); 1714 ext4_fsblk_t ext4_inode_table(struct super_block *sb, 1715 struct ext4_group_desc *bg); 1716 __u32 ext4_free_blks_count(struct super_block *sb, 1717 struct ext4_group_desc *bg); 1718 __u32 ext4_free_inodes_count(struct super_block *sb, 1719 struct ext4_group_desc *bg); 1720 __u32 ext4_used_dirs_count(struct super_block *sb, 1721 struct ext4_group_desc *bg); 1722 __u32 ext4_itable_unused_count(struct super_block *sb, 1723 struct ext4_group_desc *bg); 1724 void ext4_block_bitmap_set(struct super_block *sb, 1725 struct ext4_group_desc *bg, ext4_fsblk_t blk); 1726 void ext4_inode_bitmap_set(struct super_block *sb, 1727 struct ext4_group_desc *bg, ext4_fsblk_t blk); 1728 void ext4_inode_table_set(struct super_block *sb, 1729 struct ext4_group_desc *bg, ext4_fsblk_t blk); 1730 void ext4_free_blks_set(struct super_block *sb, 1731 struct ext4_group_desc *bg, __u32 count); 1732 void ext4_free_inodes_set(struct super_block *sb, 1733 struct ext4_group_desc *bg, __u32 count); 1734 void ext4_used_dirs_set(struct super_block *sb, 1735 struct ext4_group_desc *bg, __u32 count); 1736 void ext4_itable_unused_set(struct super_block *sb, 1737 struct ext4_group_desc *bg, __u32 count); 1738 1739 int ext3_bg_has_super(struct super_block *sb, ext3_group_t group); 1740 unsigned long ext4_bg_num_gdb(struct super_block *sb, ext4_group_t group); 1741 unsigned ext4_init_inode_bitmap(struct super_block *sb, struct buffer_head *bh, 1742 ext4_group_t block_group, 1743 struct ext4_group_desc *gdp); 1744 unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh, 1745 ext4_group_t block_group, struct ext4_group_desc *gdp); 1746 struct ext4_group_desc * ext4_get_group_desc(struct super_block *sb, 1747 ext4_group_t block_group, struct buffer_head **bh); 1748 ext4_fsblk_t ext4_count_free_blocks(struct super_block *sb); 1749 unsigned long ext4_count_free_inodes(struct super_block *sb); 1750 int ext4_check_descriptors(struct super_block *sb); 1751 1752 NTSTATUS 1753 Ext2LoadSuper( 1754 IN PEXT2_VCB Vcb, 1755 IN BOOLEAN bVerify, 1756 OUT PEXT2_SUPER_BLOCK * Sb 1757 ); 1758 1759 1760 BOOLEAN 1761 Ext2SaveSuper( 1762 IN PEXT2_IRP_CONTEXT IrpContext, 1763 IN PEXT2_VCB Vcb 1764 ); 1765 1766 BOOLEAN 1767 Ext2RefreshSuper( 1768 IN PEXT2_IRP_CONTEXT IrpContext, 1769 IN PEXT2_VCB Vcb 1770 ); 1771 1772 BOOLEAN 1773 Ext2LoadGroup(IN PEXT2_VCB Vcb); 1774 1775 VOID 1776 Ext2PutGroup(IN PEXT2_VCB Vcb); 1777 1778 VOID 1779 Ext2DropGroup(IN PEXT2_VCB Vcb); 1780 1781 BOOLEAN 1782 Ext2SaveGroup( 1783 IN PEXT2_IRP_CONTEXT IrpContext, 1784 IN PEXT2_VCB Vcb, 1785 IN ULONG Group 1786 ); 1787 1788 BOOLEAN 1789 Ext2RefreshGroup( 1790 IN PEXT2_IRP_CONTEXT IrpContext, 1791 IN PEXT2_VCB Vcb 1792 ); 1793 1794 BOOLEAN 1795 Ext2GetInodeLba ( 1796 IN PEXT2_VCB Vcb, 1797 IN ULONG inode, 1798 OUT PLONGLONG offset 1799 ); 1800 1801 BOOLEAN 1802 Ext2LoadInode ( 1803 IN PEXT2_VCB Vcb, 1804 IN struct inode *Inode 1805 ); 1806 1807 BOOLEAN 1808 Ext2ClearInode ( 1809 IN PEXT2_IRP_CONTEXT IrpContext, 1810 IN PEXT2_VCB Vcb, 1811 IN ULONG inode 1812 ); 1813 1814 BOOLEAN 1815 Ext2SaveInode ( 1816 IN PEXT2_IRP_CONTEXT IrpContext, 1817 IN PEXT2_VCB Vcb, 1818 IN struct inode *Inode 1819 ); 1820 1821 BOOLEAN 1822 Ext2LoadBlock ( 1823 IN PEXT2_VCB Vcb, 1824 IN ULONG dwBlk, 1825 IN PVOID Buffer 1826 ); 1827 1828 BOOLEAN 1829 Ext2SaveBlock ( 1830 IN PEXT2_IRP_CONTEXT IrpContext, 1831 IN PEXT2_VCB Vcb, 1832 IN ULONG dwBlk, 1833 IN PVOID Buf 1834 ); 1835 1836 BOOLEAN 1837 Ext2ZeroBuffer( 1838 IN PEXT2_IRP_CONTEXT IrpContext, 1839 IN PEXT2_VCB Vcb, 1840 IN LONGLONG Offset, 1841 IN ULONG Size 1842 ); 1843 1844 BOOLEAN 1845 Ext2SaveBuffer( 1846 IN PEXT2_IRP_CONTEXT IrpContext, 1847 IN PEXT2_VCB Vcb, 1848 IN LONGLONG Offset, 1849 IN ULONG Size, 1850 IN PVOID Buf 1851 ); 1852 1853 NTSTATUS 1854 Ext2GetBlock( 1855 IN PEXT2_IRP_CONTEXT IrpContext, 1856 IN PEXT2_VCB Vcb, 1857 IN PEXT2_MCB Mcb, 1858 IN ULONG Base, 1859 IN ULONG Layer, 1860 IN ULONG Start, 1861 IN ULONG SizeArray, 1862 IN PULONG BlockArray, 1863 IN BOOLEAN bAlloc, 1864 IN OUT PULONG Hint, 1865 OUT PULONG Block, 1866 OUT PULONG Number 1867 ); 1868 1869 NTSTATUS 1870 Ext2BlockMap( 1871 IN PEXT2_IRP_CONTEXT IrpContext, 1872 IN PEXT2_VCB Vcb, 1873 IN PEXT2_MCB Mcb, 1874 IN ULONG Index, 1875 IN BOOLEAN bAlloc, 1876 OUT PULONG pBlock, 1877 OUT PULONG Number 1878 ); 1879 1880 VOID 1881 Ext2UpdateVcbStat( 1882 IN PEXT2_IRP_CONTEXT IrpContext, 1883 IN PEXT2_VCB Vcb 1884 ); 1885 1886 NTSTATUS 1887 Ext2NewBlock( 1888 IN PEXT2_IRP_CONTEXT IrpContext, 1889 IN PEXT2_VCB Vcb, 1890 IN ULONG GroupHint, 1891 IN ULONG BlockHint, 1892 OUT PULONG Block, 1893 IN OUT PULONG Number 1894 ); 1895 1896 NTSTATUS 1897 Ext2FreeBlock( 1898 IN PEXT2_IRP_CONTEXT IrpContext, 1899 IN PEXT2_VCB Vcb, 1900 IN ULONG Block, 1901 IN ULONG Number 1902 ); 1903 1904 1905 NTSTATUS 1906 Ext2NewInode( 1907 IN PEXT2_IRP_CONTEXT IrpContext, 1908 IN PEXT2_VCB Vcb, 1909 IN ULONG GroupHint, 1910 IN ULONG Type, 1911 OUT PULONG Inode 1912 ); 1913 1914 NTSTATUS 1915 Ext2FreeInode( 1916 IN PEXT2_IRP_CONTEXT IrpContext, 1917 IN PEXT2_VCB Vcb, 1918 IN ULONG Inode, 1919 IN ULONG Type 1920 ); 1921 1922 NTSTATUS 1923 Ext2AddEntry ( 1924 IN PEXT2_IRP_CONTEXT IrpContext, 1925 IN PEXT2_VCB Vcb, 1926 IN PEXT2_FCB Dcb, 1927 IN struct inode *Inode, 1928 IN PUNICODE_STRING FileName, 1929 OUT struct dentry **dentry 1930 ); 1931 1932 NTSTATUS 1933 Ext2SetFileType ( 1934 IN PEXT2_IRP_CONTEXT IrpContext, 1935 IN PEXT2_VCB Vcb, 1936 IN PEXT2_FCB Dcb, 1937 IN PEXT2_MCB Mcb 1938 ); 1939 1940 NTSTATUS 1941 Ext2RemoveEntry ( 1942 IN PEXT2_IRP_CONTEXT IrpContext, 1943 IN PEXT2_VCB Vcb, 1944 IN PEXT2_FCB Dcb, 1945 IN PEXT2_MCB Mcb 1946 ); 1947 1948 NTSTATUS 1949 Ext2SetParentEntry ( 1950 IN PEXT2_IRP_CONTEXT IrpContext, 1951 IN PEXT2_VCB Vcb, 1952 IN PEXT2_FCB Dcb, 1953 IN ULONG OldParent, 1954 IN ULONG NewParent ); 1955 1956 1957 NTSTATUS 1958 Ext2TruncateBlock( 1959 IN PEXT2_IRP_CONTEXT IrpContext, 1960 IN PEXT2_VCB Vcb, 1961 IN PEXT2_MCB Mcb, 1962 IN ULONG Base, 1963 IN ULONG Start, 1964 IN ULONG Layer, 1965 IN ULONG SizeArray, 1966 IN PULONG BlockArray, 1967 IN PULONG Extra 1968 ); 1969 1970 struct ext3_dir_entry_2 *ext3_next_entry(struct ext3_dir_entry_2 *p); 1971 1972 int ext3_check_dir_entry (const char * function, struct inode * dir, 1973 struct ext3_dir_entry_2 * de, 1974 struct buffer_head * bh, 1975 unsigned long offset); 1976 1977 loff_t ext3_max_size(int blkbits, int has_huge_files); 1978 loff_t ext3_max_bitmap_size(int bits, int has_huge_files); 1979 1980 1981 __le16 ext4_group_desc_csum(struct ext3_sb_info *sbi, __u32 block_group, 1982 struct ext4_group_desc *gdp); 1983 int ext4_group_desc_csum_verify(struct ext3_sb_info *sbi, __u32 block_group, 1984 struct ext4_group_desc *gdp); 1985 1986 ext3_fsblk_t descriptor_loc(struct super_block *sb, 1987 ext3_fsblk_t logical_sb_block, unsigned int nr); 1988 struct ext4_group_desc * ext4_get_group_desc(struct super_block *sb, 1989 ext4_group_t block_group, struct buffer_head **bh); 1990 int ext4_check_descriptors(struct super_block *sb); 1991 1992 // 1993 // Fastio.c 1994 // 1995 1996 FAST_IO_POSSIBLE 1997 Ext2IsFastIoPossible( 1998 IN PEXT2_FCB Fcb 1999 ); 2000 2001 BOOLEAN NTAPI 2002 Ext2FastIoCheckIfPossible ( 2003 IN PFILE_OBJECT FileObject, 2004 IN PLARGE_INTEGER FileOffset, 2005 IN ULONG Length, 2006 IN BOOLEAN Wait, 2007 IN ULONG LockKey, 2008 IN BOOLEAN CheckForReadOperation, 2009 OUT PIO_STATUS_BLOCK IoStatus, 2010 IN PDEVICE_OBJECT DeviceObject 2011 ); 2012 2013 2014 BOOLEAN NTAPI 2015 Ext2FastIoRead (IN PFILE_OBJECT FileObject, 2016 IN PLARGE_INTEGER FileOffset, 2017 IN ULONG Length, 2018 IN BOOLEAN Wait, 2019 IN ULONG LockKey, 2020 OUT PVOID Buffer, 2021 OUT PIO_STATUS_BLOCK IoStatus, 2022 IN PDEVICE_OBJECT DeviceObject); 2023 2024 BOOLEAN NTAPI 2025 Ext2FastIoWrite ( 2026 IN PFILE_OBJECT FileObject, 2027 IN PLARGE_INTEGER FileOffset, 2028 IN ULONG Length, 2029 IN BOOLEAN Wait, 2030 IN ULONG LockKey, 2031 OUT PVOID Buffer, 2032 OUT PIO_STATUS_BLOCK IoStatus, 2033 IN PDEVICE_OBJECT DeviceObject); 2034 2035 BOOLEAN NTAPI 2036 Ext2FastIoQueryBasicInfo ( 2037 IN PFILE_OBJECT FileObject, 2038 IN BOOLEAN Wait, 2039 OUT PFILE_BASIC_INFORMATION Buffer, 2040 OUT PIO_STATUS_BLOCK IoStatus, 2041 IN PDEVICE_OBJECT DeviceObject); 2042 2043 BOOLEAN NTAPI 2044 Ext2FastIoQueryStandardInfo ( 2045 IN PFILE_OBJECT FileObject, 2046 IN BOOLEAN Wait, 2047 OUT PFILE_STANDARD_INFORMATION Buffer, 2048 OUT PIO_STATUS_BLOCK IoStatus, 2049 IN PDEVICE_OBJECT DeviceObject); 2050 2051 BOOLEAN NTAPI 2052 Ext2FastIoLock ( 2053 IN PFILE_OBJECT FileObject, 2054 IN PLARGE_INTEGER FileOffset, 2055 IN PLARGE_INTEGER Length, 2056 IN PEPROCESS Process, 2057 IN ULONG Key, 2058 IN BOOLEAN FailImmediately, 2059 IN BOOLEAN ExclusiveLock, 2060 OUT PIO_STATUS_BLOCK IoStatus, 2061 IN PDEVICE_OBJECT DeviceObject 2062 ); 2063 2064 BOOLEAN NTAPI 2065 Ext2FastIoUnlockSingle ( 2066 IN PFILE_OBJECT FileObject, 2067 IN PLARGE_INTEGER FileOffset, 2068 IN PLARGE_INTEGER Length, 2069 IN PEPROCESS Process, 2070 IN ULONG Key, 2071 OUT PIO_STATUS_BLOCK IoStatus, 2072 IN PDEVICE_OBJECT DeviceObject 2073 ); 2074 2075 BOOLEAN NTAPI 2076 Ext2FastIoUnlockAll ( 2077 IN PFILE_OBJECT FileObject, 2078 IN PEPROCESS Process, 2079 OUT PIO_STATUS_BLOCK IoStatus, 2080 IN PDEVICE_OBJECT DeviceObject 2081 ); 2082 2083 BOOLEAN NTAPI 2084 Ext2FastIoUnlockAllByKey ( 2085 IN PFILE_OBJECT FileObject, 2086 #ifdef __REACTOS__ 2087 IN PVOID Process, 2088 #else 2089 IN PEPROCESS Process, 2090 #endif 2091 IN ULONG Key, 2092 OUT PIO_STATUS_BLOCK IoStatus, 2093 IN PDEVICE_OBJECT DeviceObject 2094 ); 2095 2096 2097 BOOLEAN NTAPI 2098 Ext2FastIoQueryNetworkOpenInfo ( 2099 IN PFILE_OBJECT FileObject, 2100 IN BOOLEAN Wait, 2101 OUT PFILE_NETWORK_OPEN_INFORMATION Buffer, 2102 OUT PIO_STATUS_BLOCK IoStatus, 2103 IN PDEVICE_OBJECT DeviceObject ); 2104 2105 BOOLEAN NTAPI 2106 Ext2FastIoQueryNetworkOpenInfo ( 2107 IN PFILE_OBJECT FileObject, 2108 IN BOOLEAN Wait, 2109 OUT PFILE_NETWORK_OPEN_INFORMATION Buffer, 2110 OUT PIO_STATUS_BLOCK IoStatus, 2111 IN PDEVICE_OBJECT DeviceObject); 2112 2113 2114 // 2115 // FileInfo.c 2116 // 2117 2118 2119 NTSTATUS 2120 Ext2QueryFileInformation (IN PEXT2_IRP_CONTEXT IrpContext); 2121 2122 NTSTATUS 2123 Ext2SetFileInformation (IN PEXT2_IRP_CONTEXT IrpContext); 2124 2125 ULONG 2126 Ext2TotalBlocks( 2127 PEXT2_VCB Vcb, 2128 PLARGE_INTEGER Size, 2129 PULONG pMeta 2130 ); 2131 2132 NTSTATUS 2133 Ext2ExpandFile( 2134 PEXT2_IRP_CONTEXT IrpContext, 2135 PEXT2_VCB Vcb, 2136 PEXT2_MCB Mcb, 2137 PLARGE_INTEGER Size 2138 ); 2139 2140 NTSTATUS 2141 Ext2TruncateFile ( 2142 PEXT2_IRP_CONTEXT IrpContext, 2143 PEXT2_VCB Vcb, 2144 PEXT2_MCB Mcb, 2145 PLARGE_INTEGER AllocationSize ); 2146 2147 NTSTATUS 2148 Ext2IsFileRemovable( 2149 IN PEXT2_IRP_CONTEXT IrpContext, 2150 IN PEXT2_VCB Vcb, 2151 IN PEXT2_FCB Fcb, 2152 IN PEXT2_CCB Ccb 2153 ); 2154 2155 NTSTATUS 2156 Ext2SetDispositionInfo( 2157 PEXT2_IRP_CONTEXT IrpContext, 2158 PEXT2_VCB Vcb, 2159 PEXT2_FCB Fcb, 2160 PEXT2_CCB Ccb, 2161 BOOLEAN bDelete 2162 ); 2163 2164 NTSTATUS 2165 Ext2SetRenameInfo( 2166 PEXT2_IRP_CONTEXT IrpContext, 2167 PEXT2_VCB Vcb, 2168 PEXT2_FCB Fcb, 2169 PEXT2_CCB Ccb 2170 ); 2171 2172 NTSTATUS 2173 Ext2SetLinkInfo( 2174 PEXT2_IRP_CONTEXT IrpContext, 2175 PEXT2_VCB Vcb, 2176 PEXT2_FCB Fcb, 2177 PEXT2_CCB Ccb 2178 ); 2179 2180 ULONG 2181 Ext2InodeType(PEXT2_MCB Mcb); 2182 2183 NTSTATUS 2184 Ext2DeleteFile( 2185 PEXT2_IRP_CONTEXT IrpContext, 2186 PEXT2_VCB Vcb, 2187 PEXT2_FCB Fcb, 2188 PEXT2_MCB Mcb 2189 ); 2190 2191 2192 // 2193 // Flush.c 2194 // 2195 2196 NTSTATUS 2197 Ext2FlushFiles( 2198 IN PEXT2_IRP_CONTEXT IrpContext, 2199 IN PEXT2_VCB Vcb, 2200 IN BOOLEAN bShutDown 2201 ); 2202 2203 NTSTATUS 2204 Ext2FlushVolume ( 2205 IN PEXT2_IRP_CONTEXT IrpContext, 2206 IN PEXT2_VCB Vcb, 2207 IN BOOLEAN bShutDown 2208 ); 2209 2210 NTSTATUS 2211 Ext2FlushFile ( 2212 IN PEXT2_IRP_CONTEXT IrpContext, 2213 IN PEXT2_FCB Fcb, 2214 IN PEXT2_CCB Ccb 2215 ); 2216 2217 NTSTATUS 2218 Ext2Flush (IN PEXT2_IRP_CONTEXT IrpContext); 2219 2220 2221 // 2222 // Fsctl.c 2223 // 2224 2225 NTSTATUS 2226 Ext2ReadSymlink ( 2227 IN PEXT2_IRP_CONTEXT IrpContext, 2228 IN PEXT2_VCB Vcb, 2229 IN PEXT2_MCB Mcb, 2230 IN PVOID Buffer, 2231 IN ULONG Size, 2232 OUT PULONG BytesRead 2233 ); 2234 2235 NTSTATUS 2236 Ext2WriteSymlink ( 2237 IN PEXT2_IRP_CONTEXT IrpContext, 2238 IN PEXT2_VCB Vcb, 2239 IN PEXT2_MCB Mcb, 2240 IN PVOID Buffer, 2241 IN ULONG Size, 2242 OUT PULONG BytesWritten 2243 ); 2244 2245 NTSTATUS 2246 Ext2TruncateSymlink( 2247 PEXT2_IRP_CONTEXT IrpContext, 2248 PEXT2_VCB Vcb, 2249 PEXT2_MCB Mcb, 2250 ULONG Size 2251 ); 2252 2253 // 2254 // MountPoint process workitem 2255 // 2256 2257 VOID 2258 Ext2SetVpbFlag (IN PVPB Vpb, 2259 IN USHORT Flag ); 2260 2261 VOID 2262 Ext2ClearVpbFlag (IN PVPB Vpb, 2263 IN USHORT Flag ); 2264 2265 BOOLEAN 2266 Ext2CheckDismount ( 2267 IN PEXT2_IRP_CONTEXT IrpContext, 2268 IN PEXT2_VCB Vcb, 2269 IN BOOLEAN bForce ); 2270 2271 NTSTATUS 2272 Ext2PurgeVolume (IN PEXT2_VCB Vcb, 2273 IN BOOLEAN FlushBeforePurge); 2274 2275 NTSTATUS 2276 Ext2PurgeFile (IN PEXT2_FCB Fcb, 2277 IN BOOLEAN FlushBeforePurge); 2278 2279 BOOLEAN 2280 Ext2IsHandleCountZero(IN PEXT2_VCB Vcb); 2281 2282 NTSTATUS 2283 Ext2LockVcb (IN PEXT2_VCB Vcb, 2284 IN PFILE_OBJECT FileObject); 2285 2286 NTSTATUS 2287 Ext2LockVolume (IN PEXT2_IRP_CONTEXT IrpContext); 2288 2289 NTSTATUS 2290 Ext2UnlockVcb (IN PEXT2_VCB Vcb, 2291 IN PFILE_OBJECT FileObject); 2292 2293 NTSTATUS 2294 Ext2UnlockVolume (IN PEXT2_IRP_CONTEXT IrpContext); 2295 2296 NTSTATUS 2297 Ext2AllowExtendedDasdIo(IN PEXT2_IRP_CONTEXT IrpContext); 2298 2299 NTSTATUS 2300 Ext2OplockRequest (IN PEXT2_IRP_CONTEXT IrpContext); 2301 2302 NTSTATUS 2303 Ext2QueryExtentMappings( 2304 IN PEXT2_IRP_CONTEXT IrpContext, 2305 IN PEXT2_VCB Vcb, 2306 IN PEXT2_FCB Fcb, 2307 IN PLARGE_INTEGER RequestVbn, 2308 OUT PLARGE_INTEGER * pMappedRuns 2309 ); 2310 2311 NTSTATUS 2312 Ext2QueryRetrievalPointers(IN PEXT2_IRP_CONTEXT IrpContext); 2313 2314 NTSTATUS 2315 Ext2GetRetrievalPointers(IN PEXT2_IRP_CONTEXT IrpContext); 2316 2317 NTSTATUS 2318 Ext2GetRetrievalPointerBase(IN PEXT2_IRP_CONTEXT IrpContext); 2319 2320 NTSTATUS 2321 Ext2UserFsRequest (IN PEXT2_IRP_CONTEXT IrpContext); 2322 2323 BOOLEAN 2324 Ext2IsMediaWriteProtected ( 2325 IN PEXT2_IRP_CONTEXT IrpContext, 2326 IN PDEVICE_OBJECT TargetDevice 2327 ); 2328 2329 NTSTATUS 2330 Ext2MountVolume (IN PEXT2_IRP_CONTEXT IrpContext); 2331 2332 VOID 2333 Ext2VerifyVcb (IN PEXT2_IRP_CONTEXT IrpContext, 2334 IN PEXT2_VCB Vcb ); 2335 NTSTATUS 2336 Ext2VerifyVolume (IN PEXT2_IRP_CONTEXT IrpContext); 2337 2338 NTSTATUS 2339 Ext2IsVolumeMounted (IN PEXT2_IRP_CONTEXT IrpContext); 2340 2341 NTSTATUS 2342 Ext2DismountVolume (IN PEXT2_IRP_CONTEXT IrpContext); 2343 2344 NTSTATUS 2345 Ext2FileSystemControl (IN PEXT2_IRP_CONTEXT IrpContext); 2346 2347 // 2348 // HTree.c 2349 // 2350 2351 struct buffer_head *ext3_append(struct ext2_icb *icb, struct inode *inode, 2352 ext3_lblk_t *block, int *err); 2353 2354 void ext3_set_de_type(struct super_block *sb, 2355 struct ext3_dir_entry_2 *de, 2356 umode_t mode); 2357 2358 __u32 ext3_current_time(struct inode *in); 2359 void ext3_warning (struct super_block * sb, const char * function, 2360 char * fmt, ...); 2361 #define ext3_error ext3_warning 2362 #define ext4_error ext3_error 2363 2364 void ext3_update_dx_flag(struct inode *inode); 2365 int ext3_mark_inode_dirty(struct ext2_icb *icb, struct inode *in); 2366 2367 void ext3_inc_count(struct inode *inode); 2368 void ext3_dec_count(struct inode *inode); 2369 2370 struct buffer_head * 2371 ext3_find_entry (struct ext2_icb *icb, struct dentry *dentry, 2372 struct ext3_dir_entry_2 ** res_dir); 2373 struct buffer_head * 2374 ext3_dx_find_entry(struct ext2_icb *, struct dentry *dentry, 2375 struct ext3_dir_entry_2 **res_dir, int *err); 2376 2377 typedef int (*filldir_t)(void *, const char *, int, unsigned long, __u32, unsigned); 2378 int ext3_dx_readdir(struct file *filp, filldir_t filldir, void * context); 2379 2380 struct buffer_head *ext3_bread(struct ext2_icb *icb, struct inode *inode, 2381 unsigned long block, int *err); 2382 int add_dirent_to_buf(struct ext2_icb *icb, struct dentry *dentry, 2383 struct inode *inode, struct ext3_dir_entry_2 *de, 2384 struct buffer_head *bh); 2385 2386 #if !defined(__REACTOS__) || defined(_MSC_VER) 2387 struct ext3_dir_entry_2 * 2388 do_split(struct ext2_icb *icb, struct inode *dir, 2389 struct buffer_head **bh,struct dx_frame *frame, 2390 struct dx_hash_info *hinfo, int *error); 2391 #endif 2392 2393 int ext3_add_entry(struct ext2_icb *icb, struct dentry *dentry, struct inode *inode); 2394 2395 int ext3_delete_entry(struct ext2_icb *icb, struct inode *dir, 2396 struct ext3_dir_entry_2 *de_del, 2397 struct buffer_head *bh); 2398 2399 int ext3_is_dir_empty(struct ext2_icb *icb, struct inode *inode); 2400 2401 // 2402 // Init.c 2403 // 2404 2405 BOOLEAN 2406 Ext2QueryGlobalParameters (IN PUNICODE_STRING RegistryPath); 2407 2408 VOID NTAPI 2409 DriverUnload (IN PDRIVER_OBJECT DriverObject); 2410 2411 // 2412 // Indirect.c 2413 // 2414 2415 NTSTATUS 2416 Ext2MapIndirect( 2417 IN PEXT2_IRP_CONTEXT IrpContext, 2418 IN PEXT2_VCB Vcb, 2419 IN PEXT2_MCB Mcb, 2420 IN ULONG Index, 2421 IN BOOLEAN bAlloc, 2422 OUT PULONG pBlock, 2423 OUT PULONG Number 2424 ); 2425 2426 NTSTATUS 2427 Ext2ExpandIndirect( 2428 PEXT2_IRP_CONTEXT IrpContext, 2429 PEXT2_VCB Vcb, 2430 PEXT2_MCB Mcb, 2431 ULONG Start, 2432 ULONG End, 2433 PLARGE_INTEGER Size 2434 ); 2435 2436 NTSTATUS 2437 Ext2TruncateIndirect( 2438 PEXT2_IRP_CONTEXT IrpContext, 2439 PEXT2_VCB Vcb, 2440 PEXT2_MCB Mcb, 2441 PLARGE_INTEGER Size 2442 ); 2443 2444 2445 // 2446 // linux.c: linux lib implemenation 2447 // 2448 2449 int 2450 ext2_init_linux(); 2451 2452 void 2453 ext2_destroy_linux(); 2454 2455 2456 // 2457 // Lock.c 2458 // 2459 2460 NTSTATUS 2461 Ext2LockControl (IN PEXT2_IRP_CONTEXT IrpContext); 2462 2463 2464 // 2465 // Memory.c 2466 // 2467 2468 PEXT2_IRP_CONTEXT 2469 Ext2AllocateIrpContext (IN PDEVICE_OBJECT DeviceObject, 2470 IN PIRP Irp ); 2471 2472 VOID 2473 Ext2FreeIrpContext (IN PEXT2_IRP_CONTEXT IrpContext); 2474 2475 2476 PEXT2_FCB 2477 Ext2AllocateFcb ( 2478 IN PEXT2_VCB Vcb, 2479 IN PEXT2_MCB Mcb 2480 ); 2481 2482 VOID 2483 Ext2FreeFcb (IN PEXT2_FCB Fcb); 2484 2485 VOID 2486 Ext2InsertFcb(PEXT2_VCB Vcb, PEXT2_FCB Fcb); 2487 2488 VOID 2489 Ext2RemoveFcb(PEXT2_VCB Vcb, PEXT2_FCB Fcb); 2490 2491 PEXT2_CCB 2492 Ext2AllocateCcb (ULONG Flags, PEXT2_MCB SymLink); 2493 2494 VOID 2495 Ext2FreeMcb ( 2496 IN PEXT2_VCB Vcb, 2497 IN PEXT2_MCB Mcb 2498 ); 2499 2500 VOID 2501 Ext2FreeCcb (IN PEXT2_VCB Vcb, IN PEXT2_CCB Ccb); 2502 2503 PEXT2_INODE 2504 Ext2AllocateInode (PEXT2_VCB Vcb); 2505 2506 VOID 2507 Ext2DestroyInode (IN PEXT2_VCB Vcb, IN PEXT2_INODE inode); 2508 2509 struct dentry * Ext2AllocateEntry(); 2510 VOID Ext2FreeEntry (IN struct dentry *de); 2511 struct dentry *Ext2BuildEntry(PEXT2_VCB Vcb, PEXT2_MCB Dcb, PUNICODE_STRING FileName); 2512 2513 PEXT2_EXTENT 2514 Ext2AllocateExtent(); 2515 2516 VOID 2517 Ext2FreeExtent (IN PEXT2_EXTENT Extent); 2518 2519 ULONG 2520 Ext2CountExtents(IN PEXT2_EXTENT Chain); 2521 2522 VOID 2523 Ext2JointExtents( 2524 IN PEXT2_EXTENT Chain, 2525 IN PEXT2_EXTENT Extent 2526 ); 2527 2528 VOID 2529 Ext2DestroyExtentChain(IN PEXT2_EXTENT Chain); 2530 2531 NTSTATUS 2532 Ext2BuildExtents( 2533 IN PEXT2_IRP_CONTEXT IrpContext, 2534 IN PEXT2_VCB Vcb, 2535 IN PEXT2_MCB Mcb, 2536 IN ULONGLONG Offset, 2537 IN ULONG Size, 2538 IN BOOLEAN bAlloc, 2539 OUT PEXT2_EXTENT * Chain 2540 ); 2541 2542 BOOLEAN 2543 Ext2ListExtents(PLARGE_MCB Extents); 2544 2545 VOID 2546 Ext2CheckExtent( 2547 PLARGE_MCB Zone, 2548 LONGLONG Vbn, 2549 LONGLONG Lbn, 2550 LONGLONG Length, 2551 BOOLEAN bAdded 2552 ); 2553 2554 VOID 2555 Ext2ClearAllExtents(PLARGE_MCB Zone); 2556 2557 BOOLEAN 2558 Ext2AddVcbExtent ( 2559 IN PEXT2_VCB Vcb, 2560 IN LONGLONG Vbn, 2561 IN LONGLONG Length 2562 ); 2563 2564 BOOLEAN 2565 Ext2RemoveVcbExtent ( 2566 IN PEXT2_VCB Vcb, 2567 IN LONGLONG Vbn, 2568 IN LONGLONG Length 2569 ); 2570 2571 BOOLEAN 2572 Ext2LookupVcbExtent ( 2573 IN PEXT2_VCB Vcb, 2574 IN LONGLONG Vbn, 2575 OUT PLONGLONG Lbn, 2576 OUT PLONGLONG Length 2577 ); 2578 2579 BOOLEAN 2580 Ext2AddMcbExtent ( 2581 IN PEXT2_VCB Vcb, 2582 IN PEXT2_MCB Mcb, 2583 IN LONGLONG Vbn, 2584 IN LONGLONG Lbn, 2585 IN LONGLONG Length 2586 ); 2587 2588 BOOLEAN 2589 Ext2RemoveMcbExtent ( 2590 IN PEXT2_VCB Vcb, 2591 IN PEXT2_MCB Mcb, 2592 IN LONGLONG Vbn, 2593 IN LONGLONG Length 2594 ); 2595 2596 BOOLEAN 2597 Ext2LookupMcbExtent ( 2598 IN PEXT2_VCB Vcb, 2599 IN PEXT2_MCB Mcb, 2600 IN LONGLONG Vbn, 2601 OUT PLONGLONG Lbn, 2602 OUT PLONGLONG Length 2603 ); 2604 2605 BOOLEAN 2606 Ext2AddMcbMetaExts ( 2607 IN PEXT2_VCB Vcb, 2608 IN PEXT2_MCB Mcb, 2609 IN ULONG Block, 2610 IN ULONG Length 2611 ); 2612 2613 BOOLEAN 2614 Ext2RemoveMcbMetaExts ( 2615 IN PEXT2_VCB Vcb, 2616 IN PEXT2_MCB Mcb, 2617 IN ULONG Block, 2618 IN ULONG Length 2619 ); 2620 2621 BOOLEAN 2622 Ext2AddBlockExtent( 2623 IN PEXT2_VCB Vcb, 2624 IN PEXT2_MCB Mcb, 2625 IN ULONG Start, 2626 IN ULONG Block, 2627 IN ULONG Number 2628 ); 2629 2630 BOOLEAN 2631 Ext2LookupBlockExtent( 2632 IN PEXT2_VCB Vcb, 2633 IN PEXT2_MCB Mcb, 2634 IN ULONG Start, 2635 IN PULONG Block, 2636 IN PULONG Mapped 2637 ); 2638 2639 BOOLEAN 2640 Ext2RemoveBlockExtent( 2641 IN PEXT2_VCB Vcb, 2642 IN PEXT2_MCB Mcb, 2643 IN ULONG Start, 2644 IN ULONG Number 2645 ); 2646 2647 NTSTATUS 2648 Ext2InitializeZone( 2649 IN PEXT2_IRP_CONTEXT IrpContext, 2650 IN PEXT2_VCB Vcb, 2651 IN PEXT2_MCB Mcb 2652 ); 2653 2654 BOOLEAN 2655 Ext2BuildName( 2656 IN OUT PUNICODE_STRING Target, 2657 IN PUNICODE_STRING File, 2658 IN PUNICODE_STRING Parent 2659 ); 2660 2661 2662 PEXT2_MCB 2663 Ext2AllocateMcb ( 2664 IN PEXT2_VCB Vcb, 2665 IN PUNICODE_STRING FileName, 2666 IN PUNICODE_STRING Parent, 2667 IN ULONG FileAttr 2668 ); 2669 2670 PEXT2_MCB 2671 Ext2SearchMcb( 2672 PEXT2_VCB Vcb, 2673 PEXT2_MCB Parent, 2674 PUNICODE_STRING FileName 2675 ); 2676 2677 PEXT2_MCB 2678 Ext2SearchMcbWithoutLock( 2679 PEXT2_MCB Parent, 2680 PUNICODE_STRING FileName 2681 ); 2682 2683 VOID 2684 Ext2InsertMcb( 2685 PEXT2_VCB Vcb, 2686 PEXT2_MCB Parent, 2687 PEXT2_MCB Child 2688 ); 2689 2690 BOOLEAN 2691 Ext2RemoveMcb( 2692 PEXT2_VCB Vcb, 2693 PEXT2_MCB Mcb 2694 ); 2695 2696 VOID 2697 Ext2CleanupAllMcbs( 2698 PEXT2_VCB Vcb 2699 ); 2700 2701 BOOLEAN 2702 Ext2CheckSetBlock( 2703 PEXT2_IRP_CONTEXT IrpContext, 2704 PEXT2_VCB Vcb, LONGLONG Block 2705 ); 2706 2707 BOOLEAN 2708 Ext2CheckBitmapConsistency( 2709 PEXT2_IRP_CONTEXT IrpContext, 2710 PEXT2_VCB Vcb 2711 ); 2712 2713 VOID 2714 Ext2InsertVcb(PEXT2_VCB Vcb); 2715 2716 VOID 2717 Ext2RemoveVcb(PEXT2_VCB Vcb); 2718 2719 NTSTATUS 2720 Ext2InitializeLabel( 2721 IN PEXT2_VCB Vcb, 2722 IN PEXT2_SUPER_BLOCK Sb 2723 ); 2724 2725 NTSTATUS 2726 Ext2InitializeVcb( 2727 PEXT2_IRP_CONTEXT IrpContext, 2728 PEXT2_VCB Vcb, 2729 PEXT2_SUPER_BLOCK Ext2Sb, 2730 PDEVICE_OBJECT TargetDevice, 2731 PDEVICE_OBJECT VolumeDevice, 2732 PVPB Vpb ); 2733 2734 VOID 2735 Ext2TearDownStream (IN PEXT2_VCB Vcb); 2736 2737 VOID 2738 Ext2DestroyVcb (IN PEXT2_VCB Vcb); 2739 2740 NTSTATUS 2741 Ext2CompleteIrpContext ( 2742 IN PEXT2_IRP_CONTEXT IrpContext, 2743 IN NTSTATUS Status ); 2744 2745 VOID 2746 Ext2SyncUninitializeCacheMap ( 2747 IN PFILE_OBJECT FileObject ); 2748 2749 VOID 2750 Ext2LinkTailMcb(PEXT2_VCB Vcb, PEXT2_MCB Mcb); 2751 2752 2753 VOID 2754 Ext2LinkHeadMcb(PEXT2_VCB Vcb, PEXT2_MCB Mcb); 2755 2756 VOID 2757 Ext2UnlinkMcb(PEXT2_VCB Vcb, PEXT2_MCB Mcb); 2758 2759 PEXT2_MCB 2760 Ext2FirstUnusedMcb( 2761 PEXT2_VCB Vcb, 2762 BOOLEAN Wait, 2763 ULONG Number 2764 ); 2765 2766 VOID NTAPI 2767 Ext2ReaperThread( 2768 PVOID Context 2769 ); 2770 2771 NTSTATUS 2772 Ext2StartReaperThread(); 2773 2774 // 2775 // Misc.c 2776 // 2777 2778 ULONG 2779 Ext2Log2(ULONG Value); 2780 2781 LARGE_INTEGER 2782 Ext2NtTime (IN ULONG i_time); 2783 2784 ULONG 2785 Ext2LinuxTime (IN LARGE_INTEGER SysTime); 2786 2787 ULONG 2788 Ext2OEMToUnicodeSize( 2789 IN PEXT2_VCB Vcb, 2790 IN PANSI_STRING Oem 2791 ); 2792 2793 NTSTATUS 2794 Ext2OEMToUnicode( 2795 IN PEXT2_VCB Vcb, 2796 IN OUT PUNICODE_STRING Oem, 2797 IN POEM_STRING Unicode 2798 ); 2799 2800 ULONG 2801 Ext2UnicodeToOEMSize( 2802 IN PEXT2_VCB Vcb, 2803 IN PUNICODE_STRING Unicode 2804 ); 2805 2806 NTSTATUS 2807 Ext2UnicodeToOEM ( 2808 IN PEXT2_VCB Vcb, 2809 IN OUT POEM_STRING Oem, 2810 IN PUNICODE_STRING Unicode 2811 ); 2812 2813 VOID 2814 Ext2Sleep(ULONG ms); 2815 2816 int Ext2LinuxError (NTSTATUS Status); 2817 NTSTATUS Ext2WinntError(int rc); 2818 2819 BOOLEAN Ext2IsDot(PUNICODE_STRING name); 2820 BOOLEAN Ext2IsDotDot(PUNICODE_STRING name); 2821 // 2822 // nls/nls_rtl.c 2823 // 2824 2825 int 2826 Ext2LoadAllNls(); 2827 2828 VOID 2829 Ext2UnloadAllNls(); 2830 2831 // 2832 // Pnp.c 2833 // 2834 2835 NTSTATUS 2836 Ext2Pnp(IN PEXT2_IRP_CONTEXT IrpContext); 2837 2838 NTSTATUS 2839 Ext2PnpQueryRemove( 2840 PEXT2_IRP_CONTEXT IrpContext, 2841 PEXT2_VCB Vcb ); 2842 2843 NTSTATUS 2844 Ext2PnpRemove( 2845 PEXT2_IRP_CONTEXT IrpContext, 2846 PEXT2_VCB Vcb ); 2847 2848 NTSTATUS 2849 Ext2PnpCancelRemove( 2850 PEXT2_IRP_CONTEXT IrpContext, 2851 PEXT2_VCB Vcb ); 2852 2853 NTSTATUS 2854 Ext2PnpSurpriseRemove( 2855 PEXT2_IRP_CONTEXT IrpContext, 2856 PEXT2_VCB Vcb ); 2857 2858 2859 // 2860 // Read.c 2861 // 2862 2863 NTSTATUS 2864 Ext2ReadInode ( 2865 IN PEXT2_IRP_CONTEXT IrpContext, 2866 IN PEXT2_VCB Vcb, 2867 IN PEXT2_MCB Mcb, 2868 IN ULONGLONG Offset, 2869 IN PVOID Buffer, 2870 IN ULONG Size, 2871 IN BOOLEAN bDirectIo, 2872 OUT PULONG dwReturn 2873 ); 2874 2875 NTSTATUS 2876 Ext2Read (IN PEXT2_IRP_CONTEXT IrpContext); 2877 2878 2879 // 2880 // ext3\recover.c 2881 // 2882 2883 PEXT2_MCB 2884 Ext2LoadInternalJournal( 2885 PEXT2_VCB Vcb, 2886 ULONG jNo 2887 ); 2888 2889 INT 2890 Ext2CheckJournal( 2891 PEXT2_VCB Vcb, 2892 PULONG jNo 2893 ); 2894 2895 INT 2896 Ext2RecoverJournal( 2897 PEXT2_IRP_CONTEXT IrpContext, 2898 PEXT2_VCB Vcb 2899 ); 2900 2901 // 2902 // Shutdown.c 2903 // 2904 2905 2906 NTSTATUS 2907 Ext2ShutDown (IN PEXT2_IRP_CONTEXT IrpContext); 2908 2909 2910 // 2911 // Volinfo.c 2912 // 2913 2914 NTSTATUS 2915 Ext2QueryVolumeInformation (IN PEXT2_IRP_CONTEXT IrpContext); 2916 2917 NTSTATUS 2918 Ext2SetVolumeInformation (IN PEXT2_IRP_CONTEXT IrpContext); 2919 2920 // 2921 // Write.c 2922 // 2923 2924 typedef struct _EXT2_RW_CONTEXT { 2925 PIRP MasterIrp; 2926 KEVENT Event; 2927 ULONG Blocks; 2928 ULONG Length; 2929 PERESOURCE Resource; 2930 ERESOURCE_THREAD ThreadId; 2931 PFILE_OBJECT FileObject; 2932 ULONG Flags; 2933 BOOLEAN Wait; 2934 2935 } EXT2_RW_CONTEXT, *PEXT2_RW_CONTEXT; 2936 2937 #define EXT2_RW_CONTEXT_WRITE 1 2938 2939 NTSTATUS 2940 Ext2WriteInode ( 2941 IN PEXT2_IRP_CONTEXT IrpContext, 2942 IN PEXT2_VCB Vcb, 2943 IN PEXT2_MCB Mcb, 2944 IN ULONGLONG Offset, 2945 IN PVOID Buffer, 2946 IN ULONG Size, 2947 IN BOOLEAN bDirectIo, 2948 OUT PULONG dwReturn 2949 ); 2950 2951 VOID 2952 Ext2StartFloppyFlushDpc ( 2953 PEXT2_VCB Vcb, 2954 PEXT2_FCB Fcb, 2955 PFILE_OBJECT FileObject ); 2956 2957 BOOLEAN 2958 Ext2ZeroData ( 2959 IN PEXT2_IRP_CONTEXT IrpContext, 2960 IN PEXT2_VCB Vcb, 2961 IN PFILE_OBJECT FileObject, 2962 IN PLARGE_INTEGER Start, 2963 IN PLARGE_INTEGER End ); 2964 2965 NTSTATUS 2966 Ext2Write (IN PEXT2_IRP_CONTEXT IrpContext); 2967 2968 #endif /* _EXT2_HEADER_ */ 2969