2 SimpleFileSystem protocol as defined in the EFI 1.0 specification.
4 The SimpleFileSystem protocol is the programatic access to the FAT (12,16,32)
5 file system specified in EFI 1.0. It can also be used to abstract a file
8 EFI 1.0 can boot from any valid EFI image contained in a SimpleFileSystem
10 Copyright (c) 2006, Intel Corporation
11 All rights reserved. This program and the accompanying materials
12 are licensed and made available under the terms and conditions of the BSD License
13 which accompanies this distribution. The full text of the license may be found at
14 http://opensource.org/licenses/bsd-license.php
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.
21 #ifndef __SIMPLE_FILE_SYSTEM_H__
22 #define __SIMPLE_FILE_SYSTEM_H__
24 #define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID \
26 0x964e5b22, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
29 typedef struct _EFI_SIMPLE_FILE_SYSTEM_PROTOCOL EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
;
31 typedef struct _EFI_FILE_PROTOCOL EFI_FILE_PROTOCOL
;
32 typedef struct _EFI_FILE_PROTOCOL
*EFI_FILE_HANDLE
;
36 // Protocol GUID defined in EFI1.1.
38 #define SIMPLE_FILE_SYSTEM_PROTOCOL EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID
41 // Protocol defined in EFI1.1.
43 typedef EFI_SIMPLE_FILE_SYSTEM_PROTOCOL EFI_FILE_IO_INTERFACE
;
44 typedef struct _EFI_FILE_PROTOCOL EFI_FILE
;
47 Open the root directory on a volume.
49 @param This Protocol instance pointer.
50 @param Root Returns an Open file handle for the root directory
52 @retval EFI_SUCCESS The device was opened.
53 @retval EFI_UNSUPPORTED This volume does not suppor the file system.
54 @retval EFI_NO_MEDIA The device has no media.
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
63 (EFIAPI
*EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_OPEN_VOLUME
) (
64 IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
*This
,
65 OUT EFI_FILE_PROTOCOL
**Root
69 #define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION 0x00010000
71 // Revision defined in EFI1.1
73 #define EFI_FILE_IO_INTERFACE_REVISION EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION
75 struct _EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
{
77 EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_OPEN_VOLUME OpenVolume
;
81 Open the root directory on a volume.
83 @param This Protocol instance pointer.
84 @param NewHandle Returns File Handle for FileName
85 @param FileName Null terminated string. "\", ".", and ".." are supported
86 @param OpenMode Open mode for file.
87 @param Attributes Only used for EFI_FILE_MODE_CREATE
89 @retval EFI_SUCCESS The device was opened.
90 @retval EFI_NOT_FOUND The specified file could not be found on the device
91 @retval EFI_NO_MEDIA The device has no media.
92 @retval EFI_MEDIA_CHANGED The media has changed
93 @retval EFI_DEVICE_ERROR The device reported an error.
94 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted
95 @retval EFI_ACCESS_DENIED The service denied access to the file
96 @retval EFI_OUT_OF_RESOURCES The volume was not opened due to lack of resources
97 @retval EFI_VOLUME_FULL The volume is full.
102 (EFIAPI
*EFI_FILE_OPEN
) (
103 IN EFI_FILE_PROTOCOL
*This
,
104 OUT EFI_FILE_PROTOCOL
**NewHandle
,
114 #define EFI_FILE_MODE_READ 0x0000000000000001ULL
115 #define EFI_FILE_MODE_WRITE 0x0000000000000002ULL
116 #define EFI_FILE_MODE_CREATE 0x8000000000000000ULL
121 #define EFI_FILE_READ_ONLY 0x0000000000000001ULL
122 #define EFI_FILE_HIDDEN 0x0000000000000002ULL
123 #define EFI_FILE_SYSTEM 0x0000000000000004ULL
124 #define EFI_FILE_RESERVED 0x0000000000000008ULL
125 #define EFI_FILE_DIRECTORY 0x0000000000000010ULL
126 #define EFI_FILE_ARCHIVE 0x0000000000000020ULL
127 #define EFI_FILE_VALID_ATTR 0x0000000000000037ULL
130 Close the file handle
132 @param This Protocol instance pointer.
134 @retval EFI_SUCCESS The device was opened.
139 (EFIAPI
*EFI_FILE_CLOSE
) (
145 Close and delete the file handle
147 @param This Protocol instance pointer.
149 @retval EFI_SUCCESS The device was opened.
150 @retval EFI_WARN_DELETE_FAILURE The handle was closed but the file was not deleted
155 (EFIAPI
*EFI_FILE_DELETE
) (
161 Read data from the file.
163 @param This Protocol instance pointer.
164 @param BufferSize On input size of buffer, on output amount of data in buffer.
165 @param Buffer The buffer in which data is read.
167 @retval EFI_SUCCESS Data was read.
168 @retval EFI_NO_MEDIA The device has no media
169 @retval EFI_DEVICE_ERROR The device reported an error
170 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted
171 @retval EFI_BUFFER_TO_SMALL BufferSize is too small. BufferSize contains required size
176 (EFIAPI
*EFI_FILE_READ
) (
177 IN EFI_FILE_PROTOCOL
*This
,
178 IN OUT UINTN
*BufferSize
,
184 Write data from to the file.
186 @param This Protocol instance pointer.
187 @param BufferSize On input size of buffer, on output amount of data in buffer.
188 @param Buffer The buffer in which data to write.
190 @retval EFI_SUCCESS Data was written.
191 @retval EFI_UNSUPPORT Writes to Open directory are not supported
192 @retval EFI_NO_MEDIA The device has no media
193 @retval EFI_DEVICE_ERROR The device reported an error
194 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted
195 @retval EFI_WRITE_PROTECTED The device is write protected
196 @retval EFI_ACCESS_DENIED The file was open for read only
197 @retval EFI_VOLUME_FULL The volume is full
202 (EFIAPI
*EFI_FILE_WRITE
) (
203 IN EFI_FILE_PROTOCOL
*This
,
204 IN OUT UINTN
*BufferSize
,
210 Set a files current position
212 @param This Protocol instance pointer.
213 @param Position Byte possition from the start of the file
215 @retval EFI_SUCCESS Data was written.
216 @retval EFI_UNSUPPORTED Seek request for non-zero is not valid on open.
221 (EFIAPI
*EFI_FILE_SET_POSITION
) (
222 IN EFI_FILE_PROTOCOL
*This
,
228 Get a files current position
230 @param This Protocol instance pointer.
231 @param Position Byte possition from the start of the file
233 @retval EFI_SUCCESS Data was written.
234 @retval EFI_UNSUPPORTED Seek request for non-zero is not valid on open.
239 (EFIAPI
*EFI_FILE_GET_POSITION
) (
240 IN EFI_FILE_PROTOCOL
*This
,
246 Get information about a file
248 @param This Protocol instance pointer.
249 @param InformationType Type of info to return in Buffer
250 @param BufferSize On input size of buffer, on output amount of data in buffer.
251 @param Buffer The buffer to return data.
253 @retval EFI_SUCCESS Data was returned.
254 @retval EFI_UNSUPPORT InformationType is not supported
255 @retval EFI_NO_MEDIA The device has no media
256 @retval EFI_DEVICE_ERROR The device reported an error
257 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted
258 @retval EFI_WRITE_PROTECTED The device is write protected
259 @retval EFI_ACCESS_DENIED The file was open for read only
260 @retval EFI_BUFFER_TOO_SMALL Buffer was too small, required size returned in BufferSize
265 (EFIAPI
*EFI_FILE_GET_INFO
) (
266 IN EFI_FILE_PROTOCOL
*This
,
267 IN EFI_GUID
*InformationType
,
268 IN OUT UINTN
*BufferSize
,
274 Set information about a file
276 @param File Protocol instance pointer.
277 @param InformationType Type of info in Buffer
278 @param BufferSize Size of buffer.
279 @param Buffer The data to write.
281 @retval EFI_SUCCESS Data was returned.
282 @retval EFI_UNSUPPORT InformationType is not supported
283 @retval EFI_NO_MEDIA The device has no media
284 @retval EFI_DEVICE_ERROR The device reported an error
285 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted
286 @retval EFI_WRITE_PROTECTED The device is write protected
287 @retval EFI_ACCESS_DENIED The file was open for read only
292 (EFIAPI
*EFI_FILE_SET_INFO
) (
293 IN EFI_FILE_PROTOCOL
*This
,
294 IN EFI_GUID
*InformationType
,
301 Flush data back for the file handle
303 @param This Protocol instance pointer.
305 @retval EFI_SUCCESS Data was written.
306 @retval EFI_UNSUPPORT Writes to Open directory are not supported
307 @retval EFI_NO_MEDIA The device has no media
308 @retval EFI_DEVICE_ERROR The device reported an error
309 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted
310 @retval EFI_WRITE_PROTECTED The device is write protected
311 @retval EFI_ACCESS_DENIED The file was open for read only
312 @retval EFI_VOLUME_FULL The volume is full
317 (EFIAPI
*EFI_FILE_FLUSH
) (
322 #define EFI_FILE_PROTOCOL_REVISION 0x00010000
324 // Revision defined in EFI1.1.
326 #define EFI_FILE_REVISION EFI_FILE_PROTOCOL_REVISION
328 struct _EFI_FILE_PROTOCOL
{
331 EFI_FILE_CLOSE Close
;
332 EFI_FILE_DELETE Delete
;
334 EFI_FILE_WRITE Write
;
335 EFI_FILE_GET_POSITION GetPosition
;
336 EFI_FILE_SET_POSITION SetPosition
;
337 EFI_FILE_GET_INFO GetInfo
;
338 EFI_FILE_SET_INFO SetInfo
;
339 EFI_FILE_FLUSH Flush
;
343 extern EFI_GUID gEfiSimpleFileSystemProtocolGuid
;