-/*++\r
+/** @file\r
+ Routines dealing with setting/getting file/volume info\r
\r
-Copyright (c) 2005 - 2009, Intel Corporation\r
-All rights reserved. This program and the accompanying materials are licensed and made available\r
+Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials are licensed and made available\r
under the terms and conditions of the BSD License which accompanies this\r
distribution. The full text of the license may be found at\r
http://opensource.org/licenses/bsd-license.php\r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
\r
-Module Name:\r
\r
- Info.c\r
+**/\r
\r
-Abstract:\r
+#include "Fat.h"\r
\r
- Routines dealing with setting/getting file/volume info\r
+/**\r
\r
-Revision History\r
+ Get the volume's info into Buffer.\r
\r
---*/\r
+ @param Volume - FAT file system volume.\r
+ @param BufferSize - Size of Buffer.\r
+ @param Buffer - Buffer containing volume info.\r
\r
-#include "Fat.h"\r
+ @retval EFI_SUCCESS - Get the volume info successfully.\r
+ @retval EFI_BUFFER_TOO_SMALL - The buffer is too small.\r
\r
+**/\r
EFI_STATUS\r
FatGetVolumeInfo (\r
IN FAT_VOLUME *Volume,\r
OUT VOID *Buffer\r
);\r
\r
+/**\r
+\r
+ Set the volume's info.\r
+\r
+ @param Volume - FAT file system volume.\r
+ @param BufferSize - Size of Buffer.\r
+ @param Buffer - Buffer containing the new volume info.\r
+\r
+ @retval EFI_SUCCESS - Set the volume info successfully.\r
+ @retval EFI_BAD_BUFFER_SIZE - The buffer size is error.\r
+ @retval EFI_WRITE_PROTECTED - The volume is read only.\r
+ @return other - An error occurred when operation the disk.\r
+\r
+**/\r
EFI_STATUS\r
FatSetVolumeInfo (\r
IN FAT_VOLUME *Volume,\r
- IN OUT UINTN BufferSize,\r
- OUT VOID *Buffer\r
+ IN UINTN BufferSize,\r
+ IN VOID *Buffer\r
);\r
\r
+/**\r
+\r
+ Set or Get the some types info of the file into Buffer.\r
+\r
+ @param IsSet - TRUE:The access is set, else is get\r
+ @param FHand - The handle of file\r
+ @param Type - The type of the info\r
+ @param BufferSize - Size of Buffer\r
+ @param Buffer - Buffer containing volume info\r
+\r
+ @retval EFI_SUCCESS - Get the info successfully\r
+ @retval EFI_DEVICE_ERROR - Can not find the OFile for the file\r
+\r
+**/\r
EFI_STATUS\r
FatSetOrGetInfo (\r
IN BOOLEAN IsSet,\r
IN OUT VOID *Buffer\r
);\r
\r
+/**\r
+\r
+ Get the open file's info into Buffer.\r
+\r
+ @param OFile - The open file.\r
+ @param BufferSize - Size of Buffer.\r
+ @param Buffer - Buffer containing file info.\r
+\r
+ @retval EFI_SUCCESS - Get the file info successfully.\r
+ @retval EFI_BUFFER_TOO_SMALL - The buffer is too small.\r
+\r
+**/\r
EFI_STATUS\r
FatGetFileInfo (\r
IN FAT_OFILE *OFile,\r
IN OUT UINTN *BufferSize,\r
OUT VOID *Buffer\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Get the open file's info into Buffer.\r
-\r
-Arguments:\r
+{\r
+ return FatGetDirEntInfo (OFile->Volume, OFile->DirEnt, BufferSize, Buffer);\r
+}\r
\r
- OFile - The open file.\r
- BufferSize - Size of Buffer.\r
- Buffer - Buffer containing file info.\r
+/**\r
\r
-Returns:\r
+ Get the volume's info into Buffer.\r
\r
- EFI_SUCCESS - Get the file info successfully.\r
- EFI_BUFFER_TOO_SMALL - The buffer is too small.\r
+ @param Volume - FAT file system volume.\r
+ @param BufferSize - Size of Buffer.\r
+ @param Buffer - Buffer containing volume info.\r
\r
---*/\r
-{\r
- return FatGetDirEntInfo (OFile->Volume, OFile->DirEnt, BufferSize, Buffer);\r
-}\r
+ @retval EFI_SUCCESS - Get the volume info successfully.\r
+ @retval EFI_BUFFER_TOO_SMALL - The buffer is too small.\r
\r
+**/\r
EFI_STATUS\r
FatGetVolumeInfo (\r
IN FAT_VOLUME *Volume,\r
IN OUT UINTN *BufferSize,\r
OUT VOID *Buffer\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Get the volume's info into Buffer.\r
-\r
-Arguments:\r
-\r
- Volume - FAT file system volume.\r
- BufferSize - Size of Buffer.\r
- Buffer - Buffer containing volume info.\r
-\r
-Returns:\r
-\r
- EFI_SUCCESS - Get the volume info successfully.\r
- EFI_BUFFER_TOO_SMALL - The buffer is too small.\r
-\r
---*/\r
{\r
UINTN Size;\r
UINTN NameSize;\r
return Status;\r
}\r
\r
+/**\r
+\r
+ Get the volume's label info into Buffer.\r
+\r
+ @param Volume - FAT file system volume.\r
+ @param BufferSize - Size of Buffer.\r
+ @param Buffer - Buffer containing volume's label info.\r
+\r
+ @retval EFI_SUCCESS - Get the volume's label info successfully.\r
+ @retval EFI_BUFFER_TOO_SMALL - The buffer is too small.\r
+\r
+**/\r
EFI_STATUS\r
FatGetVolumeLabelInfo (\r
IN FAT_VOLUME *Volume,\r
IN OUT UINTN *BufferSize,\r
OUT VOID *Buffer\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Get the volume's label info into Buffer.\r
-\r
-Arguments:\r
-\r
- Volume - FAT file system volume.\r
- BufferSize - Size of Buffer.\r
- Buffer - Buffer containing volume's label info.\r
-\r
-Returns:\r
-\r
- EFI_SUCCESS - Get the volume's label info successfully.\r
- EFI_BUFFER_TOO_SMALL - The buffer is too small.\r
-\r
---*/\r
{\r
UINTN Size;\r
UINTN NameSize;\r
return Status;\r
}\r
\r
+/**\r
+\r
+ Set the volume's info.\r
+\r
+ @param Volume - FAT file system volume.\r
+ @param BufferSize - Size of Buffer.\r
+ @param Buffer - Buffer containing the new volume info.\r
+\r
+ @retval EFI_SUCCESS - Set the volume info successfully.\r
+ @retval EFI_BAD_BUFFER_SIZE - The buffer size is error.\r
+ @retval EFI_WRITE_PROTECTED - The volume is read only.\r
+ @return other - An error occurred when operation the disk.\r
+\r
+**/\r
EFI_STATUS\r
FatSetVolumeInfo (\r
IN FAT_VOLUME *Volume,\r
IN UINTN BufferSize,\r
IN VOID *Buffer\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Set the volume's info.\r
-\r
-Arguments:\r
-\r
- Volume - FAT file system volume.\r
- BufferSize - Size of Buffer.\r
- Buffer - Buffer containing the new volume info.\r
-\r
-Returns:\r
-\r
- EFI_SUCCESS - Set the volume info successfully.\r
- EFI_BAD_BUFFER_SIZE - The buffer size is error.\r
- EFI_WRITE_PROTECTED - The volume is read only.\r
- other - An error occurred when operation the disk.\r
-\r
---*/\r
{\r
EFI_FILE_SYSTEM_INFO *Info;\r
\r
return FatSetVolumeEntry (Volume, Info->VolumeLabel);\r
}\r
\r
+/**\r
+\r
+ Set the volume's label info.\r
+\r
+ @param Volume - FAT file system volume.\r
+ @param BufferSize - Size of Buffer.\r
+ @param Buffer - Buffer containing the new volume label info.\r
+\r
+ @retval EFI_SUCCESS - Set the volume label info successfully.\r
+ @retval EFI_WRITE_PROTECTED - The disk is write protected.\r
+ @retval EFI_BAD_BUFFER_SIZE - The buffer size is error.\r
+ @return other - An error occurred when operation the disk.\r
+\r
+**/\r
EFI_STATUS\r
FatSetVolumeLabelInfo (\r
IN FAT_VOLUME *Volume,\r
IN UINTN BufferSize,\r
IN VOID *Buffer\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Set the volume's label info\r
-\r
-Arguments:\r
-\r
- Volume - FAT file system volume.\r
- BufferSize - Size of Buffer.\r
- Buffer - Buffer containing the new volume label info.\r
-\r
-Returns:\r
-\r
- EFI_SUCCESS - Set the volume label info successfully.\r
- EFI_WRITE_PROTECTED - The disk is write protected.\r
- EFI_BAD_BUFFER_SIZE - The buffer size is error.\r
- other - An error occurred when operation the disk.\r
-\r
---*/\r
{\r
EFI_FILE_SYSTEM_VOLUME_LABEL *Info;\r
\r
return FatSetVolumeEntry (Volume, Info->VolumeLabel);\r
}\r
\r
+/**\r
+\r
+ Set the file info.\r
+\r
+ @param Volume - FAT file system volume.\r
+ @param IFile - The instance of the open file.\r
+ @param OFile - The open file.\r
+ @param BufferSize - Size of Buffer.\r
+ @param Buffer - Buffer containing the new file info.\r
+\r
+ @retval EFI_SUCCESS - Set the file info successfully.\r
+ @retval EFI_ACCESS_DENIED - It is the root directory\r
+ or the directory attribute bit can not change\r
+ or try to change a directory size\r
+ or something else.\r
+ @retval EFI_UNSUPPORTED - The new file size is larger than 4GB.\r
+ @retval EFI_WRITE_PROTECTED - The disk is write protected.\r
+ @retval EFI_BAD_BUFFER_SIZE - The buffer size is error.\r
+ @retval EFI_INVALID_PARAMETER - The time info or attributes info is error.\r
+ @retval EFI_OUT_OF_RESOURCES - Can not allocate new memory.\r
+ @retval EFI_VOLUME_CORRUPTED - The volume is corrupted.\r
+ @return other - An error occurred when operation the disk.\r
+\r
+**/\r
EFI_STATUS\r
FatSetFileInfo (\r
IN FAT_VOLUME *Volume,\r
IN UINTN BufferSize,\r
IN VOID *Buffer\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Set the file info.\r
-\r
-Arguments:\r
-\r
- Volume - FAT file system volume.\r
- IFile - The instance of the open file.\r
- OFile - The open file.\r
- BufferSize - Size of Buffer.\r
- Buffer - Buffer containing the new file info.\r
-\r
-Returns:\r
-\r
- EFI_SUCCESS - Set the file info successfully.\r
- EFI_ACCESS_DENIED - It is the root directory\r
- or the directory attribute bit can not change\r
- or try to change a directory size\r
- or something else.\r
- EFI_UNSUPPORTED - The new file size is larger than 4GB.\r
- EFI_WRITE_PROTECTED - The disk is write protected.\r
- EFI_BAD_BUFFER_SIZE - The buffer size is error.\r
- EFI_INVALID_PARAMETER - The time info or attributes info is error.\r
- EFI_OUT_OF_RESOURCES - Can not allocate new memory.\r
- EFI_VOLUME_CORRUPTED - The volume is corrupted.\r
- other - An error occurred when operation the disk.\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
EFI_FILE_INFO *NewInfo;\r
return FatOFileFlush (OFile);\r
}\r
\r
+/**\r
+\r
+ Set or Get the some types info of the file into Buffer.\r
+\r
+ @param IsSet - TRUE:The access is set, else is get\r
+ @param FHand - The handle of file\r
+ @param Type - The type of the info\r
+ @param BufferSize - Size of Buffer\r
+ @param Buffer - Buffer containing volume info\r
+\r
+ @retval EFI_SUCCESS - Get the info successfully\r
+ @retval EFI_DEVICE_ERROR - Can not find the OFile for the file\r
+\r
+**/\r
EFI_STATUS\r
FatSetOrGetInfo (\r
IN BOOLEAN IsSet,\r
IN OUT UINTN *BufferSize,\r
IN OUT VOID *Buffer\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Set or Get the some types info of the file into Buffer\r
-\r
-Arguments:\r
-\r
- IsSet - TRUE:The access is set, else is get\r
- FHand - The handle of file\r
- Type - The type of the info\r
- BufferSize - Size of Buffer\r
- Buffer - Buffer containing volume info\r
-\r
-Returns:\r
-\r
- EFI_SUCCESS - Get the info successfully\r
- EFI_DEVICE_ERROR - Can not find the OFile for the file\r
-\r
---*/\r
{\r
FAT_IFILE *IFile;\r
FAT_OFILE *OFile;\r
return EFI_DEVICE_ERROR;\r
}\r
\r
+ FatWaitNonblockingTask (IFile);\r
+\r
FatAcquireLock ();\r
\r
//\r
//\r
Status = EFI_UNSUPPORTED;\r
if (IsSet) {\r
- if (Volume->ReadOnly) {\r
- Status = EFI_WRITE_PROTECTED;\r
- } else {\r
- if (CompareGuid (Type, &gEfiFileInfoGuid)) {\r
- Status = FatSetFileInfo (Volume, IFile, OFile, *BufferSize, Buffer);\r
- }\r
+ if (CompareGuid (Type, &gEfiFileInfoGuid)) {\r
+ Status = Volume->ReadOnly ? EFI_WRITE_PROTECTED : FatSetFileInfo (Volume, IFile, OFile, *BufferSize, Buffer);\r
+ }\r
\r
- if (CompareGuid (Type, &gEfiFileSystemInfoGuid)) {\r
- Status = FatSetVolumeInfo (Volume, *BufferSize, Buffer);\r
- }\r
+ if (CompareGuid (Type, &gEfiFileSystemInfoGuid)) {\r
+ Status = Volume->ReadOnly ? EFI_WRITE_PROTECTED : FatSetVolumeInfo (Volume, *BufferSize, Buffer);\r
+ }\r
\r
- if (CompareGuid (Type, &gEfiFileSystemVolumeLabelInfoIdGuid)) {\r
- Status = FatSetVolumeLabelInfo (Volume, *BufferSize, Buffer);\r
- }\r
+ if (CompareGuid (Type, &gEfiFileSystemVolumeLabelInfoIdGuid)) {\r
+ Status = Volume->ReadOnly ? EFI_WRITE_PROTECTED : FatSetVolumeLabelInfo (Volume, *BufferSize, Buffer);\r
}\r
} else {\r
if (CompareGuid (Type, &gEfiFileInfoGuid)) {\r
}\r
}\r
\r
- Status = FatCleanupVolume (Volume, NULL, Status);\r
+ Status = FatCleanupVolume (Volume, NULL, Status, NULL);\r
\r
FatReleaseLock ();\r
return Status;\r
}\r
\r
+/**\r
+\r
+ Get the some types info of the file into Buffer.\r
+\r
+ @param FHand - The handle of file.\r
+ @param Type - The type of the info.\r
+ @param BufferSize - Size of Buffer.\r
+ @param Buffer - Buffer containing volume info.\r
+\r
+ @retval EFI_SUCCESS - Get the info successfully.\r
+ @retval EFI_DEVICE_ERROR - Can not find the OFile for the file.\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
FatGetInfo (\r
IN OUT UINTN *BufferSize,\r
OUT VOID *Buffer\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Get the some types info of the file into Buffer.\r
-\r
-Arguments:\r
+{\r
+ return FatSetOrGetInfo (FALSE, FHand, Type, BufferSize, Buffer);\r
+}\r
\r
- FHand - The handle of file.\r
- Type - The type of the info.\r
- BufferSize - Size of Buffer.\r
- Buffer - Buffer containing volume info.\r
+/**\r
\r
-Returns:\r
+ Set the some types info of the file into Buffer.\r
\r
- EFI_SUCCESS - Get the info successfully.\r
- EFI_DEVICE_ERROR - Can not find the OFile for the file.\r
+ @param FHand - The handle of file.\r
+ @param Type - The type of the info.\r
+ @param BufferSize - Size of Buffer\r
+ @param Buffer - Buffer containing volume info.\r
\r
---*/\r
-{\r
- return FatSetOrGetInfo (FALSE, FHand, Type, BufferSize, Buffer);\r
-}\r
+ @retval EFI_SUCCESS - Set the info successfully.\r
+ @retval EFI_DEVICE_ERROR - Can not find the OFile for the file.\r
\r
+**/\r
EFI_STATUS\r
EFIAPI\r
FatSetInfo (\r
IN UINTN BufferSize,\r
IN VOID *Buffer\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Set the some types info of the file into Buffer.\r
-\r
-Arguments:\r
-\r
- FHand - The handle of file.\r
- Type - The type of the info.\r
- BufferSize - Size of Buffer\r
- Buffer - Buffer containing volume info.\r
-\r
-Returns:\r
-\r
- EFI_SUCCESS - Set the info successfully.\r
- EFI_DEVICE_ERROR - Can not find the OFile for the file.\r
-\r
---*/\r
{\r
return FatSetOrGetInfo (TRUE, FHand, Type, &BufferSize, Buffer);\r
}\r