\r
#include "BootMonFsInternal.h"\r
\r
+/**\r
+ Read data from an open file.\r
+\r
+ @param[in] This A pointer to the EFI_FILE_PROTOCOL instance that\r
+ is the file handle to read data from.\r
+ @param[in out] BufferSize On input, the size of the Buffer. On output, the\r
+ amount of data returned in Buffer. In both cases,\r
+ the size is measured in bytes.\r
+ @param[out] Buffer The buffer into which the data is read.\r
+\r
+ @retval EFI_SUCCESS The data was read.\r
+ @retval EFI_DEVICE_ERROR On entry, the current file position is\r
+ beyond the end of the file, or the device\r
+ reported an error while performing the read\r
+ operation.\r
+ @retval EFI_INVALID_PARAMETER At least one of the parameters is invalid.\r
+**/\r
EFIAPI\r
EFI_STATUS\r
BootMonFsReadFile (\r
FileStart = (Media->LowestAlignedLba + File->HwDescription.BlockStart) * Media->BlockSize;\r
\r
if (File->Position >= File->HwDescription.Region[0].Size) {\r
- // The entire file has been read\r
+ // The entire file has been read or the position has been\r
+ // set past the end of the file.\r
*BufferSize = 0;\r
- return EFI_DEVICE_ERROR;\r
+ if (File->Position > File->HwDescription.Region[0].Size) {\r
+ return EFI_DEVICE_ERROR;\r
+ } else {\r
+ return EFI_SUCCESS;\r
+ }\r
}\r
\r
// This driver assumes that the entire file is in region 0.\r