/** @file\r
Provides interface to EFI_FILE_HANDLE functionality.\r
\r
-Copyright (c) 2006 - 2009, Intel Corporation\r
+Copyright (c) 2009, Intel Corporation\r
All rights reserved. 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
\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
\r
- This function allocates a buffer to store the file\92s information. It is the \r
- caller\92s responsibility to free the buffer\r
+ This function allocates a buffer to store the file's information. It is the \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
This function reads information from an opened file.\r
\r
If FileHandle is not a directory, the function reads the requested number of \r
- bytes from the file at the file\92s current position and returns them in Buffer. \r
+ bytes from the file at the file's current position and returns them in Buffer. \r
If the read goes beyond the end of the file, the read length is truncated to the\r
- end of the file. The file\92s current position is increased by the number of bytes \r
+ end of the file. The file's current position is increased by the number of bytes \r
returned. If FileHandle is a directory, the function reads the directory entry \r
- at the file\92s current position and returns the entry in Buffer. If the Buffer \r
+ at the file's current position and returns the entry in Buffer. If the Buffer \r
is not large enough to hold the current directory entry, then \r
EFI_BUFFER_TOO_SMALL is returned and the current file position is not updated. \r
BufferSize is set to be the size of the buffer needed to read the entry. On \r
This function writes the specified number of bytes to the file at the current \r
file position. The current file position is advanced the actual number of bytes \r
written, which is returned in BufferSize. Partial writes only occur when there \r
- has been a data error during the write attempt (such as \93volume space full\94). \r
+ has been a data error during the write attempt (such as "volume space full"). \r
The file is automatically grown to hold the data if required. Direct writes to \r
opened directories are not supported.\r
\r
/** \r
Close an open file handle.\r
\r
- This function closes a specified file handle. All \93dirty\94 cached file data is \r
+ This function closes a specified file handle. All "dirty" cached file data is \r
flushed to the device, and the file is closed. In all cases the handle is \r
closed.\r
\r
/**\r
Retrieves the first file from a directory\r
\r
- This function opens a directory and gets the first file\92s info in the \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
complete the caller is responsible for calling FreePool() on *Buffer.\r
\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\92s EFI_FILE_INFO \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
FileHandleGetSize (\r
IN EFI_FILE_HANDLE FileHandle,\r
OUT UINT64 *Size\r
- );
\ No newline at end of file
+ );\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
+ );\r