SSMInternal.h revision 43747b1f0bc8302a238fb35e55857a5e9aa1933d
/* $Id$ */
/** @file
* SSM - Internal header file.
*/
/*
* Copyright (C) 2006-2007 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#ifndef ___SSMInternal_h
#define ___SSMInternal_h
#include <iprt/critsect.h>
/** @defgroup grp_ssm_int Internals
* @ingroup grp_ssm
* @internal
* @{
*/
/**
* Data unit callback type.
*/
typedef enum SSMUNITTYPE
{
/** PDM Device . */
SSMUNITTYPE_DEV = 1,
/** PDM Driver. */
/** VM Internal. */
/** External Wrapper. */
} SSMUNITTYPE;
/** Pointer to a data unit descriptor. */
/**
* Data unit descriptor.
*/
typedef struct SSMUNIT
{
/** Pointer ot the next one in the list. */
* The flag is used to determine whether there is need for a call to
* done or not. */
bool fCalled;
/** Finished its live part.
* This is used to handle VERR_SSM_VOTE_FOR_GIVING_UP. */
bool fDoneLive;
/** Callback interface type. */
/** Type specific data. */
union
{
/** SSMUNITTYPE_DEV. */
struct
{
/** Prepare live save. */
/** Execute live save. */
/** Vote live save complete. */
/** Prepare save. */
/** Execute save. */
/** Done save. */
/** Prepare load. */
/** Execute load. */
/** Done load. */
/** Device instance. */
} Dev;
/** SSMUNITTYPE_DRV. */
struct
{
/** Prepare live save. */
/** Execute live save. */
/** Vote live save complete. */
/** Prepare save. */
/** Execute save. */
/** Done save. */
/** Prepare load. */
/** Execute load. */
/** Done load. */
/** Driver instance. */
} Drv;
/** SSMUNITTYPE_INTERNAL. */
struct
{
/** Prepare live save. */
/** Execute live save. */
/** Vote live save complete. */
/** Prepare save. */
/** Execute save. */
/** Done save. */
/** Prepare load. */
/** Execute load. */
/** Done load. */
} Internal;
/** SSMUNITTYPE_EXTERNAL. */
struct
{
/** Prepare live save. */
/** Execute live save. */
/** Vote live save complete. */
/** Prepare save. */
/** Execute save. */
/** Done save. */
/** Prepare load. */
/** Execute load. */
/** Done load. */
/** User data. */
void *pvUser;
} External;
struct
{
/** Prepare live save. */
/** Execute live save. */
/** Vote live save complete. */
/** Prepare save. */
/** Execute save. */
/** Done save. */
/** Prepare load. */
/** Execute load. */
/** Done load. */
/** User data. */
void *pvKey;
} Common;
} u;
/** Data layout version. */
/** Instance number. */
/** The offset of the final data unit.
* This is used for constructing the directory. */
/** The guessed size of the data unit - used only for progress indication. */
/** Name size. (bytes) */
/** Name of this unit. (extends beyond the defined size) */
char szName[1];
} SSMUNIT;
/**
* SSM VM Instance data.
* Changes to this must checked against the padding of the cfgm union in VM!
*
* @todo Move this to UVM.
*/
typedef struct SSM
{
/** Critical section for serializing cancellation (pSSM). */
/** The handle of the current save or load operation.
* This is used by SSMR3Cancel. */
PSSMHANDLE volatile pSSM;
/** FIFO of data entity descriptors. */
/** The number of register units. */
/** For lazy init. */
bool fInitialized;
/** Current pass (for STAM). */
} SSM;
/** Pointer to SSM VM instance data. */
/** @} */
#endif /* !___SSMInternal_h */