VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/Library/NvVarsFileLib/NvVarsFileLib.c@ 80721

Last change on this file since 80721 was 80721, checked in by vboxsync, 6 years ago

Devices/EFI/FirmwareNew: Start upgrade process to edk2-stable201908 (compiles on Windows and works to some extent), bugref:4643

  • Property svn:eol-style set to native
File size: 1.7 KB
Line 
1/** @file
2 Save Non-Volatile Variables to a file system.
3
4 Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7**/
8
9#include "NvVarsFileLib.h"
10#include <Library/DebugLib.h>
11#include <Library/NvVarsFileLib.h>
12
13EFI_HANDLE mNvVarsFileLibFsHandle = NULL;
14
15
16/**
17 Attempts to connect the NvVarsFileLib to the specified file system.
18
19 @param[in] FsHandle - Handle for a gEfiSimpleFileSystemProtocolGuid instance
20
21 @return The EFI_STATUS while attempting to connect the NvVarsFileLib
22 to the file system instance.
23 @retval EFI_SUCCESS - The given file system was connected successfully
24
25**/
26EFI_STATUS
27EFIAPI
28ConnectNvVarsToFileSystem (
29 IN EFI_HANDLE FsHandle
30 )
31{
32 EFI_STATUS Status;
33
34 //
35 // We might fail to load the variable, since the file system initially
36 // will not have the NvVars file.
37 //
38 LoadNvVarsFromFs (FsHandle);
39
40 //
41 // We must be able to save the variables successfully to the file system
42 // to have connected successfully.
43 //
44 Status = SaveNvVarsToFs (FsHandle);
45 if (!EFI_ERROR (Status)) {
46 mNvVarsFileLibFsHandle = FsHandle;
47 }
48
49 return Status;
50}
51
52
53/**
54 Update non-volatile variables stored on the file system.
55
56 @return The EFI_STATUS while attempting to update the variable on
57 the connected file system.
58 @retval EFI_SUCCESS - The non-volatile variables were saved to the disk
59 @retval EFI_NOT_STARTED - A file system has not been connected
60
61**/
62EFI_STATUS
63EFIAPI
64UpdateNvVarsOnFileSystem (
65 )
66{
67 if (mNvVarsFileLibFsHandle == NULL) {
68 //
69 // A file system had not been connected to the library.
70 //
71 return EFI_NOT_STARTED;
72 } else {
73 return SaveNvVarsToFs (mNvVarsFileLibFsHandle);
74 }
75}
76
77
Note: See TracBrowser for help on using the repository browser.

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