VirtualBox

source: vbox/trunk/src/VBox/Main/include/NvramStoreImpl.h@ 91521

Last change on this file since 91521 was 91434, checked in by vboxsync, 3 years ago

Main/NvramStoreImpl: Implement API to initialize the UEFI variable store and some other fixes, bugref:9580

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.5 KB
Line 
1/* $Id: NvramStoreImpl.h 91434 2021-09-28 11:56:50Z vboxsync $ */
2/** @file
3 * VirtualBox COM NVRAM store class implementation
4 */
5
6/*
7 * Copyright (C) 2021 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef MAIN_INCLUDED_NvramStoreImpl_h
19#define MAIN_INCLUDED_NvramStoreImpl_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24#include "NvramStoreWrap.h"
25#include <VBox/vmm/pdmdrv.h>
26
27#ifdef VBOX_COM_INPROC
28class Console;
29#else
30namespace settings
31{
32 struct NvramSettings;
33}
34#endif
35
36class ATL_NO_VTABLE NvramStore :
37 public NvramStoreWrap
38{
39public:
40
41 DECLARE_COMMON_CLASS_METHODS(NvramStore)
42
43 HRESULT FinalConstruct();
44 void FinalRelease();
45
46 // public initializer/uninitializer for internal purposes only
47#ifdef VBOX_COM_INPROC
48 HRESULT init(Console *aParent, const com::Utf8Str &strNonVolatileStorageFile);
49#else
50 HRESULT init(Machine *parent);
51 HRESULT init(Machine *parent, NvramStore *that);
52 HRESULT initCopy(Machine *parent, NvramStore *that);
53#endif
54 void uninit();
55
56 // public methods for internal purposes only
57#ifndef VBOX_COM_INPROC
58 HRESULT i_loadSettings(const settings::NvramSettings &data);
59 HRESULT i_saveSettings(settings::NvramSettings &data);
60#endif
61
62#ifdef VBOX_COM_INPROC
63 static const PDMDRVREG DrvReg;
64#else
65 void i_rollback();
66 void i_commit();
67 void i_copyFrom(NvramStore *aThat);
68#endif
69
70 com::Utf8Str i_getNonVolatileStorageFile();
71 void i_updateNonVolatileStorageFile(const com::Utf8Str &aNonVolatileStorageFile);
72
73 int i_loadStore(const char *pszPath);
74 int i_loadStoreFromTar(RTVFSFSSTREAM hVfsFssTar);
75 int i_saveStore(void);
76 int i_saveStoreAsTar(void);
77
78private:
79
80 // Wrapped NVRAM store properties
81 HRESULT getNonVolatileStorageFile(com::Utf8Str &aNonVolatileStorageFile);
82 HRESULT getUefiVariableStore(ComPtr<IUefiVariableStore> &aUefiVarStore);
83
84 // Wrapped NVRAM store members
85 HRESULT initUefiVariableStore(ULONG aSize);
86
87#ifdef VBOX_COM_INPROC
88 static DECLCALLBACK(int) i_nvramStoreQuerySize(PPDMIVFSCONNECTOR pInterface, const char *pszNamespace, const char *pszPath,
89 uint64_t *pcb);
90 static DECLCALLBACK(int) i_nvramStoreReadAll(PPDMIVFSCONNECTOR pInterface, const char *pszNamespace, const char *pszPath,
91 void *pvBuf, size_t cbRead);
92 static DECLCALLBACK(int) i_nvramStoreWriteAll(PPDMIVFSCONNECTOR pInterface, const char *pszNamespace, const char *pszPath,
93 const void *pvBuf, size_t cbWrite);
94 static DECLCALLBACK(int) i_nvramStoreDelete(PPDMIVFSCONNECTOR pInterface, const char *pszNamespace, const char *pszPath);
95 static DECLCALLBACK(void *) i_drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
96 static DECLCALLBACK(int) i_drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
97 static DECLCALLBACK(void) i_drvDestruct(PPDMDRVINS pDrvIns);
98#endif
99
100 struct Data; // opaque data struct, defined in NvramStoreImpl.cpp
101 Data *m;
102};
103
104#endif /* !MAIN_INCLUDED_NvramStoreImpl_h */
105/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

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