ArmPkg/SemihostFs: Fix open file issues revealed by SCT
Fix return codes in case of errors. Fix translation from EFI open mode to semi-hosting open mode to avoid the truncate to zero length of an already existing file opened in read/write or read/write/create mode. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ronald Cron <ronald.cron@arm.com> Reviewed-By: Olivier Martin <olivier.martin@arm.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16241 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
committed by
oliviermartin
parent
0f0a6fe907
commit
fdd12bd569
@@ -22,9 +22,35 @@ VolumeOpen (
|
||||
OUT EFI_FILE **Root
|
||||
);
|
||||
|
||||
/**
|
||||
Open a file on the host system by means of the semihosting interface.
|
||||
|
||||
@param[in] This A pointer to the EFI_FILE_PROTOCOL instance that is
|
||||
the file handle to source location.
|
||||
@param[out] NewHandle A pointer to the location to return the opened
|
||||
handle for the new file.
|
||||
@param[in] FileName The Null-terminated string of the name of the file
|
||||
to be opened.
|
||||
@param[in] OpenMode The mode to open the file : Read or Read/Write or
|
||||
Read/Write/Create
|
||||
@param[in] Attributes Only valid for EFI_FILE_MODE_CREATE, in which case these
|
||||
are the attribute bits for the newly created file. The
|
||||
mnemonics of the attribute bits are : EFI_FILE_READ_ONLY,
|
||||
EFI_FILE_HIDDEN, EFI_FILE_SYSTEM, EFI_FILE_RESERVED,
|
||||
EFI_FILE_DIRECTORY and EFI_FILE_ARCHIVE.
|
||||
|
||||
@retval EFI_SUCCESS The file was open.
|
||||
@retval EFI_NOT_FOUND The specified file could not be found.
|
||||
@retval EFI_DEVICE_ERROR The last issued semi-hosting operation failed.
|
||||
@retval EFI_WRITE_PROTECTED Attempt to create a directory. This is not possible
|
||||
with the semi-hosting interface.
|
||||
@retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the file.
|
||||
@retval EFI_INVALID_PARAMETER At least one of the parameters is invalid.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
FileOpen (
|
||||
IN EFI_FILE *File,
|
||||
IN EFI_FILE *This,
|
||||
OUT EFI_FILE **NewHandle,
|
||||
IN CHAR16 *FileName,
|
||||
IN UINT64 OpenMode,
|
||||
|
Reference in New Issue
Block a user