3 Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 SimpleFileSystem protocol as defined in the EFI 1.0 specification.
20 The SimpleFileSystem protocol is the programatic access to the FAT (12,16,32)
21 file system specified in EFI 1.0. It can also be used to abstract a file
22 system other than FAT.
24 EFI 1.0 can boot from any valid EFI image contained in a SimpleFileSystem
28 #ifndef _SIMPLE_FILE_SYSTEM_H_
29 #define _SIMPLE_FILE_SYSTEM_H_
31 #define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID \
33 0x964e5b22, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} \
36 EFI_FORWARD_DECLARATION (EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
);
37 EFI_FORWARD_DECLARATION (EFI_FILE
);
38 typedef struct _EFI_FILE
*EFI_FILE_HANDLE
;
39 typedef struct _EFI_FILE EFI_FILE_PROTOCOL
;
43 (EFIAPI
*EFI_VOLUME_OPEN
) (
44 IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
* This
,
50 Open the root directory on a volume.
53 This - Protocol instance pointer.
54 Root - Returns an Open file handle for the root directory
57 EFI_SUCCESS - The device was opened.
58 EFI_UNSUPPORTED - This volume does not suppor the file system.
59 EFI_NO_MEDIA - The device has no media.
60 EFI_DEVICE_ERROR - The device reported an error.
61 EFI_VOLUME_CORRUPTED - The file system structures are corrupted
62 EFI_ACCESS_DENIED - The service denied access to the file
63 EFI_OUT_OF_RESOURCES - The volume was not opened due to lack of resources
68 #define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION 0x00010000
70 struct _EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
{
72 EFI_VOLUME_OPEN OpenVolume
;
77 (EFIAPI
*EFI_FILE_OPEN
) (
79 OUT EFI_FILE
**NewHandle
,
87 Open the root directory on a volume.
90 File - Protocol instance pointer.
91 NewHandle - Returns File Handle for FileName
92 FileName - Null terminated string. "\", ".", and ".." are supported
93 OpenMode - Open mode for file.
94 Attributes - Only used for EFI_FILE_MODE_CREATE
97 EFI_SUCCESS - The device was opened.
98 EFI_NOT_FOUND - The specified file could not be found on the device
99 EFI_NO_MEDIA - The device has no media.
100 EFI_MEDIA_CHANGED - The media has changed
101 EFI_DEVICE_ERROR - The device reported an error.
102 EFI_VOLUME_CORRUPTED - The file system structures are corrupted
103 EFI_ACCESS_DENIED - The service denied access to the file
104 EFI_OUT_OF_RESOURCES - The volume was not opened due to lack of resources
105 EFI_VOLUME_FULL - The volume is full.
113 #define EFI_FILE_MODE_READ 0x0000000000000001
114 #define EFI_FILE_MODE_WRITE 0x0000000000000002
115 #define EFI_FILE_MODE_CREATE 0x8000000000000000ULL
120 #define EFI_FILE_READ_ONLY 0x0000000000000001
121 #define EFI_FILE_HIDDEN 0x0000000000000002
122 #define EFI_FILE_SYSTEM 0x0000000000000004
123 #define EFI_FILE_RESERVED 0x0000000000000008
124 #define EFI_FILE_DIRECTORY 0x0000000000000010
125 #define EFI_FILE_ARCHIVE 0x0000000000000020
126 #define EFI_FILE_VALID_ATTR 0x0000000000000037
130 (EFIAPI
*EFI_FILE_CLOSE
) (
136 Close the file handle
139 File - Protocol instance pointer.
142 EFI_SUCCESS- The device was opened.
149 (EFIAPI
*EFI_FILE_DELETE
) (
155 Close and delete the file handle
158 File - Protocol instance pointer.
161 EFI_SUCCESS - The device was opened.
162 EFI_WARN_DELETE_FAILURE - The handle was closed but the file was not
170 (EFIAPI
*EFI_FILE_READ
) (
172 IN OUT UINTN
*BufferSize
,
178 Read data from the file.
181 File - Protocol instance pointer.
182 BufferSize - On input size of buffer, on output amount of data in
184 Buffer - The buffer in which data is read.
187 EFI_SUCCESS - Data was read.
188 EFI_NO_MEDIA - The device has no media
189 EFI_DEVICE_ERROR - The device reported an error
190 EFI_VOLUME_CORRUPTED - The file system structures are corrupted
191 EFI_BUFFER_TO_SMALL - BufferSize is too small. BufferSize contains
199 (EFIAPI
*EFI_FILE_WRITE
) (
201 IN OUT UINTN
*BufferSize
,
207 Write data from to the file.
210 File - Protocol instance pointer.
211 BufferSize - On input size of buffer, on output amount of data in buffer.
212 Buffer - The buffer in which data to write.
215 EFI_SUCCESS - Data was written.
216 EFI_UNSUPPORT - Writes to Open directory are not supported
217 EFI_NO_MEDIA - The device has no media
218 EFI_DEVICE_ERROR - The device reported an error
219 EFI_VOLUME_CORRUPTED - The file system structures are corrupted
220 EFI_WRITE_PROTECTED - The device is write protected
221 EFI_ACCESS_DENIED - The file was open for read only
222 EFI_VOLUME_FULL - The volume is full
229 (EFIAPI
*EFI_FILE_SET_POSITION
) (
236 Set a files current position
239 File - Protocol instance pointer.
240 Position - Byte possition from the start of the file
243 EFI_SUCCESS - Data was written.
244 EFI_UNSUPPORTED - Seek request for non-zero is not valid on open.
251 (EFIAPI
*EFI_FILE_GET_POSITION
) (
258 Get a files current position
261 File - Protocol instance pointer.
262 Position - Byte possition from the start of the file
265 EFI_SUCCESS - Data was written.
266 EFI_UNSUPPORTED - Seek request for non-zero is not valid on open.
273 (EFIAPI
*EFI_FILE_GET_INFO
) (
275 IN EFI_GUID
* InformationType
,
276 IN OUT UINTN
*BufferSize
,
282 Get information about a file
285 File - Protocol instance pointer.
286 InformationType - Type of info to return in Buffer
287 BufferSize - On input size of buffer, on output amount of data in
289 Buffer - The buffer to return data.
292 EFI_SUCCESS - Data was returned.
293 EFI_UNSUPPORT - InformationType is not supported
294 EFI_NO_MEDIA - The device has no media
295 EFI_DEVICE_ERROR - The device reported an error
296 EFI_VOLUME_CORRUPTED - The file system structures are corrupted
297 EFI_WRITE_PROTECTED - The device is write protected
298 EFI_ACCESS_DENIED - The file was open for read only
299 EFI_BUFFER_TOO_SMALL - Buffer was too small, required size returned in
306 (EFIAPI
*EFI_FILE_SET_INFO
) (
308 IN EFI_GUID
* InformationType
,
315 Set information about a file
318 File - Protocol instance pointer.
319 InformationType - Type of info in Buffer
320 BufferSize - Size of buffer.
321 Buffer - The data to write.
324 EFI_SUCCESS - Data was returned.
325 EFI_UNSUPPORT - InformationType is not supported
326 EFI_NO_MEDIA - The device has no media
327 EFI_DEVICE_ERROR - The device reported an error
328 EFI_VOLUME_CORRUPTED - The file system structures are corrupted
329 EFI_WRITE_PROTECTED - The device is write protected
330 EFI_ACCESS_DENIED - The file was open for read only
336 (EFIAPI
*EFI_FILE_FLUSH
) (
342 Flush data back for the file handle
345 File - Protocol instance pointer.
348 EFI_SUCCESS - Data was written.
349 EFI_UNSUPPORT - Writes to Open directory are not supported
350 EFI_NO_MEDIA - The device has no media
351 EFI_DEVICE_ERROR - The device reported an error
352 EFI_VOLUME_CORRUPTED - The file system structures are corrupted
353 EFI_WRITE_PROTECTED - The device is write protected
354 EFI_ACCESS_DENIED - The file was open for read only
355 EFI_VOLUME_FULL - The volume is full
360 #define EFI_FILE_HANDLE_REVISION 0x00010000
364 EFI_FILE_CLOSE Close
;
365 EFI_FILE_DELETE Delete
;
367 EFI_FILE_WRITE Write
;
368 EFI_FILE_GET_POSITION GetPosition
;
369 EFI_FILE_SET_POSITION SetPosition
;
370 EFI_FILE_GET_INFO GetInfo
;
371 EFI_FILE_SET_INFO SetInfo
;
372 EFI_FILE_FLUSH Flush
;
375 extern EFI_GUID gEfiSimpleFileSystemProtocolGuid
;