35 IFile = IFILE_FROM_FHAND (FHand);
38 if (OFile->Error == EFI_NOT_FOUND) {
39 return EFI_DEVICE_ERROR;
42 if (OFile->ODir !=
NULL) {
43 return EFI_UNSUPPORTED;
46 *Position = IFile->Position;
72 IFile = IFILE_FROM_FHAND (FHand);
75 if (OFile->Error == EFI_NOT_FOUND) {
76 return EFI_DEVICE_ERROR;
84 if (OFile->ODir !=
NULL) {
89 return EFI_UNSUPPORTED;
98 if (Position == (UINT64)-1) {
99 Position = OFile->FileSize;
105 IFile->Position = Position;
134 OFile = IFile->OFile;
141 if (CurrentPos < ODir->CurrentPos) {
153 if (EFI_ERROR (Status) || (DirEnt ==
NULL)) {
161 }
while (ODir->CurrentPos <= CurrentPos);
169 if (!EFI_ERROR (Status)) {
173 CurrentPos = ODir->CurrentPos;
214 IFile = IFILE_FROM_FHAND (FHand);
215 OFile = IFile->OFile;
216 Volume = OFile->Volume;
222 if ((OFile->ODir !=
NULL) && (IoMode == WriteData)) {
223 return EFI_UNSUPPORTED;
226 if (OFile->Error == EFI_NOT_FOUND) {
227 return EFI_DEVICE_ERROR;
230 if (IoMode == ReadData) {
234 if (IFile->Position > OFile->FileSize) {
235 return EFI_DEVICE_ERROR;
241 if (Volume->ReadOnly) {
242 return EFI_WRITE_PROTECTED;
245 if (IFile->ReadOnly) {
246 return EFI_ACCESS_DENIED;
257 if (FHand->Revision < EFI_FILE_PROTOCOL_REVISION2) {
258 return EFI_UNSUPPORTED;
263 return EFI_OUT_OF_RESOURCES;
269 Status = OFile->Error;
270 if (!EFI_ERROR (Status)) {
271 if (OFile->ODir !=
NULL) {
275 ASSERT (IoMode == ReadData);
282 EndPosition = IFile->Position + *BufferSize;
283 if (EndPosition > OFile->FileSize) {
287 if (IoMode == ReadData) {
291 *BufferSize -= (
UINTN)EndPosition - OFile->FileSize;
297 if (EFI_ERROR (Status)) {
313 IFile->Position += *BufferSize;
318 if (!EFI_ERROR (Status)) {
335 if (EFI_ERROR (Status)) {
389 return FatIFileAccess (FHand, ReadData, &Token->BufferSize, Token->Buffer, Token);
440 return FatIFileAccess (FHand, WriteData, &Token->BufferSize, Token->Buffer, Token);
465 IN OUT UINT8 *UserBuffer,
474 BufferSize = *DataBufferSize;
475 Volume = OFile->Volume;
476 ASSERT_VOLUME_LOCKED (Volume);
479 while (BufferSize > 0) {
484 if (EFI_ERROR (Status)) {
491 Len = BufferSize > OFile->PosRem ? OFile->PosRem : BufferSize;
496 Status =
FatDiskIo (Volume, IoMode, OFile->PosDisk, Len, UserBuffer, Task);
497 if (EFI_ERROR (Status)) {
507 if (IoMode == WriteData) {
509 OFile->Archive =
TRUE;
515 ASSERT (Position <= OFile->FileSize);
521 *DataBufferSize -= BufferSize;
539 IN UINT64 ExpandedSize
545 WritePos = OFile->FileSize;
547 if (!EFI_ERROR (Status)) {
578 AppendedSize = OFile->FileSize - WritePos;
579 BufferSize = AppendedSize;
580 if (AppendedSize > FAT_MAX_ALLOCATE_SIZE) {
587 BufferSize = FAT_MAX_ALLOCATE_SIZE;
591 if (ZeroBuffer ==
NULL) {
592 return EFI_OUT_OF_RESOURCES;
596 WriteSize = AppendedSize > BufferSize ? BufferSize : (
UINTN)AppendedSize;
597 AppendedSize -= WriteSize;
599 if (EFI_ERROR (Status)) {
603 WritePos += WriteSize;
604 }
while (AppendedSize > 0);
627 OFile->FileSize = TruncatedSize;
EFI_STATUS FatGetDirEntInfo(IN FAT_VOLUME *Volume, IN FAT_DIRENT *DirEnt, IN OUT UINTN *BufferSize, OUT VOID *Buffer)
EFI_STATUS FatGetNextDirEnt(IN FAT_OFILE *OFile, OUT FAT_DIRENT **PtrDirEnt)
VOID FatUpdateDirEntClusterSizeInfo(IN FAT_OFILE *OFile)
VOID FatResetODirCursor(IN FAT_OFILE *OFile)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID FatDestroyTask(FAT_TASK *Task)
FAT_TASK * FatCreateTask(FAT_IFILE *IFile, EFI_FILE_IO_TOKEN *Token)
EFI_STATUS FatQueueTask(IN FAT_IFILE *IFile, IN FAT_TASK *Task)
EFI_STATUS FatOFileFlush(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)
VOID FatWaitNonblockingTask(FAT_IFILE *IFile)
EFI_STATUS FatShrinkEof(IN FAT_OFILE *OFile)
EFI_STATUS FatDiskIo(IN FAT_VOLUME *Volume, IN IO_MODE IoMode, IN UINT64 Offset, IN UINTN BufferSize, IN OUT VOID *Buffer, IN FAT_TASK *Task)
VOID FatAcquireLock(VOID)
VOID FatReleaseLock(VOID)
EFI_STATUS FatCleanupVolume(IN FAT_VOLUME *Volume, IN FAT_OFILE *OFile, IN EFI_STATUS EfiStatus, IN FAT_TASK *Task)
EFI_STATUS EFIAPI FatReadEx(IN EFI_FILE_PROTOCOL *FHand, IN OUT EFI_FILE_IO_TOKEN *Token)
EFI_STATUS EFIAPI FatRead(IN EFI_FILE_PROTOCOL *FHand, IN OUT UINTN *BufferSize, OUT VOID *Buffer)
EFI_STATUS FatWriteZeroPool(IN FAT_OFILE *OFile, IN UINTN WritePos)
EFI_STATUS EFIAPI FatWrite(IN EFI_FILE_PROTOCOL *FHand, IN OUT UINTN *BufferSize, IN VOID *Buffer)
EFI_STATUS FatExpandOFile(IN FAT_OFILE *OFile, IN UINT64 ExpandedSize)
EFI_STATUS EFIAPI FatGetPosition(IN EFI_FILE_PROTOCOL *FHand, OUT UINT64 *Position)
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 FatIFileReadDir(IN FAT_IFILE *IFile, IN OUT UINTN *BufferSize, OUT VOID *Buffer)
EFI_STATUS EFIAPI FatSetPosition(IN EFI_FILE_PROTOCOL *FHand, IN UINT64 Position)
EFI_STATUS FatTruncateOFile(IN FAT_OFILE *OFile, IN UINTN TruncatedSize)
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)