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.

234 lines
3.3 KiB

  1. /*++
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. ResrcSup.c
  5. Abstract:
  6. This module implements the NamedPipe Resource acquisition routines
  7. Author:
  8. Gary Kimura [GaryKi] 22-Mar-1990
  9. Revision History:
  10. --*/
  11. #include "NpProcs.h"
  12. //
  13. // The debug trace level
  14. //
  15. #define Dbg (DEBUG_TRACE_RESRCSUP)
  16. #ifdef ALLOC_PRAGMA
  17. #pragma alloc_text(PAGE, NpAcquireExclusiveCcb)
  18. #pragma alloc_text(PAGE, NpAcquireExclusiveVcb)
  19. #pragma alloc_text(PAGE, NpAcquireSharedCcb)
  20. #pragma alloc_text(PAGE, NpAcquireSharedVcb)
  21. #pragma alloc_text(PAGE, NpReleaseCcb)
  22. #pragma alloc_text(PAGE, NpReleaseVcb)
  23. #endif
  24. VOID
  25. NpAcquireExclusiveVcb (
  26. )
  27. /*++
  28. Routine Description:
  29. This routine acquires exclusive access to the Vcb
  30. Arguments:
  31. Return Value:
  32. None.
  33. --*/
  34. {
  35. PAGED_CODE();
  36. DebugTrace(+1, Dbg, "NpAcquireExclusiveVcb\n", 0);
  37. ExAcquireResourceExclusive( &(NpVcb->Resource), TRUE );
  38. DebugTrace(-1, Dbg, "NpAcquireExclusiveVcb -> (VOID)\n", 0);
  39. return;
  40. }
  41. VOID
  42. NpAcquireSharedVcb (
  43. )
  44. /*++
  45. Routine Description:
  46. This routine acquires shared access to the Vcb
  47. Arguments:
  48. Return Value:
  49. None.
  50. --*/
  51. {
  52. PAGED_CODE();
  53. DebugTrace(+1, Dbg, "NpAcquireSharedVcb\n", 0);
  54. ExAcquireResourceShared( &(NpVcb->Resource), TRUE );
  55. DebugTrace(-1, Dbg, "NpAcquireSharedVcb -> (VOID)\n", 0);
  56. return;
  57. }
  58. VOID
  59. NpAcquireExclusiveCcb (
  60. IN PNONPAGED_CCB NonpagedCcb
  61. )
  62. /*++
  63. Routine Description:
  64. This routine acquires exclusive access to the Ccb by first getting
  65. shared access to the Fcb.
  66. Arguments:
  67. NonpagedCcb - Supplies the Ccb to acquire
  68. Return Value:
  69. None.
  70. --*/
  71. {
  72. PAGED_CODE();
  73. DebugTrace(+1, Dbg, "NpAcquireExclusiveCcb, NonpagedCcb = %08lx\n", NonpagedCcb);
  74. (VOID)ExAcquireResourceShared( &(NpVcb->Resource), TRUE );
  75. (VOID)ExAcquireResourceExclusive( &(NonpagedCcb->Resource), TRUE );
  76. DebugTrace(-1, Dbg, "NpAcquireExclusiveCcb -> (VOID)\n", 0);
  77. return;
  78. }
  79. VOID
  80. NpAcquireSharedCcb (
  81. IN PNONPAGED_CCB NonpagedCcb
  82. )
  83. /*++
  84. Routine Description:
  85. This routine acquires shared access to the Ccb by first getting
  86. shared access to the Fcb.
  87. Arguments:
  88. NonpagedCcb - Supplies the Ccb to acquire
  89. Return Value:
  90. None.
  91. --*/
  92. {
  93. PAGED_CODE();
  94. DebugTrace(+1, Dbg, "NpAcquireSharedCcb, NonpagedCcb = %08lx\n", NonpagedCcb);
  95. (VOID)ExAcquireResourceShared( &(NpVcb->Resource), TRUE );
  96. (VOID)ExAcquireResourceShared( &(NonpagedCcb->Resource), TRUE );
  97. DebugTrace(-1, Dbg, "NpAcquireSharedCcb -> (VOID)\n", 0);
  98. return;
  99. }
  100. VOID
  101. NpReleaseVcb (
  102. )
  103. /*++
  104. Routine Description:
  105. This routine releases access to the Vcb
  106. Arguments:
  107. Return Value:
  108. None.
  109. --*/
  110. {
  111. PAGED_CODE();
  112. DebugTrace(0, Dbg, "NpReleaseVcb\n", 0);
  113. ExReleaseResource( &(NpVcb->Resource) );
  114. return;
  115. }
  116. VOID
  117. NpReleaseCcb (
  118. IN PNONPAGED_CCB NonpagedCcb
  119. )
  120. /*++
  121. Routine Description:
  122. This routine releases access to the Ccb
  123. Arguments:
  124. Ccb - Supplies the Ccb being released
  125. Return Value:
  126. None.
  127. --*/
  128. {
  129. PAGED_CODE();
  130. DebugTrace(0, Dbg, "NpReleaseCcb, NonpagedCcb = %08lx\n", NonpagedCcb);
  131. ExReleaseResource( &(NonpagedCcb->Resource) );
  132. ExReleaseResource( &(NpVcb->Resource) );
  133. return;
  134. }