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.

176 lines
4.2 KiB

  1. /*++
  2. Copyright (c) 1996-2001 Microsoft Corporation
  3. Module Name:
  4. QfsTrans.h
  5. Abstract:
  6. Qfs interface between clussvc and resmon
  7. Author:
  8. GorN 19-Sep-2001
  9. Revision History:
  10. --*/
  11. #ifndef _QFSP_H_INCLUDED
  12. #define _QFSP_H_INCLUDED
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. #define QFS_TRANSPORT_ver_1_0 L"28490381-dc1f-4ea2-b593-f8ca3f119dc4"
  17. #define QfsMakePipeName(ver) L"\\\\.\\pipe\\" ver
  18. #define QFSP_INSERT_OP_NAMES \
  19. OPNAME(None) \
  20. OPNAME(CreateFile) \
  21. OPNAME(CloseFile) \
  22. OPNAME(ReadFile) \
  23. OPNAME(WriteFile) \
  24. OPNAME(FlushFile) \
  25. OPNAME(DeleteFile) \
  26. OPNAME(FindFirstFile) \
  27. OPNAME(FindNextFile) \
  28. OPNAME(FindClose) \
  29. OPNAME(CreateDir) \
  30. OPNAME(GetDiskFreeSpace) \
  31. OPNAME(GetAttr) \
  32. OPNAME(SetAttr2) \
  33. OPNAME(Rename) \
  34. OPNAME(Connect)
  35. #define OPNAME(Name) op ## Name,
  36. typedef enum _JobDescription_t{
  37. QFSP_INSERT_OP_NAMES
  38. OpCount
  39. } JobDescription_t;
  40. #undef OPNAME
  41. typedef struct _JobBuf_header{
  42. DWORD OpCode;
  43. DWORD Status;
  44. DWORD BufLen;
  45. DWORD Reserved;
  46. } JOBBUF_HEADER;
  47. #define JOB_BUF_MAX_BUFFER (32 * 1024)
  48. typedef struct _JobBuf{
  49. JOBBUF_HEADER hdr;
  50. ULONGLONG Offset;
  51. PVOID ServerCookie;
  52. PVOID ClientCookie;
  53. HANDLE Handle;
  54. union {
  55. struct { // CreateFile
  56. DWORD dwDesiredAccess;
  57. DWORD dwShareMode;
  58. DWORD dwCreationDisposition;
  59. DWORD dwFlagsAndAttributes;
  60. };
  61. struct { // GetDiskFreeSpace
  62. ULONGLONG FreeBytesAvailable; // bytes available to caller
  63. ULONGLONG TotalNumberOfBytes; // bytes on disk
  64. ULONGLONG TotalNumberOfFreeBytes; // free bytes on disk
  65. };
  66. struct { // GetAttr
  67. ULONGLONG EndOfFile;
  68. ULONGLONG AllocationSize;
  69. ULONGLONG CreationTime;
  70. ULONGLONG LastAccessTime;
  71. ULONGLONG LastWriteTime;
  72. DWORD FileAttributes;
  73. };
  74. DWORD ClussvcProcessId; // Cluster Service Process ID.
  75. };
  76. USHORT cbSize;
  77. USHORT ccSize;
  78. union {
  79. UCHAR Buffer[JOB_BUF_MAX_BUFFER];
  80. struct {
  81. WCHAR FileName[JOB_BUF_MAX_BUFFER / 2 / sizeof(WCHAR)];
  82. WCHAR FileNameDest[JOB_BUF_MAX_BUFFER / 2 / sizeof(WCHAR)];
  83. };
  84. WIN32_FIND_DATA FindFileData;
  85. };
  86. } JobBuf_t, *PJOB_BUF, JOB_BUF;
  87. typedef struct _MTHREAD_COUNTER {
  88. HANDLE LastThreadLeft;
  89. LONG Count;
  90. } MTHREAD_COUNTER, *PMTHREAD_COUNTER;
  91. typedef struct _SHARED_MEM_CONTEXT {
  92. HANDLE FileHandle;
  93. HANDLE FileMappingHandle;
  94. PVOID Mem;
  95. DWORD MappingSize;
  96. } SHARED_MEM_CONTEXT, *PSHARED_MEM_CONTEXT;
  97. enum {MAX_JOB_BUFFERS = 32};
  98. typedef VOID (*DoRealWorkCallback) (PJOB_BUF, PVOID);
  99. typedef struct _SHARED_MEM_SERVER {
  100. SHARED_MEM_CONTEXT ShMem;
  101. HANDLE Attention; // copy of EventHandle[0]
  102. HANDLE GoingOffline; // copy of EventHandle[1]
  103. HANDLE* BufferReady; // EventHandle + 2
  104. HANDLE EventHandles[MAX_JOB_BUFFERS + 2];
  105. DWORD nBuffers;
  106. JOB_BUF* JobBuffers;
  107. LONG volatile* FilledBuffersMask;
  108. // client specific stuff
  109. CRITICAL_SECTION Lock;
  110. ULONG ConnectionRefcount;
  111. HANDLE FreeBufferCountSemaphore;
  112. HANDLE ServerProcess;
  113. DWORD BusyBuffers;
  114. DWORD State;
  115. HANDLE GoingOfflineWaitRegistration;
  116. HANDLE ServerProcessWaitRegistration;
  117. // server specific stuff
  118. HANDLE AttentionWaitRegistration;
  119. MTHREAD_COUNTER ThreadCounter;
  120. DoRealWorkCallback DoRealWork;
  121. PVOID DoRealWorkContext;
  122. } SHARED_MEM_SERVER, *PSHARED_MEM_SERVER;
  123. DWORD MemServer_Online(
  124. PSHARED_MEM_SERVER Server,
  125. int nBuffers,
  126. DoRealWorkCallback DoRealWork,
  127. PVOID DoRealWorkContext);
  128. VOID MemServer_Offline(PSHARED_MEM_SERVER Server);
  129. DWORD MemClient_Init(PSHARED_MEM_SERVER Client);
  130. VOID MemClient_Cleanup(PSHARED_MEM_SERVER Client);
  131. DWORD MemClient_ReserveBuffer(PSHARED_MEM_SERVER Client, PJOB_BUF *j);
  132. VOID MemClient_Release(PJOB_BUF j);
  133. DWORD MemClient_DeliverBuffer(PJOB_BUF j);
  134. #ifdef __cplusplus
  135. };
  136. #endif
  137. #endif