3 Copyright (c) 2004, Intel Corporation
4 All rights reserved. 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
);
41 (EFIAPI
*EFI_VOLUME_OPEN
) (
42 IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
* This
,
48 Open the root directory on a volume.
51 This - Protocol instance pointer.
52 Root - Returns an Open file handle for the root directory
55 EFI_SUCCESS - The device was opened.
56 EFI_UNSUPPORTED - This volume does not suppor the file system.
57 EFI_NO_MEDIA - The device has no media.
58 EFI_DEVICE_ERROR - The device reported an error.
59 EFI_VOLUME_CORRUPTED - The file system structures are corrupted
60 EFI_ACCESS_DENIED - The service denied access to the file
61 EFI_OUT_OF_RESOURCES - The volume was not opened due to lack of resources
66 #define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION 0x00010000
68 typedef struct _EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
{
70 EFI_VOLUME_OPEN OpenVolume
;
71 } EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
;
75 (EFIAPI
*EFI_FILE_OPEN
) (
77 OUT EFI_FILE
**NewHandle
,
85 Open the root directory on a volume.
88 File - Protocol instance pointer.
89 NewHandle - Returns File Handle for FileName
90 FileName - Null terminated string. "\", ".", and ".." are supported
91 OpenMode - Open mode for file.
92 Attributes - Only used for EFI_FILE_MODE_CREATE
95 EFI_SUCCESS - The device was opened.
96 EFI_NOT_FOUND - The specified file could not be found on the device
97 EFI_NO_MEDIA - The device has no media.
98 EFI_MEDIA_CHANGED - The media has changed
99 EFI_DEVICE_ERROR - The device reported an error.
100 EFI_VOLUME_CORRUPTED - The file system structures are corrupted
101 EFI_ACCESS_DENIED - The service denied access to the file
102 EFI_OUT_OF_RESOURCES - The volume was not opened due to lack of resources
103 EFI_VOLUME_FULL - The volume is full.
111 #define EFI_FILE_MODE_READ 0x0000000000000001
112 #define EFI_FILE_MODE_WRITE 0x0000000000000002
113 #define EFI_FILE_MODE_CREATE 0x8000000000000000
118 #define EFI_FILE_READ_ONLY 0x0000000000000001
119 #define EFI_FILE_HIDDEN 0x0000000000000002
120 #define EFI_FILE_SYSTEM 0x0000000000000004
121 #define EFI_FILE_RESERVED 0x0000000000000008
122 #define EFI_FILE_DIRECTORY 0x0000000000000010
123 #define EFI_FILE_ARCHIVE 0x0000000000000020
124 #define EFI_FILE_VALID_ATTR 0x0000000000000037
128 (EFIAPI
*EFI_FILE_CLOSE
) (
134 Close the file handle
137 File - Protocol instance pointer.
140 EFI_SUCCESS- The device was opened.
147 (EFIAPI
*EFI_FILE_DELETE
) (
153 Close and delete the file handle
156 File - Protocol instance pointer.
159 EFI_SUCCESS - The device was opened.
160 EFI_WARN_DELETE_FAILURE - The handle was closed but the file was not
168 (EFIAPI
*EFI_FILE_READ
) (
170 IN OUT UINTN
*BufferSize
,
176 Read data from the file.
179 File - Protocol instance pointer.
180 BufferSize - On input size of buffer, on output amount of data in
182 Buffer - The buffer in which data is read.
185 EFI_SUCCESS - Data was read.
186 EFI_NO_MEDIA - The device has no media
187 EFI_DEVICE_ERROR - The device reported an error
188 EFI_VOLUME_CORRUPTED - The file system structures are corrupted
189 EFI_BUFFER_TO_SMALL - BufferSize is too small. BufferSize contains
197 (EFIAPI
*EFI_FILE_WRITE
) (
199 IN OUT UINTN
*BufferSize
,
205 Write data from to the file.
208 File - Protocol instance pointer.
209 BufferSize - On input size of buffer, on output amount of data in buffer.
210 Buffer - The buffer in which data to write.
213 EFI_SUCCESS - Data was written.
214 EFI_UNSUPPORT - Writes to Open directory are not supported
215 EFI_NO_MEDIA - The device has no media
216 EFI_DEVICE_ERROR - The device reported an error
217 EFI_VOLUME_CORRUPTED - The file system structures are corrupted
218 EFI_WRITE_PROTECTED - The device is write protected
219 EFI_ACCESS_DENIED - The file was open for read only
220 EFI_VOLUME_FULL - The volume is full
227 (EFIAPI
*EFI_FILE_SET_POSITION
) (
234 Set a files current position
237 File - Protocol instance pointer.
238 Position - Byte possition from the start of the file
241 EFI_SUCCESS - Data was written.
242 EFI_UNSUPPORTED - Seek request for non-zero is not valid on open.
249 (EFIAPI
*EFI_FILE_GET_POSITION
) (
256 Get a files current position
259 File - Protocol instance pointer.
260 Position - Byte possition from the start of the file
263 EFI_SUCCESS - Data was written.
264 EFI_UNSUPPORTED - Seek request for non-zero is not valid on open.
271 (EFIAPI
*EFI_FILE_GET_INFO
) (
273 IN EFI_GUID
* InformationType
,
274 IN OUT UINTN
*BufferSize
,
280 Get information about a file
283 File - Protocol instance pointer.
284 InformationType - Type of info to return in Buffer
285 BufferSize - On input size of buffer, on output amount of data in
287 Buffer - The buffer to return data.
290 EFI_SUCCESS - Data was returned.
291 EFI_UNSUPPORT - InformationType is not supported
292 EFI_NO_MEDIA - The device has no media
293 EFI_DEVICE_ERROR - The device reported an error
294 EFI_VOLUME_CORRUPTED - The file system structures are corrupted
295 EFI_WRITE_PROTECTED - The device is write protected
296 EFI_ACCESS_DENIED - The file was open for read only
297 EFI_BUFFER_TOO_SMALL - Buffer was too small, required size returned in
304 (EFIAPI
*EFI_FILE_SET_INFO
) (
306 IN EFI_GUID
* InformationType
,
313 Set information about a file
316 File - Protocol instance pointer.
317 InformationType - Type of info in Buffer
318 BufferSize - Size of buffer.
319 Buffer - The data to write.
322 EFI_SUCCESS - Data was returned.
323 EFI_UNSUPPORT - InformationType is not supported
324 EFI_NO_MEDIA - The device has no media
325 EFI_DEVICE_ERROR - The device reported an error
326 EFI_VOLUME_CORRUPTED - The file system structures are corrupted
327 EFI_WRITE_PROTECTED - The device is write protected
328 EFI_ACCESS_DENIED - The file was open for read only
334 (EFIAPI
*EFI_FILE_FLUSH
) (
340 Flush data back for the file handle
343 File - Protocol instance pointer.
346 EFI_SUCCESS - Data was written.
347 EFI_UNSUPPORT - Writes to Open directory are not supported
348 EFI_NO_MEDIA - The device has no media
349 EFI_DEVICE_ERROR - The device reported an error
350 EFI_VOLUME_CORRUPTED - The file system structures are corrupted
351 EFI_WRITE_PROTECTED - The device is write protected
352 EFI_ACCESS_DENIED - The file was open for read only
353 EFI_VOLUME_FULL - The volume is full
358 #define EFI_FILE_HANDLE_REVISION 0x00010000
359 typedef struct _EFI_FILE
{
362 EFI_FILE_CLOSE Close
;
363 EFI_FILE_DELETE Delete
;
365 EFI_FILE_WRITE Write
;
366 EFI_FILE_GET_POSITION GetPosition
;
367 EFI_FILE_SET_POSITION SetPosition
;
368 EFI_FILE_GET_INFO GetInfo
;
369 EFI_FILE_SET_INFO SetInfo
;
370 EFI_FILE_FLUSH Flush
;
372 EFI_FILE
, *EFI_FILE_HANDLE
;
374 extern EFI_GUID gEfiSimpleFileSystemProtocolGuid
;