]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/SimpleFileSystem.h
MdePkg/Include/Protocol/Tls.h: pack structures from the TLS RFC
[mirror_edk2.git] / MdePkg / Include / Protocol / SimpleFileSystem.h
CommitLineData
d1f95000 1/** @file\r
8a7d75b0 2 SimpleFileSystem protocol as defined in the UEFI 2.0 specification.\r
d1f95000 3\r
630b4187 4 The SimpleFileSystem protocol is the programmatic access to the FAT (12,16,32) \r
8a7d75b0 5 file system specified in UEFI 2.0. It can also be used to abstract a file \r
d1f95000 6 system other than FAT.\r
7\r
630b4187 8 UEFI 2.0 can boot from any valid EFI image contained in a SimpleFileSystem.\r
d1f95000 9\r
37eae4c7 10Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
af2dc6a7 11This program and the accompanying materials are licensed and made available under \r
12the terms and conditions of the BSD License that accompanies this distribution. \r
13The full text of the license may be found at\r
14http://opensource.org/licenses/bsd-license.php. \r
15 \r
16THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
17WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
d1f95000 18\r
d1f95000 19**/\r
20\r
21#ifndef __SIMPLE_FILE_SYSTEM_H__\r
22#define __SIMPLE_FILE_SYSTEM_H__\r
23\r
24#define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID \\r
25 { \\r
26 0x964e5b22, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \\r
27 }\r
28\r
29typedef struct _EFI_SIMPLE_FILE_SYSTEM_PROTOCOL EFI_SIMPLE_FILE_SYSTEM_PROTOCOL;\r
a6508c05 30\r
31typedef struct _EFI_FILE_PROTOCOL EFI_FILE_PROTOCOL;\r
32typedef struct _EFI_FILE_PROTOCOL *EFI_FILE_HANDLE;\r
33\r
99e8ed21 34///\r
992f22b9 35/// Protocol GUID name defined in EFI1.1.\r
99e8ed21 36/// \r
a6508c05 37#define SIMPLE_FILE_SYSTEM_PROTOCOL EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID\r
38\r
99e8ed21 39///\r
992f22b9 40/// Protocol name defined in EFI1.1.\r
99e8ed21 41/// \r
a6508c05 42typedef EFI_SIMPLE_FILE_SYSTEM_PROTOCOL EFI_FILE_IO_INTERFACE;\r
79a36e6f 43typedef EFI_FILE_PROTOCOL EFI_FILE;\r
d1f95000 44\r
45/**\r
46 Open the root directory on a volume.\r
47\r
77df6ed9
RN
48 @param This A pointer to the volume to open the root directory.\r
49 @param Root A pointer to the location to return the opened file handle for the\r
50 root directory.\r
d1f95000 51\r
52 @retval EFI_SUCCESS The device was opened.\r
77df6ed9
RN
53 @retval EFI_UNSUPPORTED This volume does not support the requested file system type.\r
54 @retval EFI_NO_MEDIA The device has no medium.\r
d1f95000 55 @retval EFI_DEVICE_ERROR The device reported an error.\r
af2dc6a7 56 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r
57 @retval EFI_ACCESS_DENIED The service denied access to the file.\r
58 @retval EFI_OUT_OF_RESOURCES The volume was not opened due to lack of resources.\r
77df6ed9
RN
59 @retval EFI_MEDIA_CHANGED The device has a different medium in it or the medium is no\r
60 longer supported. Any existing file handles for this volume are\r
61 no longer valid. To access the files on the new medium, the\r
62 volume must be reopened with OpenVolume().\r
d1f95000 63\r
64**/\r
65typedef\r
66EFI_STATUS\r
8b13229b 67(EFIAPI *EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_OPEN_VOLUME)(\r
d1f95000 68 IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *This,\r
a6508c05 69 OUT EFI_FILE_PROTOCOL **Root\r
ed66e1bc 70 );\r
d1f95000 71\r
72#define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION 0x00010000\r
992f22b9 73\r
99e8ed21 74///\r
75/// Revision defined in EFI1.1\r
76/// \r
a6508c05 77#define EFI_FILE_IO_INTERFACE_REVISION EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION\r
d1f95000 78\r
79struct _EFI_SIMPLE_FILE_SYSTEM_PROTOCOL {\r
992f22b9
LG
80 ///\r
81 /// The version of the EFI_SIMPLE_FILE_SYSTEM_PROTOCOL. The version\r
82 /// specified by this specification is 0x00010000. All future revisions\r
83 /// must be backwards compatible.\r
84 ///\r
d1f95000 85 UINT64 Revision;\r
86 EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_OPEN_VOLUME OpenVolume;\r
87};\r
88\r
89/**\r
79a36e6f 90 Opens a new file relative to the source file's location.\r
d1f95000 91\r
77df6ed9
RN
92 @param This A pointer to the EFI_FILE_PROTOCOL instance that is the file\r
93 handle to the source location. This would typically be an open\r
94 handle to a directory.\r
95 @param NewHandle A pointer to the location to return the opened handle for the new\r
96 file.\r
97 @param FileName The Null-terminated string of the name of the file to be opened.\r
98 The file name may contain the following path modifiers: "\", ".",\r
99 and "..".\r
100 @param OpenMode The mode to open the file. The only valid combinations that the\r
101 file may be opened with are: Read, Read/Write, or Create/Read/Write.\r
102 @param Attributes Only valid for EFI_FILE_MODE_CREATE, in which case these are the \r
103 attribute bits for the newly created file.\r
104\r
105 @retval EFI_SUCCESS The file was opened.\r
af2dc6a7 106 @retval EFI_NOT_FOUND The specified file could not be found on the device.\r
77df6ed9
RN
107 @retval EFI_NO_MEDIA The device has no medium.\r
108 @retval EFI_MEDIA_CHANGED The device has a different medium in it or the medium is no\r
109 longer supported.\r
d1f95000 110 @retval EFI_DEVICE_ERROR The device reported an error.\r
af2dc6a7 111 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r
77df6ed9
RN
112 @retval EFI_WRITE_PROTECTED An attempt was made to create a file, or open a file for write\r
113 when the media is write-protected.\r
af2dc6a7 114 @retval EFI_ACCESS_DENIED The service denied access to the file.\r
77df6ed9 115 @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the file.\r
d1f95000 116 @retval EFI_VOLUME_FULL The volume is full.\r
117\r
118**/\r
119typedef\r
120EFI_STATUS\r
8b13229b 121(EFIAPI *EFI_FILE_OPEN)(\r
a6508c05 122 IN EFI_FILE_PROTOCOL *This,\r
123 OUT EFI_FILE_PROTOCOL **NewHandle,\r
d1f95000 124 IN CHAR16 *FileName,\r
125 IN UINT64 OpenMode,\r
126 IN UINT64 Attributes\r
ed66e1bc 127 );\r
d1f95000 128\r
129//\r
130// Open modes\r
131//\r
132#define EFI_FILE_MODE_READ 0x0000000000000001ULL\r
133#define EFI_FILE_MODE_WRITE 0x0000000000000002ULL\r
134#define EFI_FILE_MODE_CREATE 0x8000000000000000ULL\r
135\r
136//\r
137// File attributes\r
138//\r
139#define EFI_FILE_READ_ONLY 0x0000000000000001ULL\r
140#define EFI_FILE_HIDDEN 0x0000000000000002ULL\r
141#define EFI_FILE_SYSTEM 0x0000000000000004ULL\r
142#define EFI_FILE_RESERVED 0x0000000000000008ULL\r
143#define EFI_FILE_DIRECTORY 0x0000000000000010ULL\r
144#define EFI_FILE_ARCHIVE 0x0000000000000020ULL\r
145#define EFI_FILE_VALID_ATTR 0x0000000000000037ULL\r
146\r
147/**\r
77df6ed9 148 Closes a specified file handle.\r
d1f95000 149\r
77df6ed9
RN
150 @param This A pointer to the EFI_FILE_PROTOCOL instance that is the file \r
151 handle to close.\r
d1f95000 152\r
77df6ed9 153 @retval EFI_SUCCESS The file was closed.\r
d1f95000 154\r
155**/\r
156typedef\r
157EFI_STATUS\r
8b13229b 158(EFIAPI *EFI_FILE_CLOSE)(\r
79a36e6f 159 IN EFI_FILE_PROTOCOL *This\r
ed66e1bc 160 );\r
d1f95000 161\r
162/**\r
af2dc6a7 163 Close and delete the file handle.\r
d1f95000 164\r
77df6ed9
RN
165 @param This A pointer to the EFI_FILE_PROTOCOL instance that is the\r
166 handle to the file to delete.\r
167\r
168 @retval EFI_SUCCESS The file was closed and deleted, and the handle was closed.\r
169 @retval EFI_WARN_DELETE_FAILURE The handle was closed, but the file was not deleted.\r
d1f95000 170\r
171**/\r
172typedef\r
173EFI_STATUS\r
8b13229b 174(EFIAPI *EFI_FILE_DELETE)(\r
79a36e6f 175 IN EFI_FILE_PROTOCOL *This\r
ed66e1bc 176 );\r
d1f95000 177\r
178/**\r
77df6ed9 179 Reads data from a file.\r
d1f95000 180\r
77df6ed9
RN
181 @param This A pointer to the EFI_FILE_PROTOCOL instance that is the file\r
182 handle to read data from.\r
183 @param BufferSize On input, the size of the Buffer. On output, the amount of data\r
184 returned in Buffer. In both cases, the size is measured in bytes.\r
185 @param Buffer The buffer into which the data is read.\r
d1f95000 186\r
187 @retval EFI_SUCCESS Data was read.\r
77df6ed9 188 @retval EFI_NO_MEDIA The device has no medium.\r
af2dc6a7 189 @retval EFI_DEVICE_ERROR The device reported an error.\r
77df6ed9
RN
190 @retval EFI_DEVICE_ERROR An attempt was made to read from a deleted file.\r
191 @retval EFI_DEVICE_ERROR On entry, the current file position is beyond the end of the file.\r
af2dc6a7 192 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r
95d0cb14 193 @retval EFI_BUFFER_TOO_SMALL The BufferSize is too small to read the current directory\r
77df6ed9
RN
194 entry. BufferSize has been updated with the size\r
195 needed to complete the request.\r
d1f95000 196\r
197**/\r
198typedef\r
199EFI_STATUS\r
8b13229b 200(EFIAPI *EFI_FILE_READ)(\r
a6508c05 201 IN EFI_FILE_PROTOCOL *This,\r
d1f95000 202 IN OUT UINTN *BufferSize,\r
203 OUT VOID *Buffer\r
ed66e1bc 204 );\r
d1f95000 205\r
206/**\r
77df6ed9 207 Writes data to a file.\r
d1f95000 208\r
77df6ed9
RN
209 @param This A pointer to the EFI_FILE_PROTOCOL instance that is the file\r
210 handle to write data to.\r
211 @param BufferSize On input, the size of the Buffer. On output, the amount of data\r
212 actually written. In both cases, the size is measured in bytes.\r
213 @param Buffer The buffer of data to write.\r
d1f95000 214\r
215 @retval EFI_SUCCESS Data was written.\r
77df6ed9
RN
216 @retval EFI_UNSUPPORTED Writes to open directory files are not supported.\r
217 @retval EFI_NO_MEDIA The device has no medium.\r
af2dc6a7 218 @retval EFI_DEVICE_ERROR The device reported an error.\r
219 @retval EFI_DEVICE_ERROR An attempt was made to write to a deleted file.\r
220 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r
77df6ed9
RN
221 @retval EFI_WRITE_PROTECTED The file or medium is write-protected.\r
222 @retval EFI_ACCESS_DENIED The file was opened read only.\r
af2dc6a7 223 @retval EFI_VOLUME_FULL The volume is full.\r
d1f95000 224\r
225**/\r
226typedef\r
227EFI_STATUS\r
8b13229b 228(EFIAPI *EFI_FILE_WRITE)(\r
a6508c05 229 IN EFI_FILE_PROTOCOL *This,\r
d1f95000 230 IN OUT UINTN *BufferSize,\r
231 IN VOID *Buffer\r
ed66e1bc 232 );\r
d1f95000 233\r
234/**\r
77df6ed9 235 Sets a file's current position.\r
d1f95000 236\r
77df6ed9
RN
237 @param This A pointer to the EFI_FILE_PROTOCOL instance that is the\r
238 file handle to set the requested position on.\r
239 @param Position The byte position from the start of the file to set.\r
240\r
241 @retval EFI_SUCCESS The position was set.\r
242 @retval EFI_UNSUPPORTED The seek request for nonzero is not valid on open\r
243 directories.\r
244 @retval EFI_DEVICE_ERROR An attempt was made to set the position of a deleted file.\r
d1f95000 245\r
246**/\r
247typedef\r
248EFI_STATUS\r
8b13229b 249(EFIAPI *EFI_FILE_SET_POSITION)(\r
a6508c05 250 IN EFI_FILE_PROTOCOL *This,\r
d1f95000 251 IN UINT64 Position\r
ed66e1bc 252 );\r
d1f95000 253\r
254/**\r
77df6ed9
RN
255 Returns a file's current position.\r
256\r
257 @param This A pointer to the EFI_FILE_PROTOCOL instance that is the file\r
258 handle to get the current position on.\r
259 @param Position The address to return the file's current position value.\r
d1f95000 260\r
77df6ed9
RN
261 @retval EFI_SUCCESS The position was returned.\r
262 @retval EFI_UNSUPPORTED The request is not valid on open directories.\r
263 @retval EFI_DEVICE_ERROR An attempt was made to get the position from a deleted file.\r
d1f95000 264\r
265**/\r
266typedef\r
267EFI_STATUS\r
8b13229b 268(EFIAPI *EFI_FILE_GET_POSITION)(\r
a6508c05 269 IN EFI_FILE_PROTOCOL *This,\r
d1f95000 270 OUT UINT64 *Position\r
ed66e1bc 271 );\r
d1f95000 272\r
273/**\r
77df6ed9
RN
274 Returns information about a file.\r
275\r
276 @param This A pointer to the EFI_FILE_PROTOCOL instance that is the file\r
277 handle the requested information is for.\r
278 @param InformationType The type identifier for the information being requested.\r
279 @param BufferSize On input, the size of Buffer. On output, the amount of data\r
280 returned in Buffer. In both cases, the size is measured in bytes.\r
281 @param Buffer A pointer to the data buffer to return. The buffer's type is\r
282 indicated by InformationType.\r
283\r
284 @retval EFI_SUCCESS The information was returned.\r
285 @retval EFI_UNSUPPORTED The InformationType is not known.\r
286 @retval EFI_NO_MEDIA The device has no medium.\r
af2dc6a7 287 @retval EFI_DEVICE_ERROR The device reported an error.\r
288 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r
77df6ed9
RN
289 @retval EFI_BUFFER_TOO_SMALL The BufferSize is too small to read the current directory entry.\r
290 BufferSize has been updated with the size needed to complete\r
291 the request.\r
d1f95000 292**/\r
293typedef\r
294EFI_STATUS\r
8b13229b 295(EFIAPI *EFI_FILE_GET_INFO)(\r
a6508c05 296 IN EFI_FILE_PROTOCOL *This,\r
d1f95000 297 IN EFI_GUID *InformationType,\r
298 IN OUT UINTN *BufferSize,\r
299 OUT VOID *Buffer\r
ed66e1bc 300 );\r
d1f95000 301\r
302/**\r
77df6ed9
RN
303 Sets information about a file.\r
304\r
305 @param File A pointer to the EFI_FILE_PROTOCOL instance that is the file\r
306 handle the information is for.\r
307 @param InformationType The type identifier for the information being set.\r
308 @param BufferSize The size, in bytes, of Buffer.\r
8b67c4c8 309 @param Buffer A pointer to the data buffer to write. The buffer's type is\r
77df6ed9
RN
310 indicated by InformationType.\r
311\r
312 @retval EFI_SUCCESS The information was set.\r
313 @retval EFI_UNSUPPORTED The InformationType is not known.\r
314 @retval EFI_NO_MEDIA The device has no medium.\r
af2dc6a7 315 @retval EFI_DEVICE_ERROR The device reported an error.\r
316 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r
77df6ed9
RN
317 @retval EFI_WRITE_PROTECTED InformationType is EFI_FILE_INFO_ID and the media is\r
318 read-only.\r
319 @retval EFI_WRITE_PROTECTED InformationType is EFI_FILE_PROTOCOL_SYSTEM_INFO_ID\r
320 and the media is read only.\r
321 @retval EFI_WRITE_PROTECTED InformationType is EFI_FILE_SYSTEM_VOLUME_LABEL_ID\r
322 and the media is read-only.\r
323 @retval EFI_ACCESS_DENIED An attempt is made to change the name of a file to a\r
324 file that is already present.\r
325 @retval EFI_ACCESS_DENIED An attempt is being made to change the EFI_FILE_DIRECTORY\r
326 Attribute.\r
327 @retval EFI_ACCESS_DENIED An attempt is being made to change the size of a directory.\r
328 @retval EFI_ACCESS_DENIED InformationType is EFI_FILE_INFO_ID and the file was opened\r
329 read-only and an attempt is being made to modify a field\r
330 other than Attribute.\r
331 @retval EFI_VOLUME_FULL The volume is full.\r
332 @retval EFI_BAD_BUFFER_SIZE BufferSize is smaller than the size of the type indicated\r
333 by InformationType.\r
d1f95000 334\r
335**/\r
336typedef\r
337EFI_STATUS\r
8b13229b 338(EFIAPI *EFI_FILE_SET_INFO)(\r
a6508c05 339 IN EFI_FILE_PROTOCOL *This,\r
d1f95000 340 IN EFI_GUID *InformationType,\r
341 IN UINTN BufferSize,\r
342 IN VOID *Buffer\r
ed66e1bc 343 );\r
d1f95000 344\r
345/**\r
77df6ed9 346 Flushes all modified data associated with a file to a device.\r
d1f95000 347\r
77df6ed9
RN
348 @param This A pointer to the EFI_FILE_PROTOCOL instance that is the file \r
349 handle to flush.\r
d1f95000 350\r
77df6ed9
RN
351 @retval EFI_SUCCESS The data was flushed.\r
352 @retval EFI_NO_MEDIA The device has no medium.\r
af2dc6a7 353 @retval EFI_DEVICE_ERROR The device reported an error.\r
354 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r
77df6ed9
RN
355 @retval EFI_WRITE_PROTECTED The file or medium is write-protected.\r
356 @retval EFI_ACCESS_DENIED The file was opened read-only.\r
af2dc6a7 357 @retval EFI_VOLUME_FULL The volume is full.\r
d1f95000 358\r
359**/\r
360typedef\r
361EFI_STATUS\r
8b13229b 362(EFIAPI *EFI_FILE_FLUSH)(\r
79a36e6f 363 IN EFI_FILE_PROTOCOL *This\r
ed66e1bc 364 );\r
d1f95000 365\r
95d0cb14
RN
366typedef struct {\r
367 //\r
368 // If Event is NULL, then blocking I/O is performed.\r
369 // If Event is not NULL and non-blocking I/O is supported, then non-blocking I/O is performed,\r
370 // and Event will be signaled when the read request is completed.\r
371 // The caller must be prepared to handle the case where the callback associated with Event\r
372 // occurs before the original asynchronous I/O request call returns.\r
373 //\r
374 EFI_EVENT Event;\r
375\r
376 //\r
377 // Defines whether or not the signaled event encountered an error.\r
378 //\r
379 EFI_STATUS Status;\r
380\r
381 //\r
382 // For OpenEx(): Not Used, ignored.\r
383 // For ReadEx(): On input, the size of the Buffer. On output, the amount of data returned in Buffer.\r
384 // In both cases, the size is measured in bytes.\r
385 // For WriteEx(): On input, the size of the Buffer. On output, the amount of data actually written.\r
386 // In both cases, the size is measured in bytes.\r
387 // For FlushEx(): Not used, ignored.\r
388 //\r
389 UINTN BufferSize;\r
390\r
391 //\r
392 // For OpenEx(): Not Used, ignored.\r
393 // For ReadEx(): The buffer into which the data is read.\r
394 // For WriteEx(): The buffer of data to write.\r
395 // For FlushEx(): Not Used, ignored.\r
396 //\r
397 VOID *Buffer;\r
398} EFI_FILE_IO_TOKEN;\r
399\r
400/**\r
401 Opens a new file relative to the source directory's location.\r
402\r
403 @param This A pointer to the EFI_FILE_PROTOCOL instance that is the file\r
404 handle to the source location.\r
405 @param NewHandle A pointer to the location to return the opened handle for the new\r
406 file.\r
407 @param FileName The Null-terminated string of the name of the file to be opened.\r
408 The file name may contain the following path modifiers: "\", ".",\r
409 and "..".\r
410 @param OpenMode The mode to open the file. The only valid combinations that the\r
411 file may be opened with are: Read, Read/Write, or Create/Read/Write.\r
412 @param Attributes Only valid for EFI_FILE_MODE_CREATE, in which case these are the \r
413 attribute bits for the newly created file.\r
414 @param Token A pointer to the token associated with the transaction.\r
415\r
416 @retval EFI_SUCCESS If Event is NULL (blocking I/O): The data was read successfully.\r
417 If Event is not NULL (asynchronous I/O): The request was successfully\r
418 queued for processing.\r
419 @retval EFI_NOT_FOUND The specified file could not be found on the device.\r
420 @retval EFI_NO_MEDIA The device has no medium.\r
421 @retval EFI_MEDIA_CHANGED The device has a different medium in it or the medium is no\r
422 longer supported.\r
423 @retval EFI_DEVICE_ERROR The device reported an error.\r
424 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r
425 @retval EFI_WRITE_PROTECTED An attempt was made to create a file, or open a file for write\r
426 when the media is write-protected.\r
427 @retval EFI_ACCESS_DENIED The service denied access to the file.\r
428 @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the file.\r
429 @retval EFI_VOLUME_FULL The volume is full.\r
430\r
431**/\r
432typedef\r
433EFI_STATUS\r
434(EFIAPI *EFI_FILE_OPEN_EX)(\r
435 IN EFI_FILE_PROTOCOL *This,\r
436 OUT EFI_FILE_PROTOCOL **NewHandle,\r
437 IN CHAR16 *FileName,\r
438 IN UINT64 OpenMode,\r
439 IN UINT64 Attributes,\r
440 IN OUT EFI_FILE_IO_TOKEN *Token\r
441 );\r
442\r
443\r
444/**\r
445 Reads data from a file.\r
446\r
447 @param This A pointer to the EFI_FILE_PROTOCOL instance that is the file handle to read data from.\r
448 @param Token A pointer to the token associated with the transaction.\r
449\r
450 @retval EFI_SUCCESS If Event is NULL (blocking I/O): The data was read successfully.\r
451 If Event is not NULL (asynchronous I/O): The request was successfully\r
452 queued for processing.\r
453 @retval EFI_NO_MEDIA The device has no medium.\r
454 @retval EFI_DEVICE_ERROR The device reported an error.\r
455 @retval EFI_DEVICE_ERROR An attempt was made to read from a deleted file.\r
456 @retval EFI_DEVICE_ERROR On entry, the current file position is beyond the end of the file.\r
457 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r
458 @retval EFI_OUT_OF_RESOURCES Unable to queue the request due to lack of resources.\r
459**/\r
460typedef\r
461EFI_STATUS\r
462(EFIAPI *EFI_FILE_READ_EX) (\r
463 IN EFI_FILE_PROTOCOL *This,\r
464 IN OUT EFI_FILE_IO_TOKEN *Token\r
465);\r
466\r
467\r
468/**\r
469 Writes data to a file.\r
470\r
471 @param This A pointer to the EFI_FILE_PROTOCOL instance that is the file handle to write data to.\r
472 @param Token A pointer to the token associated with the transaction.\r
473\r
474 @retval EFI_SUCCESS If Event is NULL (blocking I/O): The data was read successfully.\r
475 If Event is not NULL (asynchronous I/O): The request was successfully\r
476 queued for processing.\r
477 @retval EFI_UNSUPPORTED Writes to open directory files are not supported.\r
478 @retval EFI_NO_MEDIA The device has no medium.\r
479 @retval EFI_DEVICE_ERROR The device reported an error.\r
480 @retval EFI_DEVICE_ERROR An attempt was made to write to a deleted file.\r
481 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r
482 @retval EFI_WRITE_PROTECTED The file or medium is write-protected.\r
483 @retval EFI_ACCESS_DENIED The file was opened read only.\r
484 @retval EFI_VOLUME_FULL The volume is full.\r
485 @retval EFI_OUT_OF_RESOURCES Unable to queue the request due to lack of resources.\r
486**/\r
487typedef\r
488EFI_STATUS\r
489(EFIAPI *EFI_FILE_WRITE_EX) (\r
490 IN EFI_FILE_PROTOCOL *This,\r
491 IN OUT EFI_FILE_IO_TOKEN *Token \r
492);\r
493\r
494/**\r
495 Flushes all modified data associated with a file to a device.\r
496\r
497 @param This A pointer to the EFI_FILE_PROTOCOL instance that is the file \r
498 handle to flush.\r
499 @param Token A pointer to the token associated with the transaction.\r
500\r
501 @retval EFI_SUCCESS If Event is NULL (blocking I/O): The data was read successfully.\r
502 If Event is not NULL (asynchronous I/O): The request was successfully\r
503 queued for processing.\r
504 @retval EFI_NO_MEDIA The device has no medium.\r
505 @retval EFI_DEVICE_ERROR The device reported an error.\r
506 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r
507 @retval EFI_WRITE_PROTECTED The file or medium is write-protected.\r
508 @retval EFI_ACCESS_DENIED The file was opened read-only.\r
509 @retval EFI_VOLUME_FULL The volume is full.\r
510 @retval EFI_OUT_OF_RESOURCES Unable to queue the request due to lack of resources.\r
511\r
512**/\r
513typedef\r
514EFI_STATUS\r
515(EFIAPI *EFI_FILE_FLUSH_EX) (\r
516 IN EFI_FILE_PROTOCOL *This,\r
517 IN OUT EFI_FILE_IO_TOKEN *Token\r
518 );\r
519\r
37eae4c7
RN
520#define EFI_FILE_PROTOCOL_REVISION 0x00010000\r
521#define EFI_FILE_PROTOCOL_REVISION2 0x00020000\r
522#define EFI_FILE_PROTOCOL_LATEST_REVISION EFI_FILE_PROTOCOL_REVISION2\r
523\r
a6508c05 524//\r
525// Revision defined in EFI1.1.\r
526// \r
527#define EFI_FILE_REVISION EFI_FILE_PROTOCOL_REVISION\r
d1f95000 528\r
44717a39 529///\r
530/// The EFI_FILE_PROTOCOL provides file IO access to supported file systems.\r
531/// An EFI_FILE_PROTOCOL provides access to a file's or directory's contents, \r
532/// and is also a reference to a location in the directory tree of the file system \r
533/// in which the file resides. With any given file handle, other files may be opened \r
534/// relative to this file's location, yielding new file handles.\r
535///\r
a6508c05 536struct _EFI_FILE_PROTOCOL {\r
1f08a159 537 ///\r
538 /// The version of the EFI_FILE_PROTOCOL interface. The version specified \r
37eae4c7
RN
539 /// by this specification is EFI_FILE_PROTOCOL_LATEST_REVISION.\r
540 /// Future versions are required to be backward compatible to version 1.0.\r
1f08a159 541 ///\r
d1f95000 542 UINT64 Revision;\r
543 EFI_FILE_OPEN Open;\r
544 EFI_FILE_CLOSE Close;\r
545 EFI_FILE_DELETE Delete;\r
546 EFI_FILE_READ Read;\r
547 EFI_FILE_WRITE Write;\r
548 EFI_FILE_GET_POSITION GetPosition;\r
549 EFI_FILE_SET_POSITION SetPosition;\r
550 EFI_FILE_GET_INFO GetInfo;\r
551 EFI_FILE_SET_INFO SetInfo;\r
552 EFI_FILE_FLUSH Flush;\r
95d0cb14
RN
553 EFI_FILE_OPEN_EX OpenEx;\r
554 EFI_FILE_READ_EX ReadEx;\r
555 EFI_FILE_WRITE_EX WriteEx;\r
556 EFI_FILE_FLUSH_EX FlushEx;\r
d1f95000 557};\r
558\r
559\r
560extern EFI_GUID gEfiSimpleFileSystemProtocolGuid;\r
561\r
562#endif\r