]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.h
ArmPkg/SemihostFs: Implement SetInfo() and handle seeking past the end of a file
[mirror_edk2.git] / ArmPkg / Filesystem / SemihostFs / Arm / SemihostFs.h
index c02b36ae5f617a3dccb14622df672f6ca5439873..93395743baaa06b7897a4b7ff9da0d5c05a1a59f 100644 (file)
@@ -57,56 +57,190 @@ FileOpen (
   IN  UINT64    Attributes\r
   );\r
 \r
+/**\r
+  Close a specified file handle.\r
+\r
+  @param[in]  This  A pointer to the EFI_FILE_PROTOCOL instance that is the file\r
+                    handle to close.\r
+\r
+  @retval  EFI_SUCCESS            The file was closed.\r
+  @retval  EFI_INVALID_PARAMETER  The parameter "This" is NULL.\r
+\r
+**/\r
 EFI_STATUS\r
 FileClose (\r
-  IN EFI_FILE *File\r
+  IN EFI_FILE  *This\r
   );\r
 \r
+/**\r
+  Close and delete a file.\r
+\r
+  @param[in]  This  A pointer to the EFI_FILE_PROTOCOL instance that is the file\r
+                    handle to delete.\r
+\r
+  @retval  EFI_SUCCESS              The file was closed and deleted.\r
+  @retval  EFI_WARN_DELETE_FAILURE  The handle was closed, but the file was not deleted.\r
+  @retval  EFI_INVALID_PARAMETER    The parameter "This" is NULL.\r
+\r
+**/\r
 EFI_STATUS\r
-FileDelete(\r
-  IN EFI_FILE *File\r
+FileDelete (\r
+  IN EFI_FILE *This\r
   );\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 semi-hosting\r
+                                  interface reported an error while performing the\r
+                                  read operation.\r
+  @retval  EFI_INVALID_PARAMETER  The parameter "This" or the parameter "Buffer"\r
+                                  is NULL.\r
+**/\r
 EFI_STATUS\r
 FileRead (\r
-  IN     EFI_FILE *File,\r
-  IN OUT UINTN    *BufferSize,\r
-  OUT    VOID     *Buffer\r
+  IN     EFI_FILE  *This,\r
+  IN OUT UINTN     *BufferSize,\r
+  OUT    VOID      *Buffer\r
   );\r
 \r
+/**\r
+  Write data to an open file.\r
+\r
+  @param[in]      This        A pointer to the EFI_FILE_PROTOCOL instance that\r
+                              is the file handle to write data to.\r
+  @param[in out]  BufferSize  On input, the size of the Buffer. On output, the\r
+                              size of the data actually written. In both cases,\r
+                              the size is measured in bytes.\r
+  @param[in]      Buffer      The buffer of data to write.\r
+\r
+  @retval  EFI_SUCCESS            The data was written.\r
+  @retval  EFI_ACCESS_DENIED      Attempt to write into a read only file or\r
+                                  in a file opened in read only mode.\r
+  @retval  EFI_DEVICE_ERROR       The last issued semi-hosting operation failed.\r
+  @retval  EFI_INVALID_PARAMETER  The parameter "This" or the parameter "Buffer"\r
+                                  is NULL.\r
+\r
+**/\r
 EFI_STATUS\r
 FileWrite (\r
-  IN     EFI_FILE *File,\r
+  IN     EFI_FILE *This,\r
   IN OUT UINTN    *BufferSize,\r
   IN     VOID     *Buffer\r
   );\r
 \r
+/**\r
+  Return a file's current position.\r
+\r
+  @param[in]   This      A pointer to the EFI_FILE_PROTOCOL instance that is\r
+                         the file handle to get the current position on.\r
+  @param[out]  Position  The address to return the file's current position value.\r
+\r
+  @retval  EFI_SUCCESS            The position was returned.\r
+  @retval  EFI_INVALID_PARAMETER  Position is a NULL pointer.\r
+\r
+**/\r
 EFI_STATUS\r
 FileGetPosition (\r
-  IN  EFI_FILE  *File,\r
-  OUT UINT64    *Position\r
+  IN  EFI_FILE    *File,\r
+  OUT UINT64      *Position\r
   );\r
 \r
+/**\r
+  Set a file's current position.\r
+\r
+  @param[in]  This      A pointer to the EFI_FILE_PROTOCOL instance that is\r
+                        the file handle to set the requested position on.\r
+  @param[in]  Position  The byte position from the start of the file to set.\r
+\r
+  @retval  EFI_SUCCESS       The position was set.\r
+  @retval  EFI_DEVICE_ERROR  The semi-hosting positionning operation failed.\r
+  @retval  EFI_UNSUPPORTED   The seek request for nonzero is not valid on open\r
+                             directories.\r
+\r
+**/\r
 EFI_STATUS\r
 FileSetPosition (\r
   IN EFI_FILE *File,\r
   IN UINT64   Position\r
   );\r
 \r
+/**\r
+  Return information about a file or a file system.\r
+\r
+  @param[in]      This             A pointer to the EFI_FILE_PROTOCOL instance that\r
+                                   is the file handle the requested information is for.\r
+  @param[in]      InformationType  The type identifier for the information being requested :\r
+                                   EFI_FILE_INFO_ID or EFI_FILE_SYSTEM_INFO_ID or\r
+                                   EFI_FILE_SYSTEM_VOLUME_LABEL_ID\r
+  @param[in out]  BufferSize       The size, in bytes, of Buffer.\r
+  @param[out]     Buffer           A pointer to the data buffer to return. The type of the\r
+                                   data inside the buffer is indicated by InformationType.\r
+\r
+  @retval  EFI_SUCCESS           The information was returned.\r
+  @retval  EFI_UNSUPPORTED       The InformationType is not known.\r
+  @retval  EFI_BUFFER_TOO_SMALL  The BufferSize is too small to return the information.\r
+                                 BufferSize has been updated with the size needed to\r
+                                 complete the request.\r
+  @retval  EFI_INVALID_PARAMETER  The parameter "This" or the parameter "Buffer"\r
+                                  is NULL.\r
+\r
+**/\r
 EFI_STATUS\r
 FileGetInfo (\r
-  IN     EFI_FILE *File,\r
-  IN     EFI_GUID *InformationType,\r
-  IN OUT UINTN    *BufferSize,\r
-  OUT    VOID     *Buffer\r
+  IN     EFI_FILE  *This,\r
+  IN     EFI_GUID  *InformationType,\r
+  IN OUT UINTN     *BufferSize,\r
+  OUT    VOID      *Buffer\r
   );\r
 \r
+/**\r
+  Set information about a file or a file system.\r
+\r
+  @param[in]  This             A pointer to the EFI_FILE_PROTOCOL instance that\r
+                               is the file handle the information is for.\r
+  @param[in]  InformationType  The type identifier for the information being set :\r
+                               EFI_FILE_INFO_ID or EFI_FILE_SYSTEM_INFO_ID or\r
+                               EFI_FILE_SYSTEM_VOLUME_LABEL_ID\r
+  @param[in]  BufferSize       The size, in bytes, of Buffer.\r
+  @param[in]  Buffer           A pointer to the data buffer to write. The type of the\r
+                               data inside the buffer is indicated by InformationType.\r
+\r
+  @retval  EFI_SUCCESS            The information was set.\r
+  @retval  EFI_UNSUPPORTED        The InformationType is not known.\r
+  @retval  EFI_DEVICE_ERROR       The last issued semi-hosting operation failed.\r
+  @retval  EFI_ACCESS_DENIED      An attempt is being made to change the\r
+                                  EFI_FILE_DIRECTORY Attribute.\r
+  @retval  EFI_ACCESS_DENIED      InformationType is EFI_FILE_INFO_ID and\r
+                                  the file is a read-only file or has been\r
+                                  opened in read-only mode and an attempt is\r
+                                  being made to modify a field other than\r
+                                  Attribute.\r
+  @retval  EFI_ACCESS_DENIED      An attempt is made to change the name of a file\r
+                                  to a file that is already present.\r
+  @retval  EFI_WRITE_PROTECTED    An attempt is being made to modify a\r
+                                  read-only attribute.\r
+  @retval  EFI_BAD_BUFFER_SIZE    The size of the buffer is lower than that indicated by\r
+                                  the data inside the buffer.\r
+  @retval  EFI_OUT_OF_RESOURCES   An allocation needed to process the request failed.\r
+  @retval  EFI_INVALID_PARAMETER  At least one of the parameters is invalid.\r
+\r
+**/\r
 EFI_STATUS\r
 FileSetInfo (\r
-  IN EFI_FILE *File,\r
-  IN EFI_GUID *InformationType,\r
-  IN UINTN    BufferSize,\r
-  IN VOID     *Buffer\r
+  IN EFI_FILE  *This,\r
+  IN EFI_GUID  *InformationType,\r
+  IN UINTN     BufferSize,\r
+  IN VOID      *Buffer\r
   );\r
 \r
 EFI_STATUS\r