Changeset 56035 in vbox for trunk/src/VBox/Main/src-server
- Timestamp:
- May 22, 2015 4:03:35 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 100554
- Location:
- trunk/src/VBox/Main/src-server
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r56019 r56035 207 207 mClipboardMode = ClipboardMode_Disabled; 208 208 mDnDMode = DnDMode_Disabled; 209 mGuestPropertyNotificationPatterns = "";210 209 211 210 mFirmwareType = FirmwareType_BIOS; … … 2845 2844 } 2846 2845 2847 HRESULT Machine::getGuestPropertyNotificationPatterns(com::Utf8Str &aGuestPropertyNotificationPatterns)2848 {2849 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);2850 2851 try2852 {2853 aGuestPropertyNotificationPatterns = mHWData->mGuestPropertyNotificationPatterns;2854 }2855 catch (...)2856 {2857 return VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);2858 }2859 2860 return S_OK;2861 }2862 2863 HRESULT Machine::setGuestPropertyNotificationPatterns(const com::Utf8Str &aGuestPropertyNotificationPatterns)2864 {2865 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);2866 2867 HRESULT rc = i_checkStateDependency(MutableOrSavedOrRunningStateDep);2868 if (FAILED(rc)) return rc;2869 2870 i_setModified(IsModified_MachineData);2871 mHWData.backup();2872 mHWData->mGuestPropertyNotificationPatterns = aGuestPropertyNotificationPatterns;2873 return rc;2874 }2875 2876 2846 HRESULT Machine::getStorageControllers(std::vector<ComPtr<IStorageController> > &aStorageControllers) 2877 2847 { … … 5752 5722 } 5753 5723 5754 if ( SUCCEEDED(rc) 5755 && ( mHWData->mGuestPropertyNotificationPatterns.isEmpty() 5756 || RTStrSimplePatternMultiMatch(mHWData->mGuestPropertyNotificationPatterns.c_str(), 5757 RTSTR_MAX, 5758 aName.c_str(), 5759 RTSTR_MAX, 5760 NULL) 5761 ) 5762 ) 5724 if (SUCCEEDED(rc)) 5763 5725 { 5764 5726 alock.release(); … … 6097 6059 } 6098 6060 6099 HRESULT Machine::getStorageControllerByInstance(ULONG aInstance, 6061 HRESULT Machine::getStorageControllerByInstance(StorageBus_T aConnectionType, 6062 ULONG aInstance, 6100 6063 ComPtr<IStorageController> &aStorageController) 6101 6064 { … … 6106 6069 ++it) 6107 6070 { 6108 if ((*it)->i_getInstance() == aInstance) 6071 if ( (*it)->i_getStorageBus() == aConnectionType 6072 && (*it)->i_getInstance() == aInstance) 6109 6073 { 6110 6074 (*it).queryInterfaceTo(aStorageController.asOutParam()); … … 9080 9044 ++it; 9081 9045 } 9082 9083 mHWData->mGuestPropertyNotificationPatterns = data.strNotificationPatterns;9084 9046 #endif /* VBOX_WITH_GUEST_PROPS defined */ 9085 9047 … … 10382 10344 } 10383 10345 10384 data.strNotificationPatterns = mHWData->mGuestPropertyNotificationPatterns;10385 10346 /* I presume this doesn't require a backup(). */ 10386 10347 mData->mGuestPropertiesModified = FALSE; … … 13393 13354 const com::Utf8Str &aValue, 13394 13355 LONG64 aTimestamp, 13395 const com::Utf8Str &aFlags, 13396 BOOL *aNotify) 13356 const com::Utf8Str &aFlags) 13397 13357 { 13398 13358 LogFlowThisFunc(("\n")); … … 13400 13360 #ifdef VBOX_WITH_GUEST_PROPS 13401 13361 using namespace guestProp; 13402 13403 *aNotify = FALSE;13404 13362 13405 13363 try … … 13469 13427 } 13470 13428 13471 /* 13472 * Send a callback notification if appropriate 13473 */ 13474 if ( mHWData->mGuestPropertyNotificationPatterns.isEmpty() 13475 || RTStrSimplePatternMultiMatch(mHWData->mGuestPropertyNotificationPatterns.c_str(), 13476 RTSTR_MAX, 13477 aName.c_str(), 13478 RTSTR_MAX, NULL) 13479 ) 13480 { 13481 alock.release(); 13482 13483 mParent->i_onGuestPropertyChange(mData->mUuid, 13484 Bstr(aName).raw(), 13485 Bstr(aValue).raw(), 13486 Bstr(aFlags).raw()); 13487 *aNotify = TRUE; 13488 } 13429 alock.release(); 13430 13431 mParent->i_onGuestPropertyChange(mData->mUuid, 13432 Bstr(aName).raw(), 13433 Bstr(aValue).raw(), 13434 Bstr(aFlags).raw()); 13489 13435 } 13490 13436 catch (...) … … 14757 14703 const com::Utf8Str &aValue, 14758 14704 LONG64 aTimestamp, 14759 const com::Utf8Str &aFlags, 14760 BOOL *aNotify) 14705 const com::Utf8Str &aFlags) 14761 14706 { 14762 14707 NOREF(aName); … … 14764 14709 NOREF(aTimestamp); 14765 14710 NOREF(aFlags); 14766 NOREF(aNotify);14767 14711 ReturnComNotImplemented(); 14768 14712 } -
trunk/src/VBox/Main/src-server/StorageControllerImpl.cpp
r54971 r56035 323 323 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 324 324 325 /* mName is constant during life time, no need to lock */ 326 aName = m->bd.data()->strName; 325 aName = m->bd->strName; 326 327 return S_OK; 328 } 329 330 HRESULT StorageController::setName(const com::Utf8Str &aName) 331 { 332 /* the machine needs to be mutable */ 333 AutoMutableStateDependency adep(m->pParent); 334 if (FAILED(adep.rc())) return adep.rc(); 335 336 AutoMultiWriteLock2 alock(m->pParent, this COMMA_LOCKVAL_SRC_POS); 337 338 if (m->bd->strName != aName) 339 { 340 ComObjPtr<StorageController> ctrl; 341 HRESULT rc = m->pParent->i_getStorageControllerByName(aName, ctrl, false /* aSetError */); 342 if (SUCCEEDED(rc)) 343 return setError(VBOX_E_OBJECT_IN_USE, 344 tr("Storage controller named '%s' already exists"), 345 aName.c_str()); 346 347 m->bd.backup(); 348 m->bd->strName = aName; 349 350 m->pParent->i_setModified(Machine::IsModified_Storage); 351 alock.release(); 352 353 m->pParent->i_onStorageControllerChange(); 354 } 327 355 328 356 return S_OK; … … 331 359 HRESULT StorageController::getBus(StorageBus_T *aBus) 332 360 { 333 CheckComArgOutPointerValid(aBus);334 335 361 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 336 362 … … 342 368 HRESULT StorageController::getControllerType(StorageControllerType_T *aControllerType) 343 369 { 344 CheckComArgOutPointerValid(aControllerType);345 346 370 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 347 371 … … 353 377 HRESULT StorageController::setControllerType(StorageControllerType_T aControllerType) 354 378 { 379 /* the machine needs to be mutable */ 380 AutoMutableStateDependency adep(m->pParent); 381 if (FAILED(adep.rc())) return adep.rc(); 382 355 383 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 356 384 … … 400 428 default: 401 429 AssertMsgFailed(("Invalid controller type %d\n", m->bd->mStorageBus)); 430 rc = E_INVALIDARG; 402 431 } 403 432 … … 407 436 aControllerType); 408 437 409 m->bd->mStorageControllerType = aControllerType; 438 if (m->bd->mStorageControllerType != aControllerType) 439 { 440 m->bd.backup(); 441 m->bd->mStorageControllerType = aControllerType; 442 443 alock.release(); 444 AutoWriteLock mlock(m->pParent COMMA_LOCKVAL_SRC_POS); // m->pParent is const, needs no locking 445 m->pParent->i_setModified(Machine::IsModified_Storage); 446 mlock.release(); 447 448 m->pParent->i_onStorageControllerChange(); 449 } 410 450 411 451 return S_OK; … … 414 454 HRESULT StorageController::getMaxDevicesPerPortCount(ULONG *aMaxDevicesPerPortCount) 415 455 { 416 CheckComArgOutPointerValid(aMaxDevicesPerPortCount);417 418 456 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 419 457 … … 425 463 HRESULT StorageController::getMinPortCount(ULONG *aMinPortCount) 426 464 { 427 CheckComArgOutPointerValid(aMinPortCount);428 429 465 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 430 466 … … 435 471 HRESULT StorageController::getMaxPortCount(ULONG *aMaxPortCount) 436 472 { 437 CheckComArgOutPointerValid(aMaxPortCount);438 439 473 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 440 474 HRESULT rc = m->pSystemProperties->GetMaxPortCountForStorageBus(m->bd->mStorageBus, aMaxPortCount); … … 445 479 HRESULT StorageController::getPortCount(ULONG *aPortCount) 446 480 { 447 CheckComArgOutPointerValid(aPortCount);448 449 481 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 450 482 … … 456 488 HRESULT StorageController::setPortCount(ULONG aPortCount) 457 489 { 458 LogFlowThisFunc(("aPortCount=%u\n", aPortCount)); 490 /* the machine needs to be mutable */ 491 AutoMutableStateDependency adep(m->pParent); 492 if (FAILED(adep.rc())) return adep.rc(); 493 494 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 459 495 460 496 switch (m->bd->mStorageBus) … … 529 565 } 530 566 531 AutoCaller autoCaller(this);532 if (FAILED(autoCaller.rc())) return autoCaller.rc();533 534 /* the machine needs to be mutable */535 AutoMutableStateDependency adep(m->pParent);536 if (FAILED(adep.rc())) return adep.rc();537 538 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);539 540 567 if (m->bd->mPortCount != aPortCount) 541 568 { … … 556 583 HRESULT StorageController::getInstance(ULONG *aInstance) 557 584 { 558 /* The machine doesn't need to be mutable. */559 560 585 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 561 586 … … 566 591 567 592 HRESULT StorageController::setInstance(ULONG aInstance) 568 {569 /* The machine doesn't need to be mutable. */570 571 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);572 573 m->bd->mInstance = aInstance;574 575 return S_OK;576 }577 578 HRESULT StorageController::getUseHostIOCache(BOOL *fUseHostIOCache)579 {580 /* The machine doesn't need to be mutable. */581 582 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);583 584 *fUseHostIOCache = m->bd->fUseHostIOCache;585 586 return S_OK;587 }588 589 HRESULT StorageController::setUseHostIOCache(BOOL fUseHostIOCache)590 593 { 591 594 /* the machine needs to be mutable */ … … 595 598 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 596 599 597 if (m->bd-> fUseHostIOCache != !!fUseHostIOCache)600 if (m->bd->mInstance != aInstance) 598 601 { 599 602 m->bd.backup(); 600 m->bd-> fUseHostIOCache = !!fUseHostIOCache;603 m->bd->mInstance = aInstance; 601 604 602 605 alock.release(); … … 611 614 } 612 615 616 HRESULT StorageController::getUseHostIOCache(BOOL *fUseHostIOCache) 617 { 618 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 619 620 *fUseHostIOCache = m->bd->fUseHostIOCache; 621 622 return S_OK; 623 } 624 625 HRESULT StorageController::setUseHostIOCache(BOOL fUseHostIOCache) 626 { 627 /* the machine needs to be mutable */ 628 AutoMutableStateDependency adep(m->pParent); 629 if (FAILED(adep.rc())) return adep.rc(); 630 631 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 632 633 if (m->bd->fUseHostIOCache != !!fUseHostIOCache) 634 { 635 m->bd.backup(); 636 m->bd->fUseHostIOCache = !!fUseHostIOCache; 637 638 alock.release(); 639 AutoWriteLock mlock(m->pParent COMMA_LOCKVAL_SRC_POS); // m->pParent is const, needs no locking 640 m->pParent->i_setModified(Machine::IsModified_Storage); 641 mlock.release(); 642 643 m->pParent->i_onStorageControllerChange(); 644 } 645 646 return S_OK; 647 } 648 613 649 HRESULT StorageController::getBootable(BOOL *fBootable) 614 650 { 615 616 /* The machine doesn't need to be mutable. */617 618 651 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 619 652 -
trunk/src/VBox/Main/src-server/USBControllerImpl.cpp
r50721 r56035 5 5 6 6 /* 7 * Copyright (C) 2005-201 3Oracle Corporation7 * Copyright (C) 2005-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 238 238 HRESULT USBController::getName(com::Utf8Str &aName) 239 239 { 240 /* strName is constant during life time, no need to lock */ 240 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 241 241 242 aName = m->bd->strName; 242 243 … … 244 245 } 245 246 247 HRESULT USBController::setName(const com::Utf8Str &aName) 248 { 249 /* the machine needs to be mutable */ 250 AutoMutableStateDependency adep(m->pParent); 251 if (FAILED(adep.rc())) return adep.rc(); 252 253 AutoMultiWriteLock2 alock(m->pParent, this COMMA_LOCKVAL_SRC_POS); 254 255 if (m->bd->strName != aName) 256 { 257 ComObjPtr<USBController> ctrl; 258 HRESULT rc = m->pParent->i_getUSBControllerByName(aName, ctrl, false /* aSetError */); 259 if (SUCCEEDED(rc)) 260 return setError(VBOX_E_OBJECT_IN_USE, 261 tr("USB controller named '%s' already exists"), 262 aName.c_str()); 263 264 m->bd.backup(); 265 m->bd->strName = aName; 266 267 m->pParent->i_setModified(Machine::IsModified_USB); 268 alock.release(); 269 270 m->pParent->i_onUSBControllerChange(); 271 } 272 273 return S_OK; 274 } 275 246 276 HRESULT USBController::getType(USBControllerType_T *aType) 247 277 { … … 249 279 250 280 *aType = m->bd->enmType; 281 282 return S_OK; 283 } 284 285 HRESULT USBController::setType(USBControllerType_T aType) 286 { 287 /* the machine needs to be mutable */ 288 AutoMutableStateDependency adep(m->pParent); 289 if (FAILED(adep.rc())) return adep.rc(); 290 291 AutoMultiWriteLock2 alock(m->pParent, this COMMA_LOCKVAL_SRC_POS); 292 293 if (m->bd->enmType != aType) 294 { 295 m->bd.backup(); 296 m->bd->enmType = aType; 297 298 m->pParent->i_setModified(Machine::IsModified_USB); 299 alock.release(); 300 301 m->pParent->i_onUSBControllerChange(); 302 } 251 303 252 304 return S_OK;
Note:
See TracChangeset
for help on using the changeset viewer.