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