Leaked source code of windows server 2003
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.

343 lines
10 KiB

  1. /*++
  2. (c) 1998 Seagate Software, Inc. All rights reserved.
  3. Module Name:
  4. RpIo.h
  5. Abstract:
  6. Contains structure definitions for the interface between RsFilter and the Fsa
  7. Author:
  8. Rick Winter
  9. Environment:
  10. Kernel mode
  11. Revision History:
  12. X-10 244816 Michael C. Johnson 5-Dec-2000
  13. Change device name from \Device\RsFilter to \FileSystem\Filters\RsFilter
  14. --*/
  15. #define RS_FILTER_DEVICE_NAME L"\\FileSystem\\Filters\\RsFilter"
  16. #define RS_FILTER_INTERNAL_SYM_LINK L"\\??\\RsFilter"
  17. #define RS_FILTER_SYM_LINK L"\\\\.\\RsFilter"
  18. #define USER_NAME_LEN 128
  19. // The following messages pass between the WIN32 component (FsAgent)
  20. // and the File System Filter component (RsFilter.sys) via FSCTL calls.
  21. //
  22. // (See ntioapi.h for FSCTL defines FSCTL_HSM_MSG and FSCTL_HSM_DATA)
  23. //
  24. //
  25. // FSCTL_HSM_MSG
  26. //
  27. // Events are passed to user mode by completing the IRP for a RP_GET_REQUEST with the output buffer
  28. // containing the event information. The FsAgent issues several of these and waits for any of them to complete.
  29. //
  30. #define RP_GET_REQUEST 1
  31. //
  32. // FSCTL_HSM_DATA
  33. //
  34. //
  35. // Signals the completion of the data transfer for a recall.
  36. //
  37. #define RP_RECALL_COMPLETE 3
  38. //
  39. // FSCTL_HSM_DATA
  40. //
  41. //
  42. // Tells the filter to suspend recall events. Any file accesses that require offline data will return error.
  43. //
  44. #define RP_SUSPEND_NEW_RECALLS 4
  45. //
  46. // FSCTL_HSM_DATA
  47. //
  48. //
  49. // Tells the filter to resume recall events
  50. //
  51. #define RP_ALLOW_NEW_RECALLS 5
  52. //
  53. // FSCTL_HSM_DATA
  54. //
  55. //
  56. // Cancel all active recall requests. Any pending file io that requires offline data will return error.
  57. //
  58. #define RP_CANCEL_ALL_RECALLS 6
  59. //
  60. // FSCTL_HSM_DATA
  61. //
  62. //
  63. // Cancel all pending device io requests (RP_GET_REQUEST).
  64. //
  65. #define RP_CANCEL_ALL_DEVICEIO 7
  66. //
  67. // FSCTL_HSM_DATA
  68. //
  69. //
  70. // Returns variable size information for a recall request such as the file path and user information needed for recall notification.
  71. //
  72. #define RP_GET_RECALL_INFO 8
  73. //
  74. // FSCTL_HSM_DATA
  75. //
  76. //
  77. // Obosolete
  78. //
  79. #define RP_SET_ADMIN_SID 9
  80. //
  81. // FSCTL_HSM_DATA
  82. //
  83. //
  84. // Passes recall data for a portion of a file. The data will be written to the file or used to complete a read request, depending
  85. // on the type of recall.
  86. //
  87. #define RP_PARTIAL_DATA 10
  88. //
  89. // FSCTL_HSM_MSG
  90. //
  91. //
  92. // Returns TRUE if a given file is currently memory mapped.
  93. //
  94. #define RP_CHECK_HANDLE 11
  95. //
  96. // The following events are sent by the filter to the FSA (by completion of a RP_GET_REQUEST)
  97. //
  98. //
  99. // A file was opened for either a normal or FILE_OPEN_NO_RECALL access
  100. //
  101. #define RP_OPEN_FILE 20
  102. //
  103. // Offline data is required for this file. For a normal open this will initiate transfer of the complete file sequentially.
  104. // If the file was opened with FILE_OPEN_NO_RECALL this indicates the amount of data required and what portion of the file.
  105. //
  106. #define RP_RECALL_FILE 21
  107. //
  108. // Not used
  109. //
  110. #define RP_CLOSE_FILE 22
  111. //
  112. // A request for a recall was cancelled. The data is no longer required.
  113. //
  114. #define RP_CANCEL_RECALL 23
  115. //
  116. // A validate job should be run because some application other than HSM has written HSM reparse point information.
  117. //
  118. #define RP_RUN_VALIDATE 24
  119. //
  120. // Not used
  121. //
  122. #define RP_START_NOTIFY 25
  123. //
  124. // Not used
  125. //
  126. #define RP_END_NOTIFY 26
  127. //
  128. // Waiting for a recall
  129. //
  130. #define RP_RECALL_WAITING 27
  131. //
  132. // This information is returned information output buffer for a FSCTL messages issued by the FSA
  133. //
  134. //
  135. // RP_GET_REQUEST
  136. //
  137. // File open event. Sent when a placeholder is opened or when data is needed for a part of a file opened with FILE_OPEN_NO_RECALL
  138. // Data transfer does not start until _RP_NT_RECALL_REQUEST is sent.
  139. //
  140. // For normal opens this sets up the recall notification information.
  141. //
  142. typedef struct _RP_NT_OPEN_REQ {
  143. LUID userAuthentication; /* Unique to this instance of this user */
  144. LUID userInstance;
  145. LUID tokenSourceId;
  146. LARGE_INTEGER offset; /* Offset of data in the target file. */
  147. LARGE_INTEGER size; /* Number of bytes needed */
  148. //
  149. // If the file was opened by ID then it is either the file Id or an object ID. It is assumed
  150. // that one or the other will not be NULL.
  151. //
  152. LONGLONG fileId;
  153. LONGLONG objIdHi;
  154. LONGLONG objIdLo;
  155. ULONGLONG filterId; /* Unique ID (lives while file is open) */
  156. ULONG localProc; /* True if recall is from local process */
  157. ULONG userInfoLen; /* Size of SID info in bytes */
  158. ULONG isAdmin; /* TRUE = user is admin */
  159. ULONG nameLen; /* Size of file path\name (in CHARacters)*/
  160. ULONG options; /* Create options */
  161. ULONG action; /* RP_OPEN or RP_READ_NO_RECALL */
  162. ULONG serial; /* Serial number of volume */
  163. RP_DATA eaData; /* PH info from file */
  164. CHAR tokenSource[TOKEN_SOURCE_LENGTH];
  165. } RP_NT_OPEN_REQ, *PRP_NT_OPEN_REQ;
  166. //
  167. // Not used
  168. //
  169. typedef struct _RP_NT_CLOSE_REQ {
  170. ULONGLONG filterId; // Unique ID (lives while file is open)
  171. BOOLEAN wasModified; // TRUE if the file was modified by the user.
  172. } RP_NT_CLOSE_REQ, *PRP_NT_CLOSE_REQ;
  173. //
  174. // RP_GET_REQUEST
  175. //
  176. //
  177. // Recall request - for previously opened file. This initiates the data transfer from secondary
  178. // storage to the file.
  179. //
  180. typedef struct _RP_NT_RECALL_REQ {
  181. ULONGLONG filterId; // Unique ID passed to FSA by open request.
  182. ULONGLONG offset; // Offset to recall from
  183. ULONGLONG length; // Length of recall
  184. ULONG threadId; // id of thread causing recall
  185. } RP_NT_RECALL_REQ, *PRP_NT_RECALL_REQ;
  186. //
  187. // Not used - Start recall notification for this user.
  188. //
  189. typedef struct _RP_NT_START_NOTIFY {
  190. ULONGLONG filterId; // Unique ID passed to FSA by open request.
  191. } RP_NT_START_NOTIFY, *PRP_NT_START_NOTIFY;
  192. // End recall notification for this user.
  193. //
  194. typedef struct _RP_NT_END_NOTIFY {
  195. ULONGLONG filterId; // Unique ID passed to FSA by open request.
  196. } RP_NT_END_NOTIFY, *PRP_NT_END_NOTIFY;
  197. //
  198. // RP_RECALL_COMPLETE
  199. //
  200. // Recall completion information.
  201. //
  202. typedef struct _RP_NT_RECALL_REP {
  203. ULONGLONG filterId; // Unique ID
  204. BOOLEAN recallCompleted; // TRUE if data has been transferred - false if open processing complete
  205. ULONG actionFlags; // See below
  206. } RP_NT_RECALL_REP, *PRP_NT_RECALL_REP;
  207. //
  208. // Action flags for recall completion
  209. //
  210. #define RP_RECALL_ACTION_TRUNCATE 1 // Truncate on close - **** Not currently implemented ****
  211. //
  212. // RP_PARTIAL_DATA
  213. //
  214. // Partial data recall reply. Used by both normal recalls and FILE_OPEN_NO_RECALL to transfer some
  215. // or all of the data requested. The filter knows (by the id) what to do with the data.
  216. //
  217. typedef struct _RP_NT_PARTIAL_REP {
  218. ULONGLONG filterId; // Unique ID
  219. ULONG bytesRead; // Number of bytes read (partial recalls)
  220. ULONGLONG byteOffset; // Offset of this data chunk
  221. ULONG offsetToData; // Offset to the data - must be aligned for non-cached writes
  222. } RP_NT_PARTIAL_REP, *PRP_NT_PARTIAL_REP;
  223. //
  224. // RP_GET_RECALL_INFO
  225. //
  226. // The following message is used to get the recall information that is
  227. // variable in size. The offset in the structure for userToken marks the
  228. // beginning of the SID info. After the SID the UNICODE file name can be
  229. // found. The size of the SID and file name is returned on the recall
  230. // request. Note that the size of the file path\name is in CHARacters.
  231. // Since these are UNICODE CHARacters the actual buffer size in bytes is
  232. // 2 times the file name length.
  233. typedef struct _RP_NT_INFO_REQ {
  234. ULONGLONG filterId; // Unique ID
  235. LONGLONG fileId; // File ID
  236. CHAR userToken; // Actual size varies
  237. CHAR unicodeName; // Actual size varies
  238. } RP_NT_INFO_REQ, *PRP_NT_INFO_REQ;
  239. typedef struct _RP_NT_SET_SID {
  240. CHAR adminSid; // Actual size varies
  241. } RP_NT_SET_SID, *PRP_NT_SET_SID;
  242. //
  243. // RP_GET_REQUEST
  244. //
  245. // Recall cancelled message.
  246. // Sent when the Irp for a pending recall is cancelled.
  247. // No reply expected.
  248. //
  249. typedef struct _RP_NT_RECALL_CANCEL_REQ {
  250. ULONGLONG filterId; /* Unique ID from original recall request */
  251. } RP_NT_RECALL_CANCEL_REQ, *PRP_NT_RECALL_CANCEL_REQ;
  252. //
  253. // RP_GET_RECALL_INFO
  254. //
  255. // Returns TRUE or FALSE based on check if file is memory mapped
  256. //
  257. typedef struct _RP_CHECK_HANDLE_REP {
  258. BOOLEAN canTruncate;
  259. } RP_CHECK_HANDLE_REP, *PRP_CHECK_HANDLE_REP;
  260. #define RP_MAX_MSG 1024 /* Max data size */
  261. /* A pad to set the union size */
  262. typedef struct _RP_NT_MSG_PAD {
  263. CHAR padd[RP_MAX_MSG];
  264. } RP_NT_MSG_PAD, *PRP_NT_MSG_PAD;
  265. /* Union of possible commands */
  266. typedef union _RP_MSG_UN {
  267. RP_NT_OPEN_REQ oReq;
  268. RP_NT_CLOSE_REQ clReq;
  269. RP_NT_START_NOTIFY snReq;
  270. RP_NT_END_NOTIFY enReq;
  271. RP_NT_RECALL_REQ rReq;
  272. RP_NT_RECALL_REP rRep;
  273. RP_NT_PARTIAL_REP pRep;
  274. RP_NT_INFO_REQ riReq;
  275. RP_NT_SET_SID sReq;
  276. RP_NT_RECALL_CANCEL_REQ cReq;
  277. RP_CHECK_HANDLE_REP hRep;
  278. RP_NT_MSG_PAD pad;
  279. } RP_MSG_UN, *PRP_MSG_UN;
  280. typedef struct _RP_CMD {
  281. ULONG command; /* Requested function */
  282. ULONG status; /* Result code */
  283. } RP_CMD, *PRP_CMD;
  284. typedef struct _RP_MSG {
  285. RP_CMD inout;
  286. RP_MSG_UN msg;
  287. } RP_MSG, *PRP_MSG;