VirtualBox

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

Last change on this file since 93444 was 93115, checked in by vboxsync, 3 years ago

scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.8 KB
Line 
1/* $Id: NvramStoreImpl.h 93115 2022-01-01 11:31:46Z vboxsync $ */
2/** @file
3 * VirtualBox COM NVRAM store class implementation
4 */
5
6/*
7 * Copyright (C) 2021-2022 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
30class GuestOSType;
31
32namespace settings
33{
34 struct NvramSettings;
35}
36#endif
37
38class ATL_NO_VTABLE NvramStore :
39 public NvramStoreWrap
40{
41public:
42
43 DECLARE_COMMON_CLASS_METHODS(NvramStore)
44
45 HRESULT FinalConstruct();
46 void FinalRelease();
47
48 // public initializer/uninitializer for internal purposes only
49#ifdef VBOX_COM_INPROC
50 HRESULT init(Console *aParent, const com::Utf8Str &strNonVolatileStorageFile);
51#else
52 HRESULT init(Machine *parent);
53 HRESULT init(Machine *parent, NvramStore *that);
54 HRESULT initCopy(Machine *parent, NvramStore *that);
55#endif
56 void uninit();
57
58 // public methods for internal purposes only
59#ifndef VBOX_COM_INPROC
60 HRESULT i_loadSettings(const settings::NvramSettings &data);
61 HRESULT i_saveSettings(settings::NvramSettings &data);
62#endif
63
64#ifdef VBOX_COM_INPROC
65 static const PDMDRVREG DrvReg;
66#else
67 void i_rollback();
68 void i_commit();
69 void i_copyFrom(NvramStore *aThat);
70 HRESULT i_applyDefaults(GuestOSType *aOSType);
71#endif
72
73 com::Utf8Str i_getNonVolatileStorageFile();
74 void i_updateNonVolatileStorageFile(const com::Utf8Str &aNonVolatileStorageFile);
75
76 int i_loadStore(const char *pszPath);
77 int i_saveStore(void);
78
79#ifndef VBOX_COM_INPROC
80 HRESULT i_retainUefiVarStore(PRTVFS phVfs, bool fReadonly);
81 HRESULT i_releaseUefiVarStore(RTVFS hVfs);
82#endif
83
84private:
85
86 // Wrapped NVRAM store properties
87 HRESULT getNonVolatileStorageFile(com::Utf8Str &aNonVolatileStorageFile);
88 HRESULT getUefiVariableStore(ComPtr<IUefiVariableStore> &aUefiVarStore);
89
90 // Wrapped NVRAM store members
91 HRESULT initUefiVariableStore(ULONG aSize);
92
93 int i_loadStoreFromTar(RTVFSFSSTREAM hVfsFssTar);
94 int i_saveStoreAsTar(const char *pszPath);
95
96#ifdef VBOX_COM_INPROC
97 static DECLCALLBACK(int) i_nvramStoreQuerySize(PPDMIVFSCONNECTOR pInterface, const char *pszNamespace, const char *pszPath,
98 uint64_t *pcb);
99 static DECLCALLBACK(int) i_nvramStoreReadAll(PPDMIVFSCONNECTOR pInterface, const char *pszNamespace, const char *pszPath,
100 void *pvBuf, size_t cbRead);
101 static DECLCALLBACK(int) i_nvramStoreWriteAll(PPDMIVFSCONNECTOR pInterface, const char *pszNamespace, const char *pszPath,
102 const void *pvBuf, size_t cbWrite);
103 static DECLCALLBACK(int) i_nvramStoreDelete(PPDMIVFSCONNECTOR pInterface, const char *pszNamespace, const char *pszPath);
104 static DECLCALLBACK(void *) i_drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
105 static DECLCALLBACK(int) i_drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
106 static DECLCALLBACK(void) i_drvDestruct(PPDMDRVINS pDrvIns);
107#endif
108
109 struct Data; // opaque data struct, defined in NvramStoreImpl.cpp
110 Data *m;
111};
112
113#endif /* !MAIN_INCLUDED_NvramStoreImpl_h */
114/* 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