BIOSSettingsImpl.cpp revision 6f0c02346cb86a521150bb90b064f439e03e2a6d
/** @file
*
* VirtualBox COM class implementation
*/
/*
* Copyright (C) 2006-2007 innotek GmbH
*
* 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.
*/
#include "BIOSSettingsImpl.h"
#include "MachineImpl.h"
#include "Logging.h"
#include <iprt/cpputils.h>
// constructor / destructor
/////////////////////////////////////////////////////////////////////////////
{
return S_OK;
}
void BIOSSettings::FinalRelease()
{
uninit ();
}
// public initializer/uninitializer for internal purposes only
/////////////////////////////////////////////////////////////////////////////
/**
* Initializes the audio adapter object.
*
* @returns COM result indicator
*/
{
/* Enclose the state transition NotReady->InInit->Ready */
AutoInitSpan autoInitSpan (this);
/* share the parent weakly */
return S_OK;
}
/**
* Initializes the audio adapter object given another audio adapter object
* (a kind of copy constructor). This object shares data with
* the object passed as an argument.
*
* @note This object must be destroyed before the original object
* it shares data with is destroyed.
*/
{
/* Enclose the state transition NotReady->InInit->Ready */
AutoInitSpan autoInitSpan (this);
return S_OK;
}
/**
* Initializes the guest object given another guest object
* (a kind of copy constructor). This object makes a private copy of data
* of the original object passed as an argument.
*/
{
/* Enclose the state transition NotReady->InInit->Ready */
AutoInitSpan autoInitSpan (this);
// mPeer is left null
return S_OK;
}
/**
* Uninitializes the instance and sets the ready flag to FALSE.
* Called either from FinalRelease() or by the parent when it gets destroyed.
*/
void BIOSSettings::uninit()
{
/* Enclose the state transition Ready->InUninit->NotReady */
AutoUninitSpan autoUninitSpan (this);
if (autoUninitSpan.uninitDone())
return;
}
// IBIOSSettings properties
/////////////////////////////////////////////////////////////////////////////
{
if (!enabled)
return E_POINTER;
AutoCaller autoCaller (this);
AutoReaderLock alock (this);
return S_OK;
}
{
AutoCaller autoCaller (this);
/* the machine needs to be mutable */
return S_OK;
}
{
if (!enabled)
return E_POINTER;
AutoCaller autoCaller (this);
AutoReaderLock alock (this);
return S_OK;
}
{
AutoCaller autoCaller (this);
/* the machine needs to be mutable */
return S_OK;
}
{
if (!displayTime)
return E_POINTER;
AutoCaller autoCaller (this);
AutoReaderLock alock (this);
return S_OK;
}
{
AutoCaller autoCaller (this);
/* the machine needs to be mutable */
return S_OK;
}
{
if (!imagePath)
return E_POINTER;
AutoCaller autoCaller (this);
AutoReaderLock alock (this);
return S_OK;
}
{
/* empty strings are not allowed as path names */
return E_INVALIDARG;
AutoCaller autoCaller (this);
/* the machine needs to be mutable */
return S_OK;
}
{
if (!bootMenuMode)
return E_POINTER;
AutoCaller autoCaller (this);
AutoReaderLock alock (this);
return S_OK;
}
{
AutoCaller autoCaller (this);
/* the machine needs to be mutable */
return S_OK;
}
{
if (!enabled)
return E_POINTER;
AutoCaller autoCaller (this);
AutoReaderLock alock (this);
return S_OK;
}
{
AutoCaller autoCaller (this);
/* the machine needs to be mutable */
return S_OK;
}
{
if (!enabled)
return E_POINTER;
AutoCaller autoCaller (this);
AutoReaderLock alock (this);
return S_OK;
}
{
AutoCaller autoCaller (this);
/* the machine needs to be mutable */
return S_OK;
}
{
if (!enabled)
return E_POINTER;
AutoCaller autoCaller (this);
AutoReaderLock alock (this);
return S_OK;
}
{
AutoCaller autoCaller (this);
/* the machine needs to be mutable */
return S_OK;
}
{
if (!aControllerType)
return E_POINTER;
AutoCaller autoCaller (this);
AutoReaderLock alock (this);
return S_OK;
}
{
AutoCaller autoCaller (this);
/* the machine needs to be mutable */
/* make sure the value is allowed */
switch (aControllerType)
{
case IDEControllerType_PIIX3:
case IDEControllerType_PIIX4:
break;
default:
tr("Invalid IDE controller type '%d'"),
}
return S_OK;
}
{
if (!offset)
return E_POINTER;
AutoCaller autoCaller (this);
AutoReaderLock alock (this);
return S_OK;
}
{
AutoCaller autoCaller (this);
/* the machine needs to be mutable */
return S_OK;
}
// IBIOSSettings methods
/////////////////////////////////////////////////////////////////////////////
// public methods only for internal purposes
/////////////////////////////////////////////////////////////////////////////
/**
* Loads settings from the given machine node.
* May be called once right after this object creation.
*
* @param aMachineNode <Machine> node.
*
* @note Locks this object for writing.
*/
{
using namespace settings;
AutoCaller autoCaller (this);
/* Note: we assume that the default values for attributes of optional
* nodes are assigned in the Data::Data() constructor and don't do it
* here. It implies that this method may only be called after constructing
* a new BIOSSettings object while all its data fields are in the default
* values. Exceptions are fields whose creation time defaults don't match
* values that should be applied when these fields are not explicitly set
* in the settings file (for backwards compatibility reasons). This takes
* place when a setting of a newly created object must default to A while
* the same setting of an object loaded from the old settings file must
* default to B. */
/* BIOS node (required) */
/* ACPI (required) */
{
}
/* IOAPIC (optional) */
{
if (!ioapicNode.isNull())
}
/* Logo (optional) */
{
{
}
}
/* boot menu (optional) */
{
if (!bootMenuNode.isNull())
{
else
E_FAIL);
}
}
/* PXE debug logging (optional) */
{
if (!pxedebugNode.isNull())
}
/* time offset (optional) */
{
if (!timeOffsetNode.isNull())
}
/* IDE controller type (optional, for old machines that lack this node,
* defaults to PIIX3) */
{
if (!ideControllerNode.isNull())
{
else
E_FAIL);
}
}
return S_OK;
}
/**
* Saves settings to the given machine node.
*
* @param aMachineNode <Machine> node.
*
* @note Locks this object for reading.
*/
{
using namespace settings;
AutoCaller autoCaller (this);
AutoReaderLock alock (this);
/* ACPI */
{
}
/* IOAPIC */
{
}
/* BIOS logo (optional) **/
{
}
/* boot menu (optional) */
{
switch (mData->mBootMenuMode)
{
modeStr = "Disabled";
break;
modeStr = "MenuOnly";
break;
modeStr = "MessageAndMenu";
break;
default:
ComAssertMsgFailedRet (("Invalid boot menu type: %d\n",
E_FAIL);
}
}
/* time offset (optional) */
{
}
/* PXE debug flag (optional) */
{
}
/* IDE controller type */
{
const char *ideControllerTypeStr = NULL;
switch (mData->mIDEControllerType)
{
case IDEControllerType_PIIX3:
ideControllerTypeStr = "PIIX3";
break;
case IDEControllerType_PIIX4:
ideControllerTypeStr = "PIIX4";
break;
default:
ComAssertMsgFailedRet (("Invalid IDE Controller type: %d\n",
E_FAIL);
}
}
return S_OK;
}
void BIOSSettings::commit()
{
if (mData.isBackedUp())
{
if (mPeer)
{
// attach new data to the peer and reshare it
}
}
}
{
// this will back up current data
}