Changeset 81299 in vbox for trunk/src/VBox/Main/src-server/BIOSSettingsImpl.cpp
- Timestamp:
- Oct 16, 2019 7:32:48 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 134004
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/BIOSSettingsImpl.cpp
r81222 r81299 467 467 468 468 469 HRESULT BIOSSettings::getNonVolatileStorageEnabled(BOOL *enabled)470 {471 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);472 473 *enabled = m->bd->fNVRAMEnabled;474 475 return S_OK;476 }477 478 HRESULT BIOSSettings::setNonVolatileStorageEnabled(BOOL enable)479 {480 /* the machine needs to be mutable */481 AutoMutableStateDependency adep(m->pMachine);482 if (FAILED(adep.rc())) return adep.rc();483 484 AutoCaller autoMachineCaller(m->pMachine);485 AssertComRCReturnRC(autoMachineCaller.rc());486 487 {488 AutoReadLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);489 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);490 491 m->bd.backup();492 m->bd->fNVRAMEnabled = RT_BOOL(enable);493 if (enable && m->bd->strNVRAMPath.isEmpty())494 m->bd->strNVRAMPath = m->pMachine->i_getDefaultNVRAMFilename();495 }496 497 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS); // mParent is const, needs no locking498 m->pMachine->i_setModified(Machine::IsModified_BIOS);499 500 return S_OK;501 }502 503 504 469 HRESULT BIOSSettings::getNonVolatileStorageFile(com::Utf8Str &aNonVolatileStorageFile) 505 470 { … … 510 475 } 511 476 477 AutoReadLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS); 478 if (strTmp.isEmpty()) 479 strTmp = m->pMachine->i_getDefaultNVRAMFilename(); 512 480 if (strTmp.isNotEmpty()) 513 481 m->pMachine->i_calculateFullPath(strTmp, aNonVolatileStorageFile); … … 544 512 545 513 Utf8Str strTmp(m->bd->strNVRAMPath); 546 m->pMachine->i_copyPathRelativeToMachine(strTmp, m->bd->strNVRAMPath); 514 if (strTmp.isNotEmpty()) 515 m->pMachine->i_copyPathRelativeToMachine(strTmp, m->bd->strNVRAMPath); 516 if ( m->pMachine->i_getFirmwareType() == FirmwareType_BIOS 517 || m->bd->strNVRAMPath == m->pMachine->i_getDefaultNVRAMFilename()) 518 m->bd->strNVRAMPath.setNull(); 547 519 548 520 return S_OK; … … 636 608 } 637 609 610 void BIOSSettings::i_updateNonVolatileStorageFile(const Utf8Str &aNonVolatileStorageFile) 611 { 612 /* sanity */ 613 AutoCaller autoCaller(this); 614 AssertComRCReturnVoid(autoCaller.rc()); 615 616 AutoReadLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS); 617 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 618 619 Utf8Str strTmp(aNonVolatileStorageFile); 620 if (strTmp == m->pMachine->i_getDefaultNVRAMFilename()) 621 strTmp.setNull(); 622 623 if (strTmp == m->bd->strNVRAMPath) 624 return; 625 626 m->bd.backup(); 627 m->bd->strNVRAMPath = strTmp; 628 } 629 638 630 /* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note:
See TracChangeset
for help on using the changeset viewer.