]>
git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskFileExplorer.c
2 Internal file explorer helper functions for RamDiskDxe driver.
4 Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #include "RamDiskImpl.h"
12 Helper function called as part of the code needed to allocate the proper
13 sized buffer for various EFI interfaces.
15 @param[in, out] Status Current status.
16 @param[in, out] Buffer Current allocated buffer, or NULL.
17 @param[in] BufferSize Current buffer size needed.
19 @retval TRUE If the buffer was reallocated and the caller should
21 @retval FALSE The caller should not call this function again.
26 IN OUT EFI_STATUS
*Status
,
34 // If this is an initial request, buffer will be null with a new buffer size
36 if ((*Buffer
== NULL
) && (BufferSize
!= 0)) {
37 *Status
= EFI_BUFFER_TOO_SMALL
;
41 // If the status code is "buffer too small", resize the buffer
44 if (*Status
== EFI_BUFFER_TOO_SMALL
) {
45 if (*Buffer
!= NULL
) {
49 *Buffer
= AllocateZeroPool (BufferSize
);
51 if (*Buffer
!= NULL
) {
54 *Status
= EFI_OUT_OF_RESOURCES
;
59 // If there's an error, free the buffer
61 if (!TryAgain
&& EFI_ERROR (*Status
) && (*Buffer
!= NULL
)) {
70 This function gets the file information from an open file descriptor,
71 and stores it in a buffer allocated from pool.
73 @param[in] FHand File Handle.
75 @return A pointer to a buffer with file information or NULL is returned.
80 IN EFI_FILE_HANDLE FHand
84 EFI_FILE_INFO
*Buffer
;
88 // Initialize for GrowBuffer loop
91 BufferSize
= SIZE_OF_EFI_FILE_INFO
+ 200;
94 // Call the real function
96 while (GrowBuffer (&Status
, (VOID
**)&Buffer
, BufferSize
)) {
97 Status
= FHand
->GetInfo (