]>
Commit | Line | Data |
---|---|---|
d2b4564b | 1 | /** @file\r |
2 | Provides interface to EFI_FILE_HANDLE functionality.\r | |
3 | \r | |
9095d37b | 4 | Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r |
9344f092 | 5 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
d2b4564b | 6 | \r |
7 | **/\r | |
8 | \r | |
a405b86d | 9 | #ifndef _FILE_HANDLE_LIBRARY_HEADER_\r |
b3011f40 | 10 | #define _FILE_HANDLE_LIBRARY_HEADER_\r |
11 | \r | |
a405b86d | 12 | #include <Protocol/SimpleFileSystem.h>\r |
0f705029 | 13 | #include <Guid/FileInfo.h>\r |
a405b86d | 14 | \r |
15 | /// The tag for use in identifying UNICODE files.\r | |
16 | /// If the file is UNICODE, the first 16 bits of the file will equal this value.\r | |
2f88bd3a | 17 | extern CONST UINT16 gUnicodeFileTag;\r |
b3011f40 | 18 | \r |
d2b4564b | 19 | /**\r |
a405b86d | 20 | This function retrieves information about the file for the handle\r |
21 | specified and stores it in the allocated pool memory.\r | |
d2b4564b | 22 | \r |
1e6e84c7 | 23 | This function allocates a buffer to store the file's information. It is the\r |
125c2cf4 | 24 | caller's responsibility to free the buffer.\r |
d2b4564b | 25 | \r |
a405b86d | 26 | @param[in] FileHandle The file handle of the file for which information is\r |
27 | being requested.\r | |
d2b4564b | 28 | \r |
a405b86d | 29 | @retval NULL Information could not be retrieved.\r |
30 | @retval !NULL The information about the file.\r | |
d2b4564b | 31 | **/\r |
2f88bd3a | 32 | EFI_FILE_INFO *\r |
d2b4564b | 33 | EFIAPI\r |
34 | FileHandleGetInfo (\r | |
2f88bd3a | 35 | IN EFI_FILE_HANDLE FileHandle\r |
d2b4564b | 36 | );\r |
37 | \r | |
38 | /**\r | |
a405b86d | 39 | This function sets the information about the file for the opened handle\r |
d2b4564b | 40 | specified.\r |
41 | \r | |
a405b86d | 42 | @param[in] FileHandle The file handle of the file for which information\r |
125c2cf4 | 43 | is being set.\r |
d2b4564b | 44 | \r |
a405b86d | 45 | @param[in] FileInfo The information to set.\r |
d2b4564b | 46 | \r |
b0934ac4 | 47 | @retval EFI_SUCCESS The information was set.\r |
a405b86d | 48 | @retval EFI_INVALID_PARAMETER A parameter was out of range or invalid.\r |
125c2cf4 | 49 | @retval EFI_UNSUPPORTED The FileHandle does not support FileInfo.\r |
b0934ac4 | 50 | @retval EFI_NO_MEDIA The device has no medium.\r |
51 | @retval EFI_DEVICE_ERROR The device reported an error.\r | |
52 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r | |
53 | @retval EFI_WRITE_PROTECTED The file or medium is write protected.\r | |
a405b86d | 54 | @retval EFI_ACCESS_DENIED The file was opened read only.\r |
55 | @retval EFI_VOLUME_FULL The volume is full.\r | |
d2b4564b | 56 | **/\r |
57 | EFI_STATUS\r | |
58 | EFIAPI\r | |
59 | FileHandleSetInfo (\r | |
2f88bd3a MK |
60 | IN EFI_FILE_HANDLE FileHandle,\r |
61 | IN CONST EFI_FILE_INFO *FileInfo\r | |
d2b4564b | 62 | );\r |
63 | \r | |
64 | /**\r | |
65 | This function reads information from an opened file.\r | |
66 | \r | |
1e6e84c7 | 67 | If FileHandle is not a directory, the function reads the requested number of\r |
68 | bytes from the file at the file's current position and returns them in Buffer.\r | |
d2b4564b | 69 | If the read goes beyond the end of the file, the read length is truncated to the\r |
1e6e84c7 | 70 | end of the file. The file's current position is increased by the number of bytes\r |
71 | returned. If FileHandle is a directory, the function reads the directory entry\r | |
72 | at the file's current position and returns the entry in Buffer. If the Buffer\r | |
73 | is not large enough to hold the current directory entry, then\r | |
74 | EFI_BUFFER_TOO_SMALL is returned and the current file position is not updated.\r | |
75 | BufferSize is set to be the size of the buffer needed to read the entry. On\r | |
76 | success, the current position is updated to the next directory entry. If there\r | |
77 | are no more directory entries, the read returns a zero-length buffer.\r | |
d2b4564b | 78 | EFI_FILE_INFO is the structure returned as the directory entry.\r |
79 | \r | |
4ff7e37b ED |
80 | @param[in] FileHandle The opened file handle.\r |
81 | @param[in, out] BufferSize On input, the size of buffer in bytes. On return,\r | |
82 | the number of bytes written.\r | |
83 | @param[out] Buffer The buffer to put read data into.\r | |
d2b4564b | 84 | \r |
b0934ac4 | 85 | @retval EFI_SUCCESS Data was read.\r |
86 | @retval EFI_NO_MEDIA The device has no media.\r | |
87 | @retval EFI_DEVICE_ERROR The device reported an error.\r | |
88 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r | |
89 | @retval EFI_BUFFER_TO_SMALL Buffer is too small. ReadSize contains required\r | |
d2b4564b | 90 | size.\r |
91 | \r | |
92 | **/\r | |
93 | EFI_STATUS\r | |
94 | EFIAPI\r | |
2f88bd3a MK |
95 | FileHandleRead (\r |
96 | IN EFI_FILE_HANDLE FileHandle,\r | |
97 | IN OUT UINTN *BufferSize,\r | |
98 | OUT VOID *Buffer\r | |
d2b4564b | 99 | );\r |
100 | \r | |
101 | /**\r | |
102 | Write data to a file.\r | |
103 | \r | |
1e6e84c7 | 104 | This function writes the specified number of bytes to the file at the current\r |
105 | file position. The current file position is advanced the actual number of bytes\r | |
106 | written, which is returned in BufferSize. Partial writes only occur when there\r | |
107 | has been a data error during the write attempt (such as "volume space full").\r | |
108 | The file is automatically grown to hold the data if required. Direct writes to\r | |
d2b4564b | 109 | opened directories are not supported.\r |
110 | \r | |
4ff7e37b ED |
111 | @param[in] FileHandle The opened file for writing.\r |
112 | @param[in, out] BufferSize On input, the number of bytes in Buffer. On output,\r | |
113 | the number of bytes written.\r | |
114 | @param[in] Buffer The buffer containing data to write is stored.\r | |
125c2cf4 | 115 | \r |
b0934ac4 | 116 | @retval EFI_SUCCESS Data was written.\r |
a405b86d | 117 | @retval EFI_UNSUPPORTED Writes to an open directory are not supported.\r |
b0934ac4 | 118 | @retval EFI_NO_MEDIA The device has no media.\r |
119 | @retval EFI_DEVICE_ERROR The device reported an error.\r | |
120 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r | |
121 | @retval EFI_WRITE_PROTECTED The device is write-protected.\r | |
122 | @retval EFI_ACCESS_DENIED The file was opened for read only.\r | |
123 | @retval EFI_VOLUME_FULL The volume is full.\r | |
d2b4564b | 124 | **/\r |
125 | EFI_STATUS\r | |
126 | EFIAPI\r | |
2f88bd3a MK |
127 | FileHandleWrite (\r |
128 | IN EFI_FILE_HANDLE FileHandle,\r | |
129 | IN OUT UINTN *BufferSize,\r | |
130 | IN VOID *Buffer\r | |
d2b4564b | 131 | );\r |
132 | \r | |
1e6e84c7 | 133 | /**\r |
d2b4564b | 134 | Close an open file handle.\r |
135 | \r | |
1e6e84c7 | 136 | This function closes a specified file handle. All "dirty" cached file data is\r |
137 | flushed to the device, and the file is closed. In all cases the handle is\r | |
d2b4564b | 138 | closed.\r |
139 | \r | |
a405b86d | 140 | @param[in] FileHandle The file handle to close.\r |
d2b4564b | 141 | \r |
a405b86d | 142 | @retval EFI_SUCCESS The file handle was closed successfully.\r |
d2b4564b | 143 | **/\r |
144 | EFI_STATUS\r | |
145 | EFIAPI\r | |
146 | FileHandleClose (\r | |
2f88bd3a | 147 | IN EFI_FILE_HANDLE FileHandle\r |
d2b4564b | 148 | );\r |
149 | \r | |
150 | /**\r | |
125c2cf4 | 151 | Delete a file and close the handle.\r |
d2b4564b | 152 | \r |
153 | This function closes and deletes a file. In all cases the file handle is closed.\r | |
1e6e84c7 | 154 | If the file cannot be deleted, the warning code EFI_WARN_DELETE_FAILURE is\r |
d2b4564b | 155 | returned, but the handle is still closed.\r |
156 | \r | |
a405b86d | 157 | @param[in] FileHandle The file handle to delete.\r |
d2b4564b | 158 | \r |
a405b86d | 159 | @retval EFI_SUCCESS The file was closed successfully.\r |
160 | @retval EFI_WARN_DELETE_FAILURE The handle was closed, but the file was not\r | |
161 | deleted.\r | |
b0934ac4 | 162 | @retval INVALID_PARAMETER One of the parameters has an invalid value.\r |
d2b4564b | 163 | **/\r |
164 | EFI_STATUS\r | |
165 | EFIAPI\r | |
166 | FileHandleDelete (\r | |
2f88bd3a | 167 | IN EFI_FILE_HANDLE FileHandle\r |
d2b4564b | 168 | );\r |
169 | \r | |
170 | /**\r | |
171 | Set the current position in a file.\r | |
172 | \r | |
1e6e84c7 | 173 | This function sets the current file position for the handle to the position\r |
a405b86d | 174 | supplied. With the exception of moving to position 0xFFFFFFFFFFFFFFFF, only\r |
175 | absolute positioning is supported, and moving past the end of the file is\r | |
176 | allowed (a subsequent write would grow the file). Moving to position\r | |
d2b4564b | 177 | 0xFFFFFFFFFFFFFFFF causes the current position to be set to the end of the file.\r |
1e6e84c7 | 178 | If FileHandle is a directory, the only position that may be set is zero. This\r |
a405b86d | 179 | has the effect of starting the read process of the directory entries over again.\r |
d2b4564b | 180 | \r |
a405b86d | 181 | @param[in] FileHandle The file handle on which the position is being set.\r |
00b7cc0f | 182 | @param[in] Position The byte position from the beginning of the file.\r |
d2b4564b | 183 | \r |
00b7cc0f | 184 | @retval EFI_SUCCESS The operation completed successfully.\r |
a405b86d | 185 | @retval EFI_UNSUPPORTED The request for non-zero is not valid on\r |
d2b4564b | 186 | directories.\r |
187 | @retval INVALID_PARAMETER One of the parameters has an invalid value.\r | |
188 | **/\r | |
189 | EFI_STATUS\r | |
190 | EFIAPI\r | |
191 | FileHandleSetPosition (\r | |
2f88bd3a MK |
192 | IN EFI_FILE_HANDLE FileHandle,\r |
193 | IN UINT64 Position\r | |
d2b4564b | 194 | );\r |
195 | \r | |
1e6e84c7 | 196 | /**\r |
125c2cf4 | 197 | Gets a file's current position.\r |
d2b4564b | 198 | \r |
1e6e84c7 | 199 | This function retrieves the current file position for the file handle. For\r |
200 | directories, the current file position has no meaning outside of the file\r | |
a405b86d | 201 | system driver. As such, the operation is not supported. An error is returned\r |
d2b4564b | 202 | if FileHandle is a directory.\r |
203 | \r | |
a405b86d | 204 | @param[in] FileHandle The open file handle on which to get the position.\r |
00b7cc0f | 205 | @param[out] Position The byte position from beginning of file.\r |
d2b4564b | 206 | \r |
a405b86d | 207 | @retval EFI_SUCCESS The operation completed successfully.\r |
d2b4564b | 208 | @retval INVALID_PARAMETER One of the parameters has an invalid value.\r |
a405b86d | 209 | @retval EFI_UNSUPPORTED The request is not valid on directories.\r |
d2b4564b | 210 | **/\r |
211 | EFI_STATUS\r | |
212 | EFIAPI\r | |
213 | FileHandleGetPosition (\r | |
2f88bd3a MK |
214 | IN EFI_FILE_HANDLE FileHandle,\r |
215 | OUT UINT64 *Position\r | |
d2b4564b | 216 | );\r |
2f88bd3a | 217 | \r |
d2b4564b | 218 | /**\r |
125c2cf4 | 219 | Flushes data on a file.\r |
1e6e84c7 | 220 | \r |
d2b4564b | 221 | This function flushes all modified data associated with a file to a device.\r |
222 | \r | |
a405b86d | 223 | @param[in] FileHandle The file handle on which to flush data.\r |
d2b4564b | 224 | \r |
225 | @retval EFI_SUCCESS The data was flushed.\r | |
226 | @retval EFI_NO_MEDIA The device has no media.\r | |
227 | @retval EFI_DEVICE_ERROR The device reported an error.\r | |
228 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r | |
229 | @retval EFI_WRITE_PROTECTED The file or medium is write protected.\r | |
230 | @retval EFI_ACCESS_DENIED The file was opened for read only.\r | |
231 | **/\r | |
232 | EFI_STATUS\r | |
233 | EFIAPI\r | |
234 | FileHandleFlush (\r | |
2f88bd3a | 235 | IN EFI_FILE_HANDLE FileHandle\r |
d2b4564b | 236 | );\r |
237 | \r | |
238 | /**\r | |
125c2cf4 | 239 | Function to determine if a given handle is a directory handle.\r |
d2b4564b | 240 | \r |
e84fb6eb | 241 | Open the file information on the DirHandle and verify that the Attribute\r |
d2b4564b | 242 | includes EFI_FILE_DIRECTORY bit set.\r |
243 | \r | |
e84fb6eb | 244 | @param[in] DirHandle Handle to open file.\r |
d2b4564b | 245 | \r |
a405b86d | 246 | @retval EFI_SUCCESS DirHandle is a directory.\r |
9095d37b LG |
247 | @retval EFI_INVALID_PARAMETER DirHandle is NULL.\r |
248 | The file information returns from FileHandleGetInfo is NULL.\r | |
a405b86d | 249 | @retval EFI_NOT_FOUND DirHandle is not a directory.\r |
d2b4564b | 250 | **/\r |
251 | EFI_STATUS\r | |
252 | EFIAPI\r | |
253 | FileHandleIsDirectory (\r | |
2f88bd3a | 254 | IN EFI_FILE_HANDLE DirHandle\r |
d2b4564b | 255 | );\r |
256 | \r | |
b0934ac4 | 257 | /** Retrieve first entry from a directory.\r |
d2b4564b | 258 | \r |
b0934ac4 | 259 | This function takes an open directory handle and gets information from the\r |
260 | first entry in the directory. A buffer is allocated to contain\r | |
261 | the information and a pointer to the buffer is returned in *Buffer. The\r | |
262 | caller can use FileHandleFindNextFile() to get subsequent directory entries.\r | |
d2b4564b | 263 | \r |
b0934ac4 | 264 | The buffer will be freed by FileHandleFindNextFile() when the last directory\r |
265 | entry is read. Otherwise, the caller must free the buffer, using FreePool,\r | |
266 | when finished with it.\r | |
267 | \r | |
268 | @param[in] DirHandle The file handle of the directory to search.\r | |
a405b86d | 269 | @param[out] Buffer The pointer to pointer to buffer for file's information.\r |
d2b4564b | 270 | \r |
271 | @retval EFI_SUCCESS Found the first file.\r | |
272 | @retval EFI_NOT_FOUND Cannot find the directory.\r | |
273 | @retval EFI_NO_MEDIA The device has no media.\r | |
274 | @retval EFI_DEVICE_ERROR The device reported an error.\r | |
275 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r | |
a405b86d | 276 | @return Others The status of FileHandleGetInfo, FileHandleSetPosition,\r |
277 | or FileHandleRead.\r | |
d2b4564b | 278 | **/\r |
279 | EFI_STATUS\r | |
280 | EFIAPI\r | |
281 | FileHandleFindFirstFile (\r | |
2f88bd3a MK |
282 | IN EFI_FILE_HANDLE DirHandle,\r |
283 | OUT EFI_FILE_INFO **Buffer\r | |
d2b4564b | 284 | );\r |
d2b4564b | 285 | \r |
b0934ac4 | 286 | /** Retrieve next entries from a directory.\r |
287 | \r | |
288 | To use this function, the caller must first call the FileHandleFindFirstFile()\r | |
289 | function to get the first directory entry. Subsequent directory entries are\r | |
290 | retrieved by using the FileHandleFindNextFile() function. This function can\r | |
291 | be called several times to get each entry from the directory. If the call of\r | |
292 | FileHandleFindNextFile() retrieved the last directory entry, the next call of\r | |
293 | this function will set *NoFile to TRUE and free the buffer.\r | |
d2b4564b | 294 | \r |
b0934ac4 | 295 | @param[in] DirHandle The file handle of the directory.\r |
a405b86d | 296 | @param[out] Buffer The pointer to buffer for file's information.\r |
297 | @param[out] NoFile The pointer to boolean when last file is found.\r | |
d2b4564b | 298 | \r |
a405b86d | 299 | @retval EFI_SUCCESS Found the next file, or reached last file.\r |
d2b4564b | 300 | @retval EFI_NO_MEDIA The device has no media.\r |
301 | @retval EFI_DEVICE_ERROR The device reported an error.\r | |
302 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r | |
303 | **/\r | |
304 | EFI_STATUS\r | |
305 | EFIAPI\r | |
2f88bd3a MK |
306 | FileHandleFindNextFile (\r |
307 | IN EFI_FILE_HANDLE DirHandle,\r | |
308 | OUT EFI_FILE_INFO *Buffer,\r | |
309 | OUT BOOLEAN *NoFile\r | |
d2b4564b | 310 | );\r |
311 | \r | |
312 | /**\r | |
313 | Retrieve the size of a file.\r | |
314 | \r | |
1e6e84c7 | 315 | This function extracts the file size info from the FileHandle's EFI_FILE_INFO\r |
d2b4564b | 316 | data.\r |
317 | \r | |
a405b86d | 318 | @param[in] FileHandle The file handle from which size is retrieved.\r |
319 | @param[out] Size The pointer to size.\r | |
d2b4564b | 320 | \r |
00b7cc0f | 321 | @retval EFI_SUCCESS Operation was completed successfully.\r |
a405b86d | 322 | @retval EFI_DEVICE_ERROR Cannot access the file.\r |
b269f895 QS |
323 | @retval EFI_INVALID_PARAMETER FileHandle is NULL.\r |
324 | Size is NULL.\r | |
d2b4564b | 325 | **/\r |
326 | EFI_STATUS\r | |
327 | EFIAPI\r | |
328 | FileHandleGetSize (\r | |
2f88bd3a MK |
329 | IN EFI_FILE_HANDLE FileHandle,\r |
330 | OUT UINT64 *Size\r | |
b1f95a06 | 331 | );\r |
332 | \r | |
a405b86d | 333 | /**\r |
334 | Set the size of a file.\r | |
335 | \r | |
a405b86d | 336 | This function changes the file size info from the FileHandle's EFI_FILE_INFO\r |
337 | data.\r | |
338 | \r | |
339 | @param[in] FileHandle The file handle whose size is to be changed.\r | |
340 | @param[in] Size The new size.\r | |
341 | \r | |
342 | @retval EFI_SUCCESS The operation completed successfully.\r | |
343 | @retval EFI_DEVICE_ERROR Cannot access the file.\r | |
b269f895 | 344 | @retval EFI_INVALID_PARAMETER FileHandle is NULL.\r |
a405b86d | 345 | **/\r |
346 | EFI_STATUS\r | |
347 | EFIAPI\r | |
348 | FileHandleSetSize (\r | |
2f88bd3a MK |
349 | IN EFI_FILE_HANDLE FileHandle,\r |
350 | IN UINT64 Size\r | |
a405b86d | 351 | );\r |
352 | \r | |
b1f95a06 | 353 | /**\r |
1e6e84c7 | 354 | Function to get a full filename given a EFI_FILE_HANDLE somewhere lower on the\r |
9095d37b LG |
355 | directory 'stack'. If the file is a directory, then append the '\' char at the\r |
356 | end of name string. If it's not a directory, then the last '\' should not be\r | |
ad6f6f86 | 357 | added.\r |
b1f95a06 | 358 | \r |
b1f95a06 | 359 | @param[in] Handle Handle to the Directory or File to create path to.\r |
1e6e84c7 | 360 | @param[out] FullFileName Pointer to pointer to generated full file name. It\r |
b1f95a06 | 361 | is the responsibility of the caller to free this memory\r |
362 | with a call to FreePool().\r | |
a405b86d | 363 | @retval EFI_SUCCESS The operation was successful and FullFileName is valid.\r |
b1f95a06 | 364 | @retval EFI_INVALID_PARAMETER Handle was NULL.\r |
365 | @retval EFI_INVALID_PARAMETER FullFileName was NULL.\r | |
a405b86d | 366 | @retval EFI_OUT_OF_MEMORY A memory allocation failed.\r |
b1f95a06 | 367 | **/\r |
368 | EFI_STATUS\r | |
369 | EFIAPI\r | |
370 | FileHandleGetFileName (\r | |
2f88bd3a MK |
371 | IN CONST EFI_FILE_HANDLE Handle,\r |
372 | OUT CHAR16 **FullFileName\r | |
b1f95a06 | 373 | );\r |
374 | \r | |
375 | /**\r | |
b3011f40 | 376 | Function to read a single line (up to but not including the \n) from a file.\r |
b1f95a06 | 377 | \r |
1e6e84c7 | 378 | If the position upon start is 0, then the Ascii Boolean will be set. This should be\r |
b3011f40 | 379 | maintained and not changed for all operations with the same file.\r |
ba180625 QS |
380 | The function will not return the \r and \n character in buffer. When an empty line is\r |
381 | read a CHAR_NULL character will be returned in buffer.\r | |
b3011f40 | 382 | \r |
4ff7e37b ED |
383 | @param[in] Handle FileHandle to read from.\r |
384 | @param[in, out] Buffer The pointer to buffer to read into.\r | |
385 | @param[in, out] Size The pointer to number of bytes in Buffer.\r | |
386 | @param[in] Truncate If the buffer is large enough, this has no effect.\r | |
387 | If the buffer is is too small and Truncate is TRUE,\r | |
388 | the line will be truncated.\r | |
389 | If the buffer is is too small and Truncate is FALSE,\r | |
390 | then no read will occur.\r | |
a405b86d | 391 | \r |
4ff7e37b ED |
392 | @param[in, out] Ascii Boolean value for indicating whether the file is\r |
393 | Ascii (TRUE) or UCS2 (FALSE).\r | |
b1f95a06 | 394 | \r |
a405b86d | 395 | @retval EFI_SUCCESS The operation was successful. The line is stored in\r |
b3011f40 | 396 | Buffer.\r |
b1f95a06 | 397 | @retval EFI_INVALID_PARAMETER Handle was NULL.\r |
b1f95a06 | 398 | @retval EFI_INVALID_PARAMETER Size was NULL.\r |
a405b86d | 399 | @retval EFI_BUFFER_TOO_SMALL Size was not large enough to store the line.\r |
400 | Size was updated to the minimum space required.\r | |
b1f95a06 | 401 | @sa FileHandleRead\r |
402 | **/\r | |
403 | EFI_STATUS\r | |
404 | EFIAPI\r | |
2f88bd3a MK |
405 | FileHandleReadLine (\r |
406 | IN EFI_FILE_HANDLE Handle,\r | |
407 | IN OUT CHAR16 *Buffer,\r | |
408 | IN OUT UINTN *Size,\r | |
409 | IN BOOLEAN Truncate,\r | |
410 | IN OUT BOOLEAN *Ascii\r | |
b3011f40 | 411 | );\r |
412 | \r | |
413 | /**\r | |
1e6e84c7 | 414 | Function to read a single line from a file. The \n is not included in the returned\r |
b3011f40 | 415 | buffer. The returned buffer must be callee freed.\r |
416 | \r | |
1e6e84c7 | 417 | If the position upon start is 0, then the Ascii Boolean will be set. This should be\r |
b3011f40 | 418 | maintained and not changed for all operations with the same file.\r |
419 | \r | |
4ff7e37b ED |
420 | @param[in] Handle FileHandle to read from.\r |
421 | @param[in, out] Ascii Boolean value for indicating whether the file is\r | |
422 | Ascii (TRUE) or UCS2 (FALSE).\r | |
b3011f40 | 423 | \r |
424 | @return The line of text from the file.\r | |
425 | \r | |
426 | @sa FileHandleReadLine\r | |
427 | **/\r | |
2f88bd3a | 428 | CHAR16 *\r |
b3011f40 | 429 | EFIAPI\r |
2f88bd3a MK |
430 | FileHandleReturnLine (\r |
431 | IN EFI_FILE_HANDLE Handle,\r | |
432 | IN OUT BOOLEAN *Ascii\r | |
b1f95a06 | 433 | );\r |
434 | \r | |
435 | /**\r | |
a86c73cd | 436 | Function to write a line of text to a file.\r |
9095d37b LG |
437 | \r |
438 | If the file is a Unicode file (with UNICODE file tag) then write the unicode\r | |
a86c73cd QS |
439 | text.\r |
440 | If the file is an ASCII file then write the ASCII text.\r | |
9095d37b | 441 | If the size of file is zero (without file tag at the beginning) then write\r |
a86c73cd | 442 | ASCII text as default.\r |
b1f95a06 | 443 | \r |
a405b86d | 444 | @param[in] Handle FileHandle to write to.\r |
1e6e84c7 | 445 | @param[in] Buffer Buffer to write, if NULL the function will\r |
125c2cf4 | 446 | take no action and return EFI_SUCCESS.\r |
b1f95a06 | 447 | \r |
b269f895 QS |
448 | @retval EFI_SUCCESS The data was written.\r |
449 | Buffer is NULL.\r | |
450 | @retval EFI_INVALID_PARAMETER Handle is NULL.\r | |
9095d37b | 451 | @retval EFI_OUT_OF_RESOURCES Unable to allocate temporary space for ASCII\r |
a86c73cd | 452 | string due to out of resources.\r |
b1f95a06 | 453 | \r |
454 | @sa FileHandleWrite\r | |
455 | **/\r | |
456 | EFI_STATUS\r | |
457 | EFIAPI\r | |
2f88bd3a MK |
458 | FileHandleWriteLine (\r |
459 | IN EFI_FILE_HANDLE Handle,\r | |
460 | IN CHAR16 *Buffer\r | |
e9880e25 | 461 | );\r |
125c2cf4 | 462 | \r |
463 | /**\r | |
a405b86d | 464 | Function to take a formatted argument and print it to a file.\r |
125c2cf4 | 465 | \r |
a405b86d | 466 | @param[in] Handle The file handle for the file to write to.\r |
467 | @param[in] Format The format argument (see printlib for the format specifier).\r | |
468 | @param[in] ... The variable arguments for the format.\r | |
125c2cf4 | 469 | \r |
a405b86d | 470 | @retval EFI_SUCCESS The operation was successful.\r |
471 | @retval other A return value from FileHandleWriteLine.\r | |
125c2cf4 | 472 | \r |
473 | @sa FileHandleWriteLine\r | |
474 | **/\r | |
475 | EFI_STATUS\r | |
476 | EFIAPI\r | |
2f88bd3a | 477 | FileHandlePrintLine (\r |
125c2cf4 | 478 | IN EFI_FILE_HANDLE Handle,\r |
479 | IN CONST CHAR16 *Format,\r | |
480 | ...\r | |
481 | );\r | |
482 | \r | |
483 | /**\r | |
484 | Function to determine if a FILE_HANDLE is at the end of the file.\r | |
485 | \r | |
486 | This will NOT work on directories.\r | |
487 | \r | |
a405b86d | 488 | If Handle is NULL, then ASSERT().\r |
b3011f40 | 489 | \r |
a405b86d | 490 | @param[in] Handle The file handle.\r |
125c2cf4 | 491 | \r |
a405b86d | 492 | @retval TRUE The position is at the end of the file.\r |
493 | @retval FALSE The position is not at the end of the file.\r | |
125c2cf4 | 494 | **/\r |
495 | BOOLEAN\r | |
496 | EFIAPI\r | |
2f88bd3a MK |
497 | FileHandleEof (\r |
498 | IN EFI_FILE_HANDLE Handle\r | |
125c2cf4 | 499 | );\r |
b3011f40 | 500 | \r |
501 | #endif //_FILE_HANDLE_LIBRARY_HEADER_\r |