VirtualBox

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

Last change on this file since 5219 was 4776, checked in by vboxsync, 17 years ago

Stricter type checking. Removed unnecessary code from the ring 0 module.

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette