]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Foundation/Efi/Protocol/SimpleFileSystem/SimpleFileSystem.h
d9f003255960478927230d3468ad8d14cd2a8242
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Efi / Protocol / SimpleFileSystem / SimpleFileSystem.h
1 /*++
2
3 Copyright (c) 2004, 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
39 typedef
40 EFI_STATUS
41 (EFIAPI *EFI_VOLUME_OPEN) (
42 IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL * This,
43 OUT EFI_FILE **Root
44 )
45 /*++
46
47 Routine Description:
48 Open the root directory on a volume.
49
50 Arguments:
51 This - Protocol instance pointer.
52 Root - Returns an Open file handle for the root directory
53
54 Returns:
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
62
63 --*/
64 ;
65
66 #define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION 0x00010000
67
68 struct _EFI_SIMPLE_FILE_SYSTEM_PROTOCOL {
69 UINT64 Revision;
70 EFI_VOLUME_OPEN OpenVolume;
71 };
72
73 typedef
74 EFI_STATUS
75 (EFIAPI *EFI_FILE_OPEN) (
76 IN EFI_FILE * File,
77 OUT EFI_FILE **NewHandle,
78 IN CHAR16 *FileName,
79 IN UINT64 OpenMode,
80 IN UINT64 Attributes
81 )
82 /*++
83
84 Routine Description:
85 Open the root directory on a volume.
86
87 Arguments:
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
93
94 Returns:
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.
104
105 --*/
106 ;
107
108 //
109 // Open modes
110 //
111 #define EFI_FILE_MODE_READ 0x0000000000000001
112 #define EFI_FILE_MODE_WRITE 0x0000000000000002
113 #define EFI_FILE_MODE_CREATE 0x8000000000000000ULL
114
115 //
116 // File attributes
117 //
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
125
126 typedef
127 EFI_STATUS
128 (EFIAPI *EFI_FILE_CLOSE) (
129 IN EFI_FILE * File
130 )
131 /*++
132
133 Routine Description:
134 Close the file handle
135
136 Arguments:
137 File - Protocol instance pointer.
138
139 Returns:
140 EFI_SUCCESS- The device was opened.
141
142 --*/
143 ;
144
145 typedef
146 EFI_STATUS
147 (EFIAPI *EFI_FILE_DELETE) (
148 IN EFI_FILE * File
149 )
150 /*++
151
152 Routine Description:
153 Close and delete the file handle
154
155 Arguments:
156 File - Protocol instance pointer.
157
158 Returns:
159 EFI_SUCCESS - The device was opened.
160 EFI_WARN_DELETE_FAILURE - The handle was closed but the file was not
161 deleted
162
163 --*/
164 ;
165
166 typedef
167 EFI_STATUS
168 (EFIAPI *EFI_FILE_READ) (
169 IN EFI_FILE * File,
170 IN OUT UINTN *BufferSize,
171 OUT VOID *Buffer
172 )
173 /*++
174
175 Routine Description:
176 Read data from the file.
177
178 Arguments:
179 File - Protocol instance pointer.
180 BufferSize - On input size of buffer, on output amount of data in
181 buffer.
182 Buffer - The buffer in which data is read.
183
184 Returns:
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
190 required size
191
192 --*/
193 ;
194
195 typedef
196 EFI_STATUS
197 (EFIAPI *EFI_FILE_WRITE) (
198 IN EFI_FILE * File,
199 IN OUT UINTN *BufferSize,
200 IN VOID *Buffer
201 )
202 /*++
203
204 Routine Description:
205 Write data from to the file.
206
207 Arguments:
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.
211
212 Returns:
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
221
222 --*/
223 ;
224
225 typedef
226 EFI_STATUS
227 (EFIAPI *EFI_FILE_SET_POSITION) (
228 IN EFI_FILE * File,
229 IN UINT64 Position
230 )
231 /*++
232
233 Routine Description:
234 Set a files current position
235
236 Arguments:
237 File - Protocol instance pointer.
238 Position - Byte possition from the start of the file
239
240 Returns:
241 EFI_SUCCESS - Data was written.
242 EFI_UNSUPPORTED - Seek request for non-zero is not valid on open.
243
244 --*/
245 ;
246
247 typedef
248 EFI_STATUS
249 (EFIAPI *EFI_FILE_GET_POSITION) (
250 IN EFI_FILE * File,
251 OUT UINT64 *Position
252 )
253 /*++
254
255 Routine Description:
256 Get a files current position
257
258 Arguments:
259 File - Protocol instance pointer.
260 Position - Byte possition from the start of the file
261
262 Returns:
263 EFI_SUCCESS - Data was written.
264 EFI_UNSUPPORTED - Seek request for non-zero is not valid on open.
265
266 --*/
267 ;
268
269 typedef
270 EFI_STATUS
271 (EFIAPI *EFI_FILE_GET_INFO) (
272 IN EFI_FILE * File,
273 IN EFI_GUID * InformationType,
274 IN OUT UINTN *BufferSize,
275 OUT VOID *Buffer
276 )
277 /*++
278
279 Routine Description:
280 Get information about a file
281
282 Arguments:
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
286 buffer.
287 Buffer - The buffer to return data.
288
289 Returns:
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
298 BufferSize
299 --*/
300 ;
301
302 typedef
303 EFI_STATUS
304 (EFIAPI *EFI_FILE_SET_INFO) (
305 IN EFI_FILE * File,
306 IN EFI_GUID * InformationType,
307 IN UINTN BufferSize,
308 IN VOID *Buffer
309 )
310 /*++
311
312 Routine Description:
313 Set information about a file
314
315 Arguments:
316 File - Protocol instance pointer.
317 InformationType - Type of info in Buffer
318 BufferSize - Size of buffer.
319 Buffer - The data to write.
320
321 Returns:
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
329 --*/
330 ;
331
332 typedef
333 EFI_STATUS
334 (EFIAPI *EFI_FILE_FLUSH) (
335 IN EFI_FILE * File
336 )
337 /*++
338
339 Routine Description:
340 Flush data back for the file handle
341
342 Arguments:
343 File - Protocol instance pointer.
344
345 Returns:
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
354
355 --*/
356 ;
357
358 #define EFI_FILE_HANDLE_REVISION 0x00010000
359 typedef struct _EFI_FILE {
360 UINT64 Revision;
361 EFI_FILE_OPEN Open;
362 EFI_FILE_CLOSE Close;
363 EFI_FILE_DELETE Delete;
364 EFI_FILE_READ Read;
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;
371 } *EFI_FILE_HANDLE;
372
373 extern EFI_GUID gEfiSimpleFileSystemProtocolGuid;
374
375 #endif