diff options
author | qhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-01-12 10:32:47 +0000 |
---|---|---|
committer | qhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-01-12 10:32:47 +0000 |
commit | 49b3b3ab262382460c9c079ddf30ff7219f86609 (patch) | |
tree | 5e4539ab8b42c51f5108a089423961d99fbdda4d /Nt32Pkg/WinNtSimpleFileSystemDxe | |
parent | 6bacae7cdc313fabae1890096d0707867de497d4 (diff) | |
download | edk2-platforms-49b3b3ab262382460c9c079ddf30ff7219f86609.tar.xz |
Don't calculate the directory size and the caller of EFI_FILE protocol can calculate that for better UI.
The enhancement algorithm to calculate directory size (Edk r2583) is incorrect because SetPosition() does not allow other arguments other than 0, causing current file cursor is lost.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9713 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Nt32Pkg/WinNtSimpleFileSystemDxe')
-rw-r--r-- | Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c | 46 |
1 files changed, 1 insertions, 45 deletions
diff --git a/Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c b/Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c index eb8971febe..2840d5f99f 100644 --- a/Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c +++ b/Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c @@ -1,6 +1,6 @@ /**@file
-Copyright (c) 2006 - 2009, Intel Corporation
+Copyright (c) 2006 - 2010, Intel Corporation
All rights reserved. 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
@@ -1972,11 +1972,6 @@ Returns: SYSTEMTIME SystemTime;
CHAR16 *RealFileName;
CHAR16 *TempPointer;
- EFI_FILE_INFO *DirInfo;
- UINTN ReadSize;
- UINT64 Location;
- EFI_STATUS DirStatus;
-
Size = SIZE_OF_EFI_FILE_INFO;
NameSize = StrSize (PrivateFile->FileName);
@@ -2061,45 +2056,6 @@ Returns: } else {
CopyMem ((CHAR8 *) Buffer + Size, RealFileName, NameSize);
}
-
- if (Info->Attribute & EFI_FILE_DIRECTORY) {
- //
- // The GetFileInformationByHandle.nFileSizeLow is bogus for dir so we
- // need to do the same thing the caller would do to get the right value
- //
- ASSERT (PrivateFile->EfiFile.Read != NULL);
- DirStatus = PrivateFile->EfiFile.GetPosition (&PrivateFile->EfiFile, &Location);
- if (EFI_ERROR (DirStatus)) {
- Location = 0;
- }
-
- PrivateFile->EfiFile.SetPosition (&PrivateFile->EfiFile, 0);
- Info->FileSize = 0;
- do {
- ReadSize = 0;
- DirInfo = NULL;
- DirStatus = PrivateFile->EfiFile.Read (&PrivateFile->EfiFile, &ReadSize, DirInfo);
- if (DirStatus == EFI_BUFFER_TOO_SMALL) {
- DirInfo = AllocatePool (ReadSize);
- if (DirInfo != NULL) {
- //
- // Read each dir entry to figure out how big the directory is
- //
- DirStatus = PrivateFile->EfiFile.Read (&PrivateFile->EfiFile, &ReadSize, DirInfo);
- if (!EFI_ERROR (DirStatus) && (ReadSize != 0)) {
- Info->FileSize += ReadSize;
- }
- FreePool (DirInfo);
- }
- }
-
- } while (!EFI_ERROR (DirStatus) && (ReadSize != 0));
-
- //
- // reset the file possition back to the previous location
- //
- PrivateFile->EfiFile.SetPosition (&PrivateFile->EfiFile, Location);
- }
}
*BufferSize = ResultSize;
|