/** @file\r
- Library functions that perform file IO. Memory buffer, file system, and \r
- fimrware volume operations are supproted. \r
+ Library functions that perform file IO. Memory buffer, file system, and\r
+ fimrware volume operations are supproted.\r
\r
Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>\r
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
current mounted device concept of current working directory concept implement\r
by this library.\r
\r
- Device names are case insensative and only check the leading characters for \r
+ Device names are case insensative and only check the leading characters for\r
unique matches. Thus the following are all the same:\r
LoadFile0:\r
l0:\r
fs3: - EFI Simple File System device 3\r
Fv2: - EFI Firmware VOlume device 2\r
1.2.3.4:name - TFTP IP and file name\r
- \r
+\r
**/\r
\r
#ifndef __EFI_FILE_LIB_H__\r
\r
#define MAX_PATHNAME 0x200\r
\r
-/// Type of the file that has been opened \r
+/// Type of the file that has been opened\r
typedef enum {\r
EfiOpenLoadFile,\r
EfiOpenMemoryBuffer,\r
\r
/// Public information about the open file\r
typedef struct {\r
- UINTN Version; // Common information \r
+ UINTN Version; // Common information\r
EFI_OPEN_FILE_TYPE Type;\r
EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
EFI_STATUS LastError;\r
- EFI_HANDLE EfiHandle; \r
+ EFI_HANDLE EfiHandle;\r
CHAR8 *DeviceName;\r
CHAR8 *FileName;\r
\r
UINT64 MaxPosition;\r
\r
UINTN BaseOffset; // Base offset for hexdump command\r
- \r
+\r
UINTN Size; // Valid for all types other than l#:\r
UINT8 *Buffer; // Information valid for A#:\r
\r
- EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv; // Information valid for Fv#: \r
- EFI_GUID FvNameGuid; \r
- EFI_SECTION_TYPE FvSectionType; \r
- EFI_FV_FILETYPE FvType; \r
- EFI_FV_FILE_ATTRIBUTES FvAttributes; \r
+ EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv; // Information valid for Fv#:\r
+ EFI_GUID FvNameGuid;\r
+ EFI_SECTION_TYPE FvSectionType;\r
+ EFI_FV_FILETYPE FvType;\r
+ EFI_FV_FILE_ATTRIBUTES FvAttributes;\r
\r
- EFI_PHYSICAL_ADDRESS FvStart; \r
- UINTN FvSize; \r
+ EFI_PHYSICAL_ADDRESS FvStart;\r
+ UINTN FvSize;\r
UINTN FvHeaderSize;\r
\r
EFI_FILE *FsFileHandle; // Information valid for Fs#:\r
UINTN DiskOffset; // Information valid for B#:\r
\r
EFI_LOAD_FILE_PROTOCOL *LoadFile; // Information valid for l#:\r
- \r
+\r
EFI_IP_ADDRESS ServerIp; // Information valid for t:\r
BOOLEAN IsDirty;\r
BOOLEAN IsBufferValid;\r
- \r
+\r
} EFI_OPEN_FILE;\r
\r
\r
\r
\r
/**\r
- Open a device named by PathName. The PathName includes a device name and \r
+ Open a device named by PathName. The PathName includes a device name and\r
path separated by a :. See file header for more details on the PathName\r
syntax. There is no checking to prevent a file from being opened more than\r
- one type. \r
+ one type.\r
\r
SectionType is only used to open an FV. Each file in an FV contains multiple\r
sections and only the SectionType section is opened.\r
\r
For any file that is opened with EfiOpen() must be closed with EfiClose().\r
\r
- @param PathName Path to parse to open \r
+ @param PathName Path to parse to open\r
@param OpenMode Same as EFI_FILE.Open()\r
@param SectionType Section in FV to open.\r
\r
\r
\r
/**\r
- Return the size of the file represented by Stream. Also return the current \r
+ Return the size of the file represented by Stream. Also return the current\r
Seek position. Opening a file will enable a valid file size to be returned.\r
- LoadFile is an exception as a load file size is set to zero. \r
+ LoadFile is an exception as a load file size is set to zero.\r
\r
@param Stream Open File Handle\r
\r
\r
/**\r
Seek to the Offset location in the file. LoadFile and FV device types do\r
- not support EfiSeek(). It is not possible to grow the file size using \r
+ not support EfiSeek(). It is not possible to grow the file size using\r
EfiSeek().\r
- \r
+\r
SeekType defines how use Offset to calculate the new file position:\r
EfiSeekStart : Position = Offset\r
EfiSeekCurrent: Position is Offset bytes from the current position\r
EfiSeekEnd : Only supported if Offset is zero to seek to end of file.\r
\r
@param Stream Open File Handle\r
- @param Offset Offset to seek too. \r
+ @param Offset Offset to seek too.\r
@param SeekType Type of seek to perform\r
\r
\r
\r
/**\r
Read BufferSize bytes from the current location in the file. For load file\r
- and FV case you must read the entire file. \r
+ and FV case you must read the entire file.\r
\r
@param Stream Open File Handle\r
- @param Buffer Caller allocated buffer. \r
+ @param Buffer Caller allocated buffer.\r
@param BufferSize Size of buffer in bytes.\r
\r
\r
\r
/**\r
Read the entire file into a buffer. This routine allocates the buffer and\r
- returns it to the user full of the read data. \r
+ returns it to the user full of the read data.\r
\r
This is very useful for load file where it's hard to know how big the buffer\r
must be.\r
\r
@param Stream Open File Handle\r
- @param Buffer Pointer to buffer to return. \r
+ @param Buffer Pointer to buffer to return.\r
@param BufferSize Pointer to Size of buffer return..\r
\r
\r
\r
\r
/**\r
- Write data back to the file. \r
+ Write data back to the file.\r
\r
@param Stream Open File Handle\r
- @param Buffer Pointer to buffer to return. \r
+ @param Buffer Pointer to buffer to return.\r
@param BufferSize Pointer to Size of buffer return..\r
\r
\r
EfiGetDeviceCounts (\r
IN EFI_OPEN_FILE_TYPE Type\r
);\r
- \r
+\r
\r
/**\r
Set the Current Working Directory (CWD). If a call is made to EfiOpen () and\r
the path does not contain a device name, The CWD is prepended to the path.\r
- \r
+\r
@param Cwd Current Working Directory to set\r
\r
\r
EFI_STATUS\r
EfiSetCwd (\r
IN CHAR8 *Cwd\r
- ); \r
+ );\r
\r
/**\r
Set the Current Working Directory (CWD). If a call is made to EfiOpen () and\r
the path does not contain a device name, The CWD is prepended to the path.\r
- \r
- @param Cwd Current Working Directory \r
+\r
+ @param Cwd Current Working Directory\r
\r
\r
@return NULL No CWD set\r
@return 'other' malloc'ed buffer contains CWD.\r
- \r
+\r
**/\r
CHAR8 *\r
EfiGetCwd (\r
VOID\r
- ); \r
+ );\r
\r
#endif\r