2 Save Non-Volatile Variables to a file system.
4 Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
5 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
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.
15 #include "NvVarsFileLib.h"
16 #include <Library/DebugLib.h>
17 #include <Library/NvVarsFileLib.h>
19 EFI_HANDLE mNvVarsFileLibFsHandle
= NULL
;
23 Attempts to connect the NvVarsFileLib to the specified file system.
25 @param[in] FsHandle - Handle for a gEfiSimpleFileSystemProtocolGuid instance
27 @return The EFI_STATUS while attempting to connect the NvVarsFileLib
28 to the file system instance.
29 @retval EFI_SUCCESS - The given file system was connected successfully
34 ConnectNvVarsToFileSystem (
35 IN EFI_HANDLE FsHandle
41 // We might fail to load the variable, since the file system initially
42 // will not have the NvVars file.
44 LoadNvVarsFromFs (FsHandle
);
47 // We must be able to save the variables successfully to the file system
48 // to have connected successfully.
50 Status
= SaveNvVarsToFs (FsHandle
);
51 if (!EFI_ERROR (Status
)) {
52 mNvVarsFileLibFsHandle
= FsHandle
;
60 Update non-volatile variables stored on the file system.
62 @return The EFI_STATUS while attempting to update the variable on
63 the connected file system.
64 @retval EFI_SUCCESS - The non-volatile variables were saved to the disk
65 @retval EFI_NOT_STARTED - A file system has not been connected
70 UpdateNvVarsOnFileSystem (
73 if (mNvVarsFileLibFsHandle
== NULL
) {
75 // A file system had not been connected to the library.
77 return EFI_NOT_STARTED
;
79 return SaveNvVarsToFs (mNvVarsFileLibFsHandle
);