]>
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 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 "RamDiskImpl.h"
19 Helper function called as part of the code needed to allocate the proper
20 sized buffer for various EFI interfaces.
22 @param[in, out] Status Current status.
23 @param[in, out] Buffer Current allocated buffer, or NULL.
24 @param[in] BufferSize Current buffer size needed.
26 @retval TRUE If the buffer was reallocated and the caller should
28 @retval FALSE The caller should not call this function again.
33 IN OUT EFI_STATUS
*Status
,
41 // If this is an initial request, buffer will be null with a new buffer size
43 if ((*Buffer
== NULL
) && (BufferSize
!= 0)) {
44 *Status
= EFI_BUFFER_TOO_SMALL
;
47 // If the status code is "buffer too small", resize the buffer
50 if (*Status
== EFI_BUFFER_TOO_SMALL
) {
52 if (*Buffer
!= NULL
) {
56 *Buffer
= AllocateZeroPool (BufferSize
);
58 if (*Buffer
!= NULL
) {
61 *Status
= EFI_OUT_OF_RESOURCES
;
65 // If there's an error, free the buffer
67 if (!TryAgain
&& EFI_ERROR (*Status
) && (*Buffer
!= NULL
)) {
77 This function gets the file information from an open file descriptor,
78 and stores it in a buffer allocated from pool.
80 @param[in] FHand File Handle.
82 @return A pointer to a buffer with file information or NULL is returned.
87 IN EFI_FILE_HANDLE FHand
91 EFI_FILE_INFO
*Buffer
;
95 // Initialize for GrowBuffer loop
98 BufferSize
= SIZE_OF_EFI_FILE_INFO
+ 200;
101 // Call the real function
103 while (GrowBuffer (&Status
, (VOID
**) &Buffer
, BufferSize
)) {
104 Status
= FHand
->GetInfo (