Changeset 91396 in vbox for trunk/src/VBox/Main/src-all
- Timestamp:
- Sep 27, 2021 1:40:35 PM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 147076
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-all/NvramStoreImpl.cpp
r91346 r91396 24 24 #else 25 25 # include "MachineImpl.h" 26 # include "AutoStateDep.h" 26 27 #endif 28 #include "UefiVariableStoreImpl.h" 27 29 28 30 #include "AutoCaller.h" … … 94 96 #else 95 97 /** The Machine object owning this NVRAM store. */ 96 Machine * const pParent;98 Machine * const pParent; 97 99 /** The peer NVRAM store object. */ 98 ComObjPtr<NvramStore> pPeer; 100 ComObjPtr<NvramStore> pPeer; 101 /** The UEFI variable store. */ 102 const ComObjPtr<UefiVariableStore> pUefiVarStore; 99 103 #endif 100 104 … … 299 303 300 304 return S_OK; 305 } 306 307 308 HRESULT NvramStore::getUefiVariableStore(ComPtr<IUefiVariableStore> &aUefiVarStore) 309 { 310 #ifndef VBOX_COM_INPROC 311 /* the machine needs to be mutable */ 312 AutoMutableStateDependency adep(m->pParent); 313 if (FAILED(adep.rc())) return adep.rc(); 314 315 /* We need a write lock because of the lazy initialization. */ 316 AutoWriteLock wlock(this COMMA_LOCKVAL_SRC_POS); 317 318 /* Check if we have to create the UEFI variabel store object */ 319 HRESULT hrc = S_OK; 320 if (!m->pUefiVarStore) 321 { 322 /* Load the NVRAM file first if it isn't already. */ 323 if (!m->bd->mapNvram.size()) 324 { 325 int vrc = i_loadStore(); 326 if (RT_FAILURE(vrc)) 327 hrc = setError(E_FAIL, tr("Loading the NVRAM store failed (%Rrc)\n"), vrc); 328 } 329 330 if (SUCCEEDED(hrc)) 331 { 332 NvramStoreIter it = m->bd->mapNvram.find("efi/nvram"); 333 if (it != m->bd->mapNvram.end()) 334 { 335 RTVFSFILE hVfsFileNvram = it->second; 336 RTVFS hVfsEfiVarStore; 337 int vrc = RTEfiVarStoreOpenAsVfs(hVfsFileNvram, 0 /*fMntFlags*/, 0 /*fVarStoreFlags*/, &hVfsEfiVarStore, 338 NULL /*pErrInfo*/); 339 if (RT_SUCCESS(vrc)) 340 { 341 unconst(m->pUefiVarStore).createObject(); 342 m->pUefiVarStore->init(this, m->pParent, hVfsEfiVarStore); 343 } 344 else 345 hrc = setError(E_FAIL, tr("Opening the UEFI variable store failed (%Rrc)."), vrc); 346 } 347 else 348 hrc = setError(VBOX_E_OBJECT_NOT_FOUND, tr("The UEFI NVRAM file is not existing for this machine.")); 349 } 350 } 351 352 if (SUCCEEDED(hrc)) 353 m->pUefiVarStore.queryInterfaceTo(aUefiVarStore.asOutParam()); 354 355 return hrc; 356 #else 357 NOREF(aUefiVarStore); 358 return E_NOTIMPL; 359 #endif 360 } 361 362 363 HRESULT NvramStore::initUefiVariableStore(ULONG aSize) 364 { 365 NOREF(aSize); 366 return E_NOTIMPL; 301 367 } 302 368
Note:
See TracChangeset
for help on using the changeset viewer.