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.

247 lines
5.1 KiB

  1. /*
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. fsd_vol.c
  5. Abstract:
  6. This module contains the entry points for the AFP volume APIs. The API
  7. dispatcher calls these. These are all callable from FSD.
  8. Author:
  9. Jameel Hyder (microsoft!jameelh)
  10. Revision History:
  11. 25 Apr 1992 Initial Version
  12. Notes: Tab stop: 4
  13. --*/
  14. #define FILENUM FILE_FSD_VOL
  15. #include <afp.h>
  16. #include <gendisp.h>
  17. /*** AfpFsdDispOpenVol
  18. *
  19. * This routine implements the AfpOpenVol API. This completes here i.e. it is
  20. * not queued up to the Fsp.
  21. *
  22. * The request packet is represented below.
  23. *
  24. * sda_ReqBlock DWORD Bitmap
  25. * sda_Name1 ANSI_STRING VolName
  26. * sda_Name2 ANSI_STRING VolPassword OPTIONAL
  27. */
  28. AFPSTATUS FASTCALL
  29. AfpFsdDispOpenVol(
  30. IN PSDA pSda
  31. )
  32. {
  33. AFPSTATUS Status;
  34. struct _RequestPacket
  35. {
  36. DWORD _Bitmap;
  37. };
  38. DBGPRINT(DBG_COMP_AFPAPI_VOL, DBG_LEVEL_INFO,
  39. ("AfpFsdDispOpenVol: Entered\n"));
  40. ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
  41. if (pSda->sda_Name1.Length > AFP_VOLNAME_LEN)
  42. {
  43. return AFP_ERR_PARAM;
  44. }
  45. pSda->sda_ReplySize = AfpVolumeGetParmsReplyLength(pReqPkt->_Bitmap,
  46. pSda->sda_Name1.Length);
  47. if ((Status = AfpAllocReplyBuf(pSda)) == AFP_ERR_NONE)
  48. {
  49. if (((Status = AfpConnectionOpen(pSda,
  50. &pSda->sda_Name1,
  51. &pSda->sda_Name2,
  52. pReqPkt->_Bitmap,
  53. pSda->sda_ReplyBuf)) != AFP_ERR_NONE) &&
  54. (Status != AFP_ERR_QUEUE))
  55. {
  56. AfpFreeReplyBuf(pSda, FALSE);
  57. }
  58. }
  59. // Change the worker routine if we need this to be queued.
  60. if (Status == AFP_ERR_QUEUE)
  61. pSda->sda_WorkerRoutine = AfpFspDispOpenVol;
  62. return Status;
  63. }
  64. /*** AfpFsdDispCloseVol
  65. *
  66. * This routine implements the AfpCloseVol API. This completes here i.e. it is
  67. * not queued up to the Fsp.
  68. *
  69. * The request packet is represented below.
  70. *
  71. * sda_ReqBlock PCONNDESC pConnDesc
  72. */
  73. AFPSTATUS FASTCALL
  74. AfpFsdDispCloseVol(
  75. IN PSDA pSda
  76. )
  77. {
  78. struct _RequestPacket
  79. {
  80. PCONNDESC _pConnDesc;
  81. };
  82. DBGPRINT(DBG_COMP_AFPAPI_VOL, DBG_LEVEL_INFO,
  83. ("AfpFsdDispCloseVol: Entered\n"));
  84. ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
  85. ASSERT(VALID_CONNDESC(pReqPkt->_pConnDesc) &&
  86. VALID_VOLDESC(pReqPkt->_pConnDesc->cds_pVolDesc));
  87. AfpConnectionClose(pReqPkt->_pConnDesc);
  88. return AFP_ERR_NONE;
  89. }
  90. /*** AfpFsdDispGetVolParms
  91. *
  92. * This routine implements the AfpGetVolParms API. This completes here i.e.
  93. * it is not queued up to the Fsp.
  94. *
  95. * The request packet is represented below.
  96. *
  97. * sda_ReqBlock DWORD VolId
  98. * sda_ReqBlock DWORD Bitmap
  99. */
  100. AFPSTATUS FASTCALL
  101. AfpFsdDispGetVolParms(
  102. IN PSDA pSda
  103. )
  104. {
  105. AFPSTATUS Status = AFP_ERR_PARAM;
  106. PVOLDESC pVolDesc;
  107. struct _RequestPacket
  108. {
  109. PCONNDESC _pConnDesc;
  110. DWORD _Bitmap;
  111. };
  112. DBGPRINT(DBG_COMP_AFPAPI_VOL, DBG_LEVEL_INFO,
  113. ("AfpFsdDispGetVolParms: Entered\n"));
  114. ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
  115. ASSERT(VALID_CONNDESC(pReqPkt->_pConnDesc) &&
  116. VALID_VOLDESC(pReqPkt->_pConnDesc->cds_pVolDesc));
  117. pVolDesc = pReqPkt->_pConnDesc->cds_pVolDesc;
  118. //
  119. // we need to update the diskquota for this user, if diskquota is enabled:
  120. // we are dpc here, so just queue this request
  121. //
  122. if (pVolDesc->vds_Flags & VOLUME_DISKQUOTA_ENABLED)
  123. {
  124. pSda->sda_WorkerRoutine = AfpFspDispGetVolParms;
  125. return(AFP_ERR_QUEUE);
  126. }
  127. pSda->sda_ReplySize = AfpVolumeGetParmsReplyLength(pReqPkt->_Bitmap,
  128. pReqPkt->_pConnDesc->cds_pVolDesc->vds_MacName.Length);
  129. if ((Status = AfpAllocReplyBuf(pSda)) == AFP_ERR_NONE)
  130. {
  131. AfpVolumePackParms(pSda, pVolDesc, pReqPkt->_Bitmap, pSda->sda_ReplyBuf);
  132. }
  133. return Status;
  134. }
  135. /*** AfpFsdDispSetVolParms
  136. *
  137. * This routine implements the AfpSetVolParms API. This completes here i.e.
  138. * it is not queued up to the Fsp.
  139. *
  140. * The request packet is represented below.
  141. *
  142. * sda_ReqBlock PCONNDESC pConnDesc
  143. * sda_ReqBlock DWORD Bitmap
  144. * sda_ReqBlock DWORD BackupTime
  145. */
  146. AFPSTATUS FASTCALL
  147. AfpFsdDispSetVolParms(
  148. IN PSDA pSda
  149. )
  150. {
  151. struct _RequestPacket
  152. {
  153. PCONNDESC _pConnDesc;
  154. DWORD _Bitmap;
  155. DWORD _BackupTime;
  156. };
  157. PVOLDESC pVolDesc;
  158. DBGPRINT(DBG_COMP_AFPAPI_VOL, DBG_LEVEL_INFO,
  159. ("AfpFsdDispSetVolParms: Entered\n"));
  160. ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
  161. ASSERT(VALID_CONNDESC(pReqPkt->_pConnDesc));
  162. pVolDesc = pReqPkt->_pConnDesc->cds_pVolDesc;
  163. ASSERT(VALID_VOLDESC(pVolDesc) & !IS_VOLUME_RO(pVolDesc));
  164. ACQUIRE_SPIN_LOCK_AT_DPC(&pVolDesc->vds_VolLock);
  165. pVolDesc->vds_BackupTime = pReqPkt->_BackupTime;
  166. pVolDesc->vds_Flags |= VOLUME_IDDBHDR_DIRTY;
  167. RELEASE_SPIN_LOCK_FROM_DPC(&pVolDesc->vds_VolLock);
  168. return AFP_ERR_NONE;
  169. }
  170. /*** AfpFsdDispFlush
  171. *
  172. * This routine implements the AfpFlush API. The only thing done here is
  173. * validation of the Volume Id. The call completes here i.e. it is not
  174. * queued up to the FSP.
  175. *
  176. * The request packet is represented below.
  177. *
  178. * sda_ReqBlock DWORD VolId
  179. */
  180. AFPSTATUS FASTCALL
  181. AfpFsdDispFlush(
  182. IN PSDA pSda
  183. )
  184. {
  185. struct _RequestPacket
  186. {
  187. PCONNDESC _pConnDesc;
  188. };
  189. ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
  190. DBGPRINT(DBG_COMP_AFPAPI_VOL, DBG_LEVEL_INFO,
  191. ("AfpFsdDispFlush: Entered\n"));
  192. ASSERT(VALID_CONNDESC(pReqPkt->_pConnDesc) &&
  193. VALID_VOLDESC(pReqPkt->_pConnDesc->cds_pVolDesc));
  194. return AFP_ERR_NONE;
  195. }
  196.