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