]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Foundation/Efi/Protocol/SimpleFileSystem/SimpleFileSystem.h
Sync all bug fixes between EDK1.04 and EDK1.06 into EdkCompatibilityPkg.
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Efi / Protocol / SimpleFileSystem / SimpleFileSystem.h
1 /*++
2
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
8
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.
11
12 Module Name:
13
14 SimpleFileSystem.h
15
16 Abstract:
17
18 SimpleFileSystem protocol as defined in the EFI 1.0 specification.
19
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.
23
24 EFI 1.0 can boot from any valid EFI image contained in a SimpleFileSystem
25
26 --*/
27
28 #ifndef _SIMPLE_FILE_SYSTEM_H_
29 #define _SIMPLE_FILE_SYSTEM_H_
30
31 #define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID \
32 { \
33 0x964e5b22, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} \
34 }
35
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;
40
41 typedef
42 EFI_STATUS
43 (EFIAPI *EFI_VOLUME_OPEN) (
44 IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL * This,
45 OUT EFI_FILE **Root
46 )
47 /*++
48
49 Routine Description:
50 Open the root directory on a volume.
51
52 Arguments:
53 This - Protocol instance pointer.
54 Root - Returns an Open file handle for the root directory
55
56 Returns:
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
64
65 --*/
66 ;
67
68 #define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION 0x00010000
69
70 struct _EFI_SIMPLE_FILE_SYSTEM_PROTOCOL {
71 UINT64 Revision;
72 EFI_VOLUME_OPEN OpenVolume;
73 };
74
75 typedef
76 EFI_STATUS
77 (EFIAPI *EFI_FILE_OPEN) (
78 IN EFI_FILE * File,
79 OUT EFI_FILE **NewHandle,
80 IN CHAR16 *FileName,
81 IN UINT64 OpenMode,
82 IN UINT64 Attributes
83 )
84 /*++
85
86 Routine Description:
87 Open the root directory on a volume.
88
89 Arguments:
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
95
96 Returns:
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.
106
107 --*/
108 ;
109
110 //
111 // Open modes
112 //
113 #define EFI_FILE_MODE_READ 0x0000000000000001
114 #define EFI_FILE_MODE_WRITE 0x0000000000000002
115 #define EFI_FILE_MODE_CREATE 0x8000000000000000ULL
116
117 //
118 // File attributes
119 //
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
127
128 typedef
129 EFI_STATUS
130 (EFIAPI *EFI_FILE_CLOSE) (
131 IN EFI_FILE * File
132 )
133 /*++
134
135 Routine Description:
136 Close the file handle
137
138 Arguments:
139 File - Protocol instance pointer.
140
141 Returns:
142 EFI_SUCCESS- The device was opened.
143
144 --*/
145 ;
146
147 typedef
148 EFI_STATUS
149 (EFIAPI *EFI_FILE_DELETE) (
150 IN EFI_FILE * File
151 )
152 /*++
153
154 Routine Description:
155 Close and delete the file handle
156
157 Arguments:
158 File - Protocol instance pointer.
159
160 Returns:
161 EFI_SUCCESS - The device was opened.
162 EFI_WARN_DELETE_FAILURE - The handle was closed but the file was not
163 deleted
164
165 --*/
166 ;
167
168 typedef
169 EFI_STATUS
170 (EFIAPI *EFI_FILE_READ) (
171 IN EFI_FILE * File,
172 IN OUT UINTN *BufferSize,
173 OUT VOID *Buffer
174 )
175 /*++
176
177 Routine Description:
178 Read data from the file.
179
180 Arguments:
181 File - Protocol instance pointer.
182 BufferSize - On input size of buffer, on output amount of data in
183 buffer.
184 Buffer - The buffer in which data is read.
185
186 Returns:
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
192 required size
193
194 --*/
195 ;
196
197 typedef
198 EFI_STATUS
199 (EFIAPI *EFI_FILE_WRITE) (
200 IN EFI_FILE * File,
201 IN OUT UINTN *BufferSize,
202 IN VOID *Buffer
203 )
204 /*++
205
206 Routine Description:
207 Write data from to the file.
208
209 Arguments:
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.
213
214 Returns:
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
223
224 --*/
225 ;
226
227 typedef
228 EFI_STATUS
229 (EFIAPI *EFI_FILE_SET_POSITION) (
230 IN EFI_FILE * File,
231 IN UINT64 Position
232 )
233 /*++
234
235 Routine Description:
236 Set a files current position
237
238 Arguments:
239 File - Protocol instance pointer.
240 Position - Byte possition from the start of the file
241
242 Returns:
243 EFI_SUCCESS - Data was written.
244 EFI_UNSUPPORTED - Seek request for non-zero is not valid on open.
245
246 --*/
247 ;
248
249 typedef
250 EFI_STATUS
251 (EFIAPI *EFI_FILE_GET_POSITION) (
252 IN EFI_FILE * File,
253 OUT UINT64 *Position
254 )
255 /*++
256
257 Routine Description:
258 Get a files current position
259
260 Arguments:
261 File - Protocol instance pointer.
262 Position - Byte possition from the start of the file
263
264 Returns:
265 EFI_SUCCESS - Data was written.
266 EFI_UNSUPPORTED - Seek request for non-zero is not valid on open.
267
268 --*/
269 ;
270
271 typedef
272 EFI_STATUS
273 (EFIAPI *EFI_FILE_GET_INFO) (
274 IN EFI_FILE * File,
275 IN EFI_GUID * InformationType,
276 IN OUT UINTN *BufferSize,
277 OUT VOID *Buffer
278 )
279 /*++
280
281 Routine Description:
282 Get information about a file
283
284 Arguments:
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
288 buffer.
289 Buffer - The buffer to return data.
290
291 Returns:
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
300 BufferSize
301 --*/
302 ;
303
304 typedef
305 EFI_STATUS
306 (EFIAPI *EFI_FILE_SET_INFO) (
307 IN EFI_FILE * File,
308 IN EFI_GUID * InformationType,
309 IN UINTN BufferSize,
310 IN VOID *Buffer
311 )
312 /*++
313
314 Routine Description:
315 Set information about a file
316
317 Arguments:
318 File - Protocol instance pointer.
319 InformationType - Type of info in Buffer
320 BufferSize - Size of buffer.
321 Buffer - The data to write.
322
323 Returns:
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
331 --*/
332 ;
333
334 typedef
335 EFI_STATUS
336 (EFIAPI *EFI_FILE_FLUSH) (
337 IN EFI_FILE * File
338 )
339 /*++
340
341 Routine Description:
342 Flush data back for the file handle
343
344 Arguments:
345 File - Protocol instance pointer.
346
347 Returns:
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
356
357 --*/
358 ;
359
360 #define EFI_FILE_HANDLE_REVISION 0x00010000
361 struct _EFI_FILE {
362 UINT64 Revision;
363 EFI_FILE_OPEN Open;
364 EFI_FILE_CLOSE Close;
365 EFI_FILE_DELETE Delete;
366 EFI_FILE_READ Read;
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;
373 };
374
375 extern EFI_GUID gEfiSimpleFileSystemProtocolGuid;
376
377 #endif