]> git.proxmox.com Git - mirror_edk2.git/blame - EdkCompatibilityPkg/Foundation/Efi/Protocol/SimpleFileSystem/SimpleFileSystem.h
Fixed issues compiling for Apple gcc on IA-32
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Efi / Protocol / SimpleFileSystem / SimpleFileSystem.h
CommitLineData
3eb9473e 1/*++\r
2\r
3Copyright (c) 2004, Intel Corporation \r
4All rights reserved. This program and the accompanying materials \r
5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12Module Name:\r
13\r
14 SimpleFileSystem.h\r
15\r
16Abstract:\r
17\r
18 SimpleFileSystem protocol as defined in the EFI 1.0 specification.\r
19\r
20 The SimpleFileSystem protocol is the programatic access to the FAT (12,16,32) \r
21 file system specified in EFI 1.0. It can also be used to abstract a file \r
22 system other than FAT.\r
23\r
24 EFI 1.0 can boot from any valid EFI image contained in a SimpleFileSystem\r
25 \r
26--*/\r
27\r
28#ifndef _SIMPLE_FILE_SYSTEM_H_\r
29#define _SIMPLE_FILE_SYSTEM_H_\r
30\r
31#define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID \\r
32 { \\r
7ccf38a3 33 0x964e5b22, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} \\r
3eb9473e 34 }\r
35\r
36EFI_FORWARD_DECLARATION (EFI_SIMPLE_FILE_SYSTEM_PROTOCOL);\r
37EFI_FORWARD_DECLARATION (EFI_FILE);\r
38\r
39typedef\r
40EFI_STATUS\r
41(EFIAPI *EFI_VOLUME_OPEN) (\r
42 IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL * This,\r
43 OUT EFI_FILE **Root\r
44 )\r
45/*++\r
46\r
47 Routine Description:\r
48 Open the root directory on a volume.\r
49\r
50 Arguments:\r
51 This - Protocol instance pointer.\r
52 Root - Returns an Open file handle for the root directory\r
53\r
54 Returns:\r
55 EFI_SUCCESS - The device was opened.\r
56 EFI_UNSUPPORTED - This volume does not suppor the file system.\r
57 EFI_NO_MEDIA - The device has no media.\r
58 EFI_DEVICE_ERROR - The device reported an error.\r
59 EFI_VOLUME_CORRUPTED - The file system structures are corrupted\r
60 EFI_ACCESS_DENIED - The service denied access to the file\r
61 EFI_OUT_OF_RESOURCES - The volume was not opened due to lack of resources\r
62\r
63--*/\r
64;\r
65\r
66#define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION 0x00010000\r
67\r
e5bce275 68struct _EFI_SIMPLE_FILE_SYSTEM_PROTOCOL {\r
3eb9473e 69 UINT64 Revision;\r
70 EFI_VOLUME_OPEN OpenVolume;\r
e5bce275 71};\r
3eb9473e 72\r
73typedef\r
74EFI_STATUS\r
75(EFIAPI *EFI_FILE_OPEN) (\r
76 IN EFI_FILE * File,\r
77 OUT EFI_FILE **NewHandle,\r
78 IN CHAR16 *FileName,\r
79 IN UINT64 OpenMode,\r
80 IN UINT64 Attributes\r
81 )\r
82/*++\r
83\r
84 Routine Description:\r
85 Open the root directory on a volume.\r
86\r
87 Arguments:\r
88 File - Protocol instance pointer.\r
89 NewHandle - Returns File Handle for FileName\r
90 FileName - Null terminated string. "\", ".", and ".." are supported\r
91 OpenMode - Open mode for file.\r
92 Attributes - Only used for EFI_FILE_MODE_CREATE\r
93\r
94 Returns:\r
95 EFI_SUCCESS - The device was opened.\r
96 EFI_NOT_FOUND - The specified file could not be found on the device\r
97 EFI_NO_MEDIA - The device has no media.\r
98 EFI_MEDIA_CHANGED - The media has changed\r
99 EFI_DEVICE_ERROR - The device reported an error.\r
100 EFI_VOLUME_CORRUPTED - The file system structures are corrupted\r
101 EFI_ACCESS_DENIED - The service denied access to the file\r
102 EFI_OUT_OF_RESOURCES - The volume was not opened due to lack of resources\r
103 EFI_VOLUME_FULL - The volume is full.\r
104\r
105--*/\r
106;\r
107\r
108//\r
109// Open modes\r
110//\r
111#define EFI_FILE_MODE_READ 0x0000000000000001\r
112#define EFI_FILE_MODE_WRITE 0x0000000000000002\r
e8de4680 113#define EFI_FILE_MODE_CREATE 0x8000000000000000ULL\r
3eb9473e 114\r
115//\r
116// File attributes\r
117//\r
118#define EFI_FILE_READ_ONLY 0x0000000000000001\r
119#define EFI_FILE_HIDDEN 0x0000000000000002\r
120#define EFI_FILE_SYSTEM 0x0000000000000004\r
121#define EFI_FILE_RESERVED 0x0000000000000008\r
122#define EFI_FILE_DIRECTORY 0x0000000000000010\r
123#define EFI_FILE_ARCHIVE 0x0000000000000020\r
124#define EFI_FILE_VALID_ATTR 0x0000000000000037\r
125\r
126typedef\r
127EFI_STATUS\r
128(EFIAPI *EFI_FILE_CLOSE) (\r
129 IN EFI_FILE * File\r
130 )\r
131/*++\r
132\r
133 Routine Description:\r
134 Close the file handle\r
135\r
136 Arguments:\r
137 File - Protocol instance pointer.\r
138\r
139 Returns:\r
140 EFI_SUCCESS- The device was opened.\r
141\r
142--*/\r
143;\r
144\r
145typedef\r
146EFI_STATUS\r
147(EFIAPI *EFI_FILE_DELETE) (\r
148 IN EFI_FILE * File\r
149 )\r
150/*++\r
151\r
152 Routine Description:\r
153 Close and delete the file handle\r
154\r
155 Arguments:\r
156 File - Protocol instance pointer.\r
157\r
158 Returns:\r
159 EFI_SUCCESS - The device was opened.\r
160 EFI_WARN_DELETE_FAILURE - The handle was closed but the file was not \r
161 deleted\r
162\r
163--*/\r
164;\r
165\r
166typedef\r
167EFI_STATUS\r
168(EFIAPI *EFI_FILE_READ) (\r
169 IN EFI_FILE * File,\r
170 IN OUT UINTN *BufferSize,\r
171 OUT VOID *Buffer\r
172 )\r
173/*++\r
174\r
175 Routine Description:\r
176 Read data from the file.\r
177\r
178 Arguments:\r
179 File - Protocol instance pointer.\r
180 BufferSize - On input size of buffer, on output amount of data in \r
181 buffer.\r
182 Buffer - The buffer in which data is read.\r
183\r
184 Returns:\r
185 EFI_SUCCESS - Data was read.\r
186 EFI_NO_MEDIA - The device has no media\r
187 EFI_DEVICE_ERROR - The device reported an error\r
188 EFI_VOLUME_CORRUPTED - The file system structures are corrupted\r
189 EFI_BUFFER_TO_SMALL - BufferSize is too small. BufferSize contains \r
190 required size\r
191\r
192--*/\r
193;\r
194\r
195typedef\r
196EFI_STATUS\r
197(EFIAPI *EFI_FILE_WRITE) (\r
198 IN EFI_FILE * File,\r
199 IN OUT UINTN *BufferSize,\r
200 IN VOID *Buffer\r
201 )\r
202/*++\r
203\r
204 Routine Description:\r
205 Write data from to the file.\r
206\r
207 Arguments:\r
208 File - Protocol instance pointer.\r
209 BufferSize - On input size of buffer, on output amount of data in buffer.\r
210 Buffer - The buffer in which data to write.\r
211\r
212 Returns:\r
213 EFI_SUCCESS - Data was written.\r
214 EFI_UNSUPPORT - Writes to Open directory are not supported\r
215 EFI_NO_MEDIA - The device has no media\r
216 EFI_DEVICE_ERROR - The device reported an error\r
217 EFI_VOLUME_CORRUPTED - The file system structures are corrupted\r
218 EFI_WRITE_PROTECTED - The device is write protected\r
219 EFI_ACCESS_DENIED - The file was open for read only\r
220 EFI_VOLUME_FULL - The volume is full\r
221\r
222--*/\r
223;\r
224\r
225typedef\r
226EFI_STATUS\r
227(EFIAPI *EFI_FILE_SET_POSITION) (\r
228 IN EFI_FILE * File,\r
229 IN UINT64 Position\r
230 )\r
231/*++\r
232\r
233 Routine Description:\r
234 Set a files current position\r
235\r
236 Arguments:\r
237 File - Protocol instance pointer.\r
238 Position - Byte possition from the start of the file\r
239\r
240 Returns:\r
241 EFI_SUCCESS - Data was written.\r
242 EFI_UNSUPPORTED - Seek request for non-zero is not valid on open.\r
243\r
244--*/\r
245;\r
246\r
247typedef\r
248EFI_STATUS\r
249(EFIAPI *EFI_FILE_GET_POSITION) (\r
250 IN EFI_FILE * File,\r
251 OUT UINT64 *Position\r
252 )\r
253/*++\r
254\r
255 Routine Description:\r
256 Get a files current position\r
257\r
258 Arguments:\r
259 File - Protocol instance pointer.\r
260 Position - Byte possition from the start of the file\r
261\r
262 Returns:\r
263 EFI_SUCCESS - Data was written.\r
264 EFI_UNSUPPORTED - Seek request for non-zero is not valid on open.\r
265\r
266--*/\r
267;\r
268\r
269typedef\r
270EFI_STATUS\r
271(EFIAPI *EFI_FILE_GET_INFO) (\r
272 IN EFI_FILE * File,\r
273 IN EFI_GUID * InformationType,\r
274 IN OUT UINTN *BufferSize,\r
275 OUT VOID *Buffer\r
276 )\r
277/*++\r
278\r
279 Routine Description:\r
280 Get information about a file\r
281\r
282 Arguments:\r
283 File - Protocol instance pointer.\r
284 InformationType - Type of info to return in Buffer\r
285 BufferSize - On input size of buffer, on output amount of data in\r
286 buffer.\r
287 Buffer - The buffer to return data.\r
288\r
289 Returns:\r
290 EFI_SUCCESS - Data was returned.\r
291 EFI_UNSUPPORT - InformationType is not supported\r
292 EFI_NO_MEDIA - The device has no media\r
293 EFI_DEVICE_ERROR - The device reported an error\r
294 EFI_VOLUME_CORRUPTED - The file system structures are corrupted\r
295 EFI_WRITE_PROTECTED - The device is write protected\r
296 EFI_ACCESS_DENIED - The file was open for read only\r
297 EFI_BUFFER_TOO_SMALL - Buffer was too small, required size returned in \r
298 BufferSize\r
299--*/\r
300;\r
301\r
302typedef\r
303EFI_STATUS\r
304(EFIAPI *EFI_FILE_SET_INFO) (\r
305 IN EFI_FILE * File,\r
306 IN EFI_GUID * InformationType,\r
307 IN UINTN BufferSize,\r
308 IN VOID *Buffer\r
309 )\r
310/*++\r
311\r
312 Routine Description:\r
313 Set information about a file\r
314\r
315 Arguments:\r
316 File - Protocol instance pointer.\r
317 InformationType - Type of info in Buffer\r
318 BufferSize - Size of buffer.\r
319 Buffer - The data to write.\r
320\r
321 Returns:\r
322 EFI_SUCCESS - Data was returned.\r
323 EFI_UNSUPPORT - InformationType is not supported\r
324 EFI_NO_MEDIA - The device has no media\r
325 EFI_DEVICE_ERROR - The device reported an error\r
326 EFI_VOLUME_CORRUPTED - The file system structures are corrupted\r
327 EFI_WRITE_PROTECTED - The device is write protected\r
328 EFI_ACCESS_DENIED - The file was open for read only\r
329--*/\r
330;\r
331\r
332typedef\r
333EFI_STATUS\r
334(EFIAPI *EFI_FILE_FLUSH) (\r
335 IN EFI_FILE * File\r
336 )\r
337/*++\r
338\r
339 Routine Description:\r
340 Flush data back for the file handle\r
341\r
342 Arguments:\r
343 File - Protocol instance pointer.\r
344\r
345 Returns:\r
346 EFI_SUCCESS - Data was written.\r
347 EFI_UNSUPPORT - Writes to Open directory are not supported\r
348 EFI_NO_MEDIA - The device has no media\r
349 EFI_DEVICE_ERROR - The device reported an error\r
350 EFI_VOLUME_CORRUPTED - The file system structures are corrupted\r
351 EFI_WRITE_PROTECTED - The device is write protected\r
352 EFI_ACCESS_DENIED - The file was open for read only\r
353 EFI_VOLUME_FULL - The volume is full\r
354\r
355--*/\r
356;\r
357\r
358#define EFI_FILE_HANDLE_REVISION 0x00010000\r
e104fc15 359typedef struct _EFI_FILE {\r
3eb9473e 360 UINT64 Revision;\r
361 EFI_FILE_OPEN Open;\r
362 EFI_FILE_CLOSE Close;\r
363 EFI_FILE_DELETE Delete;\r
364 EFI_FILE_READ Read;\r
365 EFI_FILE_WRITE Write;\r
366 EFI_FILE_GET_POSITION GetPosition;\r
367 EFI_FILE_SET_POSITION SetPosition;\r
368 EFI_FILE_GET_INFO GetInfo;\r
369 EFI_FILE_SET_INFO SetInfo;\r
370 EFI_FILE_FLUSH Flush;\r
e5bce275 371} *EFI_FILE_HANDLE;\r
3eb9473e 372\r
373extern EFI_GUID gEfiSimpleFileSystemProtocolGuid;\r
374\r
375#endif\r