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