120 CHAR16 Name[FAT_NAME_LEN + 1];
123 UINT8 ClusterAlignment;
128 ResultSize = Size + NameSize;
129 ClusterAlignment = Volume->ClusterAlignment;
136 Status = EFI_BUFFER_TOO_SMALL;
137 if (*BufferSize >= ResultSize) {
143 Info->
Size = ResultSize;
145 Info->
BlockSize = (UINT32)Volume->ClusterSize;
148 Volume->FatInfoSector.FreeInfo.ClusterCount,
151 CopyMem ((CHAR8 *)Buffer + Size, Name, NameSize);
154 *BufferSize = ResultSize;
180 CHAR16 Name[FAT_NAME_LEN + 1];
183 Size = SIZE_OF_EFI_FILE_SYSTEM_VOLUME_LABEL;
186 ResultSize = Size + NameSize;
188 Status = EFI_BUFFER_TOO_SMALL;
189 if (*BufferSize >= ResultSize) {
191 CopyMem ((CHAR8 *)Buffer + Size, Name, NameSize);
194 *BufferSize = ResultSize;
224 return EFI_BAD_BUFFER_SIZE;
255 if (BufferSize < SIZE_OF_EFI_FILE_SYSTEM_VOLUME_LABEL + 2) {
256 return EFI_BAD_BUFFER_SIZE;
299 CHAR16 NewFileName[EFI_PATH_STRING_LENGTH];
309 Parent = OFile->Parent;
310 DirEnt = OFile->DirEnt;
314 if (Parent ==
NULL) {
315 return EFI_ACCESS_DENIED;
323 return EFI_BAD_BUFFER_SIZE;
326 ReadOnly = (BOOLEAN)(IFile->ReadOnly || (DirEnt->Entry.Attributes & EFI_FILE_READ_ONLY));
332 return EFI_INVALID_PARAMETER;
342 return EFI_INVALID_PARAMETER;
349 OFile->PreserveLastModification =
TRUE;
352 if (NewInfo->
Attribute & (~EFI_FILE_VALID_ATTR)) {
353 return EFI_INVALID_PARAMETER;
356 NewAttribute = (UINT8)NewInfo->
Attribute;
360 if ((NewAttribute ^ DirEnt->Entry.Attributes) & EFI_FILE_DIRECTORY) {
361 return EFI_ACCESS_DENIED;
367 DirEnt->Entry.Attributes = (UINT8)((DirEnt->Entry.Attributes &~EFI_FILE_VALID_ATTR) | NewAttribute);
372 if (EFI_ERROR (Status)) {
376 if (*NewFileName != 0) {
381 if (!
IsListEmpty (&OFile->ChildHead) || (Parent == OFile)) {
382 return EFI_ACCESS_DENIED;
386 return EFI_ACCESS_DENIED;
390 if (EFI_ERROR (Status)) {
397 Status =
FatCreateDirEnt (Parent, NewFileName, DirEnt->Entry.Attributes, &TempDirEnt);
398 if (EFI_ERROR (Status)) {
405 DirEnt->OFile = OFile;
406 OFile->DirEnt = DirEnt;
407 OFile->Parent = Parent;
413 if (OFile->ODir !=
NULL) {
418 ASSERT (OFile->Parent !=
NULL);
419 for (DotOFile = OFile; DotOFile != OFile->Parent->Parent; DotOFile = DotOFile->Parent) {
422 return EFI_VOLUME_CORRUPTED;
427 if (EFI_ERROR (Status)) {
436 OFile->Archive =
TRUE;
437 }
else if (Parent != OFile) {
441 return EFI_ACCESS_DENIED;
447 if (NewInfo->
FileSize != OFile->FileSize) {
448 if ((OFile->ODir !=
NULL) || ReadOnly) {
452 return EFI_ACCESS_DENIED;
455 if (NewInfo->
FileSize > OFile->FileSize) {
461 if (EFI_ERROR (Status)) {
500 IFile = IFILE_FROM_FHAND (FHand);
501 OFile = IFile->OFile;
502 Volume = OFile->Volume;
504 Status = OFile->Error;
505 if (Status == EFI_NOT_FOUND) {
506 return EFI_DEVICE_ERROR;
516 if (!EFI_ERROR (Status)) {
520 Status = EFI_UNSUPPORTED;
523 Status = Volume->ReadOnly ? EFI_WRITE_PROTECTED :
FatSetFileInfo (Volume, IFile, OFile, *BufferSize, Buffer);
527 Status = Volume->ReadOnly ? EFI_WRITE_PROTECTED :
FatSetVolumeInfo (Volume, *BufferSize, Buffer);
530 if (
CompareGuid (Type, &gEfiFileSystemVolumeLabelInfoIdGuid)) {
531 Status = Volume->ReadOnly ? EFI_WRITE_PROTECTED :
FatSetVolumeLabelInfo (Volume, *BufferSize, Buffer);
542 if (
CompareGuid (Type, &gEfiFileSystemVolumeLabelInfoIdGuid)) {
UINTN EFIAPI StrSize(IN CONST CHAR16 *String)
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)
UINT64 EFIAPI LShiftU64(IN UINT64 Operand, IN UINTN Count)
INTN EFIAPI CompareMem(IN CONST VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
EFI_STATUS FatRemoveDirEnt(IN FAT_OFILE *OFile, IN FAT_DIRENT *DirEnt)
EFI_STATUS FatStoreDirEnt(IN FAT_OFILE *OFile, IN FAT_DIRENT *DirEnt)
EFI_STATUS FatGetDirEntInfo(IN FAT_VOLUME *Volume, IN FAT_DIRENT *DirEnt, IN OUT UINTN *BufferSize, OUT VOID *Buffer)
EFI_STATUS FatCreateDirEnt(IN FAT_OFILE *OFile, IN CHAR16 *FileName, IN UINT8 Attributes, OUT FAT_DIRENT **PtrDirEnt)
BOOLEAN FatIsDotDirEnt(IN FAT_DIRENT *DirEnt)
EFI_STATUS FatLocateOFile(IN OUT FAT_OFILE **PtrOFile, IN CHAR16 *FileName, IN UINT8 Attributes, OUT CHAR16 *NewFileName)
EFI_STATUS FatSetVolumeEntry(IN FAT_VOLUME *Volume, IN CHAR16 *Name)
EFI_STATUS FatGetNextDirEnt(IN FAT_OFILE *OFile, OUT FAT_DIRENT **PtrDirEnt)
EFI_STATUS FatGetVolumeEntry(IN FAT_VOLUME *Volume, IN CHAR16 *Name)
VOID FatCloneDirEnt(IN FAT_DIRENT *DirEnt1, IN FAT_DIRENT *DirEnt2)
VOID FatUpdateDirEntClusterSizeInfo(IN FAT_OFILE *OFile)
VOID FatResetODirCursor(IN FAT_OFILE *OFile)
VOID FatEfiTimeToFatTime(IN EFI_TIME *ETime, OUT FAT_DATE_TIME *FTime)
EFI_STATUS FatOFileFlush(IN FAT_OFILE *OFile)
EFI_STATUS FatExpandOFile(IN FAT_OFILE *OFile, IN UINT64 ExpandedSize)
VOID FatWaitNonblockingTask(FAT_IFILE *IFile)
BOOLEAN FatIsValidTime(IN EFI_TIME *Time)
VOID FatComputeFreeInfo(IN FAT_VOLUME *Volume)
VOID FatFreeDirEnt(IN FAT_DIRENT *DirEnt)
VOID FatAcquireLock(VOID)
VOID FatReleaseLock(VOID)
EFI_STATUS FatTruncateOFile(IN FAT_OFILE *OFile, IN UINTN TruncatedSize)
EFI_STATUS FatCleanupVolume(IN FAT_VOLUME *Volume, IN FAT_OFILE *OFile, IN EFI_STATUS EfiStatus, IN FAT_TASK *Task)
#define SIZE_OF_EFI_FILE_INFO
#define SIZE_OF_EFI_FILE_SYSTEM_INFO
EFI_STATUS FatGetVolumeInfo(IN FAT_VOLUME *Volume, IN OUT UINTN *BufferSize, OUT VOID *Buffer)
EFI_STATUS EFIAPI FatGetInfo(IN EFI_FILE_PROTOCOL *FHand, IN EFI_GUID *Type, IN OUT UINTN *BufferSize, OUT VOID *Buffer)
EFI_STATUS FatSetVolumeLabelInfo(IN FAT_VOLUME *Volume, IN UINTN BufferSize, IN VOID *Buffer)
EFI_STATUS FatGetVolumeLabelInfo(IN FAT_VOLUME *Volume, IN OUT UINTN *BufferSize, OUT VOID *Buffer)
EFI_STATUS FatSetFileInfo(IN FAT_VOLUME *Volume, IN FAT_IFILE *IFile, IN FAT_OFILE *OFile, IN UINTN BufferSize, IN VOID *Buffer)
EFI_STATUS FatGetFileInfo(IN FAT_OFILE *OFile, IN OUT UINTN *BufferSize, OUT VOID *Buffer)
EFI_STATUS EFIAPI FatSetInfo(IN EFI_FILE_PROTOCOL *FHand, IN EFI_GUID *Type, IN UINTN BufferSize, IN VOID *Buffer)
EFI_STATUS FatSetVolumeInfo(IN FAT_VOLUME *Volume, IN UINTN BufferSize, IN VOID *Buffer)
EFI_STATUS FatSetOrGetInfo(IN BOOLEAN IsSet, IN EFI_FILE_PROTOCOL *FHand, IN EFI_GUID *Type, IN OUT UINTN *BufferSize, IN OUT VOID *Buffer)
EFI_TIME ModificationTime