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