TianoCore EDK2 master
Loading...
Searching...
No Matches
ReadWrite.c File Reference
#include "Fat.h"

Go to the source code of this file.

Functions

EFI_STATUS EFIAPI FatGetPosition (IN EFI_FILE_PROTOCOL *FHand, OUT UINT64 *Position)
 
EFI_STATUS EFIAPI FatSetPosition (IN EFI_FILE_PROTOCOL *FHand, IN UINT64 Position)
 
EFI_STATUS FatIFileReadDir (IN FAT_IFILE *IFile, IN OUT UINTN *BufferSize, OUT VOID *Buffer)
 
EFI_STATUS FatIFileAccess (IN EFI_FILE_PROTOCOL *FHand, IN IO_MODE IoMode, IN OUT UINTN *BufferSize, IN OUT VOID *Buffer, IN EFI_FILE_IO_TOKEN *Token)
 
EFI_STATUS EFIAPI FatRead (IN EFI_FILE_PROTOCOL *FHand, IN OUT UINTN *BufferSize, OUT VOID *Buffer)
 
EFI_STATUS EFIAPI FatReadEx (IN EFI_FILE_PROTOCOL *FHand, IN OUT EFI_FILE_IO_TOKEN *Token)
 
EFI_STATUS EFIAPI FatWrite (IN EFI_FILE_PROTOCOL *FHand, IN OUT UINTN *BufferSize, IN VOID *Buffer)
 
EFI_STATUS EFIAPI FatWriteEx (IN EFI_FILE_PROTOCOL *FHand, IN OUT EFI_FILE_IO_TOKEN *Token)
 
EFI_STATUS FatAccessOFile (IN FAT_OFILE *OFile, IN IO_MODE IoMode, IN UINTN Position, IN OUT UINTN *DataBufferSize, IN OUT UINT8 *UserBuffer, IN FAT_TASK *Task)
 
EFI_STATUS FatExpandOFile (IN FAT_OFILE *OFile, IN UINT64 ExpandedSize)
 
EFI_STATUS FatWriteZeroPool (IN FAT_OFILE *OFile, IN UINTN WritePos)
 
EFI_STATUS FatTruncateOFile (IN FAT_OFILE *OFile, IN UINTN TruncatedSize)
 

Detailed Description

Functions that perform file read/write.

Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file ReadWrite.c.

Function Documentation

◆ FatAccessOFile()

EFI_STATUS FatAccessOFile ( IN FAT_OFILE OFile,
IN IO_MODE  IoMode,
IN UINTN  Position,
IN OUT UINTN DataBufferSize,
IN OUT UINT8 *  UserBuffer,
IN FAT_TASK Task 
)

This function reads data from a file or writes data to a file. It uses OFile->PosRem to determine how much data can be accessed in one time.

Parameters
OFile- The open file.
IoMode- Indicate whether the access mode is reading or writing.
Position- The position where data will be accessed.
DataBufferSize- Size of Buffer.
UserBuffer- Buffer containing data.
Taskpoint to task instance.
Return values
EFI_SUCCESS- Access the data successfully.
Returns
other - An error occurred when operating on the disk.

Definition at line 460 of file ReadWrite.c.

◆ FatExpandOFile()

EFI_STATUS FatExpandOFile ( IN FAT_OFILE OFile,
IN UINT64  ExpandedSize 
)

Expand OFile by appending zero bytes at the end of OFile.

Parameters
OFile- The open file.
ExpandedSize- The number of zero bytes appended at the end of the file.
Return values
EFI_SUCCESS- The file is expanded successfully.
Returns
other - An error occurred when expanding file.

Definition at line 537 of file ReadWrite.c.

◆ FatGetPosition()

EFI_STATUS EFIAPI FatGetPosition ( IN EFI_FILE_PROTOCOL FHand,
OUT UINT64 *  Position 
)

Get the file's position of the file.

Parameters
FHand- The handle of file.
Position- The file's position of the file.
Return values
EFI_SUCCESS- Get the info successfully.
EFI_DEVICE_ERROR- Can not find the OFile for the file.
EFI_UNSUPPORTED- The open file is not a file.

Definition at line 27 of file ReadWrite.c.

◆ FatIFileAccess()

EFI_STATUS FatIFileAccess ( IN EFI_FILE_PROTOCOL FHand,
IN IO_MODE  IoMode,
IN OUT UINTN BufferSize,
IN OUT VOID *  Buffer,
IN EFI_FILE_IO_TOKEN Token 
)

Get the file info from the open file of the IFile into Buffer.

Parameters
FHand- The file handle to access.
IoMode- Indicate whether the access mode is reading or writing.
BufferSize- Size of Buffer.
Buffer- Buffer containing read data.
Token- A pointer to the token associated with the transaction.
Return values
EFI_SUCCESS- Get the file info successfully.
EFI_DEVICE_ERROR- Can not find the OFile for the file.
EFI_VOLUME_CORRUPTED- The file type of open file is error.
EFI_WRITE_PROTECTED- The disk is write protect.
EFI_ACCESS_DENIED- The file is read-only.
Returns
other - An error occurred when operating on the disk.

Definition at line 199 of file ReadWrite.c.

◆ FatIFileReadDir()

EFI_STATUS FatIFileReadDir ( IN FAT_IFILE IFile,
IN OUT UINTN BufferSize,
OUT VOID *  Buffer 
)

Get the file info from the open file of the IFile into Buffer.

Parameters
IFile- The instance of the open file.
BufferSize- Size of Buffer.
Buffer- Buffer containing read data.
Return values
EFI_SUCCESS- Get the file info successfully.
other- An error occurred when operation the disk.

Definition at line 122 of file ReadWrite.c.

◆ FatRead()

EFI_STATUS EFIAPI FatRead ( IN EFI_FILE_PROTOCOL FHand,
IN OUT UINTN BufferSize,
OUT VOID *  Buffer 
)

Get the file info.

Parameters
FHand- The handle of the file.
BufferSize- Size of Buffer.
Buffer- Buffer containing read data.
Return values
EFI_SUCCESS- Get the file info successfully.
EFI_DEVICE_ERROR- Can not find the OFile for the file.
EFI_VOLUME_CORRUPTED- The file type of open file is error.
Returns
other - An error occurred when operation the disk.

Definition at line 360 of file ReadWrite.c.

◆ FatReadEx()

EFI_STATUS EFIAPI FatReadEx ( IN EFI_FILE_PROTOCOL FHand,
IN OUT EFI_FILE_IO_TOKEN Token 
)

Get the file info.

Parameters
FHand- The handle of the file.
Token- A pointer to the token associated with the transaction.
Return values
EFI_SUCCESS- Get the file info successfully.
EFI_DEVICE_ERROR- Can not find the OFile for the file.
EFI_VOLUME_CORRUPTED- The file type of open file is error.
Returns
other - An error occurred when operation the disk.

Definition at line 384 of file ReadWrite.c.

◆ FatSetPosition()

EFI_STATUS EFIAPI FatSetPosition ( IN EFI_FILE_PROTOCOL FHand,
IN UINT64  Position 
)

Set the file's position of the file.

Parameters
FHand- The handle of file.
Position- The file's position of the file.
Return values
EFI_SUCCESS- Set the info successfully.
EFI_DEVICE_ERROR- Can not find the OFile for the file.
EFI_UNSUPPORTED- Set a directory with a not-zero position.

Definition at line 64 of file ReadWrite.c.

◆ FatTruncateOFile()

EFI_STATUS FatTruncateOFile ( IN FAT_OFILE OFile,
IN UINTN  TruncatedSize 
)

Truncate the OFile to smaller file size.

Parameters
OFile- The open file.
TruncatedSize- The new file size.
Return values
EFI_SUCCESS- The file is truncated successfully.
Returns
other - An error occurred when truncating file.

Definition at line 622 of file ReadWrite.c.

◆ FatWrite()

EFI_STATUS EFIAPI FatWrite ( IN EFI_FILE_PROTOCOL FHand,
IN OUT UINTN BufferSize,
IN VOID *  Buffer 
)

Write the content of buffer into files.

Parameters
FHand- The handle of the file.
BufferSize- Size of Buffer.
Buffer- Buffer containing write data.
Return values
EFI_SUCCESS- Set the file info successfully.
EFI_WRITE_PROTECTED- The disk is write protect.
EFI_ACCESS_DENIED- The file is read-only.
EFI_DEVICE_ERROR- The OFile is not valid.
EFI_UNSUPPORTED- The open file is not a file.
  • The writing file size is larger than 4GB.
Returns
other - An error occurred when operation the disk.

Definition at line 411 of file ReadWrite.c.

◆ FatWriteEx()

EFI_STATUS EFIAPI FatWriteEx ( IN EFI_FILE_PROTOCOL FHand,
IN OUT EFI_FILE_IO_TOKEN Token 
)

Get the file info.

Parameters
FHand- The handle of the file.
Token- A pointer to the token associated with the transaction.
Return values
EFI_SUCCESS- Get the file info successfully.
EFI_DEVICE_ERROR- Can not find the OFile for the file.
EFI_VOLUME_CORRUPTED- The file type of open file is error.
Returns
other - An error occurred when operation the disk.

Definition at line 435 of file ReadWrite.c.

◆ FatWriteZeroPool()

EFI_STATUS FatWriteZeroPool ( IN FAT_OFILE OFile,
IN UINTN  WritePos 
)

Write zero pool from the WritePos to the end of OFile.

Parameters
OFile- The open file to write zero pool.
WritePos- The number of zero bytes written.
Return values
EFI_SUCCESS- Write the zero pool successfully.
EFI_OUT_OF_RESOURCES- Not enough memory to perform the operation.
Returns
other - An error occurred when writing disk.

Definition at line 567 of file ReadWrite.c.