diff options
author | Ruiyu Ni <ruiyu.ni@intel.com> | 2015-01-28 08:58:38 +0000 |
---|---|---|
committer | Jordan Justen <jordan.l.justen@intel.com> | 2016-04-06 23:22:43 -0700 |
commit | 55248f85d180b0bbb0409638cc28e28a053123bd (patch) | |
tree | fd5d7ad1ba58ab7b87269a0d96c9b872e5334e48 /FatPkg | |
parent | 2433260edf4f46281030cc0b72d2c3c887f14184 (diff) | |
download | edk2-55248f85d180b0bbb0409638cc28e28a053123bd.tar.gz edk2-55248f85d180b0bbb0409638cc28e28a053123bd.tar.bz2 edk2-55248f85d180b0bbb0409638cc28e28a053123bd.zip |
EFI_FILE_PROTOCOL spec conformance bug fix.
1. Write() should return Unsupported instead of WriteProtected when operating above a directory in read-only media.
2. SetInfo() should return Unsupported instead of WriteProtected when operating above a directory using a undefined GUID in read-only media.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Eric Jin <eric.jin@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
(based on FatPkg commit 8ff136aaa3fff82d81514fd3091961ec4a63c873)
[jordan.l.justen@intel.com: Use script to relicense to 2-clause BSD]
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Acked-by: Mark Doran <mark.doran@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Diffstat (limited to 'FatPkg')
-rw-r--r-- | FatPkg/EnhancedFatDxe/Info.c | 22 | ||||
-rw-r--r-- | FatPkg/EnhancedFatDxe/ReadWrite.c | 21 |
2 files changed, 20 insertions, 23 deletions
diff --git a/FatPkg/EnhancedFatDxe/Info.c b/FatPkg/EnhancedFatDxe/Info.c index ae85cce859..858b3f4a3e 100644 --- a/FatPkg/EnhancedFatDxe/Info.c +++ b/FatPkg/EnhancedFatDxe/Info.c @@ -1,6 +1,6 @@ /*++
-Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available
under the terms and conditions of the BSD License which accompanies this
distribution. The full text of the license may be found at
@@ -528,20 +528,16 @@ Returns: //
Status = EFI_UNSUPPORTED;
if (IsSet) {
- if (Volume->ReadOnly) {
- Status = EFI_WRITE_PROTECTED;
- } else {
- if (CompareGuid (Type, &gEfiFileInfoGuid)) {
- Status = FatSetFileInfo (Volume, IFile, OFile, *BufferSize, Buffer);
- }
+ if (CompareGuid (Type, &gEfiFileInfoGuid)) {
+ Status = Volume->ReadOnly ? EFI_WRITE_PROTECTED : FatSetFileInfo (Volume, IFile, OFile, *BufferSize, Buffer);
+ }
- if (CompareGuid (Type, &gEfiFileSystemInfoGuid)) {
- Status = FatSetVolumeInfo (Volume, *BufferSize, Buffer);
- }
+ if (CompareGuid (Type, &gEfiFileSystemInfoGuid)) {
+ Status = Volume->ReadOnly ? EFI_WRITE_PROTECTED : FatSetVolumeInfo (Volume, *BufferSize, Buffer);
+ }
- if (CompareGuid (Type, &gEfiFileSystemVolumeLabelInfoIdGuid)) {
- Status = FatSetVolumeLabelInfo (Volume, *BufferSize, Buffer);
- }
+ if (CompareGuid (Type, &gEfiFileSystemVolumeLabelInfoIdGuid)) {
+ Status = Volume->ReadOnly ? EFI_WRITE_PROTECTED : FatSetVolumeLabelInfo (Volume, *BufferSize, Buffer);
}
} else {
if (CompareGuid (Type, &gEfiFileInfoGuid)) {
diff --git a/FatPkg/EnhancedFatDxe/ReadWrite.c b/FatPkg/EnhancedFatDxe/ReadWrite.c index 4621817c93..9afb6bff89 100644 --- a/FatPkg/EnhancedFatDxe/ReadWrite.c +++ b/FatPkg/EnhancedFatDxe/ReadWrite.c @@ -1,6 +1,6 @@ /*++
-Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available
under the terms and conditions of the BSD License which accompanies this
distribution. The full text of the license may be found at
@@ -250,6 +250,13 @@ Returns: Volume = OFile->Volume;
Task = NULL;
+ //
+ // Write to a directory is unsupported
+ //
+ if ((OFile->ODir != NULL) && (IoMode == WRITE_DATA)) {
+ return EFI_UNSUPPORTED;
+ }
+
if (OFile->Error == EFI_NOT_FOUND) {
return EFI_DEVICE_ERROR;
}
@@ -296,16 +303,10 @@ Returns: if (!EFI_ERROR (Status)) {
if (OFile->ODir != NULL) {
//
- // Access a directory
+ // Read a directory is supported
//
- Status = EFI_UNSUPPORTED;
- if (IoMode == READ_DATA) {
- //
- // Read a directory is supported
- //
- Status = FatIFileReadDir (IFile, BufferSize, Buffer);
- }
-
+ ASSERT (IoMode == READ_DATA);
+ Status = FatIFileReadDir (IFile, BufferSize, Buffer);
OFile = NULL;
} else {
//
|