1 | /* $Id: FTMInternal.h 31895 2010-08-24 09:00:14Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * FTM - Internal header file.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2010 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef ___FTMInternal_h
|
---|
19 | #define ___FTMInternal_h
|
---|
20 |
|
---|
21 | #include <VBox/cdefs.h>
|
---|
22 | #include <VBox/types.h>
|
---|
23 | #include <VBox/ftm.h>
|
---|
24 | #include <VBox/stam.h>
|
---|
25 | #include <VBox/pdmcritsect.h>
|
---|
26 |
|
---|
27 | /** @defgroup grp_ftm_int Internals.
|
---|
28 | * @ingroup grp_ftm
|
---|
29 | * @{
|
---|
30 | */
|
---|
31 |
|
---|
32 | typedef enum
|
---|
33 | {
|
---|
34 | /* Sync the changed memory pages. */
|
---|
35 | FTMSYNCSTATE_DELTA_MEMORY,
|
---|
36 | /* Sync the changed state (memory + vm/device internal state) */
|
---|
37 | FTMSYNCSTATE_DELTA_VM,
|
---|
38 | /* Sync the entire VM state. */
|
---|
39 | FTMSYNCSTATE_FULL
|
---|
40 | } FTMSYNCSTATE;
|
---|
41 |
|
---|
42 |
|
---|
43 | /**
|
---|
44 | * FTM VM Instance data.
|
---|
45 | * Changes to this must checked against the padding of the ftm union in VM!
|
---|
46 | */
|
---|
47 | typedef struct FTM
|
---|
48 | {
|
---|
49 | /** Address of the standby VM. */
|
---|
50 | R3PTRTYPE(char *) pszAddress;
|
---|
51 | /** Password to access the syncing server of the standby VM. */
|
---|
52 | R3PTRTYPE(char *) pszPassword;
|
---|
53 | /** Port of the standby VM. */
|
---|
54 | unsigned uPort;
|
---|
55 | /** Syncing interval in ms. */
|
---|
56 | unsigned uInterval;
|
---|
57 |
|
---|
58 | /** Set when this VM is the standby FT node. */
|
---|
59 | bool fIsStandbyNode;
|
---|
60 | /** Set when this master VM is busy with checkpointing. */
|
---|
61 | bool fCheckpointingActive;
|
---|
62 | bool fAlignment[6];
|
---|
63 |
|
---|
64 | /** Current active socket. */
|
---|
65 | RTSOCKET hSocket;
|
---|
66 | #if HC_ARCH_BITS == 32
|
---|
67 | RTSOCKET hSocketAlignment; /**< Alignment padding. */
|
---|
68 | #endif
|
---|
69 |
|
---|
70 | /** State sync. */
|
---|
71 | struct
|
---|
72 | {
|
---|
73 | unsigned uOffStream;
|
---|
74 | unsigned cbReadBlock;
|
---|
75 | bool fStopReading;
|
---|
76 | bool fIOError;
|
---|
77 | bool fEndOfStream;
|
---|
78 | bool fAlignment[5];
|
---|
79 | } syncstate;
|
---|
80 |
|
---|
81 | struct
|
---|
82 | {
|
---|
83 | R3PTRTYPE(PRTTCPSERVER) hServer;
|
---|
84 | } standby;
|
---|
85 |
|
---|
86 | struct
|
---|
87 | {
|
---|
88 | RTSEMEVENT hShutdownEvent;
|
---|
89 | } master;
|
---|
90 |
|
---|
91 | /** FTM critical section.
|
---|
92 | * This makes sure only the checkpoint or sync is active
|
---|
93 | */
|
---|
94 | PDMCRITSECT CritSect;
|
---|
95 |
|
---|
96 | STAMCOUNTER StatReceivedMem;
|
---|
97 | STAMCOUNTER StatReceivedState;
|
---|
98 | STAMCOUNTER StatSentMem;
|
---|
99 | STAMCOUNTER StatSentState;
|
---|
100 | } FTM;
|
---|
101 | AssertCompileMemberAlignment(FTM, CritSect, 8);
|
---|
102 |
|
---|
103 | /** @} */
|
---|
104 |
|
---|
105 | #endif
|
---|