]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Include/Library/FileHandleLib.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdePkg / Include / Library / FileHandleLib.h
index b5ac19ac85de4506a010d659b42889074aee524a..1a238edee38c8c5d412aa054c1032fc7a7bc2403 100644 (file)
@@ -1,14 +1,8 @@
 /** @file\r
   Provides interface to EFI_FILE_HANDLE functionality.\r
 \r
-  Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
-  This program and the accompanying materials\r
-  are licensed and made available under the terms and conditions of the BSD License\r
-  which accompanies this distribution.  The full text of the license may be found at\r
-  http://opensource.org/licenses/bsd-license.php\r
-\r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+  Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
 #define _FILE_HANDLE_LIBRARY_HEADER_\r
 \r
 #include <Protocol/SimpleFileSystem.h>\r
+#include <Guid/FileInfo.h>\r
 \r
 /// The tag for use in identifying UNICODE files.\r
 /// If the file is UNICODE, the first 16 bits of the file will equal this value.\r
-extern CONST UINT16 gUnicodeFileTag;\r
+extern CONST UINT16  gUnicodeFileTag;\r
 \r
 /**\r
   This function retrieves information about the file for the handle\r
@@ -34,10 +29,10 @@ extern CONST UINT16 gUnicodeFileTag;
   @retval NULL                  Information could not be retrieved.\r
   @retval !NULL                 The information about the file.\r
 **/\r
-EFI_FILE_INFO*\r
+EFI_FILE_INFO *\r
 EFIAPI\r
 FileHandleGetInfo (\r
-  IN EFI_FILE_HANDLE            FileHandle\r
+  IN EFI_FILE_HANDLE  FileHandle\r
   );\r
 \r
 /**\r
@@ -62,8 +57,8 @@ FileHandleGetInfo (
 EFI_STATUS\r
 EFIAPI\r
 FileHandleSetInfo (\r
-  IN EFI_FILE_HANDLE            FileHandle,\r
-  IN CONST EFI_FILE_INFO        *FileInfo\r
+  IN EFI_FILE_HANDLE      FileHandle,\r
+  IN CONST EFI_FILE_INFO  *FileInfo\r
   );\r
 \r
 /**\r
@@ -97,10 +92,10 @@ FileHandleSetInfo (
 **/\r
 EFI_STATUS\r
 EFIAPI\r
-FileHandleRead(\r
-  IN EFI_FILE_HANDLE            FileHandle,\r
-  IN OUT UINTN                  *BufferSize,\r
-  OUT VOID                      *Buffer\r
+FileHandleRead (\r
+  IN EFI_FILE_HANDLE  FileHandle,\r
+  IN OUT UINTN        *BufferSize,\r
+  OUT VOID            *Buffer\r
   );\r
 \r
 /**\r
@@ -129,10 +124,10 @@ FileHandleRead(
 **/\r
 EFI_STATUS\r
 EFIAPI\r
-FileHandleWrite(\r
-  IN EFI_FILE_HANDLE            FileHandle,\r
-  IN OUT UINTN                  *BufferSize,\r
-  IN VOID                       *Buffer\r
+FileHandleWrite (\r
+  IN EFI_FILE_HANDLE  FileHandle,\r
+  IN OUT UINTN        *BufferSize,\r
+  IN VOID             *Buffer\r
   );\r
 \r
 /**\r
@@ -149,7 +144,7 @@ FileHandleWrite(
 EFI_STATUS\r
 EFIAPI\r
 FileHandleClose (\r
-  IN EFI_FILE_HANDLE            FileHandle\r
+  IN EFI_FILE_HANDLE  FileHandle\r
   );\r
 \r
 /**\r
@@ -169,7 +164,7 @@ FileHandleClose (
 EFI_STATUS\r
 EFIAPI\r
 FileHandleDelete (\r
-  IN EFI_FILE_HANDLE    FileHandle\r
+  IN EFI_FILE_HANDLE  FileHandle\r
   );\r
 \r
 /**\r
@@ -184,9 +179,9 @@ FileHandleDelete (
   has the effect of starting the read process of the directory entries over again.\r
 \r
   @param[in] FileHandle         The file handle on which the position is being set.\r
-  @param[in] Position           The byte position from the begining of the file.\r
+  @param[in] Position           The byte position from the beginning of the file.\r
 \r
-  @retval EFI_SUCCESS           The operation completed sucessfully.\r
+  @retval EFI_SUCCESS           The operation completed successfully.\r
   @retval EFI_UNSUPPORTED       The request for non-zero is not valid on\r
                                 directories.\r
   @retval INVALID_PARAMETER     One of the parameters has an invalid value.\r
@@ -194,8 +189,8 @@ FileHandleDelete (
 EFI_STATUS\r
 EFIAPI\r
 FileHandleSetPosition (\r
-  IN EFI_FILE_HANDLE    FileHandle,\r
-  IN UINT64             Position\r
+  IN EFI_FILE_HANDLE  FileHandle,\r
+  IN UINT64           Position\r
   );\r
 \r
 /**\r
@@ -207,7 +202,7 @@ FileHandleSetPosition (
   if FileHandle is a directory.\r
 \r
   @param[in] FileHandle         The open file handle on which to get the position.\r
-  @param[out] Position          The byte position from begining of file.\r
+  @param[out] Position          The byte position from beginning of file.\r
 \r
   @retval EFI_SUCCESS           The operation completed successfully.\r
   @retval INVALID_PARAMETER     One of the parameters has an invalid value.\r
@@ -216,9 +211,10 @@ FileHandleSetPosition (
 EFI_STATUS\r
 EFIAPI\r
 FileHandleGetPosition (\r
-  IN EFI_FILE_HANDLE            FileHandle,\r
-  OUT UINT64                    *Position\r
+  IN EFI_FILE_HANDLE  FileHandle,\r
+  OUT UINT64          *Position\r
   );\r
+\r
 /**\r
   Flushes data on a file.\r
 \r
@@ -236,7 +232,7 @@ FileHandleGetPosition (
 EFI_STATUS\r
 EFIAPI\r
 FileHandleFlush (\r
-  IN EFI_FILE_HANDLE            FileHandle\r
+  IN EFI_FILE_HANDLE  FileHandle\r
   );\r
 \r
 /**\r
@@ -248,14 +244,14 @@ FileHandleFlush (
   @param[in] DirHandle          Handle to open file.\r
 \r
   @retval EFI_SUCCESS           DirHandle is a directory.\r
-  @retval EFI_INVALID_PARAMETER DirHandle is NULL. \r
-                                The file information returns from FileHandleGetInfo is NULL. \r
+  @retval EFI_INVALID_PARAMETER DirHandle is NULL.\r
+                                The file information returns from FileHandleGetInfo is NULL.\r
   @retval EFI_NOT_FOUND         DirHandle is not a directory.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 FileHandleIsDirectory (\r
-  IN EFI_FILE_HANDLE            DirHandle\r
+  IN EFI_FILE_HANDLE  DirHandle\r
   );\r
 \r
 /** Retrieve first entry from a directory.\r
@@ -283,8 +279,8 @@ FileHandleIsDirectory (
 EFI_STATUS\r
 EFIAPI\r
 FileHandleFindFirstFile (\r
-  IN EFI_FILE_HANDLE            DirHandle,\r
-  OUT EFI_FILE_INFO             **Buffer\r
+  IN EFI_FILE_HANDLE  DirHandle,\r
+  OUT EFI_FILE_INFO   **Buffer\r
   );\r
 \r
 /** Retrieve next entries from a directory.\r
@@ -307,10 +303,10 @@ FileHandleFindFirstFile (
 **/\r
 EFI_STATUS\r
 EFIAPI\r
-FileHandleFindNextFile(\r
-  IN EFI_FILE_HANDLE             DirHandle,\r
-  OUT EFI_FILE_INFO              *Buffer,\r
-  OUT BOOLEAN                    *NoFile\r
+FileHandleFindNextFile (\r
+  IN EFI_FILE_HANDLE  DirHandle,\r
+  OUT EFI_FILE_INFO   *Buffer,\r
+  OUT BOOLEAN         *NoFile\r
   );\r
 \r
 /**\r
@@ -322,7 +318,7 @@ FileHandleFindNextFile(
   @param[in] FileHandle         The file handle from which size is retrieved.\r
   @param[out] Size              The pointer to size.\r
 \r
-  @retval EFI_SUCCESS           Operation was completed sucessfully.\r
+  @retval EFI_SUCCESS           Operation was completed successfully.\r
   @retval EFI_DEVICE_ERROR      Cannot access the file.\r
   @retval EFI_INVALID_PARAMETER FileHandle is NULL.\r
                                 Size is NULL.\r
@@ -330,8 +326,8 @@ FileHandleFindNextFile(
 EFI_STATUS\r
 EFIAPI\r
 FileHandleGetSize (\r
-  IN EFI_FILE_HANDLE            FileHandle,\r
-  OUT UINT64                    *Size\r
+  IN EFI_FILE_HANDLE  FileHandle,\r
+  OUT UINT64          *Size\r
   );\r
 \r
 /**\r
@@ -350,13 +346,15 @@ FileHandleGetSize (
 EFI_STATUS\r
 EFIAPI\r
 FileHandleSetSize (\r
-  IN EFI_FILE_HANDLE            FileHandle,\r
-  IN UINT64                     Size\r
+  IN EFI_FILE_HANDLE  FileHandle,\r
+  IN 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
+  directory 'stack'. If the file is a directory, then append the '\' char at the\r
+  end of name string. If it's not a directory, then the last '\' should not be\r
+  added.\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
@@ -370,8 +368,8 @@ FileHandleSetSize (
 EFI_STATUS\r
 EFIAPI\r
 FileHandleGetFileName (\r
-  IN CONST EFI_FILE_HANDLE      Handle,\r
-  OUT CHAR16                    **FullFileName\r
+  IN CONST EFI_FILE_HANDLE  Handle,\r
+  OUT CHAR16                **FullFileName\r
   );\r
 \r
 /**\r
@@ -379,6 +377,8 @@ FileHandleGetFileName (
 \r
   If the position upon start is 0, then the Ascii Boolean will be set.  This should be\r
   maintained and not changed for all operations with the same file.\r
+  The function will not return the \r and \n character in buffer. When an empty line is\r
+  read a CHAR_NULL character will be returned in buffer.\r
 \r
   @param[in]       Handle        FileHandle to read from.\r
   @param[in, out]  Buffer        The pointer to buffer to read into.\r
@@ -402,12 +402,12 @@ FileHandleGetFileName (
 **/\r
 EFI_STATUS\r
 EFIAPI\r
-FileHandleReadLine(\r
-  IN EFI_FILE_HANDLE            Handle,\r
-  IN OUT CHAR16                 *Buffer,\r
-  IN OUT UINTN                  *Size,\r
-  IN BOOLEAN                    Truncate,\r
-  IN OUT BOOLEAN                *Ascii\r
+FileHandleReadLine (\r
+  IN EFI_FILE_HANDLE  Handle,\r
+  IN OUT CHAR16       *Buffer,\r
+  IN OUT UINTN        *Size,\r
+  IN BOOLEAN          Truncate,\r
+  IN OUT BOOLEAN      *Ascii\r
   );\r
 \r
 /**\r
@@ -425,20 +425,20 @@ FileHandleReadLine(
 \r
   @sa FileHandleReadLine\r
 **/\r
-CHAR16*\r
+CHAR16 *\r
 EFIAPI\r
-FileHandleReturnLine(\r
-  IN EFI_FILE_HANDLE            Handle,\r
-  IN OUT BOOLEAN                *Ascii\r
+FileHandleReturnLine (\r
+  IN EFI_FILE_HANDLE  Handle,\r
+  IN OUT BOOLEAN      *Ascii\r
   );\r
 \r
 /**\r
   Function to write a line of text to a file.\r
-  \r
-  If the file is a Unicode file (with UNICODE file tag) then write the unicode \r
+\r
+  If the file is a Unicode file (with UNICODE file tag) then write the unicode\r
   text.\r
   If the file is an ASCII file then write the ASCII text.\r
-  If the size of file is zero (without file tag at the beginning) then write \r
+  If the size of file is zero (without file tag at the beginning) then write\r
   ASCII text as default.\r
 \r
   @param[in]     Handle         FileHandle to write to.\r
@@ -448,16 +448,16 @@ FileHandleReturnLine(
   @retval  EFI_SUCCESS            The data was written.\r
                                   Buffer is NULL.\r
   @retval  EFI_INVALID_PARAMETER  Handle is NULL.\r
-  @retval  EFI_OUT_OF_RESOURCES   Unable to allocate temporary space for ASCII \r
+  @retval  EFI_OUT_OF_RESOURCES   Unable to allocate temporary space for ASCII\r
                                   string due to out of resources.\r
 \r
   @sa FileHandleWrite\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
-FileHandleWriteLine(\r
-  IN EFI_FILE_HANDLE Handle,\r
-  IN CHAR16          *Buffer\r
+FileHandleWriteLine (\r
+  IN EFI_FILE_HANDLE  Handle,\r
+  IN CHAR16           *Buffer\r
   );\r
 \r
 /**\r
@@ -474,7 +474,7 @@ FileHandleWriteLine(
 **/\r
 EFI_STATUS\r
 EFIAPI\r
-FileHandlePrintLine(\r
+FileHandlePrintLine (\r
   IN EFI_FILE_HANDLE  Handle,\r
   IN CONST CHAR16     *Format,\r
   ...\r
@@ -494,9 +494,8 @@ FileHandlePrintLine(
 **/\r
 BOOLEAN\r
 EFIAPI\r
-FileHandleEof(\r
-  IN EFI_FILE_HANDLE Handle\r
+FileHandleEof (\r
+  IN EFI_FILE_HANDLE  Handle\r
   );\r
 \r
 #endif //_FILE_HANDLE_LIBRARY_HEADER_\r
-\r