ReactOS 0.4.15-dev-7918-g2a2556c
shutdown.c File Reference
#include "ext2fs.h"
Include dependency graph for shutdown.c:

Go to the source code of this file.

Functions

NTSTATUS Ext2ShutDown (IN PEXT2_IRP_CONTEXT IrpContext)
 

Variables

PEXT2_GLOBAL Ext2Global
 

Function Documentation

◆ Ext2ShutDown()

NTSTATUS Ext2ShutDown ( IN PEXT2_IRP_CONTEXT  IrpContext)

Definition at line 25 of file shutdown.c.

26{
28
29 PIRP Irp;
30
32 PLIST_ENTRY ListEntry;
33
34 BOOLEAN GlobalResourceAcquired = FALSE;
35
36 _SEH2_TRY {
37
39
40 ASSERT(IrpContext);
41 ASSERT((IrpContext->Identifier.Type == EXT2ICX) &&
42 (IrpContext->Identifier.Size == sizeof(EXT2_IRP_CONTEXT)));
43
44 Irp = IrpContext->Irp;
45
48 IsFlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT) )) {
51 }
52
53 GlobalResourceAcquired = TRUE;
54
55 for (ListEntry = Ext2Global->VcbList.Flink;
56 ListEntry != &(Ext2Global->VcbList);
57 ListEntry = ListEntry->Flink ) {
58
59 Vcb = CONTAINING_RECORD(ListEntry, EXT2_VCB, Next);
60
62 &Vcb->MainResource,
63 TRUE )) {
64
65 if (IsMounted(Vcb)) {
66
67 /* update mount count */
68 Vcb->SuperBlock->s_mnt_count++;
69 if (Vcb->SuperBlock->s_mnt_count >
70 Vcb->SuperBlock->s_max_mnt_count ) {
71 Vcb->SuperBlock->s_mnt_count =
72 Vcb->SuperBlock->s_max_mnt_count;
73 }
74 Ext2SaveSuper(IrpContext, Vcb);
75
76 /* flush dirty cache for all files */
77 Status = Ext2FlushFiles(IrpContext, Vcb, TRUE);
78 if (!NT_SUCCESS(Status)) {
79 DbgBreak();
80 }
81
82 /* flush volume stream's cache to disk */
83 Status = Ext2FlushVolume(IrpContext, Vcb, TRUE);
84
86 DbgBreak();
87 }
88
89 /* send shutdown request to underlying disk */
91 }
92
93 ExReleaseResourceLite(&Vcb->MainResource);
94 }
95 }
96
97 /*
98 IoUnregisterFileSystem(Ext2Global->DiskdevObject);
99 IoUnregisterFileSystem(Ext2Global->CdromdevObject);
100 */
101
102 } _SEH2_FINALLY {
103
104 if (GlobalResourceAcquired) {
106 }
107
108 if (!IrpContext->ExceptionInProgress) {
109 if (Status == STATUS_PENDING) {
110 Ext2QueueRequest(IrpContext);
111 } else {
112 Ext2CompleteIrpContext(IrpContext, Status);
113 }
114 }
115 } _SEH2_END;
116
117 return Status;
118}
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
#define IRP_CONTEXT_FLAG_WAIT
Definition: cdstruc.h:1215
_In_ PIRP Irp
Definition: csq.h:116
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
PEXT2_GLOBAL Ext2Global
Definition: init.c:16
#define ExAcquireResourceExclusiveLite(res, wait)
Definition: env_spec_w32.h:615
@ EXT2ICX
Definition: ext2fs.h:465
#define IsMounted(Vcb)
Definition: ext2fs.h:812
NTSTATUS Ext2QueueRequest(IN PEXT2_IRP_CONTEXT IrpContext)
Definition: dispatch.c:158
BOOLEAN Ext2SaveSuper(IN PEXT2_IRP_CONTEXT IrpContext, IN PEXT2_VCB Vcb)
Definition: generic.c:67
NTSTATUS Ext2DiskShutDown(PEXT2_VCB Vcb)
Definition: block.c:748
#define DbgBreak()
Definition: ext2fs.h:46
NTSTATUS Ext2CompleteIrpContext(IN PEXT2_IRP_CONTEXT IrpContext, IN NTSTATUS Status)
Definition: read.c:32
NTSTATUS Ext2FlushFiles(IN PEXT2_IRP_CONTEXT IrpContext, IN PEXT2_VCB Vcb, IN BOOLEAN bShutDown)
Definition: flush.c:112
NTSTATUS Ext2FlushVolume(IN PEXT2_IRP_CONTEXT IrpContext, IN PEXT2_VCB Vcb, IN BOOLEAN bShutDown)
Definition: flush.c:43
#define IsFlagOn(a, b)
Definition: ext2fs.h:177
#define _SEH2_FINALLY
Definition: filesup.c:21
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
#define _SEH2_LEAVE
Definition: filesup.c:20
Status
Definition: gdiplustypes.h:25
#define ASSERT(a)
Definition: mode.c:44
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1822
#define STATUS_PENDING
Definition: ntstatus.h:82
#define Vcb
Definition: cdprocs.h:1415
#define STATUS_SUCCESS
Definition: shellext.h:65
ERESOURCE Resource
Definition: ext2fs.h:519
LIST_ENTRY VcbList
Definition: ext2fs.h:545
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
#define STATUS_MEDIA_WRITE_PROTECTED
Definition: udferr_usr.h:161

Referenced by Ext2DispatchRequest().

Variable Documentation

◆ Ext2Global

PEXT2_GLOBAL Ext2Global
extern

Definition at line 16 of file init.c.

Referenced by Ext2ShutDown().