Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

184 lines
4.6 KiB

  1. /*++
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. Shutdown.c
  5. Abstract:
  6. This module implements the file system shutdown routine for Rx
  7. Author:
  8. Gary Kimura [GaryKi] 19-Aug-1991
  9. Revision History:
  10. DANGER DANGER DANGER
  11. THIS IS THE OLD FAT CODE....MINIMAL MODIFICATIONS HAVE BEEN MADE TO MAKE IT COMPILE.........
  12. CODE.IMPROVEMENT
  13. --*/
  14. #include "precomp.h"
  15. #pragma hdrstop
  16. #define RxFlushVolume( __x, __y) (RtlAssert("dont call rxflushvolume", __FILE__, __LINE__, NULL))
  17. //
  18. // Local debug trace level
  19. //
  20. #define Dbg (DEBUG_TRACE_SHUTDOWN)
  21. #ifdef ALLOC_PRAGMA
  22. #pragma alloc_text(PAGE, RxCommonShutdown)
  23. #endif
  24. NTSTATUS
  25. RxCommonShutdown ( RXCOMMON_SIGNATURE )
  26. /*++
  27. Routine Description:
  28. This is the common routine for shutdown called by both the fsd and
  29. fsp threads.
  30. Arguments:
  31. Irp - Supplies the Irp being processed
  32. Return Value:
  33. RXSTATUS - The return status for the operation
  34. --*/
  35. {
  36. //PKEVENT Event;
  37. //PLIST_ENTRY Links;
  38. //PVCB Vcb;
  39. //PIRP NewIrp;
  40. //IO_STATUS_BLOCK Iosb;
  41. PAGED_CODE();
  42. //
  43. // Make sure we don't get any pop-ups, and write everything through.
  44. //
  45. ASSERT(!"Shutdown is not implemented");
  46. #if 0
  47. //BUGBUG
  48. // we should do a forced finalize here! i wonder what rdr1 does...............
  49. SetFlag(RxContext->Flags, RX_CONTEXT_FLAG_DISABLE_POPUPS |
  50. RX_CONTEXT_FLAG_WRITE_THROUGH);
  51. //
  52. // Allocate an initialize an event for doing calls down to
  53. // our target deivce objects
  54. //
  55. Event = RxAllocatePoolWithTag( NonPagedPool, sizeof(KEVENT), RX_MISC_POOLTAG );
  56. KeInitializeEvent( Event, NotificationEvent, FALSE );
  57. //
  58. // Get everyone else out of the way
  59. //
  60. (VOID) RxAcquireExclusiveGlobal( RxContext );
  61. try {
  62. //
  63. // For every volume that is mounted we will flush the
  64. // volume and then shutdown the target device objects.
  65. //
  66. for (Links = RxData.VcbQueue.Flink;
  67. Links != &RxData.VcbQueue;
  68. Links = Links->Flink) {
  69. Vcb = CONTAINING_RECORD(Links, VCB, VcbLinks);
  70. //
  71. // If we have already been called before for this volume
  72. // (and yes this does happen), skip this volume as no writes
  73. // have been allowed since the first shutdown.
  74. //
  75. if ( FlagOn( Vcb->VcbState, VCB_STATE_FLAG_SHUTDOWN) ||
  76. (Vcb->VcbCondition != VcbGood) ) {
  77. continue;
  78. }
  79. //joejoe an underlying routine for this macro has been removed
  80. // this code is never executed in the remote case because we never haver a
  81. // VCB queue formed!
  82. //RxAcquireExclusiveVolume( RxContext, Vcb );
  83. try {
  84. if ( (Vcb->VcbCondition == VcbGood) &&
  85. (!FlagOn(Vcb->VcbState, VCB_STATE_FLAG_FLOPPY)) ) {
  86. (VOID)RxFlushVolume( RxContext, Vcb );
  87. NewIrp = IoBuildSynchronousFsdRequest( IRP_MJ_SHUTDOWN,
  88. Vcb->TargetDeviceObject,
  89. NULL,
  90. 0,
  91. NULL,
  92. Event,
  93. &Iosb );
  94. if (NewIrp != NULL) {
  95. if (NT_SUCCESS(IoCallDriver( Vcb->TargetDeviceObject, NewIrp ))) {
  96. (VOID) KeWaitForSingleObject( Event,
  97. Executive,
  98. KernelMode,
  99. FALSE,
  100. NULL );
  101. (VOID) KeResetEvent( Event );
  102. }
  103. }
  104. }
  105. } except( EXCEPTION_EXECUTE_HANDLER ) {
  106. NOTHING;
  107. }
  108. SetFlag( Vcb->VcbState, VCB_STATE_FLAG_SHUTDOWN );
  109. //joejoe see comment above
  110. //RxReleaseVolume( RxContext, Vcb );
  111. }
  112. } finally {
  113. RxFreePool( Event );
  114. RxReleaseGlobal( RxContext );
  115. //RxCompleteRequest( RxContext, RxStatus(SUCCESS) );
  116. }
  117. //
  118. // And return to our caller
  119. //
  120. #endif
  121. //RxCompleteRequest( RxContext, RxStatus(SUCCESS) );
  122. return STATUS_SUCCESS;
  123. }
  124.