VirtualBox

source: vbox/trunk/src/VBox/VMM/SSMInternal.h@ 2676

Last change on this file since 2676 was 23, checked in by vboxsync, 17 years ago

string.h & stdio.h + header cleanups.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 5.2 KB
Line 
1/* $Id: SSMInternal.h 23 2007-01-15 14:08:28Z vboxsync $ */
2/** @file
3 * SSM - Internal header file.
4 */
5
6/*
7 * Copyright (C) 2006 InnoTek Systemberatung GmbH
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 as published by the Free Software Foundation,
13 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
14 * distribution. VirtualBox OSE is distributed in the hope that it will
15 * be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * If you received this file as part of a commercial VirtualBox
18 * distribution, then only the terms of your commercial VirtualBox
19 * license agreement apply instead of the previous paragraph.
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 */
41typedef 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. */
54typedef struct SSMUNIT *PSSMUNIT;
55
56/**
57 * Data unit descriptor.
58 */
59typedef 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/**
163 * Converts a SSM pointer into a VM pointer.
164 * @returns Pointer to the VM structure the SSM is part of.
165 * @param pSSM Pointer to SSM instance data.
166 */
167#define SSM2VM(pSSM) ( (PVM)((char*)pSSM - pSSM->offVM) )
168
169
170/**
171 * SSM VM Instance data.
172 * Changes to this must checked against the padding of the cfgm union in VM!
173 */
174typedef struct SSM
175{
176 /** Offset to the VM structure.
177 * See SSM2VM(). */
178 RTUINT offVM;
179
180 /** FIFO of data entity descriptors. */
181 HCPTRTYPE(PSSMUNIT) pHead;
182
183} SSM;
184/** Pointer to SSM VM instance data. */
185typedef SSM *PSSM;
186
187
188
189/** @} */
190
191__END_DECLS
192
193#endif /* !__SSMInternal_h__ */
194
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use