]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Include/Library/FileHandleLib.h
ShellPkg: Move UpdateMapping() out of Map command and added to UefiShellCommandLib...
[mirror_edk2.git] / ShellPkg / Include / Library / FileHandleLib.h
index 1c191ad64a27b2e73aa8d34737e0bc65148c97ec..6c79397570911a7db2e2ccdb04859db1eafbe617 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Provides interface to EFI_FILE_HANDLE functionality.\r
 \r
-  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2011, 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
@@ -19,9 +19,7 @@
 \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
-enum {\r
-  UnicodeFileTag = 0xFEFF\r
-};\r
+extern CONST UINT16 gUnicodeFileTag;\r
 \r
 /**\r
   This function retrieves information about the file for the handle\r
@@ -51,20 +49,20 @@ FileHandleGetInfo (
 \r
   @param[in]  FileInfo          The information to set.\r
 \r
-  @retval EFI_SUCCESS                  The information was set.\r
+  @retval EFI_SUCCESS           The information was set.\r
   @retval EFI_INVALID_PARAMETER A parameter was out of range or invalid.\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_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
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 FileHandleSetInfo (\r
-  IN EFI_FILE_HANDLE           FileHandle,\r
+  IN EFI_FILE_HANDLE            FileHandle,\r
   IN CONST EFI_FILE_INFO        *FileInfo\r
   );\r
 \r
@@ -84,16 +82,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[in] FileHandle         The opened file handle.\r
-  @param[in,out] BufferSize     On input, the size of buffer in bytes.  On return,\r
-                                the number of bytes written.\r
-  @param[out] Buffer            The buffer to put read data into.\r
+  @param[in] FileHandle          The opened file handle.\r
+  @param[in, out] BufferSize     On input, the size of buffer in bytes.  On return,\r
+                                 the number of bytes written.\r
+  @param[out] 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_VOLUME_CORRUPTED The file system structures are corrupted.\r
-  @retval EFI_BUFFER_TO_SMALL  Buffer is too small. ReadSize contains required\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_VOLUME_CORRUPTED  The file system structures are corrupted.\r
+  @retval EFI_BUFFER_TO_SMALL Buffer is too small. ReadSize contains required\r
                                 size.\r
 \r
 **/\r
@@ -115,19 +113,19 @@ FileHandleRead(
   The file is automatically grown to hold the data if required. Direct writes to\r
   opened directories are not supported.\r
 \r
-  @param[in] FileHandle         The opened file for writing.\r
-  @param[in,out] BufferSize     On input, the number of bytes in Buffer.  On output,\r
-                                the number of bytes written.\r
-  @param[in] Buffer             The buffer containing data to write is stored.\r
+  @param[in] FileHandle          The opened file for writing.\r
+  @param[in, out] BufferSize     On input, the number of bytes in Buffer.  On output,\r
+                                 the number of bytes written.\r
+  @param[in] Buffer              The buffer containing data to write is stored.\r
 \r
-  @retval EFI_SUCCESS          Data was written.\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 opened for read only.\r
-  @retval EFI_VOLUME_FULL      The volume is full.\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 opened for read only.\r
+  @retval EFI_VOLUME_FULL The volume is full.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -166,12 +164,12 @@ FileHandleClose (
   @retval EFI_SUCCESS               The file was closed successfully.\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 INVALID_PARAMETER         One of the parameters has an invalid value.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 FileHandleDelete (\r
-  IN EFI_FILE_HANDLE           FileHandle\r
+  IN EFI_FILE_HANDLE    FileHandle\r
   );\r
 \r
 /**\r
@@ -196,8 +194,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
@@ -261,14 +259,18 @@ FileHandleIsDirectory (
   IN EFI_FILE_HANDLE            DirHandle\r
   );\r
 \r
-/**\r
-  Retrieves the first file from a directory.\r
+/** Retrieve first entry from a directory.\r
 \r
-  This function opens a directory and gets the first file's information in the\r
-  directory. The caller the uses FileHandleFindNextFile() to get other files.  When\r
-  complete, the caller is responsible for calling FreePool() on *Buffer.\r
+  This function takes an open directory handle and gets information from the\r
+  first entry in the directory.  A buffer is allocated to contain\r
+  the information and a pointer to the buffer is returned in *Buffer.  The\r
+  caller can use FileHandleFindNextFile() to get subsequent directory entries.\r
 \r
-  @param[in] DirHandle          The file handle of the directory to search.\r
+  The buffer will be freed by FileHandleFindNextFile() when the last directory\r
+  entry is read.  Otherwise, the caller must free the buffer, using FreePool,\r
+  when finished with it.\r
+\r
+  @param[in]  DirHandle         The file handle of the directory to search.\r
   @param[out] Buffer            The pointer to pointer to buffer for file's information.\r
 \r
   @retval EFI_SUCCESS           Found the first file.\r
@@ -285,17 +287,17 @@ FileHandleFindFirstFile (
   IN EFI_FILE_HANDLE            DirHandle,\r
   OUT EFI_FILE_INFO             **Buffer\r
   );\r
-/**\r
-  Retrieves the next file in a directory.\r
 \r
-  To use this function, caller must call the FileHandleFindFirstFile() to get the\r
-  first file, and then use this function get other files. This function can be\r
-  called for several times to get each file's information in the directory. If\r
-  the call of FileHandleFindNextFile() got the last file in the directory, the next\r
-  call of this function has no file to get. *NoFile will be set to TRUE and the\r
-  Buffer memory will be automatically freed.\r
+/** Retrieve next entries from a directory.\r
+\r
+  To use this function, the caller must first call the FileHandleFindFirstFile()\r
+  function to get the first directory entry.  Subsequent directory entries are\r
+  retrieved by using the FileHandleFindNextFile() function.  This function can\r
+  be called several times to get each entry from the directory.  If the call of\r
+  FileHandleFindNextFile() retrieved the last directory entry, the next call of\r
+  this function will set *NoFile to TRUE and free the buffer.\r
 \r
-  @param[in] DirHandle          The file handle of the directory.\r
+  @param[in]  DirHandle         The file handle of the directory.\r
   @param[out] Buffer            The pointer to buffer for file's information.\r
   @param[out] NoFile            The pointer to boolean when last file is found.\r
 \r
@@ -381,17 +383,17 @@ FileHandleGetFileName (
   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
 \r
-  @param[in]      Handle        FileHandle to read from.\r
-  @param[in,out]  Buffer        The pointer to buffer to read into.\r
-  @param[in,out]  Size          The pointer to number of bytes in Buffer.\r
-  @param[in]      Truncate      If the buffer is large enough, this has no effect.\r
-                                If the buffer is is too small and Truncate is TRUE,\r
-                                the line will be truncated.\r
-                                If the buffer is is too small and Truncate is FALSE,\r
-                                then no read will occur.\r
+  @param[in]       Handle        FileHandle to read from.\r
+  @param[in, out]  Buffer        The pointer to buffer to read into.\r
+  @param[in, out]  Size          The pointer to number of bytes in Buffer.\r
+  @param[in]       Truncate      If the buffer is large enough, this has no effect.\r
+                                 If the buffer is is too small and Truncate is TRUE,\r
+                                 the line will be truncated.\r
+                                 If the buffer is is too small and Truncate is FALSE,\r
+                                 then no read will occur.\r
 \r
-  @param[in,out]  Ascii         Boolean value for indicating whether the file is\r
-                                Ascii (TRUE) or UCS2 (FALSE).\r
+  @param[in, out]  Ascii         Boolean value for indicating whether the file is\r
+                                 Ascii (TRUE) or UCS2 (FALSE).\r
 \r
   @retval EFI_SUCCESS           The operation was successful.  The line is stored in\r
                                 Buffer.\r
@@ -418,9 +420,9 @@ FileHandleReadLine(
   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
 \r
-  @param[in]      Handle        FileHandle to read from.\r
-  @param[in,out]  Ascii         Boolean value for indicating whether the file is\r
-                                Ascii (TRUE) or UCS2 (FALSE).\r
+  @param[in]       Handle        FileHandle to read from.\r
+  @param[in, out]  Ascii         Boolean value for indicating whether the file is\r
+                                 Ascii (TRUE) or UCS2 (FALSE).\r
 \r
   @return                       The line of text from the file.\r
 \r