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
;
16 Attempts to connect the NvVarsFileLib to the specified file system.
18 @param[in] FsHandle - Handle for a gEfiSimpleFileSystemProtocolGuid instance
20 @return The EFI_STATUS while attempting to connect the NvVarsFileLib
21 to the file system instance.
22 @retval EFI_SUCCESS - The given file system was connected successfully
27 ConnectNvVarsToFileSystem (
28 IN EFI_HANDLE FsHandle
34 // We might fail to load the variable, since the file system initially
35 // will not have the NvVars file.
37 LoadNvVarsFromFs (FsHandle
);
40 // We must be able to save the variables successfully to the file system
41 // to have connected successfully.
43 Status
= SaveNvVarsToFs (FsHandle
);
44 if (!EFI_ERROR (Status
)) {
45 mNvVarsFileLibFsHandle
= FsHandle
;
52 Update non-volatile variables stored on the file system.
54 @return The EFI_STATUS while attempting to update the variable on
55 the connected file system.
56 @retval EFI_SUCCESS - The non-volatile variables were saved to the disk
57 @retval EFI_NOT_STARTED - A file system has not been connected
62 UpdateNvVarsOnFileSystem (
65 if (mNvVarsFileLibFsHandle
== NULL
) {
67 // A file system had not been connected to the library.
69 return EFI_NOT_STARTED
;
71 return SaveNvVarsToFs (mNvVarsFileLibFsHandle
);