VirtualBox

Changeset 61418 in vbox


Ignore:
Timestamp:
Jun 2, 2016 5:24:05 PM (8 years ago)
Author:
vboxsync
Message:

bugref:8238 VBoxSVC settings - StorageControllerImpl.cpp

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/StorageControllerImpl.cpp

    r58132 r61418  
    77
    88/*
    9  * Copyright (C) 2008-2015 Oracle Corporation
     9 * Copyright (C) 2008-2016 Oracle Corporation
    1010 *
    1111 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    4141DEFINE_EMPTY_CTOR_DTOR(StorageController)
    4242
    43 struct BackupableStorageControllerData
    44 {
    45     /* Constructor. */
    46     BackupableStorageControllerData()
    47         : mStorageBus(StorageBus_IDE),
    48           mStorageControllerType(StorageControllerType_PIIX4),
    49           mInstance(0),
    50           mPortCount(2),
    51           fUseHostIOCache(true),
    52           fBootable(false)
    53     { }
    54 
    55     /** Unique name of the storage controller. */
    56     Utf8Str strName;
    57     /** The connection type of the storage controller. */
    58     StorageBus_T mStorageBus;
    59     /** Type of the Storage controller. */
    60     StorageControllerType_T mStorageControllerType;
    61     /** Instance number of the storage controller. */
    62     ULONG mInstance;
    63     /** Number of usable ports. */
    64     ULONG mPortCount;
    65     /** Whether to use the host IO caches. */
    66     BOOL fUseHostIOCache;
    67     /** Whether it is possible to boot from disks attached to this controller. */
    68     BOOL fBootable;
    69 };
    70 
    7143struct StorageController::Data
    7244{
     
    8557    const ComObjPtr<StorageController>  pPeer;
    8658
    87     Backupable<BackupableStorageControllerData> bd;
     59    Backupable<settings::StorageController> bd;
    8860};
    8961
     
    152124
    153125    m->bd->strName = aName;
    154     m->bd->mInstance = aInstance;
     126    m->bd->ulInstance = aInstance;
    155127    m->bd->fBootable = fBootable;
    156     m->bd->mStorageBus = aStorageBus;
     128    m->bd->storageBus = aStorageBus;
    157129    if (   aStorageBus != StorageBus_IDE
    158130        && aStorageBus != StorageBus_Floppy)
     
    164136    {
    165137        case StorageBus_IDE:
    166             m->bd->mPortCount = 2;
    167             m->bd->mStorageControllerType = StorageControllerType_PIIX4;
     138            m->bd->ulPortCount = 2;
     139            m->bd->controllerType = StorageControllerType_PIIX4;
    168140            break;
    169141        case StorageBus_SATA:
    170             m->bd->mPortCount = 30;
    171             m->bd->mStorageControllerType = StorageControllerType_IntelAhci;
     142            m->bd->ulPortCount = 30;
     143            m->bd->controllerType = StorageControllerType_IntelAhci;
    172144            break;
    173145        case StorageBus_SCSI:
    174             m->bd->mPortCount = 16;
    175             m->bd->mStorageControllerType = StorageControllerType_LsiLogic;
     146            m->bd->ulPortCount = 16;
     147            m->bd->controllerType = StorageControllerType_LsiLogic;
    176148            break;
    177149        case StorageBus_Floppy:
    178             m->bd->mPortCount = 1;
    179             m->bd->mStorageControllerType = StorageControllerType_I82078;
     150            m->bd->ulPortCount = 1;
     151            m->bd->controllerType = StorageControllerType_I82078;
    180152            break;
    181153        case StorageBus_SAS:
    182             m->bd->mPortCount = 8;
    183             m->bd->mStorageControllerType = StorageControllerType_LsiLogicSas;
     154            m->bd->ulPortCount = 8;
     155            m->bd->controllerType = StorageControllerType_LsiLogicSas;
    184156        case StorageBus_USB:
    185             m->bd->mPortCount = 8;
    186             m->bd->mStorageControllerType = StorageControllerType_USB;
     157            m->bd->ulPortCount = 8;
     158            m->bd->controllerType = StorageControllerType_USB;
    187159            break;
    188160        case StorageBus_PCIe:
    189             m->bd->mPortCount = 1;
    190             m->bd->mStorageControllerType = StorageControllerType_NVMe;
     161            m->bd->ulPortCount = 1;
     162            m->bd->controllerType = StorageControllerType_NVMe;
    191163            break;
    192164    }
     
    364336    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    365337
    366     *aBus = m->bd->mStorageBus;
     338    *aBus = m->bd->storageBus;
    367339
    368340    return S_OK;
     
    373345    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    374346
    375     *aControllerType = m->bd->mStorageControllerType;
     347    *aControllerType = m->bd->controllerType;
    376348
    377349    return S_OK;
     
    388360    HRESULT rc = S_OK;
    389361
    390     switch (m->bd->mStorageBus)
     362    switch (m->bd->storageBus)
    391363    {
    392364        case StorageBus_IDE:
     
    436408        }
    437409        default:
    438             AssertMsgFailed(("Invalid controller type %d\n", m->bd->mStorageBus));
     410            AssertMsgFailed(("Invalid controller type %d\n", m->bd->storageBus));
    439411            rc = E_INVALIDARG;
    440412    }
     
    445417                        aControllerType);
    446418
    447     if (m->bd->mStorageControllerType != aControllerType)
     419    if (m->bd->controllerType != aControllerType)
    448420    {
    449421        m->bd.backup();
    450         m->bd->mStorageControllerType = aControllerType;
     422        m->bd->controllerType = aControllerType;
    451423
    452424        alock.release();
     
    465437    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    466438
    467     HRESULT rc = m->pSystemProperties->GetMaxDevicesPerPortForStorageBus(m->bd->mStorageBus, aMaxDevicesPerPortCount);
     439    HRESULT rc = m->pSystemProperties->GetMaxDevicesPerPortForStorageBus(m->bd->storageBus, aMaxDevicesPerPortCount);
    468440
    469441    return rc;
     
    474446    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    475447
    476     HRESULT rc = m->pSystemProperties->GetMinPortCountForStorageBus(m->bd->mStorageBus, aMinPortCount);
     448    HRESULT rc = m->pSystemProperties->GetMinPortCountForStorageBus(m->bd->storageBus, aMinPortCount);
    477449    return rc;
    478450}
     
    481453{
    482454    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    483     HRESULT rc = m->pSystemProperties->GetMaxPortCountForStorageBus(m->bd->mStorageBus, aMaxPortCount);
     455    HRESULT rc = m->pSystemProperties->GetMaxPortCountForStorageBus(m->bd->storageBus, aMaxPortCount);
    484456
    485457    return rc;
     
    490462    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    491463
    492     *aPortCount = m->bd->mPortCount;
     464    *aPortCount = m->bd->ulPortCount;
    493465
    494466    return S_OK;
     
    503475    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    504476
    505     switch (m->bd->mStorageBus)
     477    switch (m->bd->storageBus)
    506478    {
    507479        case StorageBus_SATA:
     
    583555        }
    584556        default:
    585             AssertMsgFailed(("Invalid controller type %d\n", m->bd->mStorageBus));
    586     }
    587 
    588     if (m->bd->mPortCount != aPortCount)
     557            AssertMsgFailed(("Invalid controller type %d\n", m->bd->storageBus));
     558    }
     559
     560    if (m->bd->ulPortCount != aPortCount)
    589561    {
    590562        m->bd.backup();
    591         m->bd->mPortCount = aPortCount;
     563        m->bd->ulPortCount = aPortCount;
    592564
    593565        alock.release();
     
    606578    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    607579
    608     *aInstance = m->bd->mInstance;
     580    *aInstance = m->bd->ulInstance;
    609581
    610582    return S_OK;
     
    619591    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    620592
    621     if (m->bd->mInstance != aInstance)
     593    if (m->bd->ulInstance != aInstance)
    622594    {
    623595        m->bd.backup();
    624         m->bd->mInstance = aInstance;
     596        m->bd->ulInstance = aInstance;
    625597
    626598        alock.release();
     
    687659StorageControllerType_T StorageController::i_getControllerType() const
    688660{
    689     return m->bd->mStorageControllerType;
     661    return m->bd->controllerType;
    690662}
    691663
    692664StorageBus_T StorageController::i_getStorageBus() const
    693665{
    694     return m->bd->mStorageBus;
     666    return m->bd->storageBus;
    695667}
    696668
    697669ULONG StorageController::i_getInstance() const
    698670{
    699     return m->bd->mInstance;
     671    return m->bd->ulInstance;
    700672}
    701673
     
    719691    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    720692
    721     ULONG portCount = m->bd->mPortCount;
     693    ULONG portCount = m->bd->ulPortCount;
    722694    ULONG devicesPerPort;
    723     HRESULT rc = m->pSystemProperties->GetMaxDevicesPerPortForStorageBus(m->bd->mStorageBus, &devicesPerPort);
     695    HRESULT rc = m->pSystemProperties->GetMaxDevicesPerPortForStorageBus(m->bd->storageBus, &devicesPerPort);
    724696    if (FAILED(rc)) return rc;
    725697
Note: See TracChangeset for help on using the changeset viewer.

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