Efi_file.read(), E the, Read() – Intel Extensible Firmware Interface User Manual

Page 386: Efi_file.read() summary, Prototype, Parameters, Description, Status codes returned

Advertising
background image

Extensible Firmware Interface Specification

11-26

12/01/02

Version 1.10

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. See the type

EFI_FILE

protocol description.

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

file’s 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 file’s current position is increased by the number
of bytes returned.

If

This

is a directory, the function reads the directory entry at the file’s 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.

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.

Advertising