]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Include/Library/FileHandleLib.h
Updating with new functions and adding "C" style entrypoint library with example...
[mirror_edk2.git] / ShellPkg / Include / Library / FileHandleLib.h
index 3d2bbd1535d692417a172a4410df211e9369bd31..8547fd2e91f58b28e927d7bf2c27589b8aa6a6df 100644 (file)
@@ -12,13 +12,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 **/\r
 \r
-#include <Uefi.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/BaseLib.h>\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/MemoryAllocationLib.h>\r
-\r
 /**\r
   This function will retrieve the information about the file for the handle \r
   specified and store it in allocated pool memory.\r
@@ -328,4 +321,75 @@ EFIAPI
 FileHandleGetSize (\r
   IN EFI_FILE_HANDLE            FileHandle,\r
   OUT UINT64                    *Size\r
+  );\r
+\r
+/**\r
+  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
+                                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
+  @retval EFI_INVALID_PARAMETER Handle was NULL.\r
+  @retval EFI_INVALID_PARAMETER FullFileName was NULL.\r
+  @retval EFI_OUT_OF_MEMORY     a memory allocation failed.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FileHandleGetFileName (\r
+  IN CONST EFI_FILE_HANDLE      Handle,\r
+  OUT CHAR16                    **FullFileName\r
+  );\r
+\r
+/**\r
+  Function to read a single line (up to but not including the \n) from a file.\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
+                                line if the buffer is not large enough.\r
+\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
+  @retval EFI_INVALID_PARAMETER Size was NULL.\r
+  @retval EFI_BUFFER_TOO_SMALL  Size was not enough space to store the line.  \r
+                                Size was updated to minimum space required.\r
+  @sa FileHandleRead\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FileHandleReadLine(\r
+  IN EFI_FILE_HANDLE            Handle,\r
+  IN OUT VOID                   *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
+\r
+  if Handle is NULL, ASSERT.\r
+  if Buffer is NULL, do nothing.  (return SUCCESS)\r
+\r
+  @param[in]     Handle         FileHandle to write to\r
+  @param[in]     Buffer         Buffer to write\r
+\r
+  @retval  EFI_SUCCESS          the data was written.\r
+  @retval  other                failure.\r
+\r
+  @sa FileHandleWrite\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FileHandleWriteLine(\r
+  IN EFI_FILE_HANDLE Handle,\r
+  IN CHAR16          *Buffer\r
   );
\ No newline at end of file