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