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

Go to the source code of this file.

Functions

STATIC VOID * FatLoadFatEntry (IN FAT_VOLUME *Volume, IN UINTN Index)
 
STATIC UINTN FatGetFatEntry (IN FAT_VOLUME *Volume, IN UINTN Index)
 
STATIC EFI_STATUS FatSetFatEntry (IN FAT_VOLUME *Volume, IN UINTN Index, IN UINTN Value)
 
STATIC EFI_STATUS FatFreeClusters (IN FAT_VOLUME *Volume, IN UINTN Cluster)
 
STATIC UINTN FatAllocateCluster (IN FAT_VOLUME *Volume)
 
STATIC UINTN FatSizeToClusters (IN FAT_VOLUME *Volume, IN UINTN Size)
 
EFI_STATUS FatShrinkEof (IN FAT_OFILE *OFile)
 
EFI_STATUS FatGrowEof (IN FAT_OFILE *OFile, IN UINT64 NewSizeInBytes)
 
EFI_STATUS FatOFilePosition (IN FAT_OFILE *OFile, IN UINTN Position, IN UINTN PosLimit)
 
UINTN FatPhysicalDirSize (IN FAT_VOLUME *Volume, IN UINTN Cluster)
 
UINT64 FatPhysicalFileSize (IN FAT_VOLUME *Volume, IN UINTN RealSize)
 
VOID FatComputeFreeInfo (IN FAT_VOLUME *Volume)
 

Detailed Description

Routines dealing with disk spaces and FAT table entries.

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

Definition in file FileSpace.c.

Function Documentation

◆ FatAllocateCluster()

STATIC UINTN FatAllocateCluster ( IN FAT_VOLUME Volume)

Allocate a free cluster and return the cluster index.

Parameters
Volume- FAT file system volume.
Returns
The index of the free cluster

Definition at line 273 of file FileSpace.c.

◆ FatComputeFreeInfo()

VOID FatComputeFreeInfo ( IN FAT_VOLUME Volume)

Update the free cluster info of FatInfoSector of the volume.

Parameters
Volume- FAT file system volume.

Definition at line 720 of file FileSpace.c.

◆ FatFreeClusters()

STATIC EFI_STATUS FatFreeClusters ( IN FAT_VOLUME Volume,
IN UINTN  Cluster 
)

Free the cluster chain.

Parameters
Volume- FAT file system volume.
Cluster- The first cluster of cluster chain.
Return values
EFI_SUCCESS- The cluster chain is freed successfully.
EFI_VOLUME_CORRUPTED- There are errors in the file's clusters.

Definition at line 241 of file FileSpace.c.

◆ FatGetFatEntry()

STATIC UINTN FatGetFatEntry ( IN FAT_VOLUME Volume,
IN UINTN  Index 
)

Get the FAT entry value of the volume, which is identified with the Index.

Parameters
Volume- FAT file system volume.
Index- The index of the FAT entry of the volume.
Returns
The value of the FAT entry.

Definition at line 85 of file FileSpace.c.

◆ FatGrowEof()

EFI_STATUS FatGrowEof ( IN FAT_OFILE OFile,
IN UINT64  NewSizeInBytes 
)

Grow the end of the open file base on the NewSizeInBytes.

Parameters
OFile- The open file.
NewSizeInBytes- The new size in bytes of the open file.
Return values
EFI_SUCCESS- The file is grown successfully.
EFI_UNSUPPORTED- The file size is larger than 4GB.
EFI_VOLUME_CORRUPTED- There are errors in the files' clusters.
EFI_VOLUME_FULL- The volume is full and can not grow the file.

Definition at line 429 of file FileSpace.c.

◆ FatLoadFatEntry()

STATIC VOID * FatLoadFatEntry ( IN FAT_VOLUME Volume,
IN UINTN  Index 
)

Get the FAT entry of the volume, which is identified with the Index.

Parameters
Volume- FAT file system volume.
Index- The index of the FAT entry of the volume.
Returns
The buffer of the FAT entry

Definition at line 25 of file FileSpace.c.

◆ FatOFilePosition()

EFI_STATUS FatOFilePosition ( IN FAT_OFILE OFile,
IN UINTN  Position,
IN UINTN  PosLimit 
)

Seek OFile to requested position, and calculate the number of consecutive clusters from the position in the file

Parameters
OFile- The open file.
Position- The file's position which will be accessed.
PosLimit- The maximum length current reading/writing may access
Return values
EFI_SUCCESS- Set the info successfully.
EFI_VOLUME_CORRUPTED- Cluster chain corrupt.

Definition at line 562 of file FileSpace.c.

◆ FatPhysicalDirSize()

UINTN FatPhysicalDirSize ( IN FAT_VOLUME Volume,
IN UINTN  Cluster 
)

Get the size of directory of the open file.

Parameters
Volume- The File System Volume.
Cluster- The Starting cluster.
Returns
The physical size of the file starting at the input cluster, if there is error in the cluster chain, the return value is 0.

Definition at line 654 of file FileSpace.c.

◆ FatPhysicalFileSize()

UINT64 FatPhysicalFileSize ( IN FAT_VOLUME Volume,
IN UINTN  RealSize 
)

Get the physical size of a file on the disk.

Parameters
Volume- The file system volume.
RealSize- The real size of a file.
Returns
The physical size of a file on the disk.

Definition at line 699 of file FileSpace.c.

◆ FatSetFatEntry()

STATIC EFI_STATUS FatSetFatEntry ( IN FAT_VOLUME Volume,
IN UINTN  Index,
IN UINTN  Value 
)

Set the FAT entry value of the volume, which is identified with the Index.

Parameters
Volume- FAT file system volume.
Index- The index of the FAT entry of the volume.
Value- The new value of the FAT entry.
Return values
EFI_SUCCESS- Set the new FAT entry value successfully.
EFI_VOLUME_CORRUPTED- The FAT type of the volume is error.
Returns
other - An error occurred when operation the FAT entries.

Definition at line 140 of file FileSpace.c.

◆ FatShrinkEof()

EFI_STATUS FatShrinkEof ( IN FAT_OFILE OFile)

Shrink the end of the open file base on the file size.

Parameters
OFile- The open file.
Return values
EFI_SUCCESS- Shrinked successfully.
EFI_VOLUME_CORRUPTED- There are errors in the file's clusters.

Definition at line 355 of file FileSpace.c.

◆ FatSizeToClusters()

STATIC UINTN FatSizeToClusters ( IN FAT_VOLUME Volume,
IN UINTN  Size 
)

Count the number of clusters given a size.

Parameters
Volume- The file system volume.
Size- The size in bytes.
Returns
The number of the clusters.

Definition at line 329 of file FileSpace.c.