38 IFile = IFILE_FROM_FHAND (FHand);
40 Volume = OFile->Volume;
46 if (EFI_ERROR (OFile->Error)) {
50 if (Volume->ReadOnly) {
51 return EFI_WRITE_PROTECTED;
57 if (IFile->ReadOnly) {
58 return EFI_ACCESS_DENIED;
68 if (FHand->Revision < EFI_FILE_PROTOCOL_REVISION2) {
69 return EFI_UNSUPPORTED;
74 return EFI_OUT_OF_RESOURCES;
87 if (!EFI_ERROR (Status)) {
137 IFile = IFILE_FROM_FHAND (FHand);
138 OFile = IFile->OFile;
139 Volume = OFile->Volume;
180 OFile = IFile->OFile;
181 Volume = OFile->Volume;
183 ASSERT_VOLUME_LOCKED (Volume);
195 if (OFile->CheckLink.ForwardLink ==
NULL) {
235 if (EFI_ERROR (OFile->Error)) {
239 Parent = OFile->Parent;
240 DirEnt = OFile->DirEnt;
246 CopyMem (&DirEnt->Entry.FileLastAccess, &FatNow.Date, sizeof (
FAT_DATE));
247 if (!OFile->PreserveLastModification) {
251 OFile->PreserveLastModification =
FALSE;
252 if (OFile->Archive) {
253 DirEnt->Entry.Attributes |= FAT_ATTRIBUTE_ARCHIVE;
254 OFile->Archive =
FALSE;
260 if ((Parent !=
NULL) && !DirEnt->Invalid) {
265 if (EFI_ERROR (Status)) {
270 OFile->Dirty =
FALSE;
277 }
while (OFile !=
NULL);
302 if (OFile->CheckLink.ForwardLink !=
NULL) {
304 OFile->CheckLink.ForwardLink =
NULL;
351 Parent = OFILE_FROM_CHECKLINK (Volume->CheckRef.ForwardLink);
355 while (Parent !=
NULL) {
357 Parent = OFile->Parent;
409 if (Volume->FreeInfoValid && Volume->FatDirty && Volume->FreeInfoPos) {
410 Status =
FatDiskIo (Volume, WriteDisk, Volume->FreeInfoPos, sizeof (
FAT_INFO_SECTOR), &Volume->FatInfoSector, Task);
411 if (EFI_ERROR (Status)) {
419 if (Volume->FatDirty && (Volume->FatType != Fat12)) {
420 Volume->FatDirty =
FALSE;
422 if (EFI_ERROR (Status)) {
431 if (EFI_ERROR (Status)) {
440 if ((Volume->Root ==
NULL) && !Volume->Valid) {
470 if (!EFI_ERROR (OFile->Error)) {
471 OFile->Error = Status;
477 for (Link = OFile->ChildHead.ForwardLink; Link != &OFile->ChildHead; Link = Link->ForwardLink) {
478 ChildOFile = OFILE_FROM_CHILDLINK (Link);
BOOLEAN EFIAPI IsListEmpty(IN CONST LIST_ENTRY *ListHead)
LIST_ENTRY *EFIAPI InsertHeadList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
LIST_ENTRY *EFIAPI RemoveEntryList(IN CONST LIST_ENTRY *Entry)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
EFI_STATUS FatStoreDirEnt(IN FAT_OFILE *OFile, IN FAT_DIRENT *DirEnt)
VOID FatCloseDirEnt(IN FAT_DIRENT *DirEnt)
EFI_STATUS FatVolumeFlushCache(IN FAT_VOLUME *Volume, IN FAT_TASK *Task)
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID FatFreeVolume(IN FAT_VOLUME *Volume)
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)
VOID FatWaitNonblockingTask(FAT_IFILE *IFile)
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)
EFI_STATUS FatAccessVolumeDirty(IN FAT_VOLUME *Volume, IN IO_MODE IoMode, IN VOID *DirtyValue)
VOID FatAcquireLock(VOID)
VOID FatReleaseLock(VOID)
VOID FatGetCurrentFatTime(OUT FAT_DATE_TIME *FatTime)
EFI_STATUS FatOFileFlush(IN FAT_OFILE *OFile)
EFI_STATUS EFIAPI FatFlushEx(IN EFI_FILE_PROTOCOL *FHand, IN EFI_FILE_IO_TOKEN *Token)
EFI_STATUS FatIFileClose(FAT_IFILE *IFile)
BOOLEAN FatCheckOFileRef(IN FAT_OFILE *OFile)
EFI_STATUS EFIAPI FatFlush(IN EFI_FILE_PROTOCOL *FHand)
VOID FatSetVolumeError(IN FAT_OFILE *OFile, IN EFI_STATUS Status)
EFI_STATUS EFIAPI FatClose(IN EFI_FILE_PROTOCOL *FHand)
STATIC VOID FatCheckVolumeRef(IN FAT_VOLUME *Volume)
EFI_STATUS FatCleanupVolume(IN FAT_VOLUME *Volume, IN FAT_OFILE *OFile, IN EFI_STATUS EfiStatus, IN FAT_TASK *Task)