SystemPropertiesImpl.cpp revision 1961ed9e22cc2a61623f667cd24c2f4c4368e76b
/* $Id$ */
/** @file
*
* VirtualBox COM class implementation
*/
/*
* Copyright (C) 2006-2010 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.
*/
#include "SystemPropertiesImpl.h"
#include "VirtualBoxImpl.h"
#include "MachineImpl.h"
#include "AutoCaller.h"
#include "Logging.h"
// generated header
#include "SchemaDefs.h"
#include <VBox/settings.h>
// defines
/////////////////////////////////////////////////////////////////////////////
// constructor / destructor
/////////////////////////////////////////////////////////////////////////////
m(new settings::SystemProperties)
{
}
{
delete m;
}
{
return S_OK;
}
void SystemProperties::FinalRelease()
{
uninit();
}
// public methods only for internal purposes
/////////////////////////////////////////////////////////////////////////////
/**
* Initializes the system information object.
*
* @returns COM result indicator
*/
{
/* Enclose the state transition NotReady->InInit->Ready */
AutoInitSpan autoInitSpan(this);
m->ulLogHistoryCount = 3;
/* Fetch info of all available hd backends. */
/// @todo NEWMEDIA VDBackendInfo needs to be improved to let us enumerate
/// any number of backends
unsigned cEntries;
if (RT_SUCCESS(vrc))
{
for (unsigned i = 0; i < cEntries; ++ i)
{
}
}
/* Confirm a successful initialization */
return rc;
}
/**
* Uninitializes the instance and sets the ready flag to FALSE.
* Called either from FinalRelease() or by the parent when it gets destroyed.
*/
void SystemProperties::uninit()
{
LogFlowThisFunc(("\n"));
/* Enclose the state transition Ready->InUninit->NotReady */
AutoUninitSpan autoUninitSpan(this);
if (autoUninitSpan.uninitDone())
return;
}
// ISystemProperties properties
/////////////////////////////////////////////////////////////////////////////
{
AutoCaller autoCaller(this);
/* no need to lock, this is const */
return S_OK;
}
{
AutoCaller autoCaller(this);
/* no need to lock, this is const */
return S_OK;
}
{
AutoCaller autoCaller(this);
/* no need to lock, this is const */
return S_OK;
}
{
AutoCaller autoCaller(this);
/* no need to lock, this is const */
return S_OK;
}
{
AutoCaller autoCaller(this);
/* no need to lock, this is const */
return S_OK;
}
{
AutoCaller autoCaller(this);
/* no need to lock, this is const */
return S_OK;
}
{
AutoCaller autoCaller(this);
/* no need to lock, this is const */
return S_OK;
}
{
AutoCaller autoCaller(this);
/** The BIOS supports currently 32 bit LBA numbers (implementing the full
* 48 bit range is in theory trivial, but the crappy compiler makes things
* more difficult). This translates to almost 2 TBytes (to be on the safe
* side, the reported limit is 1 MiByte less than that, as the total number
* of sectors should fit in 32 bits, too), which should bei enough for
* the moment. The virtual ATA disks support complete LBA48 (although for
* example iSCSI is also currently limited to 32 bit LBA), so the
* theoretical maximum disk size is 128 PiByte. The user interface cannot
* cope with this in a reasonable way yet. */
/* no need to lock, this is const */
return S_OK;
}
{
AutoCaller autoCaller(this);
/* no need to lock, this is const */
return S_OK;
}
{
AutoCaller autoCaller(this);
/* no need to lock, this is const */
return S_OK;
}
{
AutoCaller autoCaller(this);
/* no need to lock, this is const */
return S_OK;
}
{
AutoCaller autoCaller(this);
/* no need to lock, this is const */
return S_OK;
}
{
AutoCaller autoCaller(this);
/* no need to lock, this is const */
switch (aBus)
{
case StorageBus_SATA:
case StorageBus_SCSI:
case StorageBus_SAS:
{
/* SATA and both SCSI controllers only support one device per port. */
*aMaxDevicesPerPort = 1;
break;
}
case StorageBus_IDE:
case StorageBus_Floppy:
{
/* The IDE and Floppy controllers support 2 devices. One as master
* and one as slave (or floppy drive 0 and 1). */
*aMaxDevicesPerPort = 2;
break;
}
default:
}
return S_OK;
}
{
AutoCaller autoCaller(this);
/* no need to lock, this is const */
switch (aBus)
{
case StorageBus_SATA:
{
*aMinPortCount = 1;
break;
}
case StorageBus_SCSI:
{
*aMinPortCount = 16;
break;
}
case StorageBus_IDE:
{
*aMinPortCount = 2;
break;
}
case StorageBus_Floppy:
{
*aMinPortCount = 1;
break;
}
case StorageBus_SAS:
{
*aMinPortCount = 8;
break;
}
default:
}
return S_OK;
}
{
AutoCaller autoCaller(this);
/* no need to lock, this is const */
switch (aBus)
{
case StorageBus_SATA:
{
*aMaxPortCount = 30;
break;
}
case StorageBus_SCSI:
{
*aMaxPortCount = 16;
break;
}
case StorageBus_IDE:
{
*aMaxPortCount = 2;
break;
}
case StorageBus_Floppy:
{
*aMaxPortCount = 1;
break;
}
case StorageBus_SAS:
{
*aMaxPortCount = 8;
break;
}
default:
}
return S_OK;
}
{
AutoCaller autoCaller(this);
/* no need to lock, this is const */
switch (aBus)
{
case StorageBus_SATA:
case StorageBus_SCSI:
case StorageBus_IDE:
case StorageBus_SAS:
case StorageBus_Floppy:
{
/** @todo raise the limits ASAP, per bus type */
*aMaxInstances = 1;
break;
}
default:
}
return S_OK;
}
{
AutoCaller autoCaller(this);
/* no need to lock, this is const */
switch (aBus)
{
case StorageBus_IDE:
case StorageBus_SATA:
{
saDeviceTypes[0] = DeviceType_DVD;
break;
}
case StorageBus_SCSI:
case StorageBus_SAS:
{
break;
}
case StorageBus_Floppy:
{
break;
}
default:
}
return S_OK;
}
STDMETHODIMP SystemProperties::GetDefaultIoCacheSettingForStorageController(StorageControllerType_T aControllerType, BOOL *aEnabled)
{
AutoCaller autoCaller(this);
/* no need to lock, this is const */
switch (aControllerType)
{
*aEnabled = false;
break;
*aEnabled = true;
break;
default:
}
return S_OK;
}
{
AutoCaller autoCaller(this);
return S_OK;
}
{
AutoCaller autoCaller(this);
{
// VirtualBox::saveSettings() needs vbox write lock
}
return rc;
}
{
AutoCaller autoCaller(this);
return S_OK;
}
{
AutoCaller autoCaller(this);
{
// VirtualBox::saveSettings() needs vbox write lock
}
return rc;
}
STDMETHODIMP SystemProperties::COMGETTER(MediumFormats)(ComSafeArrayOut(IMediumFormat *, aMediumFormats))
{
AutoCaller autoCaller(this);
return S_OK;
}
{
AutoCaller autoCaller(this);
return S_OK;
}
{
AutoCaller autoCaller(this);
{
// VirtualBox::saveSettings() needs vbox write lock
}
return rc;
}
{
}
{
}
{
}
STDMETHODIMP SystemProperties::COMSETTER(FreeDiskSpacePercentWarning)(ULONG /* aFreeSpacePercent */)
{
}
{
}
{
}
{
}
{
}
{
AutoCaller autoCaller(this);
return S_OK;
}
STDMETHODIMP SystemProperties::COMSETTER(RemoteDisplayAuthLibrary)(IN_BSTR aRemoteDisplayAuthLibrary)
{
AutoCaller autoCaller(this);
{
// VirtualBox::saveSettings() needs vbox write lock
}
return rc;
}
{
AutoCaller autoCaller(this);
return S_OK;
}
{
AutoCaller autoCaller(this);
{
// VirtualBox::saveSettings() needs vbox write lock
}
return rc;
}
{
AutoCaller autoCaller(this);
*count = m->ulLogHistoryCount;
return S_OK;
}
{
AutoCaller autoCaller(this);
m->ulLogHistoryCount = count;
// VirtualBox::saveSettings() needs vbox write lock
return rc;
}
{
AutoCaller autoCaller(this);
return S_OK;
}
// public methods only for internal purposes
/////////////////////////////////////////////////////////////////////////////
{
AutoCaller autoCaller(this);
return S_OK;
}
{
AutoCaller autoCaller(this);
data = *m;
return S_OK;
}
/**
* Returns a medium format object corresponding to the given format
* identifier or null if no such format.
*
* @param aFormat Format identifier.
*
* @return ComObjPtr<MediumFormat>
*/
{
AutoCaller autoCaller(this);
++ it)
{
/* MediumFormat is all const, no need to lock */
{
break;
}
}
return format;
}
// private methods
/////////////////////////////////////////////////////////////////////////////
{
path = "Machines";
/* get the full file name */
if (RT_FAILURE(vrc))
tr("Invalid default machine folder '%s' (%Rrc)"),
vrc);
m->strDefaultMachineFolder = path;
return S_OK;
}
{
path = "HardDisks";
/* get the full file name */
if (RT_FAILURE(vrc))
tr("Invalid default hard disk folder '%s' (%Rrc)"),
vrc);
m->strDefaultHardDiskFolder = path;
return S_OK;
}
{
else
m->strDefaultHardDiskFormat = "VDI";
return S_OK;
}
{
else
m->strRemoteDisplayAuthLibrary = "VRDPAuth";
return S_OK;
}
{
else
m->strWebServiceAuthLibrary = "VRDPAuth";
return S_OK;
}