File System Protocol
Version 1.02 12/12/00 197
10.2.4 EFI_FILE.Read()
Summary
Reads data from a file.
Prototype
EFI_STATUS
(EFIAPI *EFI_FILE_READ) (
IN EFI_FILE *This,
IN OUT UINTN *BufferSize,
OUT VOID *Buffer
);
Parameters
This A pointer to the EFI_FILE instance that is the file handle to read data
from. Type EFI_FILE is defined in Section 10.2.
BufferSize On input, the size of the Buffer. On output, the amount of data
returned in Buffer. In both cases, the size is measured in bytes.
Buffer The buffer into which the data is read.
Description
The Read() function reads data from a file.
If This is not a directory, the function reads the requested number of bytes from the file at the
files current position and returns them in Buffer. If the read goes beyond the end of the file, the
read length is truncated to the end of the file. The files current position is increased by the number
of bytes returned.
If This is a directory, the function reads the directory entry at the files current position and
returns the entry in Buffer. If the Buffer is not large enough to hold the current directory
entry, then EFI_BUFFER_TOO_SMALL is returned and the current file position is not updated.
BufferSize is set to be the size of the buffer needed to read the entry. On success, the current
position is updated to the next directory entry. If there are no more directory entries, the read
returns a zero length buffer. EFI_FILE_INFO is the structure returned as the directory entry.
See Section 10.2.11 for a discussion of EFI_FILE_INFO.
Status Codes Returned
EFI_SUCCESS The data was read.
EFI_NO_MEDIA The device has no medium.
EFI_DEVICE_ERROR The device reported an error.
EFI_VOLUME_CORRUPTED The file system structures are corrupted.
EFI_BUFFER_TOO_SMALL The BufferSize is too small to read the current
directory entry. BufferSize has been updated
with the size needed to complete the request.