SystemPropertiesImpl.cpp revision dc09cb937d0a66e030b4d7bef88dec429f41e060
/* $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
/////////////////////////////////////////////////////////////////////////////
{
}
{
}
{
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);
mLogHistoryCount = 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)
{
}
}
/* Driver defaults which are OS specific */
#if defined(RT_OS_WINDOWS)
# ifdef VBOX_WITH_WINMM
# else /* VBOX_WITH_WINMM */
# endif /* !VBOX_WITH_WINMM */
#elif defined(RT_OS_SOLARIS)
#elif defined(RT_OS_LINUX)
# if defined(VBOX_WITH_PULSE)
/* Check for the pulse library & that the pulse audio daemon is running. */
if (RTProcIsRunningByName("pulseaudio") &&
RTLdrIsLoadable("libpulse.so.0"))
else
# endif /* VBOX_WITH_PULSE */
# if defined(VBOX_WITH_ALSA)
/* Check if we can load the ALSA library */
if (RTLdrIsLoadable("libasound.so.2"))
else
# endif /* VBOX_WITH_ALSA */
#elif defined(RT_OS_DARWIN)
#elif defined(RT_OS_FREEBSD)
#else
#endif
/* 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 */
# ifdef RT_OS_WINDOWS
else
else
# else
# endif
#endif
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:
{
saDeviceTypes[0] = DeviceType_DVD;
break;
}
case StorageBus_SATA:
case StorageBus_SCSI:
case StorageBus_SAS:
{
break;
}
case StorageBus_Floppy:
{
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);
return S_OK;
}
{
AutoCaller autoCaller(this);
// 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);
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);
{
/* 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);
return S_OK;
}
{
path = "HardDisks";
/* get the full file name */
if (RT_FAILURE(vrc))
tr("Invalid default hard disk folder '%s' (%Rrc)"),
vrc);
return S_OK;
}
{
else
m_strDefaultHardDiskFormat = "VDI";
return S_OK;
}
{
else
m_strRemoteDisplayAuthLibrary = "VRDPAuth";
return S_OK;
}
{
else
m_strWebServiceAuthLibrary = "VRDPAuth";
return S_OK;
}