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.

2507 lines
52 KiB

  1. #ifndef _FMP_H
  2. #define _FMP_H
  3. /*++
  4. Copyright (c) 1996-1999 Microsoft Corporation
  5. Module Name:
  6. fmp.h
  7. Abstract:
  8. Private data structures and procedure prototypes for
  9. the Failover Manager subcomponent of the NT Cluster
  10. Service
  11. Author:
  12. John Vert (jvert) 7-Feb-1996
  13. Revision History:
  14. --*/
  15. #define UNICODE 1
  16. #include "nt.h"
  17. #include "ntrtl.h"
  18. #include "nturtl.h"
  19. #define QFS_DO_NOT_UNMAP_WIN32
  20. #include "service.h"
  21. #include "clusudef.h"
  22. #include "rm_rpc.h"
  23. #include "stdlib.h"
  24. #define LOG_CURRENT_MODULE LOG_MODULE_FM
  25. #define FMGUM 1
  26. #define RMNOTIFY 2
  27. #define RESOURCE 3
  28. #define FMAPI 4
  29. #define GROUP 5
  30. #define RECV 6
  31. #define EVENT 7
  32. #define FMCLIENT 8
  33. #define TREE 9
  34. #define FMINIT 10
  35. #define IOCTL 11
  36. #define FMREG 12
  37. #define RESMONF 13 //for resmon.c
  38. #define WORKER 14
  39. #define RESFAIL 15
  40. #define GROUPARB 16
  41. #define MONITOR 17
  42. //
  43. // RPC timeout constant (borrowed from nmp.h)
  44. // Node Intracluster RPC record/cancellation routines.
  45. // Useful to terminate outstanding RPCs to failed nodes.
  46. //
  47. #define FM_RPC_TIMEOUT 45000 // 45 secs
  48. //
  49. // Monitor shutdown timeout
  50. //
  51. #define FM_MONITOR_SHUTDOWN_TIMEOUT 15 * 60 * 1000 // 15 min
  52. typedef CLUSTER_EVENT FM_EVENT;
  53. //fm event handling
  54. //events generated by the service
  55. #define FM_EVENT_NODE_DOWN 1
  56. #define FM_EVENT_SHUTDOWN 2
  57. #define FM_EVENT_RESOURCE_ADDED 3
  58. #define FM_EVENT_RESOURCE_DELETED 4
  59. #define FM_EVENT_GROUP_FAILED 5
  60. #define FM_EVENT_NODE_ADDED 6
  61. #define FM_EVENT_CLUSTER_PROPERTY_CHANGE 7
  62. #define FM_EVENT_RESOURCE_PROPERTY_CHANGE 8
  63. //#define FM_EVENT_GROUP_PROPERTY_CHANGE 9
  64. #define FM_EVENT_RESOURCE_CHANGE 10
  65. #define FM_EVENT_NODE_EVICTED 11
  66. //events generated due to resource dll's
  67. #define FM_EVENT_RES_RESOURCE_TRANSITION 128
  68. #define FM_EVENT_RES_RESOURCE_FAILED 129
  69. //generated when DealyedRestart timer fires
  70. #define FM_EVENT_RES_RETRY_TIMER 131
  71. #define FM_EVENT_INTERNAL_PROP_GROUP_STATE 256
  72. #define FM_EVENT_INTERNAL_SHUTDOWN_CLEANUP 258
  73. #define FM_EVENT_INTERNAL_RETRY_ONLINE 259
  74. #define FM_EVENT_INTERNAL_RESOURCE_CHANGE_PARAMS 260
  75. #define FM_EVENT_INTERNAL_ONLINE_GROUPLIST 261
  76. #define FM_EVENT_RESOURCE_NAME_CHANGE 262
  77. // timer activities ( in msec)
  78. #define FM_TIMER_RESLIST_ONLINE_RETRY 1 * 60 * 1000 //( 1 minute)
  79. //
  80. // Global defines
  81. //
  82. #define FMP_GROUP_NAME L"Group"
  83. #define FMP_RESOURCE_NAME L"Resource"
  84. #define FMP_RESOURCE_TYPE_NAME L"ResType"
  85. #define FMP_GROUP_SIGNATURE 'rGmF'
  86. #define FMP_RESOURCE_SIGNATURE 'sRmF'
  87. #define FMP_RESOURCE_TYPE_SIGNATURE 'tRmF'
  88. #define FMP_RESMON_SIGNATURE 'mRmF'
  89. #define PENDING_TIMEOUT (4*1000) // retry pending operations every 4 secs
  90. //
  91. // Globals
  92. //
  93. extern HANDLE FmpShutdownEvent;
  94. extern DWORD FmpFMOnline;
  95. extern DWORD FmpFMFormPhaseProcessing;
  96. extern DWORD FmpFMGroupsInited;
  97. extern BOOL FmpShutdown;
  98. extern BOOL FmpMajorEvent;
  99. extern CRITICAL_SECTION FmpResourceLock;
  100. extern CRITICAL_SECTION FmpGroupLock;
  101. extern CRITICAL_SECTION FmpMonitorLock;
  102. //
  103. // 185575: remove use of unique RPC binding handles.
  104. //
  105. //extern CRITICAL_SECTION FmpBindingLock;
  106. extern CL_QUEUE FmpWorkQueue;
  107. //global data relating to the quorum resource
  108. #if NO_SHARED_LOCKS
  109. extern CRITICAL_SECTION gQuoLock;
  110. #else
  111. extern RTL_RESOURCE gQuoLock;
  112. #endif
  113. #if NO_SHARED_LOCKS
  114. extern CRITICAL_SECTION gQuoChangeLock;
  115. #else
  116. extern RTL_RESOURCE gQuoChangeLock;
  117. #endif
  118. #if NO_SHARED_LOCKS
  119. extern CRITICAL_SECTION gResTypeLock;
  120. #else
  121. extern RTL_RESOURCE gResTypeLock;
  122. #endif
  123. extern PFM_RESOURCE gpQuoResource;
  124. extern HANDLE ghQuoOnlineEvent;
  125. extern DWORD gdwQuoBlockingResources;
  126. extern RPC_BINDING_HANDLE FmpRpcBindings[];
  127. extern RPC_BINDING_HANDLE FmpRpcQuorumBindings[];
  128. extern RESUTIL_PROPERTY_ITEM FmpGroupCommonProperties[];
  129. typedef struct FM_NODE{
  130. DWORD dwNodeDownProcessingInProgress;
  131. PNM_NODE pNode;
  132. DWORD dwNodeDownProcessingThreadId;
  133. }FM_NODE, *PFM_NODE;
  134. extern PFM_NODE gFmpNodeArray;
  135. extern LIST_ENTRY g_leFmpMonitorListHead;
  136. extern DWORD FmpInitialized;
  137. //
  138. // Macros
  139. //
  140. #define FmpMustBeOnline( ) \
  141. if ( !FmpFMOnline ) { \
  142. if ( FmpShutdown ) { \
  143. return(ERROR_CLUSTER_NODE_SHUTTING_DOWN); \
  144. } else { \
  145. return(ERROR_CLUSTER_NODE_NOT_READY); \
  146. } \
  147. }
  148. #define FmpMustBeOnlineEx( ReturnValue ) \
  149. if ( !FmpFMOnline ) { \
  150. if ( FmpShutdown ) { \
  151. SetLastError(ERROR_CLUSTER_NODE_SHUTTING_DOWN); \
  152. } else { \
  153. SetLastError(ERROR_CLUSTER_NODE_NOT_READY); \
  154. } \
  155. return(ReturnValue); \
  156. }
  157. #define FmpLogGroupInfoEvent1( MsgId, Group) \
  158. { \
  159. if (!CsNoGroupInfoEvtLogging) \
  160. CsLogEvent1(LOG_NOISE, MsgId, Group); \
  161. } \
  162. #define FmpLogGroupInfoEvent2( MsgId, Resource, Group) \
  163. { \
  164. if (!CsNoGroupInfoEvtLogging) \
  165. CsLogEvent2(LOG_NOISE, MsgId, Resource, Group); \
  166. }
  167. typedef struct WORK_ITEM {
  168. LIST_ENTRY ListEntry;
  169. CLUSTER_EVENT Event;
  170. PVOID Context1;
  171. ULONG_PTR Context2;
  172. } WORK_ITEM, *PWORK_ITEM;
  173. // structures for timer activity
  174. typedef struct _FM_RESLIST_ONLINE_RETRY_INFO{
  175. PFM_GROUP pGroup;
  176. RESOURCE_ENUM ResourceEnum;
  177. }FM_RESLIST_ONLINE_RETRY_INFO, *PFM_RESLIST_ONLINE_RETRY_INFO;
  178. //structure for cleanup at shutdown
  179. typedef struct FM_CLEANUP_INFO{
  180. PGROUP_ENUM pGroupEnum;
  181. BOOL bContainsQuorumGroup;
  182. DWORD dwTimeOut;
  183. }FM_CLEANUP_INFO, *PFM_CLEANUP_INFO;
  184. //
  185. // Wait block used for waiting on completion of pending
  186. // events
  187. //
  188. typedef struct FM_WAIT_BLOCK {
  189. LIST_ENTRY ListEntry;
  190. HANDLE hEvent;
  191. DWORD Status;
  192. } FM_WAIT_BLOCK, *PFM_WAIT_BLOCK;
  193. //
  194. // Group Move structure
  195. //
  196. typedef struct MOVE_GROUP {
  197. PFM_GROUP Group;
  198. PNM_NODE DestinationNode;
  199. } MOVE_GROUP, *PMOVE_GROUP;
  200. //
  201. // Information for group affinity calculation.
  202. //
  203. typedef struct GROUP_AFFINITY_NODE_INFO {
  204. PFM_GROUP pGroup;
  205. PNM_NODE *ppNmNodeList;
  206. BOOL fDidPruningOccur;
  207. } GROUP_AFFINITY_NODE_INFO, *PGROUP_AFFINITY_NODE_INFO;
  208. //
  209. // Define types of pending routines
  210. //
  211. typedef enum {
  212. OfflinePending
  213. } PENDING_ROUTINE;
  214. //
  215. // Define types of Group failbacks
  216. //
  217. typedef enum {
  218. FailbackNot,
  219. FailbackOkay,
  220. FailbackMaximum
  221. } FAILBACK_TYPE;
  222. //
  223. // Define resource restart actions
  224. //
  225. typedef enum {
  226. RestartNot,
  227. RestartLocal,
  228. RestartGroup,
  229. RestartMaximum
  230. } RESTART_ACTION;
  231. //
  232. // Define FM to Resmon event types.
  233. //
  234. typedef enum {
  235. ResourceTransition,
  236. ResourceResuscitate,
  237. RmWorkerTerminate,
  238. RmUpdateResource,
  239. RmRestartResource
  240. } RM_EVENT_TYPE;
  241. //
  242. // Macro for easy dereferencing of a quorum target node
  243. //
  244. #define FM_DEREF_QUORUM_TARGET( pQuorumTargetNode ) \
  245. { \
  246. if ( pQuorumTargetNode ) \
  247. { \
  248. OmDereferenceObject( pQuorumTargetNode ); \
  249. pQuorumTargetNode = NULL; \
  250. } \
  251. }
  252. DWORD
  253. WINAPI
  254. FmpGumReceiveUpdates(
  255. IN DWORD Context,
  256. IN BOOL SourceNode,
  257. IN DWORD BufferLength,
  258. IN PVOID Buffer
  259. );
  260. DWORD
  261. WINAPI
  262. FmpGumVoteHandler(
  263. IN DWORD dwContext,
  264. IN DWORD dwInputBufLength,
  265. IN PVOID pInputBuf,
  266. IN DWORD dwVoteLength,
  267. OUT PVOID pVoteBuf
  268. );
  269. //
  270. // Gum update message buffers.
  271. //
  272. // UpdateResourceState
  273. typedef struct GUM_RESOURCE_STATE {
  274. CLUSTER_RESOURCE_STATE State;
  275. CLUSTER_RESOURCE_STATE PersistentState;
  276. DWORD StateSequence;
  277. } GUM_RESOURCE_STATE, *PGUM_RESOURCE_STATE;
  278. // UpdateGroupState
  279. typedef struct GUM_GROUP_STATE {
  280. CLUSTER_GROUP_STATE State;
  281. CLUSTER_GROUP_STATE PersistentState;
  282. DWORD StateSequence;
  283. } GUM_GROUP_STATE, *PGUM_GROUP_STATE;
  284. // UpdateGroupFailureCount
  285. typedef struct GUM_FAILURE_COUNT {
  286. DWORD Count;
  287. DWORD NewTime;
  288. WCHAR GroupId[1];
  289. } GUM_FAILURE_COUNT, *PGUM_FAILURE_COUNT;
  290. typedef struct GUM_CREATE_GROUP {
  291. PFM_GROUP Group;
  292. DWORD GroupIdLen;
  293. DWORD GroupNameLen;
  294. WCHAR GroupId[1];
  295. // WCHAR GroupName[1];
  296. // WCHAR NodeName[1];
  297. } GUM_CREATE_GROUP, *PGUM_CREATE_GROUP;
  298. typedef struct GUM_DELETE_GROUP {
  299. WCHAR GroupId[1];
  300. } GUM_DELETE_GROUP, *PGUM_DELETE_GROUP;
  301. typedef struct GUM_CREATE_RESOURCE {
  302. PFM_RESOURCE Resource;
  303. DWORD GroupIdLen;
  304. DWORD ResourceIdLen;
  305. WCHAR GroupId[1];
  306. // WCHAR ResourceId[1];
  307. // WCHAR ResourceName[1];
  308. } GUM_CREATE_RESOURCE, *PGUM_CREATE_RESOURCE;
  309. typedef struct GUM_INIT_RESOURCE {
  310. DWORD ResourceIdLen;
  311. WCHAR ResourceId[1];
  312. } GUM_INIT_RESOURCE, *PGUM_INIT_RESOURCE;
  313. typedef struct GUM_CHANGE_POSSIBLE_NODE {
  314. DWORD ResourceIdLen;
  315. WCHAR ResourceId[1];
  316. // WCHAR NodeName[1];
  317. } GUM_CHANGE_POSSIBLE_NODE, *PGUM_CHANGE_POSSIBLE_NODE;
  318. typedef struct GUM_CREATE_RESOURCE_TYPE {
  319. WCHAR TypeName[1];
  320. } GUM_CREATE_RESOURCE_TYPE, *PGUM_CREATE_RESOURCE_TYPE;
  321. typedef struct GUM_DELETE_RESOURCE_TYPE {
  322. WCHAR TypeName[1];
  323. } GUM_DELETE_RESOURCE_TYPE, *PGUM_DELETE_RESOURCE_TYPE;
  324. typedef struct GUM_CHANGE_GROUP {
  325. DWORD ResourceIdLen;
  326. WCHAR ResourceId[1];
  327. // WCHAR GroupName[1];
  328. } GUM_CHANGE_GROUP, *PGUM_CHANGE_GROUP;
  329. #if 0
  330. typedef struct GUM_SET_POSSIBLE_NODE_FORRESTYPE{
  331. DWORD ResTypeNameLen;
  332. WCHAR ResTypeName[1];
  333. } GUM_SET_POSSIBLE_OWNER_FORRESTYPE, *PGUM_SET_POSSIBLE_OWNER_FORRESTYPE;
  334. #endif
  335. typedef struct _FMP_POSSIBLE_NODE {
  336. PFM_RESOURCE Resource;
  337. PNM_NODE Node;
  338. DWORD ControlCode;
  339. } FMP_POSSIBLE_NODE, *PFMP_POSSIBLE_NODE;
  340. //VOTE STRUCTURES
  341. typedef struct _FMP_VOTE_POSSIBLE_NODE_FOR_RESTYPE{
  342. DWORD dwSize;
  343. DWORD dwNodeId;
  344. BOOL bPossibleNode;
  345. }FMP_VOTE_POSSIBLE_NODE_FOR_RESTYPE, *PFMP_VOTE_POSSIBLE_NODE_FOR_RESTYPE;
  346. typedef struct _FM_RES_CHANGE_NAME {
  347. PFM_RESOURCE pResource;
  348. WCHAR szNewResourceName[1];
  349. } FM_RES_CHANGE_NAME, *PFM_RES_CHANGE_NAME;
  350. //
  351. // Monitor resource enumeration
  352. //
  353. typedef struct MONITOR_RESOURCE_ENUM {
  354. DWORD EntryCount;
  355. DWORD CurrentIndex;
  356. BOOL fCreateMonitors;
  357. PFM_RESOURCE Entry[1];
  358. } MONITOR_RESOURCE_ENUM, *PMONITOR_RESOURCE_ENUM;
  359. #define ENUM_GROW_SIZE 16
  360. //
  361. // Resource enumeration interface
  362. //
  363. #define RESOURCE_SIZE(Entries) ((Entries-1) * sizeof(RESOURCE_ENUM_ENTRY) + sizeof(RESOURCE_ENUM))
  364. #define MONITOR_RESOURCE_SIZE(Entries) ((Entries-1) * sizeof(PFM_GROUP) + \
  365. sizeof(MONITOR_RESOURCE_ENUM))
  366. //
  367. // Group and resource enumeration entries.
  368. //
  369. #define GROUP_SIZE(Entries) ((Entries-1) * sizeof(GROUP_ENUM_ENTRY) + sizeof(GROUP_ENUM))
  370. #define NODE_SIZE(Entries) ((Entries-1) * sizeof (NM_NODE_INFO2) + sizeof(NM_NODE_ENUM2))
  371. #define RESOURCE_SIZE(Entries) ((Entries-1) * sizeof(RESOURCE_ENUM_ENTRY) + sizeof(RESOURCE_ENUM))
  372. //
  373. // Define structure for a Resource Monitor process
  374. //
  375. typedef struct RESMON {
  376. DWORD Signature;
  377. HANDLE Process;
  378. HANDLE NotifyThread;
  379. BOOL Shutdown;
  380. DWORD RefCount;
  381. RPC_BINDING_HANDLE Binding;
  382. struct MONITOR_STATE *SharedState;
  383. LIST_ENTRY leMonitor; // Link to the next monitor
  384. DWORD dwDeadlockTimeoutSecs;// Tells us what exactly the monitor has
  385. } RESMON, *PRESMON;
  386. //
  387. // Monitor list enumeration info used for resource DLL upgrade.
  388. //
  389. typedef struct _FM_MONITOR_ENUM_HEADER
  390. {
  391. DWORD cEntries;
  392. DWORD cAllocated;
  393. BOOL fDefaultMonitorAdded;
  394. PRESMON *ppMonitorList;
  395. } FM_MONITOR_ENUM_HEADER, *PFM_MONITOR_ENUM_HEADER;
  396. //
  397. // Structure definitions for passing around group preferred node list info on a node
  398. // down.
  399. //
  400. typedef struct _FM_GROUP_NODE_LIST_ENTRY
  401. {
  402. DWORD dwPreferredNodeId;
  403. WCHAR szGroupId[1]; // Always at the end to help marshalling
  404. } FM_GROUP_NODE_LIST_ENTRY, *PFM_GROUP_NODE_LIST_ENTRY;
  405. typedef struct _FM_GROUP_NODE_LIST
  406. {
  407. DWORD cbGroupNodeList;
  408. FM_GROUP_NODE_LIST_ENTRY leGroupNodeList[1]; // Always at the end to help marshalling
  409. } FM_GROUP_NODE_LIST, *PFM_GROUP_NODE_LIST;
  410. //flags for cluster propery change
  411. #define CLUSTER_NAME_CHANGE 0x00000001
  412. #define CLUSTER_QUORUM_CHANGE 0x00000002
  413. // FM event handling structures
  414. typedef struct CLUSTER_EVENT_PROPERTY_CONTEXT{
  415. DWORD dwFlags;
  416. PVOID pContext1;
  417. PVOID pContext2;
  418. } CLUSTER_EVENT_PROPERTY_CONTEXT, *PCLUSTER_EVENT_PROPERTY_CONTEXT;
  419. typedef struct RESOURCE_STATE_CHANGE{
  420. PFM_RESOURCE pResource;
  421. CLUSTER_RESOURCE_STATE OldState;
  422. CLUSTER_RESOURCE_STATE NewState;
  423. } RESOURCE_STATE_CHANGE, *PRESOURCE_STATE_CHANGE;
  424. typedef struct {
  425. LIST_ENTRY Linkage;
  426. RM_EVENT_TYPE EventType;
  427. union {
  428. struct {
  429. RM_NOTIFY_KEY NotifyKey;
  430. CLUSTER_RESOURCE_STATE NewState;
  431. } ResourceTransition;
  432. struct {
  433. RM_NOTIFY_KEY NotifyKey;
  434. } ResourceResuscitate;
  435. } Parameters;
  436. } RM_EVENT, *PRM_EVENT;
  437. //Cluster Name management
  438. DWORD
  439. FmpRegUpdateClusterName(
  440. IN LPCWSTR szNewClusterName
  441. );
  442. //
  443. // Quorum resource Arbitration.
  444. //
  445. DWORD
  446. FmpRmArbitrateResource(
  447. IN PFM_RESOURCE Resource
  448. );
  449. DWORD
  450. FmpRmReleaseResource(
  451. IN PFM_RESOURCE Resource
  452. );
  453. //
  454. // Interfaces for managing the registry.
  455. //
  456. DWORD
  457. FmpRegEnumerateKey(
  458. IN HDMKEY ListKey,
  459. IN DWORD Index,
  460. IN LPWSTR *Name,
  461. IN OUT LPDWORD NameMaxSize
  462. );
  463. //
  464. // Gum interfaces
  465. //
  466. DWORD
  467. FmpEnableGum(
  468. );
  469. //
  470. // Interfaces for managing Resource Monitor processes
  471. //
  472. PRESMON
  473. FmpCreateMonitor(
  474. LPWSTR DebugPrefix,
  475. BOOL SeparateMonitor
  476. );
  477. VOID
  478. FmpShutdownMonitor(
  479. IN PRESMON Monitor
  480. );
  481. BOOL
  482. FmpRestartMonitor(
  483. IN PRESMON OldMonitor,
  484. IN BOOL fCreateResourcesOnly,
  485. OUT OPTIONAL PMONITOR_RESOURCE_ENUM *ppMonitorResourceEnum
  486. );
  487. DWORD
  488. FmpCreateMonitorRestartThread(
  489. IN PRESMON pMonitor
  490. );
  491. //
  492. // Interfaces for managing resources via the Resource Monitors
  493. //
  494. DWORD
  495. FmpRmCreateResource(
  496. PFM_RESOURCE Resource
  497. );
  498. DWORD
  499. FmpRmCloseResource(
  500. PFM_RESOURCE Resource
  501. );
  502. DWORD
  503. FmpRmOnlineResource(
  504. PFM_RESOURCE Resource
  505. );
  506. DWORD
  507. FmpRmOfflineResource(
  508. PFM_RESOURCE Resource
  509. );
  510. VOID
  511. FmpRmTerminateResource(
  512. PFM_RESOURCE Resource
  513. );
  514. DWORD
  515. FmpRmFailResource(
  516. PFM_RESOURCE Resource
  517. );
  518. DWORD
  519. FmpRmChangeResourceParams(
  520. PFM_RESOURCE Resource
  521. );
  522. DWORD
  523. FmpRmResourceTypeControl(
  524. IN LPCWSTR ResourceTypeName,
  525. IN DWORD ControlCode,
  526. IN PUCHAR InBuffer,
  527. IN DWORD InBufferSize,
  528. OUT PUCHAR OutBuffer,
  529. IN DWORD OutBufferSize,
  530. OUT LPDWORD BytesReturned,
  531. OUT LPDWORD Required
  532. );
  533. DWORD
  534. FmpRmResourceControl(
  535. IN PFM_RESOURCE Resource,
  536. IN DWORD ControlCode,
  537. IN PUCHAR InBuffer,
  538. IN DWORD InBufferSize,
  539. OUT PUCHAR OutBuffer,
  540. IN DWORD OutBufferSize,
  541. OUT LPDWORD BytesReturned,
  542. OUT LPDWORD Required
  543. );
  544. DWORD FmpRmLoadResTypeDll(
  545. IN PFM_RESTYPE pResType
  546. );
  547. DWORD
  548. FmpPostProcessResourceControl(
  549. IN PFM_RESOURCE Resource,
  550. IN DWORD ControlCode,
  551. IN PUCHAR InBuffer,
  552. IN DWORD InBufferSize,
  553. OUT PUCHAR OutBuffer,
  554. IN DWORD OutBufferSize,
  555. OUT LPDWORD BytesReturned,
  556. OUT LPDWORD Required
  557. );
  558. //
  559. // Interfaces for managing resources
  560. //
  561. DWORD
  562. FmpInitResource(
  563. VOID
  564. );
  565. VOID
  566. FmpCleanupResource(
  567. VOID
  568. );
  569. PFM_RESOURCE
  570. FmpCreateResource(
  571. IN PFM_GROUP Group,
  572. IN LPCWSTR ResourceId,
  573. IN LPCWSTR ResourceName,
  574. IN BOOL Initialize
  575. );
  576. VOID
  577. FmpDestroyResource(
  578. IN PFM_RESOURCE Resource,
  579. IN BOOL bDeleteObjOnly
  580. );
  581. VOID
  582. FmpResourceLastReference(
  583. IN PFM_RESOURCE Resource
  584. );
  585. DWORD
  586. FmpInitializeResource(
  587. IN PFM_RESOURCE Resource,
  588. IN BOOL Initialize
  589. );
  590. DWORD
  591. FmpOnlineResource(
  592. IN PFM_RESOURCE Resource,
  593. IN BOOL ForceOnline
  594. );
  595. DWORD
  596. FmpArbitrateResource(
  597. IN PFM_RESOURCE pResource
  598. );
  599. DWORD
  600. FmpOfflineResource(
  601. IN PFM_RESOURCE Resource,
  602. IN BOOL bForceOffline
  603. );
  604. DWORD
  605. FmpDoOnlineResource(
  606. IN PFM_RESOURCE Resource,
  607. IN BOOL ForceOnline
  608. );
  609. DWORD
  610. FmpDoOfflineResource(
  611. IN PFM_RESOURCE Resource,
  612. IN BOOL bForceOffline
  613. );
  614. VOID
  615. FmpSetResourcePersistentState(
  616. IN PFM_RESOURCE Resource,
  617. IN CLUSTER_RESOURCE_STATE State
  618. );
  619. VOID
  620. FmpCallResourceNotifyCb(
  621. IN PFM_RESOURCE Resource,
  622. IN CLUSTER_RESOURCE_STATE State
  623. );
  624. DWORD
  625. FmpPropagateResourceState(
  626. IN PFM_RESOURCE Resource,
  627. IN CLUSTER_RESOURCE_STATE State
  628. );
  629. DWORD
  630. FmpGetResourceList(
  631. OUT PRESOURCE_ENUM *ReturnEnum,
  632. IN PFM_GROUP Group
  633. );
  634. DWORD FmpSubmitRetryOnline(
  635. IN PRESOURCE_ENUM pResourceEnum,
  636. IN PFM_GROUP pGroup
  637. );
  638. VOID
  639. FmpDeleteResourceEnum(
  640. IN PRESOURCE_ENUM Enum
  641. );
  642. DWORD
  643. FmpOnlineResourceList(
  644. IN PRESOURCE_ENUM Enum,
  645. IN PFM_GROUP pGroup
  646. );
  647. DWORD
  648. FmpOfflineResourceList(
  649. IN PRESOURCE_ENUM Enum,
  650. IN BOOL Restore
  651. );
  652. DWORD
  653. FmpTerminateResourceList(
  654. IN PRESOURCE_ENUM Enum
  655. );
  656. VOID
  657. FmpPrunePreferredList(
  658. IN PFM_RESOURCE Resource
  659. );
  660. DWORD
  661. FmpCleanupPossibleNodeList(
  662. IN PFM_RESOURCE pResource
  663. );
  664. DWORD
  665. FmpSetPreferredEntry(
  666. IN PFM_GROUP Group,
  667. IN PNM_NODE Node
  668. );
  669. DWORD
  670. FmpAddPossibleNode(
  671. IN PFM_RESOURCE Resource,
  672. IN PNM_NODE Node
  673. );
  674. DWORD
  675. FmpAddPossibleEntry(
  676. IN PFM_RESOURCE Resource,
  677. IN PNM_NODE Node
  678. );
  679. DWORD
  680. FmpRemovePossibleNode(
  681. IN PFM_RESOURCE Resource,
  682. IN PNM_NODE Node,
  683. IN BOOL RemoveQuorum
  684. );
  685. DWORD
  686. FmpRemoveResourceDependency(
  687. IN HXSACTION hXsaction,
  688. IN PFM_RESOURCE Resource,
  689. IN PFM_RESOURCE DependsOn
  690. );
  691. BOOL
  692. FmpFindQuorumResource(
  693. IN OUT PFM_RESOURCE *QuorumResource,
  694. IN PVOID Context2,
  695. IN PFM_RESOURCE Resource,
  696. IN LPCWSTR Name
  697. );
  698. DWORD
  699. FmpGetQuorumDiskSignature(
  700. IN LPCWSTR lpQuorumId,
  701. OUT LPDWORD lpdwSignature
  702. );
  703. BOOL
  704. FmpReturnResourceType(
  705. IN OUT PFM_RESTYPE *FoundResourceType,
  706. IN LPCWSTR ResourceTypeName,
  707. IN PFM_RESTYPE ResourceType,
  708. IN LPCWSTR Name
  709. );
  710. DWORD
  711. FmpChangeResourceMonitor(
  712. IN PFM_RESOURCE Resource,
  713. IN DWORD SeparateMonitor
  714. );
  715. DWORD
  716. FmpChangeResourceGroup(
  717. IN PFM_RESOURCE Resource,
  718. IN PFM_GROUP Group
  719. );
  720. DWORD
  721. FmpValAddResourceDependency(
  722. IN PFM_RESOURCE pResource,
  723. IN PFM_RESOURCE pDependentResource
  724. );
  725. DWORD
  726. FmpValRemoveResourceDependency(
  727. IN PFM_RESOURCE pResource,
  728. IN PFM_RESOURCE pDependentResource
  729. );
  730. DWORD
  731. FmpUpdateChangeResourceName(
  732. IN BOOL bSourceNode,
  733. IN LPCWSTR lpszResourceId,
  734. IN LPCWSTR lpszNewName
  735. );
  736. DWORD
  737. FmpUpdateDeleteResource(
  738. IN BOOL SourceNode,
  739. IN LPCWSTR ResourceId
  740. );
  741. DWORD
  742. FmpUpdateAddDependency(
  743. IN BOOL SourceNode,
  744. IN LPCWSTR ResourceId,
  745. IN LPCWSTR DependsOnId
  746. );
  747. DWORD
  748. FmpUpdateRemoveDependency(
  749. IN BOOL SourceNode,
  750. IN LPCWSTR ResourceId,
  751. IN LPCWSTR DependsOnId
  752. );
  753. DWORD
  754. FmpUpdateAssignOwnerToGroups(
  755. IN BOOL SourceNode,
  756. IN LPCWSTR pszNodeId
  757. );
  758. DWORD
  759. FmpUpdateApproveJoin(
  760. IN BOOL SourceNode,
  761. IN LPCWSTR pszNodeId
  762. );
  763. DWORD
  764. FmpUpdateCreateGroup(
  765. IN PGUM_CREATE_GROUP pGumGroup,
  766. IN BOOL bSourceNode
  767. );
  768. DWORD
  769. FmpUpdateCreateResource(
  770. IN OUT PGUM_CREATE_RESOURCE pGumResource
  771. );
  772. DWORD
  773. FmpUpdateCompleteGroupMove(
  774. IN BOOL SourceNode,
  775. IN LPCWSTR pszNodeId,
  776. IN LPCWSTR pszGroupId
  777. );
  778. DWORD
  779. FmpUpdateCheckAndSetGroupOwner(
  780. IN BOOL bSourceNode,
  781. IN LPCWSTR lpszGroupId,
  782. IN LPCWSTR lpszNodeId
  783. );
  784. DWORD
  785. FmpUpdateCreateResourceType(
  786. IN PVOID Buffer
  787. );
  788. DWORD FmpSetResourceName(
  789. IN PFM_RESOURCE pResource,
  790. IN LPCWSTR lpszFriendlyName
  791. );
  792. DWORD
  793. FmpClusterEventPropHandler(
  794. IN PFM_RESOURCE pResource
  795. );
  796. BOOL
  797. FmpEnumResourceNodeEvict(
  798. IN PVOID Context1,
  799. IN PVOID Context2,
  800. IN PVOID Object,
  801. IN LPCWSTR Name
  802. );
  803. DWORD FmpPrepareQuorumResChange(
  804. IN PFM_RESOURCE pNewQuoRes,
  805. IN LPCWSTR lpszQuoLogPath,
  806. IN DWORD dwMaxQuoLogSize
  807. );
  808. DWORD
  809. FmpCompleteQuorumResChange(
  810. IN LPCWSTR lpszOldQuoResId,
  811. IN LPCWSTR lpszQuoLogPath
  812. );
  813. DWORD
  814. FmpBackupClusterDatabase(
  815. IN PFM_RESOURCE pQuoRes,
  816. IN LPCWSTR lpszPathName
  817. );
  818. VOID FmpCheckForGroupCompletionEvent(
  819. IN PFM_GROUP pGroup);
  820. //
  821. // Interfaces for handling pending online/offline requests.
  822. //
  823. VOID
  824. FmpSignalGroupWaiters(
  825. IN PFM_GROUP Group
  826. );
  827. DWORD
  828. FmpWaitForGroup(
  829. IN PFM_GROUP Group
  830. );
  831. #define FmpIsGroupPending(_group_) (!IsListEmpty(&((_group_)->WaitQueue)))
  832. //
  833. // There is currently one default monitor process, and resources
  834. // with the SeparateMonitor property have a monitor created for them.
  835. //
  836. extern PRESMON FmpDefaultMonitor;
  837. //
  838. // Interface for notification module
  839. //
  840. DWORD
  841. FmpInitializeNotify(
  842. VOID
  843. );
  844. BOOL
  845. FmpPostNotification(
  846. IN RM_NOTIFY_KEY NotifyKey,
  847. IN DWORD NotifyEvent,
  848. IN CLUSTER_RESOURCE_STATE CurrentState
  849. );
  850. //
  851. // Event processing routines
  852. //
  853. DWORD
  854. FmpStartWorkerThread(
  855. VOID
  856. );
  857. VOID
  858. FmpPostWorkItem(
  859. IN CLUSTER_EVENT Event,
  860. IN PVOID Context1,
  861. IN ULONG_PTR Context2
  862. );
  863. VOID
  864. FmpHandleGroupFailure(
  865. IN PFM_GROUP Group,
  866. IN PFM_RESOURCE pResource OPTIONAL
  867. );
  868. DWORD
  869. FmpNodeUp(
  870. PVOID Context
  871. );
  872. DWORD
  873. FmpNodeDown(
  874. PVOID Context
  875. );
  876. VOID
  877. FmpPropagateState(
  878. VOID
  879. );
  880. DWORD
  881. FmpSetPossibleNodeForResType(
  882. IN LPCWSTR TypeName,
  883. IN BOOL bAssumeSupported
  884. );
  885. DWORD
  886. FmpRemovePossibleNodeForResType(
  887. IN LPCWSTR TypeName,
  888. IN PNM_NODE pNode
  889. );
  890. //
  891. // Object Manager callback routines.
  892. //
  893. DWORD
  894. WINAPI
  895. FmpQueryGroupInfo(
  896. IN PVOID Object,
  897. IN BOOL Initialize
  898. );
  899. DWORD
  900. WINAPI
  901. FmpQueryResourceInfo(
  902. IN PVOID Object,
  903. IN BOOL Initialize
  904. );
  905. DWORD
  906. WINAPI
  907. FmpQueryResTypeInfo(
  908. IN PVOID Object
  909. );
  910. DWORD
  911. WINAPI
  912. FmpFixupGroupInfo(
  913. IN PFM_GROUP Group
  914. );
  915. DWORD
  916. WINAPI
  917. FmpFixupResourceInfo(
  918. IN PFM_RESOURCE Resource
  919. );
  920. //
  921. // Synchronization macros
  922. //
  923. #define FmpAcquireResourceLock() EnterCriticalSection(&FmpResourceLock)
  924. #define FmpReleaseResourceLock() LeaveCriticalSection(&FmpResourceLock)
  925. #define FmpAcquireGroupLock() EnterCriticalSection(&FmpGroupLock)
  926. #define FmpReleaseGroupLock() LeaveCriticalSection(&FmpGroupLock)
  927. #define FmpAcquireMonitorLock() EnterCriticalSection(&FmpMonitorLock)
  928. #define FmpReleaseMonitorLock() LeaveCriticalSection(&FmpMonitorLock)
  929. #if 0
  930. // 185575: remove unique RPC binding handles
  931. #define FmpAcquireBindingLock() EnterCriticalSection(&FmpBindingLock)
  932. #define FmpReleaseBindingLock() LeaveCriticalSection(&FmpBindingLock)
  933. #endif
  934. #define FmpTryAcquireGroupLock( Locked, Timeout ) \
  935. { \
  936. DWORD _retry = (Timeout + 19) / 20; \
  937. do { \
  938. Locked = TryEnterCriticalSection(&FmpGroupLock); \
  939. if ( !Locked ) Sleep( 20 ); \
  940. } while (_retry-- && !Locked ); \
  941. }
  942. // Group and Resource Specific locks
  943. #if 1 // DBG
  944. #define FmpAcquireLocalGroupLock( Group ) \
  945. { \
  946. DWORD _fmpLockIndx; \
  947. EnterCriticalSection( &Group->Lock ); \
  948. _fmpLockIndx = Group->LockIndex & (FM_MAX_LOCK_ENTRIES - 1); \
  949. Group->LockTable[_fmpLockIndx].Module = LOG_MODULE; \
  950. Group->LockTable[_fmpLockIndx].ThreadId = GetCurrentThreadId(); \
  951. Group->LockTable[_fmpLockIndx].LineNumber = __LINE__; \
  952. Group->LockIndex = ++_fmpLockIndx; \
  953. }
  954. #define FmpTryAcquireLocalGroupLock( Group, Locked ) \
  955. { \
  956. DWORD _fmpLockIndx; \
  957. Locked = TryEnterCriticalSection( &Group->Lock ); \
  958. if ( Locked ) { \
  959. _fmpLockIndx = Group->LockIndex & (FM_MAX_LOCK_ENTRIES - 1); \
  960. Group->LockTable[_fmpLockIndx].Module = LOG_MODULE; \
  961. Group->LockTable[_fmpLockIndx].ThreadId = GetCurrentThreadId(); \
  962. Group->LockTable[_fmpLockIndx].LineNumber = __LINE__; \
  963. Group->LockIndex = ++_fmpLockIndx; \
  964. } \
  965. }
  966. #define FmpReleaseLocalGroupLock( Group ) \
  967. { \
  968. DWORD _fmpLockIndx; \
  969. CL_ASSERT(HandleToUlong(Group->Lock.OwningThread) == GetCurrentThreadId()); \
  970. _fmpLockIndx = Group->UnlockIndex & (FM_MAX_LOCK_ENTRIES - 1); \
  971. Group->UnlockTable[_fmpLockIndx].Module = LOG_MODULE; \
  972. Group->UnlockTable[_fmpLockIndx].ThreadId = GetCurrentThreadId(); \
  973. Group->UnlockTable[_fmpLockIndx].LineNumber = __LINE__; \
  974. Group->UnlockIndex = ++_fmpLockIndx; \
  975. LeaveCriticalSection( &Group->Lock ); \
  976. }
  977. #define FmpAcquireLocalResourceLock( Resource ) \
  978. { \
  979. DWORD _fmpLockIndx; \
  980. PFM_GROUP pGroup; \
  981. while( 1 ) { \
  982. pGroup = Resource->Group; \
  983. EnterCriticalSection( &pGroup->Lock );\
  984. if( pGroup == Resource->Group ) break; \
  985. LeaveCriticalSection( &pGroup->Lock ); \
  986. } \
  987. _fmpLockIndx = Resource->Group->LockIndex & (FM_MAX_LOCK_ENTRIES - 1); \
  988. Resource->Group->LockTable[_fmpLockIndx].Module = LOG_MODULE; \
  989. Resource->Group->LockTable[_fmpLockIndx].ThreadId = GetCurrentThreadId(); \
  990. Resource->Group->LockTable[_fmpLockIndx].LineNumber = __LINE__; \
  991. Resource->Group->LockIndex = ++_fmpLockIndx; \
  992. }
  993. #define FmpReleaseLocalResourceLock( Resource ) \
  994. { \
  995. DWORD _fmpLockIndx; \
  996. CL_ASSERT(HandleToUlong(Resource->Group->Lock.OwningThread) == GetCurrentThreadId()); \
  997. _fmpLockIndx = Resource->Group->UnlockIndex & (FM_MAX_LOCK_ENTRIES - 1); \
  998. Resource->Group->UnlockTable[_fmpLockIndx].Module = LOG_MODULE; \
  999. Resource->Group->UnlockTable[_fmpLockIndx].ThreadId = GetCurrentThreadId(); \
  1000. Resource->Group->UnlockTable[_fmpLockIndx].LineNumber = __LINE__; \
  1001. Resource->Group->UnlockIndex = ++_fmpLockIndx; \
  1002. LeaveCriticalSection( &Resource->Group->Lock ); \
  1003. }
  1004. #define FmpTryAcquireLocalResourceLock( Resource, _Status_ ) \
  1005. { \
  1006. (_Status_) = TryEnterCriticalSection(&Resource->Group->Lock); \
  1007. if ( !(_Status_) ) { \
  1008. Sleep(100); \
  1009. (_Status_) = TryEnterCriticalSection( &Resource->Group->Lock ); \
  1010. } \
  1011. if (_Status_) { \
  1012. DWORD _fmpLockIndx; \
  1013. _fmpLockIndx = Resource->Group->LockIndex & (FM_MAX_LOCK_ENTRIES - 1); \
  1014. Resource->Group->LockTable[_fmpLockIndx].Module = LOG_MODULE; \
  1015. Resource->Group->LockTable[_fmpLockIndx].ThreadId = GetCurrentThreadId(); \
  1016. Resource->Group->LockTable[_fmpLockIndx].LineNumber = __LINE__; \
  1017. Resource->Group->LockIndex = ++_fmpLockIndx; \
  1018. } \
  1019. }
  1020. #else // DBG
  1021. #define FmpAcquireLocalGroupLock( Group ) \
  1022. EnterCriticalSection( &Group->Lock )
  1023. #define FmpTryAcquireLocalGroupLock( Group, Locked ) \
  1024. Locked = TryEnterCriticalSection( &Group->Lock )
  1025. #define FmpReleaseLocalGroupLock( Group ) \
  1026. LeaveCriticalSection( &Group->Lock )
  1027. #define FmpAcquireLocalResourceLock( Resource ) \
  1028. { \
  1029. PFM_GROUP pGroup; \
  1030. while( 1 ) { \
  1031. pGroup = Resource->Group; \
  1032. EnterCriticalSection( &pGroup->Lock );\
  1033. if( pGroup == Resource->Group ) break; \
  1034. LeaveCriticalSection( &pGroup->Lock ); \
  1035. } \
  1036. }
  1037. #define FmpReleaseLocalResourceLock( Resource ) \
  1038. LeaveCriticalSection( &Resource->Group->Lock )
  1039. #define FmpTryAcquireLocalResourceLock( Resource, _result_ ) \
  1040. if ( !((_result_) = TryEnterCriticalSection(&Resource->Group->Lock)) ) { \
  1041. sleep(100); \
  1042. (_result_) = TryEnterCriticalSection( &Resource->Group->Lock ); \
  1043. }
  1044. #endif // DBG
  1045. //
  1046. // Global Data
  1047. //
  1048. extern CRITICAL_SECTION FmpResourceLock;
  1049. //
  1050. // Resource Management Routines
  1051. //
  1052. //
  1053. // Interfaces for managing resource trees.
  1054. //
  1055. DWORD
  1056. FmpRestartResourceTree(
  1057. IN PFM_RESOURCE Resource
  1058. );
  1059. DWORD
  1060. FmpOnlineWaitingTree(
  1061. IN PFM_RESOURCE Resource
  1062. );
  1063. DWORD
  1064. FmpOfflineWaitingTree(
  1065. IN PFM_RESOURCE Resource
  1066. );
  1067. //++
  1068. //
  1069. // Routine Description:
  1070. //
  1071. // Processes the Cluster resource list in the registry. For each
  1072. // resource key found, a cluster resource is created.
  1073. //
  1074. // Arguments:
  1075. //
  1076. // None.
  1077. //
  1078. // Return Value:
  1079. //
  1080. // None.
  1081. //
  1082. //--
  1083. DWORD
  1084. FmpInitResources(
  1085. VOID
  1086. );
  1087. VOID
  1088. FmpCleanupResources(
  1089. VOID
  1090. );
  1091. BOOL
  1092. FmpInPossibleListForResource(
  1093. IN PFM_RESOURCE pResource,
  1094. IN PNM_NODE pNode
  1095. );
  1096. DWORD
  1097. FmpInitResourceTypes(
  1098. VOID
  1099. );
  1100. PFM_RESTYPE
  1101. FmpCreateResType(
  1102. IN LPWSTR ResTypeName
  1103. );
  1104. DWORD
  1105. FmpDeleteResType(
  1106. IN PFM_RESTYPE pResType
  1107. );
  1108. BOOL
  1109. FmpFindResourceType(
  1110. IN PFM_RESTYPE Type,
  1111. IN PBOOL ResourceExists,
  1112. IN PFM_RESOURCE Resource,
  1113. IN LPCWSTR Name
  1114. );
  1115. BOOL
  1116. FmpInPossibleListForResType(
  1117. IN PFM_RESTYPE pResType,
  1118. IN PNM_NODE pNode
  1119. );
  1120. DWORD
  1121. FmpHandleResourceTypeControl(
  1122. IN PFM_RESTYPE Type,
  1123. IN DWORD ControlCode,
  1124. IN PUCHAR InBuffer,
  1125. IN DWORD InBufferSize,
  1126. OUT PUCHAR OutBuffer,
  1127. IN DWORD OutBufferSize,
  1128. OUT LPDWORD BytesReturned,
  1129. OUT LPDWORD Required
  1130. );
  1131. BOOL
  1132. FmpEnumResTypeNodeEvict(
  1133. IN PVOID Context1,
  1134. IN PVOID Context2,
  1135. IN PVOID Object,
  1136. IN LPCWSTR Name
  1137. );
  1138. VOID
  1139. FmpResTypeLastRef(
  1140. IN PFM_RESTYPE Resource
  1141. );
  1142. DWORD FmpAddPossibleNodeToList(
  1143. IN LPCWSTR pmszPossibleNodes,
  1144. IN DWORD dwStringSize,
  1145. IN PLIST_ENTRY pPosNodeList
  1146. );
  1147. BOOL
  1148. FmpFixupPossibleNodesForResTypeCb(
  1149. IN PVOID pContext1,
  1150. IN PVOID pContext2,
  1151. IN PFM_RESTYPE pResType,
  1152. IN LPCWSTR ResTypeName
  1153. );
  1154. BOOL
  1155. FmpFixupResTypePhase2Cb(
  1156. IN PVOID pContext1,
  1157. IN PVOID pContext2,
  1158. IN PFM_RESTYPE pResType,
  1159. IN LPCWSTR pszResTypeName
  1160. );
  1161. DWORD
  1162. FmpFixupResourceTypesPhase1(
  1163. BOOL bJoin,
  1164. BOOL bNmLocalNodeVersionChanged,
  1165. PCLUSTERVERSIONINFO pClusterVersionInfo
  1166. );
  1167. DWORD
  1168. FmpFixupResourceTypesPhase2(
  1169. BOOL bJoin,
  1170. BOOL bNmLocalNodeVersionChanged,
  1171. PCLUSTERVERSIONINFO pClusterVersionInfo
  1172. );
  1173. DWORD FmpDecidePossibleNodeForResType
  1174. (
  1175. IN PGUM_VOTE_DECISION_CONTEXT pDecisionContext,
  1176. IN DWORD dwVoteBufLength,
  1177. IN PVOID pVoteBuf,
  1178. IN DWORD dwNumVotes,
  1179. IN BOOL bDidAllActiveNodesVote,
  1180. OUT LPDWORD pdwOutputBufSize,
  1181. OUT PVOID *ppOutputBuf
  1182. );
  1183. PFM_RESOURCE
  1184. FmpFindResourceByNotifyKey(
  1185. RM_NOTIFY_KEY NotifyKey
  1186. );
  1187. DWORD
  1188. FmpTerminateResource(
  1189. IN PFM_RESOURCE Resource
  1190. );
  1191. DWORD
  1192. WINAPI
  1193. FmpEventHandler(
  1194. IN CLUSTER_EVENT Event,
  1195. IN PVOID Context
  1196. );
  1197. DWORD
  1198. WINAPI
  1199. FmpSyncEventHandler(
  1200. IN CLUSTER_EVENT Event,
  1201. IN PVOID Context
  1202. );
  1203. DWORD
  1204. FmpSyncArbitration(
  1205. IN DWORD NewPhase,
  1206. OUT LPDWORD CurrentPhase
  1207. );
  1208. DWORD
  1209. FmpEnumSortGroups(
  1210. OUT PGROUP_ENUM *ReturnEnum,
  1211. IN LPCWSTR pszOwnerNodeId OPTIONAL,
  1212. OUT PBOOL QuorumGroup
  1213. );
  1214. VOID
  1215. FmpPrepareGroupForOnline(
  1216. IN PFM_GROUP Group
  1217. );
  1218. DWORD
  1219. FmpSetGroupEnumOwner(
  1220. IN PGROUP_ENUM pGroupEnum,
  1221. IN PNM_NODE pDefaultOwnerNode,
  1222. IN LPCWSTR pszDeadNodeId,
  1223. IN BOOL bQuorumGroup,
  1224. IN PFM_GROUP_NODE_LIST pGroupNodeList
  1225. );
  1226. DWORD
  1227. FmpOnlineGroupList(
  1228. IN PGROUP_ENUM GroupEnum,
  1229. IN BOOL bPrepareQuoForOnline
  1230. );
  1231. DWORD FmpOnlineGroupFromList(
  1232. IN PGROUP_ENUM GroupEnum,
  1233. IN DWORD Index,
  1234. IN BOOL bPrepareQuoForOnline
  1235. );
  1236. DWORD FmpOnlineResourceFromList(
  1237. IN PRESOURCE_ENUM GroupEnum,
  1238. IN PFM_GROUP pGroup
  1239. );
  1240. BOOL
  1241. FmpEqualGroupLists(
  1242. IN PGROUP_ENUM Group1,
  1243. IN PGROUP_ENUM Group2
  1244. );
  1245. DWORD
  1246. FmpOnlineGroup(
  1247. IN PFM_GROUP Group,
  1248. IN BOOL ForceOnline
  1249. );
  1250. DWORD
  1251. FmpOfflineGroup(
  1252. IN PFM_GROUP Group,
  1253. IN BOOL OfflineQuorum,
  1254. IN BOOL SetPersistent
  1255. );
  1256. DWORD
  1257. FmpDeleteGroup(
  1258. IN PFM_GROUP pGroup
  1259. );
  1260. DWORD
  1261. FmpMoveGroup(
  1262. IN PFM_GROUP Group,
  1263. IN PNM_NODE DestinationNode,
  1264. IN BOOL ShutdownHandler,
  1265. OUT PNM_NODE *pChosenDestinationNode,
  1266. IN BOOL bChooseMostPreferredNode
  1267. );
  1268. DWORD
  1269. FmpCompleteMoveGroup(
  1270. IN PFM_GROUP Group,
  1271. IN PNM_NODE DestinationNode
  1272. );
  1273. DWORD
  1274. FmpDoMoveGroup(
  1275. IN PFM_GROUP Group,
  1276. IN PNM_NODE DestinationNode,
  1277. IN BOOL bChooseMostPreferredNode
  1278. );
  1279. BOOL
  1280. FmpGroupCanMove(
  1281. IN PFM_GROUP Group
  1282. );
  1283. DWORD
  1284. FmpUpdateChangeGroupName(
  1285. IN BOOL SourceNode,
  1286. IN LPCWSTR ResourceId,
  1287. IN LPCWSTR NewName
  1288. );
  1289. DWORD
  1290. FmpUpdateDeleteGroup(
  1291. IN BOOL SourceNode,
  1292. IN LPCWSTR GroupId
  1293. );
  1294. BOOL
  1295. FmpEnumGroupNodeEvict(
  1296. IN PVOID Context1,
  1297. IN PVOID Context2,
  1298. IN PVOID Object,
  1299. IN LPCWSTR Name
  1300. );
  1301. PNM_NODE
  1302. FmpFindAnotherNode(
  1303. IN PFM_GROUP Group,
  1304. IN BOOL bChooseMostPreferredNode
  1305. );
  1306. PNM_NODE
  1307. FmpGetPreferredNode(
  1308. IN PFM_GROUP Group
  1309. );
  1310. //++
  1311. //
  1312. // Routine Description:
  1313. //
  1314. // Takes appropriate action based on resource state transitions indicated
  1315. // by the Resource Monitor.
  1316. //
  1317. // Arguments:
  1318. //
  1319. // Resource - The resource which has transitioned.
  1320. //
  1321. // NewState - The new state of Resource.
  1322. //
  1323. // Return Value:
  1324. //
  1325. // None.
  1326. //
  1327. //--
  1328. VOID
  1329. FmpHandleResourceTransition(
  1330. IN PFM_RESOURCE Resource,
  1331. IN CLUSTER_RESOURCE_STATE NewState
  1332. );
  1333. DWORD FmpCreateResStateChangeHandler(
  1334. IN PFM_RESOURCE pResource,
  1335. IN CLUSTER_RESOURCE_STATE NewState,
  1336. IN CLUSTER_RESOURCE_STATE OldState
  1337. );
  1338. VOID
  1339. FmpProcessResourceEvents(
  1340. IN PFM_RESOURCE pResource,
  1341. IN CLUSTER_RESOURCE_STATE NewState,
  1342. IN CLUSTER_RESOURCE_STATE OldState
  1343. );
  1344. VOID
  1345. FmpHandleResourceFailure(
  1346. IN PFM_RESOURCE Resource
  1347. );
  1348. //
  1349. // Group Management Routines
  1350. //
  1351. //++
  1352. //
  1353. // Routine Description:
  1354. //
  1355. // Processes the Cluster Group list in the registry. For each
  1356. // Group key found, a cluster Group is created.
  1357. //
  1358. // Arguments:
  1359. //
  1360. // None.
  1361. //
  1362. // Return Value:
  1363. //
  1364. // None.
  1365. //
  1366. //--
  1367. DWORD
  1368. FmpInitGroups(
  1369. IN BOOL Initialize
  1370. );
  1371. DWORD
  1372. FmpCompleteInitGroup(
  1373. IN PFM_GROUP Group
  1374. );
  1375. VOID
  1376. FmpCleanupGroups(
  1377. IN BOOL ClusterShutDownEvent
  1378. );
  1379. DWORD
  1380. FmpCleanupGroupPhase1(
  1381. IN PFM_GROUP Group,
  1382. IN DWORD dwTimeOut
  1383. );
  1384. DWORD
  1385. FmpCleanupGroupsWorker(
  1386. IN PFM_CLEANUP_INFO pFmCleanupInfo
  1387. );
  1388. DWORD
  1389. FmpCleanupGroupPhase2(
  1390. IN PFM_GROUP Group
  1391. );
  1392. DWORD FmpCleanupQuorumResource(
  1393. IN PFM_RESOURCE Resource
  1394. );
  1395. BOOL
  1396. FmpInPreferredList(
  1397. IN PFM_GROUP Group,
  1398. IN PNM_NODE Node,
  1399. IN BOOL bRecalc,
  1400. IN PFM_RESOURCE pRefResource
  1401. );
  1402. BOOL
  1403. FmpHigherInPreferredList(
  1404. IN PFM_GROUP Group,
  1405. IN PNM_NODE Node1,
  1406. IN PNM_NODE Node2
  1407. );
  1408. PFM_GROUP
  1409. FmpCreateGroup(
  1410. IN LPWSTR GroupId,
  1411. IN BOOL Initialize
  1412. );
  1413. DWORD FmpInitializeGroup(
  1414. IN PFM_GROUP Group,
  1415. IN BOOL Initialize
  1416. );
  1417. DWORD
  1418. FmpDestroyGroup(
  1419. IN PFM_GROUP Group,
  1420. IN BOOL bDeleteObjOnly
  1421. );
  1422. VOID
  1423. FmpSetGroupPersistentState(
  1424. IN PFM_GROUP Group,
  1425. IN CLUSTER_GROUP_STATE State
  1426. );
  1427. DWORD
  1428. FmpPropagateGroupState(
  1429. IN PFM_GROUP Group
  1430. );
  1431. DWORD
  1432. FmpPropagateFailureCount(
  1433. IN PFM_GROUP Group,
  1434. IN BOOL NewTime
  1435. );
  1436. DWORD
  1437. FmpGetGroupListState(
  1438. IN PGROUP_ENUM GroupEnum
  1439. );
  1440. DWORD
  1441. FmpOfflineGroupList(
  1442. IN PGROUP_ENUM GroupEnum
  1443. );
  1444. VOID
  1445. FmpGroupLastReference(
  1446. IN PFM_GROUP pGroup
  1447. );
  1448. //
  1449. // Stuff previously in fmclient.h
  1450. //
  1451. typedef
  1452. DWORD
  1453. (WINAPI *PSEND_MSG_ROUTINE) (
  1454. IN PGROUP_ENUM MyGroups,
  1455. IN PGROUP_ENUM OtherGroups,
  1456. OUT PGROUP_ENUM *ResponseOtherGroups,
  1457. OUT PGROUP_ENUM *ResponseMyGroups
  1458. );
  1459. //
  1460. // Global function prototypes
  1461. //
  1462. DWORD
  1463. FmcOnlineGroupRequest(
  1464. IN PFM_GROUP Group
  1465. );
  1466. DWORD
  1467. FmcOfflineGroupRequest(
  1468. IN PFM_GROUP Group
  1469. );
  1470. DWORD
  1471. FmcMoveGroupRequest(
  1472. IN PFM_GROUP Group,
  1473. IN PNM_NODE DestinationNode OPTIONAL
  1474. );
  1475. DWORD
  1476. FmcTakeGroupRequest(
  1477. IN PNM_NODE DestinationNode,
  1478. IN LPCWSTR GroupId,
  1479. IN PRESOURCE_ENUM ResourceList
  1480. );
  1481. DWORD
  1482. FmcDeleteGroupRequest(
  1483. IN PFM_GROUP pGroup
  1484. );
  1485. DWORD
  1486. FmcOnlineResourceRequest(
  1487. IN PFM_RESOURCE Resource
  1488. );
  1489. DWORD
  1490. FmcOfflineResourceRequest(
  1491. IN PFM_RESOURCE Resource
  1492. );
  1493. DWORD
  1494. FmcArbitrateResource(
  1495. IN PFM_RESOURCE Resource
  1496. );
  1497. DWORD
  1498. FmcFailResource(
  1499. IN PFM_RESOURCE Resource
  1500. );
  1501. PFM_RESOURCE
  1502. FmcCreateResource(
  1503. IN PFM_GROUP Group,
  1504. IN LPWSTR ResourceId,
  1505. IN LPCWSTR ResourceName,
  1506. IN LPCWSTR ResourceType,
  1507. IN DWORD dwFlags
  1508. );
  1509. DWORD
  1510. FmcDeleteResource(
  1511. IN PFM_RESOURCE Resource
  1512. );
  1513. CLUSTER_GROUP_STATE
  1514. FmcGetGroupState(
  1515. IN LPCWSTR GroupId,
  1516. OUT LPWSTR *NodeName
  1517. );
  1518. DWORD
  1519. FmcChangeResourceNode(
  1520. IN PFM_RESOURCE Resource,
  1521. IN PNM_NODE Node,
  1522. IN BOOL Add
  1523. );
  1524. DWORD
  1525. FmcResourceControl(
  1526. IN PNM_NODE Node,
  1527. IN PFM_RESOURCE Resource,
  1528. IN DWORD ControlCode,
  1529. IN PUCHAR InBuffer,
  1530. IN DWORD InBufferSize,
  1531. OUT PUCHAR OutBuffer,
  1532. IN DWORD OutBufferSize,
  1533. OUT LPDWORD BytesReturned,
  1534. OUT LPDWORD Required
  1535. );
  1536. DWORD
  1537. FmcResourceTypeControl(
  1538. IN PNM_NODE Node,
  1539. IN LPCWSTR ResourceTypeName,
  1540. IN DWORD ControlCode,
  1541. IN PUCHAR InBuffer,
  1542. IN DWORD InBufferSize,
  1543. OUT PUCHAR OutBuffer,
  1544. IN DWORD OutBufferSize,
  1545. OUT LPDWORD BytesReturned,
  1546. OUT LPDWORD Required
  1547. );
  1548. DWORD
  1549. FmcGroupControl(
  1550. IN PNM_NODE Node,
  1551. IN PFM_GROUP Group,
  1552. IN DWORD ControlCode,
  1553. IN PUCHAR InBuffer,
  1554. IN DWORD InBufferSize,
  1555. OUT PUCHAR OutBuffer,
  1556. IN DWORD OutBufferSize,
  1557. OUT LPDWORD BytesReturned,
  1558. OUT LPDWORD Required
  1559. );
  1560. DWORD
  1561. FmcPrepareQuorumResChange(
  1562. IN PFM_RESOURCE Resource,
  1563. IN LPCWSTR lpszQuoLogPath,
  1564. IN DWORD dwMaxQuoLogSize
  1565. );
  1566. DWORD
  1567. FmcCompleteQuorumResChange(
  1568. IN PFM_RESOURCE pOldQuoRes,
  1569. IN LPCWSTR lpszOldQuoLogPath
  1570. );
  1571. DWORD
  1572. FmcBackupClusterDatabase(
  1573. IN PFM_RESOURCE pQuoResource,
  1574. IN LPCWSTR lpszPathName
  1575. );
  1576. DWORD
  1577. FmcChangeResourceGroup(
  1578. IN PFM_RESOURCE pResource,
  1579. IN PFM_GROUP pNewGroup
  1580. );
  1581. DWORD
  1582. FmcAddResourceDependency(
  1583. IN PFM_RESOURCE pResource,
  1584. IN PFM_RESOURCE pDependentResource
  1585. );
  1586. DWORD
  1587. FmcRemoveResourceDependency(
  1588. IN PFM_RESOURCE pResource,
  1589. IN PFM_RESOURCE pDependentResource
  1590. );
  1591. DWORD
  1592. FmpGroupControl(
  1593. IN PFM_GROUP Group,
  1594. IN DWORD ControlCode,
  1595. IN PUCHAR InBuffer,
  1596. IN DWORD InBufferSize,
  1597. OUT PUCHAR OutBuffer,
  1598. IN DWORD OutBufferSize,
  1599. OUT LPDWORD BytesReturned,
  1600. OUT LPDWORD Required
  1601. );
  1602. DWORD
  1603. FmpHandleGroupControl(
  1604. IN PFM_GROUP Group,
  1605. IN DWORD ControlCode,
  1606. IN PUCHAR InBuffer,
  1607. IN DWORD InBufferSize,
  1608. OUT PUCHAR OutBuffer,
  1609. IN DWORD OutBufferSize,
  1610. OUT LPDWORD BytesReturned,
  1611. OUT LPDWORD Required
  1612. );
  1613. DWORD
  1614. FmpTakeGroupRequest(
  1615. IN PFM_GROUP Group,
  1616. IN PRESOURCE_ENUM ResourceList
  1617. );
  1618. CLUSTER_GROUP_STATE
  1619. FmpGetGroupState(
  1620. IN PFM_GROUP Group,
  1621. IN BOOL IsNormalized
  1622. );
  1623. VOID
  1624. FmpDeleteEnum(
  1625. IN PGROUP_ENUM Enum
  1626. );
  1627. DWORD
  1628. FmpClaimAllGroups(
  1629. PGROUP_ENUM MyGroups
  1630. );
  1631. DWORD
  1632. FmpAssignOwnersToGroups(
  1633. IN LPCWSTR pszDeadNodeId,
  1634. IN PFM_GROUP pGroup,
  1635. IN PFM_GROUP_NODE_LIST pGroupNodeList
  1636. );
  1637. VOID
  1638. FmpPruneGroupOwners(
  1639. IN PFM_GROUP Group
  1640. );
  1641. DWORD
  1642. FmpQueryGroupNodes(
  1643. IN PFM_GROUP Group,
  1644. IN HDMKEY hGroupKey
  1645. );
  1646. DWORD
  1647. FmpUpdateChangeClusterName(
  1648. IN BOOL SourceNode,
  1649. IN LPCWSTR NewName
  1650. );
  1651. DWORD
  1652. FmpUpdateChangeQuorumResource(
  1653. IN BOOL SourceNode,
  1654. IN LPCWSTR NewQuorumResId,
  1655. IN LPCWSTR pszQuorumLogPath,
  1656. IN LPDWORD pdwMaxQuorumLogSize
  1657. );
  1658. DWORD
  1659. FmpUpdateChangeQuorumResource2(
  1660. IN BOOL SourceNode,
  1661. IN LPCWSTR NewQuorumResId,
  1662. IN LPCWSTR pszQuorumLogPath,
  1663. IN LPDWORD pdwMaxQuorumLogSize,
  1664. IN LPDWORD pdwQuorumArbTimeout,
  1665. IN LPDWORD pdwNewQuorumResourceCharacteristics OPTIONAL
  1666. );
  1667. DWORD
  1668. FmpUpdateResourceState(
  1669. IN BOOL SourceNode,
  1670. IN LPCWSTR ResourceId,
  1671. IN PGUM_RESOURCE_STATE ResourceState
  1672. );
  1673. DWORD
  1674. FmpUpdateGroupState(
  1675. IN BOOL SourceNode,
  1676. IN LPCWSTR GroupId,
  1677. IN LPCWSTR NodeId,
  1678. IN PGUM_GROUP_STATE ResourceState
  1679. );
  1680. DWORD
  1681. FmpUpdateGroupNode(
  1682. IN BOOL SourceNode,
  1683. IN LPCWSTR GroupId,
  1684. IN LPCWSTR NodeId
  1685. );
  1686. DWORD
  1687. FmpUpdateGroupIntendedOwner(
  1688. IN BOOL SourceNode,
  1689. IN LPCWSTR pszGroupId,
  1690. IN PDWORD pdwNodeId
  1691. );
  1692. //
  1693. // Handle group property requests
  1694. //
  1695. DWORD
  1696. FmpGroupEnumCommonProperties(
  1697. OUT PVOID OutBuffer,
  1698. IN DWORD OutBufferSize,
  1699. OUT LPDWORD BytesReturned,
  1700. OUT LPDWORD Required
  1701. );
  1702. DWORD
  1703. FmpGroupEnumPrivateProperties(
  1704. IN PFM_GROUP Group,
  1705. OUT PVOID OutBuffer,
  1706. IN DWORD OutBufferSize,
  1707. OUT LPDWORD BytesReturned,
  1708. OUT LPDWORD Required
  1709. );
  1710. DWORD
  1711. FmpGroupGetCommonProperties(
  1712. IN PFM_GROUP Group,
  1713. IN BOOL ReadOnly,
  1714. OUT PVOID OutBuffer,
  1715. IN DWORD OutBufferSize,
  1716. OUT LPDWORD BytesReturned,
  1717. OUT LPDWORD Required
  1718. );
  1719. DWORD
  1720. FmpGroupValidateCommonProperties(
  1721. IN PFM_GROUP Group,
  1722. IN PVOID InBuffer,
  1723. IN DWORD InBufferSize
  1724. );
  1725. DWORD
  1726. FmpGroupSetCommonProperties(
  1727. IN PFM_GROUP Group,
  1728. IN PVOID InBuffer,
  1729. IN DWORD InBufferSize
  1730. );
  1731. DWORD
  1732. FmpGroupGetPrivateProperties(
  1733. IN PFM_GROUP Group,
  1734. OUT PVOID OutBuffer,
  1735. IN DWORD OutBufferSize,
  1736. OUT LPDWORD BytesReturned,
  1737. OUT LPDWORD Required
  1738. );
  1739. DWORD
  1740. FmpGroupValidatePrivateProperties(
  1741. IN PFM_GROUP Group,
  1742. IN PVOID InBuffer,
  1743. IN DWORD InBufferSize
  1744. );
  1745. DWORD
  1746. FmpGroupSetPrivateProperties(
  1747. IN PFM_GROUP Group,
  1748. IN PVOID InBuffer,
  1749. IN DWORD InBufferSize
  1750. );
  1751. DWORD
  1752. FmpGroupGetFlags(
  1753. IN PFM_GROUP Group,
  1754. OUT PVOID OutBuffer,
  1755. IN DWORD OutBufferSize,
  1756. OUT LPDWORD BytesReturned,
  1757. OUT LPDWORD Required
  1758. );
  1759. //property parse routines
  1760. DWORD FmpGetDiskInfoParseProperties(
  1761. IN PUCHAR InBuffer,
  1762. IN DWORD InBufferSize,
  1763. IN OUT LPWSTR pszPath
  1764. );
  1765. DWORD
  1766. FmpBroadcastDeleteControl(
  1767. IN PFM_RESOURCE Resource
  1768. );
  1769. DWORD
  1770. FmpBroadcastDependencyChange(
  1771. IN PFM_RESOURCE Resource,
  1772. IN LPCWSTR DependsOnId,
  1773. IN BOOL Remove
  1774. );
  1775. BOOL
  1776. FmpCheckNetworkDependency(
  1777. IN LPCWSTR DependentNetwork
  1778. );
  1779. DWORD
  1780. FmpVotePossibleNodeForResType(
  1781. IN DWORD dwInputBufLength,
  1782. IN LPCWSTR lpszResType,
  1783. IN DWORD dwVoteLength,
  1784. OUT PVOID pVoteBuf
  1785. );
  1786. DWORD
  1787. FmpUpdatePossibleNodeForResType(
  1788. IN BOOL SourceNode,
  1789. IN LPCWSTR lpszResTypeName,
  1790. IN LPDWORD pdwBufLength,
  1791. IN PVOID pBuf
  1792. );
  1793. DWORD
  1794. FmpUpdateChangeResourceNode(
  1795. IN BOOL SourceNode,
  1796. IN PFM_RESOURCE pResource,
  1797. IN PNM_NODE pNode,
  1798. IN DWORD dwControlCode
  1799. );
  1800. DWORD
  1801. FmpUpdateChangeResourceGroup(
  1802. IN BOOL bSourceNode,
  1803. IN PFM_RESOURCE pResource,
  1804. IN PFM_GROUP pNewGroup
  1805. );
  1806. DWORD
  1807. FmpChangeResourceNode(
  1808. IN PFM_RESOURCE Resource,
  1809. IN LPCWSTR NodeId,
  1810. IN BOOL Add
  1811. );
  1812. DWORD
  1813. FmpFixupPossibleNodesForResources(
  1814. BOOL bJoin
  1815. );
  1816. BOOL
  1817. FmpEnumFixupPossibleNodesForResource(
  1818. IN PVOID pContext1,
  1819. IN PVOID pContext2,
  1820. IN PFM_RESOURCE pResource,
  1821. IN LPCWSTR pszResName
  1822. );
  1823. DWORD
  1824. FmpQueueTimerActivity(
  1825. IN DWORD dwInterval,
  1826. IN PFN_TIMER_CALLBACK pfnTimerCb,
  1827. IN PVOID pContext
  1828. );
  1829. DWORD
  1830. FmpDelayedStartRes(
  1831. IN PFM_RESOURCE pResource
  1832. );
  1833. //timer callback functions
  1834. void
  1835. WINAPI
  1836. FmpReslistOnlineRetryCb(
  1837. IN HANDLE hTimer,
  1838. IN PVOID pContext
  1839. );
  1840. VOID
  1841. FmpDelayedRestartCb(
  1842. IN HANDLE hTimer,
  1843. IN PVOID pContext
  1844. );
  1845. DWORD
  1846. FmpDoMoveGroupOnFailure(
  1847. IN LPVOID pContext
  1848. );
  1849. DWORD
  1850. FmpSetOwnerForGroup(
  1851. IN PFM_GROUP pGroup,
  1852. IN PNM_NODE pNode
  1853. );
  1854. DWORD
  1855. FmpSetIntendedOwnerForGroup(
  1856. IN PFM_GROUP pGroup,
  1857. IN DWORD dwNodeId
  1858. );
  1859. VOID
  1860. FmpResetGroupIntendedOwner(
  1861. IN PGROUP_ENUM pGroupEnum
  1862. );
  1863. DWORD
  1864. FmpGetGroupInNodeGroupList(
  1865. OUT PGROUP_ENUM *pReturnEnum,
  1866. IN PFM_GROUP pGroup,
  1867. IN LPCWSTR pszDeadNodeId,
  1868. OUT PBOOL pbQuorumGroup
  1869. );
  1870. VOID
  1871. FmpPrepareGroupEnumForOnline(
  1872. IN PGROUP_ENUM pGroupEnum
  1873. );
  1874. DWORD
  1875. FmpRmExceptionFilter(
  1876. DWORD ExceptionCode
  1877. );
  1878. DWORD
  1879. FmpBringQuorumGroupListOnline(
  1880. IN LPVOID pContext
  1881. );
  1882. DWORD
  1883. FmpHandleNodeDownEvent(
  1884. IN PVOID pContext
  1885. );
  1886. DWORD
  1887. FmpEnumerateGroupResources(
  1888. IN PFM_GROUP pGroup,
  1889. IN FM_ENUM_GROUP_RESOURCE_ROUTINE pfnEnumerationRoutine,
  1890. IN PVOID pContext1,
  1891. IN PVOID pContext2
  1892. );
  1893. PNM_NODE
  1894. FmpGetNonLocalPreferredNode(
  1895. IN PFM_GROUP Group
  1896. );
  1897. DWORD
  1898. FmpGetResourceCharacteristics(
  1899. IN PFM_RESOURCE pQuoResource,
  1900. OUT LPDWORD pdwCharacteristics
  1901. );
  1902. BOOL
  1903. FmpIsAnyResourcePersistentStateOnline(
  1904. IN PFM_GROUP pGroup
  1905. );
  1906. PNM_NODE
  1907. FmpGetNodeNotHostingUndesiredGroups(
  1908. IN PFM_GROUP pGroup,
  1909. IN BOOL fRuleOutLocalNode,
  1910. IN BOOL fChooseMostPreferredNode
  1911. );
  1912. BOOL
  1913. FmpCheckForAntiAffinityProperty(
  1914. IN LPCWSTR lpszLimitOneGroupPerName,
  1915. IN PGROUP_AFFINITY_NODE_INFO pGroupAffinityNodeInfo,
  1916. IN PFM_GROUP pGroup,
  1917. IN LPCWSTR lpszGroupName
  1918. );
  1919. DWORD
  1920. FmpUpgradeResourceDLL(
  1921. IN PFM_RESOURCE pResource,
  1922. IN LPWSTR lpszInstallationPath
  1923. );
  1924. DWORD
  1925. FmpParsePathForFileName(
  1926. IN LPWSTR lpszPath,
  1927. IN BOOL fCheckPathExists,
  1928. OUT LPWSTR *ppszFileName
  1929. );
  1930. DWORD
  1931. FmpValidateResourceDLLReplacement(
  1932. IN PFM_RESOURCE pResource,
  1933. IN LPWSTR lpszNewDllName,
  1934. OUT LPWSTR *ppszCurrentDllPath
  1935. );
  1936. DWORD
  1937. FmpReplaceResourceDLL(
  1938. IN LPWSTR lpszNewDllName,
  1939. IN LPWSTR lpszCurrentDllPath,
  1940. IN LPWSTR lpszInstallationPath
  1941. );
  1942. DWORD
  1943. FmpRecycleMonitors(
  1944. IN LPCWSTR lpszDllName
  1945. );
  1946. DWORD
  1947. FmpCreateMonitorList(
  1948. IN LPCWSTR lpszDllName,
  1949. OUT PFM_MONITOR_ENUM_HEADER pMonitorHeader
  1950. );
  1951. BOOL
  1952. FmpFindHostMonitors(
  1953. IN LPCWSTR lpszDllName,
  1954. IN OUT PFM_MONITOR_ENUM_HEADER pMonitorEnumHeader,
  1955. IN PFM_RESOURCE pResource,
  1956. IN LPCWSTR lpszResourceId
  1957. );
  1958. DWORD
  1959. FmpRecoverResourceDLLFiles(
  1960. VOID
  1961. );
  1962. DWORD
  1963. FmpResetMultiSzValue(
  1964. IN HKEY hKey,
  1965. IN LPWSTR lpmszList,
  1966. IN OUT LPDWORD pcchLen,
  1967. IN LPCWSTR lpszValueName,
  1968. IN LPCWSTR lpszString
  1969. );
  1970. DWORD
  1971. FmpCopyBackupFile(
  1972. IN LPCWSTR lpszPath
  1973. );
  1974. VOID
  1975. FmpDeleteBackupFiles(
  1976. IN LPCWSTR lpszPath OPTIONAL
  1977. );
  1978. PNM_NODE
  1979. FmpPickNodeFromPreferredListAtRandom(
  1980. IN PFM_GROUP pGroup,
  1981. IN PNM_NODE pSuggestedPreferredNode OPTIONAL,
  1982. IN BOOL fRuleOutLocalNode,
  1983. IN BOOL fCheckForDisablingRandomization
  1984. );
  1985. BOOL
  1986. FmpIsNodeUserPreferred(
  1987. IN PFM_GROUP pGroup,
  1988. IN PNM_NODE pPreferredNode
  1989. );
  1990. DWORD
  1991. FmpPrepareGroupNodeList(
  1992. OUT PFM_GROUP_NODE_LIST *ppGroupNodeList
  1993. );
  1994. DWORD
  1995. FmpAddGroupNodeToList(
  1996. IN PFM_GROUP_NODE_LIST *ppGroupNodeList,
  1997. IN LPDWORD pcbBuffer,
  1998. IN PFM_GROUP pGroup,
  1999. IN LPCWSTR lpszGroupId
  2000. );
  2001. PNM_NODE
  2002. FmpParseGroupNodeListForPreferredOwner(
  2003. IN PFM_GROUP pGroup,
  2004. IN PFM_GROUP_NODE_LIST pGroupNodeList,
  2005. IN PNM_NODE pSuggestedPreferredNode
  2006. );
  2007. DWORD
  2008. FmpUpdateUseRandomizedNodeListForGroups(
  2009. IN BOOL SourceNode,
  2010. IN LPCWSTR pszNodeId,
  2011. IN PFM_GROUP_NODE_LIST pGroupNodeList
  2012. );
  2013. VOID
  2014. FmpClusterWideInitializeResource(
  2015. IN PFM_RESOURCE pResource
  2016. );
  2017. VOID
  2018. FmpNotifyResourceStateChangeReason(
  2019. IN PFM_RESOURCE pResource,
  2020. IN CLUSTER_RESOURCE_STATE_CHANGE_REASON eReason
  2021. );
  2022. VOID
  2023. FmpNotifyGroupStateChangeReason(
  2024. IN PFM_GROUP pGroup,
  2025. IN CLUSTER_RESOURCE_STATE_CHANGE_REASON eReason
  2026. );
  2027. DWORD FmpGetClusterNameChangeParams(
  2028. IN LPCWSTR lpszNewName,
  2029. OUT PFM_RESOURCE *ppCoreNetNameResource,
  2030. OUT PVOID *ppPropList,
  2031. OUT LPDWORD pdwPropListSize
  2032. );
  2033. DWORD FmpValidateCoreNetNameChange(
  2034. IN PFM_RESOURCE pResource,
  2035. IN PVOID pPropList,
  2036. IN DWORD cbListSize
  2037. );
  2038. DWORD FmpCoreNetNameChange(
  2039. IN PFM_RESOURCE pResource,
  2040. IN PVOID pPropList,
  2041. IN DWORD cbListSize
  2042. );
  2043. VOID
  2044. FmpHandleNodeEvictEvent(
  2045. IN PVOID pContext
  2046. );
  2047. DWORD
  2048. FmpRmDoHandleCriticalResourceStateChange(
  2049. IN PRM_EVENT pEvent,
  2050. IN OPTIONAL PFM_RESOURCE pTransitionedResource,
  2051. IN CLUSTER_RESOURCE_STATE NewState
  2052. );
  2053. BOOL
  2054. FmpHandleMonitorCrash(
  2055. IN PRESMON pCrashedMonitor
  2056. );
  2057. VOID
  2058. FmpHandleResourceRestartOnMonitorCrash(
  2059. IN PFM_RESOURCE pResource
  2060. );
  2061. VOID
  2062. FmpCheckAndUpdateMonitorForDeadlockDetection(
  2063. IN PRESMON pMonitor
  2064. );
  2065. VOID
  2066. FmpHandleMonitorDeadlock(
  2067. IN PRESMON pMonitor
  2068. );
  2069. #endif //ifndef _FMP_H