94e00e0bdb8eb5acdf485f300e60502b7a05a1ed
[mirror_edk2.git] / OvmfPkg / Library / NvVarsFileLib / NvVarsFileLib.c
1 /** @file
2 Save Non-Volatile Variables to a file system.
3
4 Copyright (c) 2009, Intel Corporation. <BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #include "NvVarsFileLib.h"
16 #include <Library/DebugLib.h>
17 #include <Library/NvVarsFileLib.h>
18
19
20 /**
21 Attempts to connect the NvVarsFileLib to the specified file system.
22
23 @param[in] FsHandle - Handle for a gEfiSimpleFileSystemProtocolGuid instance
24
25 @return The EFI_STATUS while attempting to connect the NvVarsFileLib
26 to the file system instance.
27 @retval EFI_SUCCESS - The given file system was connected successfully
28
29 **/
30 EFI_STATUS
31 EFIAPI
32 ConnectNvVarsToFileSystem (
33 IN EFI_HANDLE FsHandle
34 )
35 {
36 EFI_STATUS Status;
37
38 //
39 // We might fail to load the variable, since the file system initially
40 // will not have the NvVars file.
41 //
42 LoadNvVarsFromFs (FsHandle);
43
44 //
45 // We must be able to save the variables successfully to the file system
46 // to have connected successfully.
47 //
48 Status = SaveNvVarsToFs (FsHandle);
49
50 return Status;
51 }
52
53