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