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.
19 Module Name: SimpleFileSystem.h
23 #ifndef __SIMPLE_FILE_SYSTEM_H__
24 #define __SIMPLE_FILE_SYSTEM_H__
26 #define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID \
28 0x964e5b22, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
31 typedef struct _EFI_SIMPLE_FILE_SYSTEM_PROTOCOL EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
;
32 typedef struct _EFI_FILE EFI_FILE
;
33 typedef struct _EFI_FILE
*EFI_FILE_HANDLE
;
34 typedef struct _EFI_FILE EFI_FILE_PROTOCOL
;
37 Open the root directory on a volume.
39 @param This Protocol instance pointer.
40 @param Root Returns an Open file handle for the root directory
42 @retval EFI_SUCCESS The device was opened.
43 @retval EFI_UNSUPPORTED This volume does not suppor the file system.
44 @retval EFI_NO_MEDIA The device has no media.
45 @retval EFI_DEVICE_ERROR The device reported an error.
46 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted
47 @retval EFI_ACCESS_DENIED The service denied access to the file
48 @retval EFI_OUT_OF_RESOURCES The volume was not opened due to lack of resources
53 (EFIAPI
*EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_OPEN_VOLUME
) (
54 IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
*This
,
59 #define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION 0x00010000
61 struct _EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
{
63 EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_OPEN_VOLUME OpenVolume
;
67 Open the root directory on a volume.
69 @param This Protocol instance pointer.
70 @param NewHandle Returns File Handle for FileName
71 @param FileName Null terminated string. "\", ".", and ".." are supported
72 @param OpenMode Open mode for file.
73 @param Attributes Only used for EFI_FILE_MODE_CREATE
75 @retval EFI_SUCCESS The device was opened.
76 @retval EFI_NOT_FOUND The specified file could not be found on the device
77 @retval EFI_NO_MEDIA The device has no media.
78 @retval EFI_MEDIA_CHANGED The media has changed
79 @retval EFI_DEVICE_ERROR The device reported an error.
80 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted
81 @retval EFI_ACCESS_DENIED The service denied access to the file
82 @retval EFI_OUT_OF_RESOURCES The volume was not opened due to lack of resources
83 @retval EFI_VOLUME_FULL The volume is full.
88 (EFIAPI
*EFI_FILE_OPEN
) (
90 OUT EFI_FILE
**NewHandle
,
100 #define EFI_FILE_MODE_READ 0x0000000000000001ULL
101 #define EFI_FILE_MODE_WRITE 0x0000000000000002ULL
102 #define EFI_FILE_MODE_CREATE 0x8000000000000000ULL
107 #define EFI_FILE_READ_ONLY 0x0000000000000001ULL
108 #define EFI_FILE_HIDDEN 0x0000000000000002ULL
109 #define EFI_FILE_SYSTEM 0x0000000000000004ULL
110 #define EFI_FILE_RESERVED 0x0000000000000008ULL
111 #define EFI_FILE_DIRECTORY 0x0000000000000010ULL
112 #define EFI_FILE_ARCHIVE 0x0000000000000020ULL
113 #define EFI_FILE_VALID_ATTR 0x0000000000000037ULL
116 Close the file handle
118 @param This Protocol instance pointer.
120 @retval EFI_SUCCESS The device was opened.
125 (EFIAPI
*EFI_FILE_CLOSE
) (
131 Close and delete the file handle
133 @param This Protocol instance pointer.
135 @retval EFI_SUCCESS The device was opened.
136 @retval EFI_WARN_DELETE_FAILURE The handle was closed but the file was not deleted
141 (EFIAPI
*EFI_FILE_DELETE
) (
147 Read data from the file.
149 @param This Protocol instance pointer.
150 @param BufferSize On input size of buffer, on output amount of data in buffer.
151 @param Buffer The buffer in which data is read.
153 @retval EFI_SUCCESS Data was read.
154 @retval EFI_NO_MEDIA The device has no media
155 @retval EFI_DEVICE_ERROR The device reported an error
156 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted
157 @retval EFI_BUFFER_TO_SMALL BufferSize is too small. BufferSize contains required size
162 (EFIAPI
*EFI_FILE_READ
) (
164 IN OUT UINTN
*BufferSize
,
170 Write data from to the file.
172 @param This Protocol instance pointer.
173 @param BufferSize On input size of buffer, on output amount of data in buffer.
174 @param Buffer The buffer in which data to write.
176 @retval EFI_SUCCESS Data was written.
177 @retval EFI_UNSUPPORT Writes to Open directory are not supported
178 @retval EFI_NO_MEDIA The device has no media
179 @retval EFI_DEVICE_ERROR The device reported an error
180 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted
181 @retval EFI_WRITE_PROTECTED The device is write protected
182 @retval EFI_ACCESS_DENIED The file was open for read only
183 @retval EFI_VOLUME_FULL The volume is full
188 (EFIAPI
*EFI_FILE_WRITE
) (
190 IN OUT UINTN
*BufferSize
,
196 Set a files current position
198 @param This Protocol instance pointer.
199 @param Position Byte possition from the start of the file
201 @retval EFI_SUCCESS Data was written.
202 @retval EFI_UNSUPPORTED Seek request for non-zero is not valid on open.
207 (EFIAPI
*EFI_FILE_SET_POSITION
) (
214 Get a files current position
216 @param This Protocol instance pointer.
217 @param Position Byte possition from the start of the file
219 @retval EFI_SUCCESS Data was written.
220 @retval EFI_UNSUPPORTED Seek request for non-zero is not valid on open.
225 (EFIAPI
*EFI_FILE_GET_POSITION
) (
232 Get information about a file
234 @param This Protocol instance pointer.
235 @param InformationType Type of info to return in Buffer
236 @param BufferSize On input size of buffer, on output amount of data in buffer.
237 @param Buffer The buffer to return data.
239 @retval EFI_SUCCESS Data was returned.
240 @retval EFI_UNSUPPORT InformationType is not supported
241 @retval EFI_NO_MEDIA The device has no media
242 @retval EFI_DEVICE_ERROR The device reported an error
243 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted
244 @retval EFI_WRITE_PROTECTED The device is write protected
245 @retval EFI_ACCESS_DENIED The file was open for read only
246 @retval EFI_BUFFER_TOO_SMALL Buffer was too small, required size returned in BufferSize
251 (EFIAPI
*EFI_FILE_GET_INFO
) (
253 IN EFI_GUID
*InformationType
,
254 IN OUT UINTN
*BufferSize
,
260 Set information about a file
262 @param File Protocol instance pointer.
263 @param InformationType Type of info in Buffer
264 @param BufferSize Size of buffer.
265 @param Buffer The data to write.
267 @retval EFI_SUCCESS Data was returned.
268 @retval EFI_UNSUPPORT InformationType is not supported
269 @retval EFI_NO_MEDIA The device has no media
270 @retval EFI_DEVICE_ERROR The device reported an error
271 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted
272 @retval EFI_WRITE_PROTECTED The device is write protected
273 @retval EFI_ACCESS_DENIED The file was open for read only
278 (EFIAPI
*EFI_FILE_SET_INFO
) (
280 IN EFI_GUID
*InformationType
,
287 Flush data back for the file handle
289 @param This Protocol instance pointer.
291 @retval EFI_SUCCESS Data was written.
292 @retval EFI_UNSUPPORT Writes to Open directory are not supported
293 @retval EFI_NO_MEDIA The device has no media
294 @retval EFI_DEVICE_ERROR The device reported an error
295 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted
296 @retval EFI_WRITE_PROTECTED The device is write protected
297 @retval EFI_ACCESS_DENIED The file was open for read only
298 @retval EFI_VOLUME_FULL The volume is full
303 (EFIAPI
*EFI_FILE_FLUSH
) (
308 #define EFI_FILE_HANDLE_REVISION 0x00010000
309 #define EFI_FILE_PROTOCOL_REVISION EFI_FILE_HANDLE_REVISION
314 EFI_FILE_CLOSE Close
;
315 EFI_FILE_DELETE Delete
;
317 EFI_FILE_WRITE Write
;
318 EFI_FILE_GET_POSITION GetPosition
;
319 EFI_FILE_SET_POSITION SetPosition
;
320 EFI_FILE_GET_INFO GetInfo
;
321 EFI_FILE_SET_INFO SetInfo
;
322 EFI_FILE_FLUSH Flush
;
326 extern EFI_GUID gEfiSimpleFileSystemProtocolGuid
;