[edk2] [PATCH 05/11] Common Lib MemoryFile: Add GetMemoryFileSize function

Subject: [edk2] [PATCH 05/11] Common Lib MemoryFile: Add GetMemoryFileSize function

From: Jordan Justen <jordan.l.justen@intel.com>

To: edk2-buildtools-devel@lists.sourceforge.net, edk2-devel@lists.sourceforge.net

Date: 2014-05-05 18:31:19

  • 2014-05-05 18:31:19  Jordan Justen   [edk2] [PATCH 05/11] Common Lib MemoryFile: Add GetMemoryFileSize function
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen 
---
 Source/C/Common/MemoryFile.c | 22 ++++++++++++++++++++++
 Source/C/Common/MemoryFile.h | 12 ++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/Source/C/Common/MemoryFile.c b/Source/C/Common/MemoryFile.c
index 1fb845d..82ca45d 100644
--- a/Source/C/Common/MemoryFile.c
+++ b/Source/C/Common/MemoryFile.c
@@ -240,6 +240,28 @@ Returns:
 }
 
 
+/**
+  Returns the size of the data stored in the memory file
+
+  @param MemoryFile  The memory file
+
+  @return  Size of the memory file's contents
+**/
+UINTN
+GetMemoryFileSize (
+  IN EFI_HANDLE InputMemoryFile
+  )
+{
+  MEMORY_FILE *MemoryFile;
+
+  CheckMemoryFileState (InputMemoryFile);
+
+  MemoryFile = (MEMORY_FILE*)InputMemoryFile;
+
+  return (UINTN) (MemoryFile->Eof - MemoryFile->FileImage);
+}
+
+
 STATIC
 VOID
 CheckMemoryFileState (
diff --git a/Source/C/Common/MemoryFile.h b/Source/C/Common/MemoryFile.h
index baab40b..3bfa509 100644
--- a/Source/C/Common/MemoryFile.h
+++ b/Source/C/Common/MemoryFile.h
@@ -119,4 +119,16 @@ Returns:
 **/
 
 
+/**
+  Returns the size of the data stored in the memory file
+
+  @param MemoryFile  The memory file
+
+  @return  Size of the memory file's contents
+**/
+UINTN
+GetMemoryFileSize (
+  IN EFI_HANDLE InputMemoryFile
+  );
+
 #endif
-- 
1.9.2


------------------------------------------------------------------------------
Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
• 3 signs your SCM is hindering your productivity
• Requirements for releasing software faster
• Expert tips and advice for migrating your SCM now
http://p.sf.net/sfu/perforce
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel