1 | /* $Id: SSMInternal.h 12440 2008-09-12 18:40:20Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * SSM - Internal header file.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
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 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
18 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
19 | * additional information or have any questions.
|
---|
20 | */
|
---|
21 |
|
---|
22 | #ifndef ___SSMInternal_h
|
---|
23 | #define ___SSMInternal_h
|
---|
24 |
|
---|
25 | #include <VBox/cdefs.h>
|
---|
26 | #include <VBox/types.h>
|
---|
27 | #include <VBox/ssm.h>
|
---|
28 |
|
---|
29 | __BEGIN_DECLS
|
---|
30 |
|
---|
31 | /** @defgroup grp_ssm_int Internals
|
---|
32 | * @ingroup grp_ssm
|
---|
33 | * @internal
|
---|
34 | * @{
|
---|
35 | */
|
---|
36 |
|
---|
37 |
|
---|
38 | /**
|
---|
39 | * Data unit callback type.
|
---|
40 | */
|
---|
41 | typedef enum SSMUNITTYPE
|
---|
42 | {
|
---|
43 | /** PDM Device . */
|
---|
44 | SSMUNITTYPE_DEV = 1,
|
---|
45 | /** PDM Driver. */
|
---|
46 | SSMUNITTYPE_DRV,
|
---|
47 | /** VM Internal. */
|
---|
48 | SSMUNITTYPE_INTERNAL,
|
---|
49 | /** External Wrapper. */
|
---|
50 | SSMUNITTYPE_EXTERNAL
|
---|
51 | } SSMUNITTYPE;
|
---|
52 |
|
---|
53 | /** Pointer to a data unit descriptor. */
|
---|
54 | typedef struct SSMUNIT *PSSMUNIT;
|
---|
55 |
|
---|
56 | /**
|
---|
57 | * Data unit descriptor.
|
---|
58 | */
|
---|
59 | typedef struct SSMUNIT
|
---|
60 | {
|
---|
61 | /** Pointer ot the next one in the list. */
|
---|
62 | PSSMUNIT pNext;
|
---|
63 |
|
---|
64 | /** Called in this save/load operation.
|
---|
65 | * The flag is used to determin whether there is need for a call to
|
---|
66 | * done or not. */
|
---|
67 | bool fCalled;
|
---|
68 | /** Callback interface type. */
|
---|
69 | SSMUNITTYPE enmType;
|
---|
70 | /** Type specific data. */
|
---|
71 | union
|
---|
72 | {
|
---|
73 | /** SSMUNITTYPE_DEV. */
|
---|
74 | struct
|
---|
75 | {
|
---|
76 | /** Prepare save. */
|
---|
77 | PFNSSMDEVSAVEPREP pfnSavePrep;
|
---|
78 | /** Execute save. */
|
---|
79 | PFNSSMDEVSAVEEXEC pfnSaveExec;
|
---|
80 | /** Done save. */
|
---|
81 | PFNSSMDEVSAVEDONE pfnSaveDone;
|
---|
82 | /** Prepare load. */
|
---|
83 | PFNSSMDEVLOADPREP pfnLoadPrep;
|
---|
84 | /** Execute load. */
|
---|
85 | PFNSSMDEVLOADEXEC pfnLoadExec;
|
---|
86 | /** Done load. */
|
---|
87 | PFNSSMDEVLOADDONE pfnLoadDone;
|
---|
88 | /** Device instance. */
|
---|
89 | PPDMDEVINS pDevIns;
|
---|
90 | } Dev;
|
---|
91 |
|
---|
92 | /** SSMUNITTYPE_DRV. */
|
---|
93 | struct
|
---|
94 | {
|
---|
95 | /** Prepare save. */
|
---|
96 | PFNSSMDRVSAVEPREP pfnSavePrep;
|
---|
97 | /** Execute save. */
|
---|
98 | PFNSSMDRVSAVEEXEC pfnSaveExec;
|
---|
99 | /** Done save. */
|
---|
100 | PFNSSMDRVSAVEDONE pfnSaveDone;
|
---|
101 | /** Prepare load. */
|
---|
102 | PFNSSMDRVLOADPREP pfnLoadPrep;
|
---|
103 | /** Execute load. */
|
---|
104 | PFNSSMDRVLOADEXEC pfnLoadExec;
|
---|
105 | /** Done load. */
|
---|
106 | PFNSSMDRVLOADDONE pfnLoadDone;
|
---|
107 | /** Driver instance. */
|
---|
108 | PPDMDRVINS pDrvIns;
|
---|
109 | } Drv;
|
---|
110 |
|
---|
111 | /** SSMUNITTYPE_INTERNAL. */
|
---|
112 | struct
|
---|
113 | {
|
---|
114 | /** Prepare save. */
|
---|
115 | PFNSSMINTSAVEPREP pfnSavePrep;
|
---|
116 | /** Execute save. */
|
---|
117 | PFNSSMINTSAVEEXEC pfnSaveExec;
|
---|
118 | /** Done save. */
|
---|
119 | PFNSSMINTSAVEDONE pfnSaveDone;
|
---|
120 | /** Prepare load. */
|
---|
121 | PFNSSMINTLOADPREP pfnLoadPrep;
|
---|
122 | /** Execute load. */
|
---|
123 | PFNSSMINTLOADEXEC pfnLoadExec;
|
---|
124 | /** Done load. */
|
---|
125 | PFNSSMINTLOADDONE pfnLoadDone;
|
---|
126 | } Internal;
|
---|
127 |
|
---|
128 | /** SSMUNITTYPE_EXTERNAL. */
|
---|
129 | struct
|
---|
130 | {
|
---|
131 | /** Prepare save. */
|
---|
132 | PFNSSMEXTSAVEPREP pfnSavePrep;
|
---|
133 | /** Execute save. */
|
---|
134 | PFNSSMEXTSAVEEXEC pfnSaveExec;
|
---|
135 | /** Done save. */
|
---|
136 | PFNSSMEXTSAVEDONE pfnSaveDone;
|
---|
137 | /** Prepare load. */
|
---|
138 | PFNSSMEXTLOADPREP pfnLoadPrep;
|
---|
139 | /** Execute load. */
|
---|
140 | PFNSSMEXTLOADEXEC pfnLoadExec;
|
---|
141 | /** Done load. */
|
---|
142 | PFNSSMEXTLOADDONE pfnLoadDone;
|
---|
143 | /** User data. */
|
---|
144 | void *pvUser;
|
---|
145 | } External;
|
---|
146 | } u;
|
---|
147 | /** Data layout version. */
|
---|
148 | uint32_t u32Version;
|
---|
149 | /** Instance number. */
|
---|
150 | uint32_t u32Instance;
|
---|
151 | /** The guessed size of the data unit - used only for progress indication. */
|
---|
152 | size_t cbGuess;
|
---|
153 | /** Name size. (bytes) */
|
---|
154 | size_t cchName;
|
---|
155 | /** Name of this unit. (extends beyond the defined size) */
|
---|
156 | char szName[1];
|
---|
157 | } SSMUNIT;
|
---|
158 |
|
---|
159 |
|
---|
160 |
|
---|
161 | /**
|
---|
162 | * SSM VM Instance data.
|
---|
163 | * Changes to this must checked against the padding of the cfgm union in VM!
|
---|
164 | */
|
---|
165 | typedef struct SSM
|
---|
166 | {
|
---|
167 | /** FIFO of data entity descriptors. */
|
---|
168 | R3PTRTYPE(PSSMUNIT) pHead;
|
---|
169 | /** For lazy init. */
|
---|
170 | bool fInitialized;
|
---|
171 | } SSM;
|
---|
172 | /** Pointer to SSM VM instance data. */
|
---|
173 | typedef SSM *PSSM;
|
---|
174 |
|
---|
175 |
|
---|
176 |
|
---|
177 | /** @} */
|
---|
178 |
|
---|
179 | __END_DECLS
|
---|
180 |
|
---|
181 | #endif /* !___SSMInternal_h */
|
---|
182 |
|
---|