ReactOS  0.4.14-dev-376-gaedba84
shutdown.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: GNU GENERAL PUBLIC LICENSE VERSION 2
3  * PROJECT: ReiserFs file system driver for Windows NT/2000/XP/Vista.
4  * FILE: shutdown.c
5  * PURPOSE:
6  * PROGRAMMER: Mark Piper, Matt Wu, Bo BrantÚn.
7  * HOMEPAGE:
8  * UPDATE HISTORY:
9  */
10 
11 /* INCLUDES *****************************************************************/
12 
13 #include "rfsd.h"
14 
15 /* GLOBALS ***************************************************************/
16 
18 
19 /* DEFINITIONS *************************************************************/
20 
21 #ifdef ALLOC_PRAGMA
22 #pragma alloc_text(PAGE, RfsdShutDown)
23 #endif
24 
28 {
30 #ifndef __REACTOS__
31  PKEVENT Event;
32 #endif
33  PIRP Irp;
35  PRFSD_VCB Vcb;
36  PLIST_ENTRY ListEntry;
37  BOOLEAN GlobalResourceAcquired = FALSE;
38 
39  PAGED_CODE();
40 
41  _SEH2_TRY {
42 
43  ASSERT(IrpContext);
44 
45  ASSERT((IrpContext->Identifier.Type == RFSDICX) &&
46  (IrpContext->Identifier.Size == sizeof(RFSD_IRP_CONTEXT)));
47 
49 
50  Irp = IrpContext->Irp;
51 
53 
54 #ifdef _MSC_VER
55 #pragma prefast( suppress: 28137, "by design" )
56 #endif
59  IrpContext->IsSynchronous )) {
62  }
63 
64  GlobalResourceAcquired = TRUE;
65 
66 #ifndef __REACTOS__
69 #endif
70 
71  for (ListEntry = RfsdGlobal->VcbList.Flink;
72  ListEntry != &(RfsdGlobal->VcbList);
73  ListEntry = ListEntry->Flink ) {
74 
75  Vcb = CONTAINING_RECORD(ListEntry, RFSD_VCB, Next);
76 
78  &Vcb->MainResource,
79  TRUE )) {
80 
82  if(!NT_SUCCESS(Status)) {
83  DbgBreak();
84  }
85 
87 
88  if(!NT_SUCCESS(Status)) {
89  DbgBreak();
90  }
91 
93 
95  &Vcb->MainResource,
97  }
98  }
99 
100 /*
101  IoUnregisterFileSystem(RfsdGlobal->DeviceObject);
102 */
103  } _SEH2_FINALLY {
104 
105  if (GlobalResourceAcquired) {
109  }
110 
111  if (!IrpContext->ExceptionInProgress) {
112  if (Status == STATUS_PENDING) {
113  RfsdQueueRequest(IrpContext);
114  } else {
115  RfsdCompleteIrpContext(IrpContext, Status);
116  }
117  }
118  } _SEH2_END;
119 
120  return Status;
121 }
#define ExGetCurrentResourceThread()
Definition: env_spec_w32.h:633
#define IN
Definition: typedefs.h:38
NTSTATUS RfsdCompleteIrpContext(IN PRFSD_IRP_CONTEXT IrpContext, IN NTSTATUS Status)
Definition: memory.c:160
#define TRUE
Definition: types.h:120
NTSTATUS RfsdDiskShutDown(PRFSD_VCB Vcb)
Definition: blockio.c:631
#define __drv_mustHoldCriticalRegion
Definition: ffsdrv.h:34
_In_ PIRP Irp
Definition: csq.h:116
LONG NTSTATUS
Definition: precomp.h:26
#define RFSD_POOL_TAG
Definition: rfsd.h:99
NTSTATUS RfsdFlushVolume(IN PRFSD_VCB Vcb, BOOLEAN bShutDown)
Definition: flush.c:97
NTSTATUS RfsdFlushFiles(IN PRFSD_VCB Vcb, BOOLEAN bShutDown)
Definition: flush.c:51
LIST_ENTRY VcbList
Definition: rfsd.h:410
NTSTATUS RfsdQueueRequest(IN PRFSD_IRP_CONTEXT IrpContext)
Definition: dispatch.c:29
PRFSD_GLOBAL RfsdGlobal
Definition: init.c:17
#define PAGED_CODE()
Definition: video.h:57
_SEH2_TRY
Definition: create.c:4250
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:435
unsigned char BOOLEAN
Definition: rfsd.h:326
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
#define Vcb
Definition: cdprocs.h:1425
ERESOURCE Resource
Definition: rfsd.h:388
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
Definition: typedefs.h:117
Status
Definition: gdiplustypes.h:24
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
_SEH2_END
Definition: create.c:4424
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4157
_SEH2_FINALLY
Definition: create.c:4395
#define DbgBreak()
Definition: ext2fs.h:46
VOID NTAPI ExReleaseResourceForThreadLite(IN PERESOURCE Resource, IN ERESOURCE_THREAD Thread)
Definition: resource.c:1844
#define _SEH2_LEAVE
Definition: filesup.c:20
return STATUS_SUCCESS
Definition: btrfs.c:2938
__drv_mustHoldCriticalRegion NTSTATUS RfsdShutDown(IN PRFSD_IRP_CONTEXT IrpContext)
Definition: shutdown.c:27