]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Include/Library/FileHandleLib.h
updating headers from code review.
[mirror_edk2.git] / ShellPkg / Include / Library / FileHandleLib.h
index c03a112ceca265bd8c75bcdcf201629b1fe1d5cf..ee5b52642208cf29d340ab50209c7bf5f773357b 100644 (file)
@@ -17,14 +17,14 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
   specified and store it in allocated pool memory.\r
 \r
   This function allocates a buffer to store the file's information. It is the \r
-  caller's responsibility to free the buffer\r
+  caller's responsibility to free the buffer.\r
 \r
   @param  FileHandle  The file handle of the file for which information is \r
-  being requested.\r
+                      being requested.\r
 \r
-  @retval NULL information could not be retrieved.\r
+  @retval NULL        information could not be retrieved.\r
 \r
-  @return the information about the file\r
+  @retval !NULL       the information about the file\r
 **/\r
 EFI_FILE_INFO*\r
 EFIAPI\r
@@ -37,18 +37,18 @@ FileHandleGetInfo (
   specified.\r
 \r
   @param  FileHandle            The file handle of the file for which information \r
-  is being set\r
+                                is being set.\r
 \r
-  @param  FileInfo              The infotmation to set.\r
+  @param  FileInfo              The information to set.\r
 \r
-  @retval EFI_SUCCESS          The information was set.\r
-  @retval EFI_UNSUPPORTED The InformationType is not known.\r
-  @retval EFI_NO_MEDIA         The device has no medium.\r
-  @retval EFI_DEVICE_ERROR     The device reported an error.\r
+  @retval EFI_SUCCESS                  The information was set.\r
+  @retval EFI_UNSUPPORTED       The FileHandle does not support FileInfo.\r
+  @retval EFI_NO_MEDIA               The device has no medium.\r
+  @retval EFI_DEVICE_ERROR         The device reported an error.\r
   @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r
-  @retval EFI_WRITE_PROTECTED  The file or medium is write protected.\r
-  @retval EFI_ACCESS_DENIED    The file was opened read only.\r
-  @retval EFI_VOLUME_FULL      The volume is full.\r
+  @retval EFI_WRITE_PROTECTED    The file or medium is write protected.\r
+  @retval EFI_ACCESS_DENIED        The file was opened read only.\r
+  @retval EFI_VOLUME_FULL            The volume is full.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -73,16 +73,16 @@ FileHandleSetInfo (
   are no more directory entries, the read returns a zero-length buffer. \r
   EFI_FILE_INFO is the structure returned as the directory entry.\r
 \r
-  @param FileHandle             the opened file handle\r
-  @param BufferSize             on input the size of buffer in bytes.  on return \r
+  @param FileHandle             The opened file handle.\r
+  @param BufferSize             On input the size of buffer in bytes.  on return \r
                                 the number of bytes written.\r
-  @param Buffer                 the buffer to put read data into.\r
+  @param Buffer                 The buffer to put read data into.\r
 \r
   @retval EFI_SUCCESS            Data was read.\r
   @retval EFI_NO_MEDIA         The device has no media.\r
-  @retval EFI_DEVICE_ERROR     The device reported an error.\r
+  @retval EFI_DEVICE_ERROR         The device reported an error.\r
   @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r
-  @retval EFI_BUFFER_TO_SMALL  Buffer is too small. ReadSize contains required \r
+  @retval EFI_BUFFER_TO_SMALL    Buffer is too small. ReadSize contains required \r
                                 size.\r
 \r
 **/\r
@@ -105,18 +105,18 @@ FileHandleRead(
   opened directories are not supported.\r
 \r
   @param FileHandle           The opened file for writing\r
-  @param BufferSize           on input the number of bytes in Buffer.  On output\r
+  @param BufferSize           On input the number of bytes in Buffer.  On output\r
                               the number of bytes written.\r
-  @param Buffer               the buffer containing data to write is stored.\r
-\r
@retval EFI_SUCCESS           Data was written.\r
@retval EFI_UNSUPPORTED           Writes to an open directory are not supported.\r
@retval EFI_NO_MEDIA          The device has no media.\r
@retval EFI_DEVICE_ERROR          The device reported an error.\r
@retval EFI_VOLUME_CORRUPTED  The file system structures are corrupted.\r
@retval EFI_WRITE_PROTECTED   The device is write-protected.\r
@retval EFI_ACCESS_DENIED       The file was open for read only.\r
@retval EFI_VOLUME_FULL           The volume is full.\r
+  @param Buffer               The buffer containing data to write is stored.\r
+\r
 @retval EFI_SUCCESS          Data was written.\r
 @retval EFI_UNSUPPORTED          Writes to an open directory are not supported.\r
 @retval EFI_NO_MEDIA         The device has no media.\r
 @retval EFI_DEVICE_ERROR         The device reported an error.\r
 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r
 @retval EFI_WRITE_PROTECTED  The device is write-protected.\r
 @retval EFI_ACCESS_DENIED      The file was open for read only.\r
 @retval EFI_VOLUME_FULL          The volume is full.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -133,9 +133,9 @@ FileHandleWrite(
   flushed to the device, and the file is closed. In all cases the handle is \r
   closed.\r
 \r
-@param FileHandle               the file handle to close.\r
+  @param FileHandle               The file handle to close.\r
 \r
-@retval EFI_SUCCESS             the file handle was closed sucessfully.\r
+  @retval EFI_SUCCESS             The file handle was closed sucessfully.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -144,18 +144,18 @@ FileHandleClose (
   );\r
 \r
 /**\r
-  Delete a file and close the handle\r
+  Delete a file and close the handle.\r
 \r
   This function closes and deletes a file. In all cases the file handle is closed.\r
   If the file cannot be deleted, the warning code EFI_WARN_DELETE_FAILURE is \r
   returned, but the handle is still closed.\r
 \r
-  @param FileHandle             the file handle to delete\r
+  @param FileHandle             The file handle to delete.\r
 \r
-  @retval EFI_SUCCESS           the file was closed sucessfully\r
-  @retval EFI_WARN_DELETE_FAILURE the handle was closed, but the file was not \r
-                                deleted\r
-  @retval INVALID_PARAMETER            One of the parameters has an invalid value.\r
+  @retval EFI_SUCCESS               The file was closed sucessfully.\r
+  @retval EFI_WARN_DELETE_FAILURE   the handle was closed, but the file was not \r
+                                    deleted\r
+  @retval INVALID_PARAMETER                One of the parameters has an invalid value.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -190,7 +190,7 @@ FileHandleSetPosition (
   );\r
 \r
 /** \r
-  Gets a file's current position\r
+  Gets a file's current position.\r
 \r
   This function retrieves the current file position for the file handle. For \r
   directories, the current file position has no meaning outside of the file \r
@@ -211,11 +211,11 @@ FileHandleGetPosition (
   OUT UINT64                    *Position\r
   );\r
 /**\r
-  Flushes data on a file\r
+  Flushes data on a file.\r
   \r
   This function flushes all modified data associated with a file to a device.\r
 \r
-  @param FileHandle             The file handle on which to flush data\r
+  @param FileHandle             The file handle on which to flush data.\r
 \r
   @retval EFI_SUCCESS           The data was flushed.\r
   @retval EFI_NO_MEDIA          The device has no media.\r
@@ -231,14 +231,14 @@ FileHandleFlush (
   );\r
 \r
 /**\r
-  function to determine if a given handle is a directory handle\r
+  Function to determine if a given handle is a directory handle.\r
 \r
-  if DirHandle is NULL then ASSERT()\r
+  If DirHandle is NULL then ASSERT().\r
 \r
-  open the file information on the DirHandle and verify that the Attribute\r
+  Open the file information on the DirHandle and verify that the Attribute\r
   includes EFI_FILE_DIRECTORY bit set.\r
 \r
-  @param DirHandle              Handle to open file\r
+  @param DirHandle              Handle to open file.\r
 \r
   @retval EFI_SUCCESS           DirHandle is a directory\r
   @retval EFI_INVALID_PARAMETER DirHandle did not have EFI_FILE_INFO available\r
@@ -251,7 +251,7 @@ FileHandleIsDirectory (
   );\r
 \r
 /**\r
-  Retrieves the first file from a directory\r
+  Retrieves the first file from a directory.\r
 \r
   This function opens a directory and gets the first file's info in the \r
   directory. Caller can use FileHandleFindNextFile() to get other files.  When \r
@@ -304,14 +304,14 @@ FileHandleFindNextFile(
 /**\r
   Retrieve the size of a file.\r
 \r
-  if FileHandle is NULL then ASSERT()\r
-  if Size is NULL then ASSERT()\r
+  If FileHandle is NULL then ASSERT()\r
+  If Size is NULL then ASSERT()\r
 \r
   This function extracts the file size info from the FileHandle's EFI_FILE_INFO \r
   data.\r
 \r
-  @param FileHandle             file handle from which size is retrieved\r
-  @param Size                   pointer to size\r
+  @param FileHandle             The file handle from which size is retrieved.\r
+  @param Size                   pointer to size.\r
 \r
   @retval EFI_SUCCESS           operation was completed sucessfully\r
   @retval EFI_DEVICE_ERROR      cannot access the file\r
@@ -327,10 +327,8 @@ FileHandleGetSize (
   Function to get a full filename given a EFI_FILE_HANDLE somewhere lower on the \r
   directory 'stack'.\r
 \r
-  if Handle is NULL, return EFI_INVALID_PARAMETER\r
-\r
   @param[in] Handle             Handle to the Directory or File to create path to.\r
-  @param[out] FullFileName      pointer to pointer to generated full file name.  It \r
+  @param[out] FullFileName      Pointer to pointer to generated full file name.  It \r
                                 is the responsibility of the caller to free this memory\r
                                 with a call to FreePool().\r
   @retval EFI_SUCCESS           the operation was sucessful and the FullFileName is valid.\r
@@ -346,16 +344,16 @@ FileHandleGetFileName (
   );\r
 \r
 /**\r
-  Function to read a single line (up to but not including the \n) from a file.\r
+  Function to read a single line from a file. The \n is not included in the returned buffer.\r
 \r
-  @param[in]      Handle        FileHandle to read from\r
-  @param[in][out] Buffer        pointer to buffer to read into\r
-  @param[in][out] Size          pointer to number of bytes in buffer\r
-  @param[in[      Truncate      if TRUE then allows for truncation of the line to fit.\r
-                                if FALSE will reset the position to the begining of the \r
+  @param[in]      Handle        FileHandle to read from.\r
+  @param[in,out]  Buffer        Pointer to buffer to read into\r
+  @param[in,out]  Size          Pointer to number of bytes in buffer\r
+  @param[in]      Truncate      If TRUE then allows for truncation of the line to fit.\r
+                                If FALSE will reset the position to the begining of the \r
                                 line if the buffer is not large enough.\r
 \r
-  @retval EFI_SUCCESS           the operation was sucessful.  the line is stored in \r
+  @retval EFI_SUCCESS           The operation was sucessful.  the line is stored in \r
                                 Buffer.  (Size was NOT updated)\r
   @retval EFI_INVALID_PARAMETER Handle was NULL.\r
   @retval EFI_INVALID_PARAMETER Buffer was NULL.\r
@@ -368,19 +366,19 @@ EFI_STATUS
 EFIAPI\r
 FileHandleReadLine(\r
   IN EFI_FILE_HANDLE            Handle,\r
-  IN OUT VOID                   *Buffer,\r
+  IN OUT CHAR16                 *Buffer,\r
   IN OUT UINTN                  *Size,\r
   IN BOOLEAN                    Truncate\r
   );\r
 \r
 /**\r
-  function to write a line of unicode text to a file.\r
+  Function to write a line of unicode text to a file.\r
 \r
-  if Handle is NULL, ASSERT.\r
-  if Buffer is NULL, do nothing.  (return SUCCESS)\r
+  If Handle is NULL, ASSERT.\r
 \r
   @param[in]     Handle         FileHandle to write to\r
-  @param[in]     Buffer         Buffer to write\r
+  @param[in]     Buffer         Buffer to write, if NULL the function will \r
+                                take no action and return EFI_SUCCESS.\r
 \r
   @retval  EFI_SUCCESS          the data was written.\r
   @retval  other                failure.\r
@@ -392,4 +390,40 @@ EFIAPI
 FileHandleWriteLine(\r
   IN EFI_FILE_HANDLE Handle,\r
   IN CHAR16          *Buffer\r
-  );
\ No newline at end of file
+  );\r
+\r
+/**\r
+  function to take a formatted argument and print it to a file.\r
+\r
+  @param[in] Handle   the file handle for the file to write to\r
+  @param[in] Format   the format argument (see printlib for format specifier)\r
+  @param[in] ...      the variable arguments for the format\r
+\r
+  @retval EFI_SUCCESS the operation was sucessful\r
+  @return other       a return value from FileHandleWriteLine\r
+\r
+  @sa FileHandleWriteLine\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FileHandlePrintLine(\r
+  IN EFI_FILE_HANDLE  Handle,\r
+  IN CONST CHAR16     *Format,\r
+  ...\r
+  );\r
+\r
+/**\r
+  Function to determine if a FILE_HANDLE is at the end of the file.\r
+\r
+  This will NOT work on directories.\r
+\r
+  @param[in] Handle     the file handle\r
+\r
+  @retval TRUE          the position is at the end of the file\r
+  @retval FALSE         the position is not at the end of the file\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+FileHandleEof(\r
+  IN EFI_FILE_HANDLE Handle\r
+  );\r