Changeset 61418 in vbox
- Timestamp:
- Jun 2, 2016 5:24:05 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/StorageControllerImpl.cpp
r58132 r61418 7 7 8 8 /* 9 * Copyright (C) 2008-201 5Oracle Corporation9 * Copyright (C) 2008-2016 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 41 41 DEFINE_EMPTY_CTOR_DTOR(StorageController) 42 42 43 struct BackupableStorageControllerData44 {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 71 43 struct StorageController::Data 72 44 { … … 85 57 const ComObjPtr<StorageController> pPeer; 86 58 87 Backupable< BackupableStorageControllerData> bd;59 Backupable<settings::StorageController> bd; 88 60 }; 89 61 … … 152 124 153 125 m->bd->strName = aName; 154 m->bd-> mInstance = aInstance;126 m->bd->ulInstance = aInstance; 155 127 m->bd->fBootable = fBootable; 156 m->bd-> mStorageBus = aStorageBus;128 m->bd->storageBus = aStorageBus; 157 129 if ( aStorageBus != StorageBus_IDE 158 130 && aStorageBus != StorageBus_Floppy) … … 164 136 { 165 137 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; 168 140 break; 169 141 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; 172 144 break; 173 145 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; 176 148 break; 177 149 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; 180 152 break; 181 153 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; 184 156 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; 187 159 break; 188 160 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; 191 163 break; 192 164 } … … 364 336 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 365 337 366 *aBus = m->bd-> mStorageBus;338 *aBus = m->bd->storageBus; 367 339 368 340 return S_OK; … … 373 345 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 374 346 375 *aControllerType = m->bd-> mStorageControllerType;347 *aControllerType = m->bd->controllerType; 376 348 377 349 return S_OK; … … 388 360 HRESULT rc = S_OK; 389 361 390 switch (m->bd-> mStorageBus)362 switch (m->bd->storageBus) 391 363 { 392 364 case StorageBus_IDE: … … 436 408 } 437 409 default: 438 AssertMsgFailed(("Invalid controller type %d\n", m->bd-> mStorageBus));410 AssertMsgFailed(("Invalid controller type %d\n", m->bd->storageBus)); 439 411 rc = E_INVALIDARG; 440 412 } … … 445 417 aControllerType); 446 418 447 if (m->bd-> mStorageControllerType != aControllerType)419 if (m->bd->controllerType != aControllerType) 448 420 { 449 421 m->bd.backup(); 450 m->bd-> mStorageControllerType = aControllerType;422 m->bd->controllerType = aControllerType; 451 423 452 424 alock.release(); … … 465 437 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 466 438 467 HRESULT rc = m->pSystemProperties->GetMaxDevicesPerPortForStorageBus(m->bd-> mStorageBus, aMaxDevicesPerPortCount);439 HRESULT rc = m->pSystemProperties->GetMaxDevicesPerPortForStorageBus(m->bd->storageBus, aMaxDevicesPerPortCount); 468 440 469 441 return rc; … … 474 446 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 475 447 476 HRESULT rc = m->pSystemProperties->GetMinPortCountForStorageBus(m->bd-> mStorageBus, aMinPortCount);448 HRESULT rc = m->pSystemProperties->GetMinPortCountForStorageBus(m->bd->storageBus, aMinPortCount); 477 449 return rc; 478 450 } … … 481 453 { 482 454 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); 484 456 485 457 return rc; … … 490 462 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 491 463 492 *aPortCount = m->bd-> mPortCount;464 *aPortCount = m->bd->ulPortCount; 493 465 494 466 return S_OK; … … 503 475 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 504 476 505 switch (m->bd-> mStorageBus)477 switch (m->bd->storageBus) 506 478 { 507 479 case StorageBus_SATA: … … 583 555 } 584 556 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) 589 561 { 590 562 m->bd.backup(); 591 m->bd-> mPortCount = aPortCount;563 m->bd->ulPortCount = aPortCount; 592 564 593 565 alock.release(); … … 606 578 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 607 579 608 *aInstance = m->bd-> mInstance;580 *aInstance = m->bd->ulInstance; 609 581 610 582 return S_OK; … … 619 591 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 620 592 621 if (m->bd-> mInstance != aInstance)593 if (m->bd->ulInstance != aInstance) 622 594 { 623 595 m->bd.backup(); 624 m->bd-> mInstance = aInstance;596 m->bd->ulInstance = aInstance; 625 597 626 598 alock.release(); … … 687 659 StorageControllerType_T StorageController::i_getControllerType() const 688 660 { 689 return m->bd-> mStorageControllerType;661 return m->bd->controllerType; 690 662 } 691 663 692 664 StorageBus_T StorageController::i_getStorageBus() const 693 665 { 694 return m->bd-> mStorageBus;666 return m->bd->storageBus; 695 667 } 696 668 697 669 ULONG StorageController::i_getInstance() const 698 670 { 699 return m->bd-> mInstance;671 return m->bd->ulInstance; 700 672 } 701 673 … … 719 691 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 720 692 721 ULONG portCount = m->bd-> mPortCount;693 ULONG portCount = m->bd->ulPortCount; 722 694 ULONG devicesPerPort; 723 HRESULT rc = m->pSystemProperties->GetMaxDevicesPerPortForStorageBus(m->bd-> mStorageBus, &devicesPerPort);695 HRESULT rc = m->pSystemProperties->GetMaxDevicesPerPortForStorageBus(m->bd->storageBus, &devicesPerPort); 724 696 if (FAILED(rc)) return rc; 725 697
Note:
See TracChangeset
for help on using the changeset viewer.

