2 Save Non-Volatile Variables to a file system.
4 Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #include "NvVarsFileLib.h"
10 #include <Library/DebugLib.h>
11 #include <Library/NvVarsFileLib.h>
13 EFI_HANDLE mNvVarsFileLibFsHandle
= NULL
;
17 Attempts to connect the NvVarsFileLib to the specified file system.
19 @param[in] FsHandle - Handle for a gEfiSimpleFileSystemProtocolGuid instance
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
28 ConnectNvVarsToFileSystem (
29 IN EFI_HANDLE FsHandle
35 // We might fail to load the variable, since the file system initially
36 // will not have the NvVars file.
38 LoadNvVarsFromFs (FsHandle
);
41 // We must be able to save the variables successfully to the file system
42 // to have connected successfully.
44 Status
= SaveNvVarsToFs (FsHandle
);
45 if (!EFI_ERROR (Status
)) {
46 mNvVarsFileLibFsHandle
= FsHandle
;
54 Update non-volatile variables stored on the file system.
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
64 UpdateNvVarsOnFileSystem (
67 if (mNvVarsFileLibFsHandle
== NULL
) {
69 // A file system had not been connected to the library.
71 return EFI_NOT_STARTED
;
73 return SaveNvVarsToFs (mNvVarsFileLibFsHandle
);