]>
Commit | Line | Data |
---|---|---|
99c9b949 PA |
1 | /** @file\r |
2 | UDF/ECMA-167 file system driver.\r | |
3 | \r | |
4 | Copyright (C) 2014-2017 Paulo Alcantara <pcacjr@zytor.com>\r | |
b9ae1705 | 5 | Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>\r |
99c9b949 PA |
6 | \r |
7 | This program and the accompanying materials are licensed and made available\r | |
8 | under the terms and conditions of the BSD License which accompanies this\r | |
9 | distribution. The full text of the license may be found at\r | |
10 | http://opensource.org/licenses/bsd-license.php\r | |
11 | \r | |
12 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT\r | |
13 | WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
14 | **/\r | |
15 | \r | |
16 | #ifndef _UDF_H_\r | |
17 | #define _UDF_H_\r | |
18 | \r | |
19 | #include <Uefi.h>\r | |
20 | #include <Base.h>\r | |
21 | \r | |
22 | #include <Protocol/BlockIo.h>\r | |
23 | #include <Protocol/ComponentName.h>\r | |
24 | #include <Protocol/DevicePath.h>\r | |
25 | #include <Protocol/DriverBinding.h>\r | |
26 | #include <Protocol/DiskIo.h>\r | |
27 | #include <Protocol/SimpleFileSystem.h>\r | |
28 | \r | |
29 | #include <Guid/FileInfo.h>\r | |
30 | #include <Guid/FileSystemInfo.h>\r | |
31 | #include <Guid/FileSystemVolumeLabelInfo.h>\r | |
32 | \r | |
33 | #include <Library/DebugLib.h>\r | |
34 | #include <Library/UefiDriverEntryPoint.h>\r | |
35 | #include <Library/BaseLib.h>\r | |
36 | #include <Library/UefiLib.h>\r | |
37 | #include <Library/BaseMemoryLib.h>\r | |
38 | #include <Library/MemoryAllocationLib.h>\r | |
39 | #include <Library/UefiBootServicesTableLib.h>\r | |
40 | #include <Library/DevicePathLib.h>\r | |
41 | \r | |
42 | #include <IndustryStandard/ElTorito.h>\r | |
43 | #include <IndustryStandard/Udf.h>\r | |
44 | \r | |
45 | //\r | |
46 | // C5BD4D42-1A76-4996-8956-73CDA326CD0A\r | |
47 | //\r | |
48 | #define EFI_UDF_DEVICE_PATH_GUID \\r | |
49 | { 0xC5BD4D42, 0x1A76, 0x4996, \\r | |
50 | { 0x89, 0x56, 0x73, 0xCD, 0xA3, 0x26, 0xCD, 0x0A } \\r | |
51 | }\r | |
52 | \r | |
baaa3cee PA |
53 | #define FE_ICB_FILE_TYPE(_Ptr) \\r |
54 | (UDF_FILE_ENTRY_TYPE)( \\r | |
55 | ((UDF_DESCRIPTOR_TAG *)(_Ptr))->TagIdentifier == UdfFileEntry ? \\r | |
56 | ((UDF_FILE_ENTRY *)(_Ptr))->IcbTag.FileType : \\r | |
57 | ((UDF_EXTENDED_FILE_ENTRY *)(_Ptr))->IcbTag.FileType)\r | |
58 | \r | |
59 | typedef enum {\r | |
60 | UdfFileEntryDirectory = 4,\r | |
61 | UdfFileEntryStandardFile = 5,\r | |
62 | UdfFileEntrySymlink = 12,\r | |
63 | } UDF_FILE_ENTRY_TYPE;\r | |
99c9b949 PA |
64 | \r |
65 | #define HIDDEN_FILE (1 << 0)\r | |
66 | #define DIRECTORY_FILE (1 << 1)\r | |
67 | #define DELETED_FILE (1 << 2)\r | |
68 | #define PARENT_FILE (1 << 3)\r | |
69 | \r | |
baaa3cee PA |
70 | #define IS_FID_HIDDEN_FILE(_Fid) \\r |
71 | (BOOLEAN)((_Fid)->FileCharacteristics & HIDDEN_FILE)\r | |
72 | #define IS_FID_DIRECTORY_FILE(_Fid) \\r | |
73 | (BOOLEAN)((_Fid)->FileCharacteristics & DIRECTORY_FILE)\r | |
74 | #define IS_FID_DELETED_FILE(_Fid) \\r | |
75 | (BOOLEAN)((_Fid)->FileCharacteristics & DELETED_FILE)\r | |
76 | #define IS_FID_PARENT_FILE(_Fid) \\r | |
77 | (BOOLEAN)((_Fid)->FileCharacteristics & PARENT_FILE)\r | |
78 | #define IS_FID_NORMAL_FILE(_Fid) \\r | |
79 | (BOOLEAN)(!IS_FID_DIRECTORY_FILE (_Fid) && \\r | |
80 | !IS_FID_PARENT_FILE (_Fid))\r | |
99c9b949 PA |
81 | \r |
82 | typedef enum {\r | |
880ec683 HW |
83 | ShortAdsSequence,\r |
84 | LongAdsSequence,\r | |
85 | ExtendedAdsSequence,\r | |
86 | InlineData\r | |
99c9b949 PA |
87 | } UDF_FE_RECORDING_FLAGS;\r |
88 | \r | |
89 | #define GET_FE_RECORDING_FLAGS(_Fe) \\r | |
90 | ((UDF_FE_RECORDING_FLAGS)((UDF_ICB_TAG *)( \\r | |
91 | (UINT8 *)(_Fe) + \\r | |
92 | sizeof (UDF_DESCRIPTOR_TAG)))->Flags & 0x07)\r | |
93 | \r | |
94 | typedef enum {\r | |
880ec683 HW |
95 | ExtentRecordedAndAllocated,\r |
96 | ExtentNotRecordedButAllocated,\r | |
97 | ExtentNotRecordedNotAllocated,\r | |
98 | ExtentIsNextExtent,\r | |
99c9b949 PA |
99 | } UDF_EXTENT_FLAGS;\r |
100 | \r | |
101 | #define AD_LENGTH(_RecFlags) \\r | |
880ec683 | 102 | ((_RecFlags) == ShortAdsSequence ? \\r |
99c9b949 PA |
103 | ((UINT64)(sizeof (UDF_SHORT_ALLOCATION_DESCRIPTOR))) : \\r |
104 | ((UINT64)(sizeof (UDF_LONG_ALLOCATION_DESCRIPTOR))))\r | |
105 | \r | |
106 | #define GET_EXTENT_FLAGS(_RecFlags, _Ad) \\r | |
880ec683 | 107 | ((_RecFlags) == ShortAdsSequence ? \\r |
99c9b949 PA |
108 | ((UDF_EXTENT_FLAGS)((((UDF_SHORT_ALLOCATION_DESCRIPTOR *)(_Ad))->ExtentLength >> \\r |
109 | 30) & 0x3)) : \\r | |
110 | ((UDF_EXTENT_FLAGS)((((UDF_LONG_ALLOCATION_DESCRIPTOR *)(_Ad))->ExtentLength >> \\r | |
111 | 30) & 0x3)))\r | |
112 | \r | |
113 | #define GET_EXTENT_LENGTH(_RecFlags, _Ad) \\r | |
880ec683 | 114 | ((_RecFlags) == ShortAdsSequence ? \\r |
99c9b949 PA |
115 | ((UINT32)((((UDF_SHORT_ALLOCATION_DESCRIPTOR *)(_Ad))->ExtentLength & \\r |
116 | ~0xC0000000UL))) : \\r | |
117 | ((UINT32)((((UDF_LONG_ALLOCATION_DESCRIPTOR *)(_Ad))->ExtentLength & \\r | |
118 | ~0xC0000000UL))))\r | |
119 | \r | |
120 | #define UDF_FILENAME_LENGTH 128\r | |
121 | #define UDF_PATH_LENGTH 512\r | |
122 | \r | |
123 | #define GET_FID_FROM_ADS(_Data, _Offs) \\r | |
124 | ((UDF_FILE_IDENTIFIER_DESCRIPTOR *)((UINT8 *)(_Data) + (_Offs)))\r | |
125 | \r | |
126 | #define IS_VALID_COMPRESSION_ID(_CompId) \\r | |
127 | ((BOOLEAN)((_CompId) == 8 || (_CompId) == 16))\r | |
128 | \r | |
99c9b949 PA |
129 | #define UDF_STANDARD_IDENTIFIER_LENGTH 5\r |
130 | \r | |
99c9b949 PA |
131 | #pragma pack(1)\r |
132 | \r | |
133 | typedef struct {\r | |
134 | UINT8 StandardIdentifier[UDF_STANDARD_IDENTIFIER_LENGTH];\r | |
135 | } UDF_STANDARD_IDENTIFIER;\r | |
136 | \r | |
137 | #pragma pack()\r | |
138 | \r | |
139 | typedef enum {\r | |
880ec683 HW |
140 | ReadFileGetFileSize,\r |
141 | ReadFileAllocateAndRead,\r | |
142 | ReadFileSeekAndRead,\r | |
99c9b949 PA |
143 | } UDF_READ_FILE_FLAGS;\r |
144 | \r | |
145 | typedef struct {\r | |
146 | VOID *FileData;\r | |
147 | UDF_READ_FILE_FLAGS Flags;\r | |
148 | UINT64 FileDataSize;\r | |
149 | UINT64 FilePosition;\r | |
150 | UINT64 FileSize;\r | |
151 | UINT64 ReadLength;\r | |
152 | } UDF_READ_FILE_INFO;\r | |
153 | \r | |
154 | #pragma pack(1)\r | |
155 | \r | |
99c9b949 PA |
156 | typedef struct {\r |
157 | UINT16 TypeAndTimezone;\r | |
158 | INT16 Year;\r | |
159 | UINT8 Month;\r | |
160 | UINT8 Day;\r | |
161 | UINT8 Hour;\r | |
162 | UINT8 Minute;\r | |
163 | UINT8 Second;\r | |
164 | UINT8 Centiseconds;\r | |
165 | UINT8 HundredsOfMicroseconds;\r | |
166 | UINT8 Microseconds;\r | |
167 | } UDF_TIMESTAMP;\r | |
168 | \r | |
99c9b949 PA |
169 | typedef struct {\r |
170 | UDF_DESCRIPTOR_TAG DescriptorTag;\r | |
171 | UINT32 PrevAllocationExtentDescriptor;\r | |
172 | UINT32 LengthOfAllocationDescriptors;\r | |
173 | } UDF_ALLOCATION_EXTENT_DESCRIPTOR;\r | |
174 | \r | |
175 | typedef struct {\r | |
176 | UINT8 StructureType;\r | |
177 | UINT8 StandardIdentifier[UDF_STANDARD_IDENTIFIER_LENGTH];\r | |
178 | UINT8 StructureVersion;\r | |
179 | UINT8 Reserved;\r | |
180 | UINT8 StructureData[2040];\r | |
181 | } UDF_VOLUME_DESCRIPTOR;\r | |
182 | \r | |
baaa3cee PA |
183 | typedef struct {\r |
184 | UDF_DESCRIPTOR_TAG DescriptorTag;\r | |
185 | UDF_TIMESTAMP RecordingDateTime;\r | |
186 | UINT32 IntegrityType;\r | |
187 | UDF_EXTENT_AD NextIntegrityExtent;\r | |
188 | UINT8 LogicalVolumeContentsUse[32];\r | |
189 | UINT32 NumberOfPartitions;\r | |
190 | UINT32 LengthOfImplementationUse;\r | |
191 | UINT8 Data[0];\r | |
192 | } UDF_LOGICAL_VOLUME_INTEGRITY;\r | |
193 | \r | |
99c9b949 PA |
194 | typedef struct {\r |
195 | UDF_DESCRIPTOR_TAG DescriptorTag;\r | |
196 | UINT32 VolumeDescriptorSequenceNumber;\r | |
197 | UINT16 PartitionFlags;\r | |
198 | UINT16 PartitionNumber;\r | |
199 | UDF_ENTITY_ID PartitionContents;\r | |
200 | UINT8 PartitionContentsUse[128];\r | |
201 | UINT32 AccessType;\r | |
202 | UINT32 PartitionStartingLocation;\r | |
203 | UINT32 PartitionLength;\r | |
204 | UDF_ENTITY_ID ImplementationIdentifier;\r | |
205 | UINT8 ImplementationUse[128];\r | |
206 | UINT8 Reserved[156];\r | |
207 | } UDF_PARTITION_DESCRIPTOR;\r | |
208 | \r | |
99c9b949 PA |
209 | typedef struct {\r |
210 | UDF_DESCRIPTOR_TAG DescriptorTag;\r | |
211 | UDF_TIMESTAMP RecordingDateAndTime;\r | |
212 | UINT16 InterchangeLevel;\r | |
213 | UINT16 MaximumInterchangeLevel;\r | |
214 | UINT32 CharacterSetList;\r | |
215 | UINT32 MaximumCharacterSetList;\r | |
216 | UINT32 FileSetNumber;\r | |
217 | UINT32 FileSetDescriptorNumber;\r | |
218 | UDF_CHAR_SPEC LogicalVolumeIdentifierCharacterSet;\r | |
219 | UINT8 LogicalVolumeIdentifier[128];\r | |
220 | UDF_CHAR_SPEC FileSetCharacterSet;\r | |
221 | UINT8 FileSetIdentifier[32];\r | |
222 | UINT8 CopyrightFileIdentifier[32];\r | |
223 | UINT8 AbstractFileIdentifier[32];\r | |
224 | UDF_LONG_ALLOCATION_DESCRIPTOR RootDirectoryIcb;\r | |
225 | UDF_ENTITY_ID DomainIdentifier;\r | |
226 | UDF_LONG_ALLOCATION_DESCRIPTOR NextExtent;\r | |
227 | UDF_LONG_ALLOCATION_DESCRIPTOR SystemStreamDirectoryIcb;\r | |
228 | UINT8 Reserved[32];\r | |
229 | } UDF_FILE_SET_DESCRIPTOR;\r | |
230 | \r | |
231 | typedef struct {\r | |
232 | UINT32 ExtentLength;\r | |
233 | UINT32 ExtentPosition;\r | |
234 | } UDF_SHORT_ALLOCATION_DESCRIPTOR;\r | |
235 | \r | |
236 | typedef struct {\r | |
237 | UDF_DESCRIPTOR_TAG DescriptorTag;\r | |
238 | UINT16 FileVersionNumber;\r | |
239 | UINT8 FileCharacteristics;\r | |
240 | UINT8 LengthOfFileIdentifier;\r | |
241 | UDF_LONG_ALLOCATION_DESCRIPTOR Icb;\r | |
242 | UINT16 LengthOfImplementationUse;\r | |
243 | UINT8 Data[0];\r | |
244 | } UDF_FILE_IDENTIFIER_DESCRIPTOR;\r | |
245 | \r | |
246 | typedef struct {\r | |
247 | UINT32 PriorRecordNumberOfDirectEntries;\r | |
248 | UINT16 StrategyType;\r | |
249 | UINT16 StrategyParameter;\r | |
250 | UINT16 MaximumNumberOfEntries;\r | |
251 | UINT8 Reserved;\r | |
252 | UINT8 FileType;\r | |
253 | UDF_LB_ADDR ParentIcbLocation;\r | |
254 | UINT16 Flags;\r | |
255 | } UDF_ICB_TAG;\r | |
256 | \r | |
257 | typedef struct {\r | |
258 | UDF_DESCRIPTOR_TAG DescriptorTag;\r | |
259 | UDF_ICB_TAG IcbTag;\r | |
260 | UINT32 Uid;\r | |
261 | UINT32 Gid;\r | |
262 | UINT32 Permissions;\r | |
263 | UINT16 FileLinkCount;\r | |
264 | UINT8 RecordFormat;\r | |
265 | UINT8 RecordDisplayAttributes;\r | |
266 | UINT32 RecordLength;\r | |
267 | UINT64 InformationLength;\r | |
268 | UINT64 LogicalBlocksRecorded;\r | |
269 | UDF_TIMESTAMP AccessTime;\r | |
270 | UDF_TIMESTAMP ModificationTime;\r | |
271 | UDF_TIMESTAMP AttributeTime;\r | |
272 | UINT32 CheckPoint;\r | |
273 | UDF_LONG_ALLOCATION_DESCRIPTOR ExtendedAttributeIcb;\r | |
274 | UDF_ENTITY_ID ImplementationIdentifier;\r | |
275 | UINT64 UniqueId;\r | |
276 | UINT32 LengthOfExtendedAttributes;\r | |
277 | UINT32 LengthOfAllocationDescriptors;\r | |
278 | UINT8 Data[0]; // L_EA + L_AD\r | |
279 | } UDF_FILE_ENTRY;\r | |
280 | \r | |
281 | typedef struct {\r | |
282 | UDF_DESCRIPTOR_TAG DescriptorTag;\r | |
283 | UDF_ICB_TAG IcbTag;\r | |
284 | UINT32 Uid;\r | |
285 | UINT32 Gid;\r | |
286 | UINT32 Permissions;\r | |
287 | UINT16 FileLinkCount;\r | |
288 | UINT8 RecordFormat;\r | |
289 | UINT8 RecordDisplayAttributes;\r | |
290 | UINT32 RecordLength;\r | |
291 | UINT64 InformationLength;\r | |
292 | UINT64 ObjectSize;\r | |
293 | UINT64 LogicalBlocksRecorded;\r | |
294 | UDF_TIMESTAMP AccessTime;\r | |
295 | UDF_TIMESTAMP ModificationTime;\r | |
296 | UDF_TIMESTAMP CreationTime;\r | |
297 | UDF_TIMESTAMP AttributeTime;\r | |
298 | UINT32 CheckPoint;\r | |
299 | UINT32 Reserved;\r | |
300 | UDF_LONG_ALLOCATION_DESCRIPTOR ExtendedAttributeIcb;\r | |
301 | UDF_LONG_ALLOCATION_DESCRIPTOR StreamDirectoryIcb;\r | |
302 | UDF_ENTITY_ID ImplementationIdentifier;\r | |
303 | UINT64 UniqueId;\r | |
304 | UINT32 LengthOfExtendedAttributes;\r | |
305 | UINT32 LengthOfAllocationDescriptors;\r | |
306 | UINT8 Data[0]; // L_EA + L_AD\r | |
307 | } UDF_EXTENDED_FILE_ENTRY;\r | |
308 | \r | |
309 | typedef struct {\r | |
310 | UINT8 ComponentType;\r | |
311 | UINT8 LengthOfComponentIdentifier;\r | |
312 | UINT16 ComponentFileVersionNumber;\r | |
313 | UINT8 ComponentIdentifier[0];\r | |
314 | } UDF_PATH_COMPONENT;\r | |
315 | \r | |
316 | #pragma pack()\r | |
317 | \r | |
318 | //\r | |
319 | // UDF filesystem driver's private data\r | |
320 | //\r | |
321 | typedef struct {\r | |
baaa3cee PA |
322 | UINT64 MainVdsStartLocation;\r |
323 | UDF_LOGICAL_VOLUME_DESCRIPTOR LogicalVolDesc;\r | |
324 | UDF_PARTITION_DESCRIPTOR PartitionDesc;\r | |
325 | UDF_FILE_SET_DESCRIPTOR FileSetDesc;\r | |
99c9b949 PA |
326 | UINTN FileEntrySize;\r |
327 | } UDF_VOLUME_INFO;\r | |
328 | \r | |
329 | typedef struct {\r | |
330 | VOID *FileEntry;\r | |
331 | UDF_FILE_IDENTIFIER_DESCRIPTOR *FileIdentifierDesc;\r | |
332 | } UDF_FILE_INFO;\r | |
333 | \r | |
334 | typedef struct {\r | |
335 | VOID *DirectoryData;\r | |
336 | UINT64 DirectoryLength;\r | |
337 | UINT64 FidOffset;\r | |
338 | } UDF_READ_DIRECTORY_INFO;\r | |
339 | \r | |
340 | #define PRIVATE_UDF_FILE_DATA_SIGNATURE SIGNATURE_32 ('U', 'd', 'f', 'f')\r | |
341 | \r | |
342 | #define PRIVATE_UDF_FILE_DATA_FROM_THIS(a) \\r | |
343 | CR ( \\r | |
344 | a, \\r | |
345 | PRIVATE_UDF_FILE_DATA, \\r | |
346 | FileIo, \\r | |
347 | PRIVATE_UDF_FILE_DATA_SIGNATURE \\r | |
348 | )\r | |
349 | \r | |
350 | typedef struct {\r | |
351 | UINTN Signature;\r | |
352 | BOOLEAN IsRootDirectory;\r | |
353 | UDF_FILE_INFO *Root;\r | |
354 | UDF_FILE_INFO File;\r | |
355 | UDF_READ_DIRECTORY_INFO ReadDirInfo;\r | |
356 | EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *SimpleFs;\r | |
357 | EFI_FILE_PROTOCOL FileIo;\r | |
358 | CHAR16 AbsoluteFileName[UDF_PATH_LENGTH];\r | |
359 | CHAR16 FileName[UDF_FILENAME_LENGTH];\r | |
360 | UINT64 FileSize;\r | |
361 | UINT64 FilePosition;\r | |
362 | } PRIVATE_UDF_FILE_DATA;\r | |
363 | \r | |
364 | #define PRIVATE_UDF_SIMPLE_FS_DATA_SIGNATURE SIGNATURE_32 ('U', 'd', 'f', 's')\r | |
365 | \r | |
366 | #define PRIVATE_UDF_SIMPLE_FS_DATA_FROM_THIS(a) \\r | |
367 | CR ( \\r | |
368 | a, \\r | |
369 | PRIVATE_UDF_SIMPLE_FS_DATA, \\r | |
370 | SimpleFs, \\r | |
371 | PRIVATE_UDF_SIMPLE_FS_DATA_SIGNATURE \\r | |
372 | )\r | |
373 | \r | |
374 | typedef struct {\r | |
375 | UINTN Signature;\r | |
376 | EFI_BLOCK_IO_PROTOCOL *BlockIo;\r | |
377 | EFI_DISK_IO_PROTOCOL *DiskIo;\r | |
378 | EFI_SIMPLE_FILE_SYSTEM_PROTOCOL SimpleFs;\r | |
379 | UDF_VOLUME_INFO Volume;\r | |
380 | UDF_FILE_INFO Root;\r | |
381 | UINTN OpenFiles;\r | |
382 | EFI_HANDLE Handle;\r | |
383 | } PRIVATE_UDF_SIMPLE_FS_DATA;\r | |
384 | \r | |
385 | //\r | |
386 | // Global Variables\r | |
387 | //\r | |
388 | extern EFI_DRIVER_BINDING_PROTOCOL gUdfDriverBinding;\r | |
389 | extern EFI_COMPONENT_NAME_PROTOCOL gUdfComponentName;\r | |
390 | extern EFI_COMPONENT_NAME2_PROTOCOL gUdfComponentName2;\r | |
391 | \r | |
392 | //\r | |
393 | // Function Prototypes\r | |
394 | //\r | |
395 | \r | |
396 | /**\r | |
397 | Open the root directory on a volume.\r | |
398 | \r | |
399 | @param This Protocol instance pointer.\r | |
400 | @param Root Returns an Open file handle for the root directory\r | |
401 | \r | |
402 | @retval EFI_SUCCESS The device was opened.\r | |
403 | @retval EFI_UNSUPPORTED This volume does not support the file system.\r | |
404 | @retval EFI_NO_MEDIA The device has no media.\r | |
405 | @retval EFI_DEVICE_ERROR The device reported an error.\r | |
406 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r | |
407 | @retval EFI_ACCESS_DENIED The service denied access to the file.\r | |
408 | @retval EFI_OUT_OF_RESOURCES The volume was not opened due to lack of resources.\r | |
409 | \r | |
410 | **/\r | |
411 | EFI_STATUS\r | |
412 | EFIAPI\r | |
413 | UdfOpenVolume (\r | |
414 | IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *This,\r | |
415 | OUT EFI_FILE_PROTOCOL **Root\r | |
416 | );\r | |
417 | \r | |
418 | /**\r | |
419 | Opens a new file relative to the source file's location.\r | |
420 | \r | |
421 | @param This The protocol instance pointer.\r | |
422 | @param NewHandle Returns File Handle for FileName.\r | |
423 | @param FileName Null terminated string. "\", ".", and ".." are supported.\r | |
424 | @param OpenMode Open mode for file.\r | |
425 | @param Attributes Only used for EFI_FILE_MODE_CREATE.\r | |
426 | \r | |
427 | @retval EFI_SUCCESS The device was opened.\r | |
428 | @retval EFI_NOT_FOUND The specified file could not be found on the device.\r | |
429 | @retval EFI_NO_MEDIA The device has no media.\r | |
430 | @retval EFI_MEDIA_CHANGED The media has changed.\r | |
431 | @retval EFI_DEVICE_ERROR The device reported an error.\r | |
432 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r | |
433 | @retval EFI_ACCESS_DENIED The service denied access to the file.\r | |
434 | @retval EFI_OUT_OF_RESOURCES The volume was not opened due to lack of resources.\r | |
435 | @retval EFI_VOLUME_FULL The volume is full.\r | |
436 | \r | |
437 | **/\r | |
438 | EFI_STATUS\r | |
439 | EFIAPI\r | |
440 | UdfOpen (\r | |
441 | IN EFI_FILE_PROTOCOL *This,\r | |
442 | OUT EFI_FILE_PROTOCOL **NewHandle,\r | |
443 | IN CHAR16 *FileName,\r | |
444 | IN UINT64 OpenMode,\r | |
445 | IN UINT64 Attributes\r | |
446 | );\r | |
447 | \r | |
448 | /**\r | |
449 | Read data from the file.\r | |
450 | \r | |
451 | @param This Protocol instance pointer.\r | |
452 | @param BufferSize On input size of buffer, on output amount of data in buffer.\r | |
453 | @param Buffer The buffer in which data is read.\r | |
454 | \r | |
455 | @retval EFI_SUCCESS Data was read.\r | |
456 | @retval EFI_NO_MEDIA The device has no media.\r | |
457 | @retval EFI_DEVICE_ERROR The device reported an error.\r | |
458 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r | |
459 | @retval EFI_BUFFER_TO_SMALL BufferSize is too small. BufferSize contains required size.\r | |
460 | \r | |
461 | **/\r | |
462 | EFI_STATUS\r | |
463 | EFIAPI\r | |
464 | UdfRead (\r | |
465 | IN EFI_FILE_PROTOCOL *This,\r | |
466 | IN OUT UINTN *BufferSize,\r | |
467 | OUT VOID *Buffer\r | |
468 | );\r | |
469 | \r | |
470 | /**\r | |
471 | Close the file handle.\r | |
472 | \r | |
473 | @param This Protocol instance pointer.\r | |
474 | \r | |
475 | @retval EFI_SUCCESS The file was closed.\r | |
476 | \r | |
477 | **/\r | |
478 | EFI_STATUS\r | |
479 | EFIAPI\r | |
480 | UdfClose (\r | |
481 | IN EFI_FILE_PROTOCOL *This\r | |
482 | );\r | |
483 | \r | |
484 | /**\r | |
485 | Close and delete the file handle.\r | |
486 | \r | |
487 | @param This Protocol instance pointer.\r | |
488 | \r | |
489 | @retval EFI_SUCCESS The file was closed and deleted.\r | |
490 | @retval EFI_WARN_DELETE_FAILURE The handle was closed but the file was not\r | |
491 | deleted.\r | |
492 | \r | |
493 | **/\r | |
494 | EFI_STATUS\r | |
495 | EFIAPI\r | |
496 | UdfDelete (\r | |
497 | IN EFI_FILE_PROTOCOL *This\r | |
498 | );\r | |
499 | \r | |
500 | /**\r | |
501 | Write data to a file.\r | |
502 | \r | |
503 | @param This Protocol instance pointer.\r | |
504 | @param BufferSize On input size of buffer, on output amount of data in buffer.\r | |
505 | @param Buffer The buffer in which data to write.\r | |
506 | \r | |
507 | @retval EFI_SUCCESS Data was written.\r | |
508 | @retval EFI_UNSUPPORTED Writes to Open directory are not supported.\r | |
509 | @retval EFI_NO_MEDIA The device has no media.\r | |
510 | @retval EFI_DEVICE_ERROR The device reported an error.\r | |
511 | @retval EFI_DEVICE_ERROR An attempt was made to write to a deleted file.\r | |
512 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r | |
513 | @retval EFI_WRITE_PROTECTED The device is write protected.\r | |
514 | @retval EFI_ACCESS_DENIED The file was open for read only.\r | |
515 | @retval EFI_VOLUME_FULL The volume is full.\r | |
516 | \r | |
517 | **/\r | |
518 | EFI_STATUS\r | |
519 | EFIAPI\r | |
520 | UdfWrite (\r | |
521 | IN EFI_FILE_PROTOCOL *This,\r | |
522 | IN OUT UINTN *BufferSize,\r | |
523 | IN VOID *Buffer\r | |
524 | );\r | |
525 | \r | |
526 | /**\r | |
527 | Get file's current position.\r | |
528 | \r | |
529 | @param This Protocol instance pointer.\r | |
530 | @param Position Byte position from the start of the file.\r | |
531 | \r | |
532 | @retval EFI_SUCCESS Position was updated.\r | |
533 | @retval EFI_UNSUPPORTED Seek request for directories is not valid.\r | |
534 | \r | |
535 | **/\r | |
536 | EFI_STATUS\r | |
537 | EFIAPI\r | |
538 | UdfGetPosition (\r | |
539 | IN EFI_FILE_PROTOCOL *This,\r | |
540 | OUT UINT64 *Position\r | |
541 | );\r | |
542 | \r | |
543 | /**\r | |
544 | Set file's current position.\r | |
545 | \r | |
546 | @param This Protocol instance pointer.\r | |
547 | @param Position Byte position from the start of the file.\r | |
548 | \r | |
549 | @retval EFI_SUCCESS Position was updated.\r | |
550 | @retval EFI_UNSUPPORTED Seek request for non-zero is not valid on open.\r | |
551 | \r | |
552 | **/\r | |
553 | EFI_STATUS\r | |
554 | EFIAPI\r | |
555 | UdfSetPosition (\r | |
556 | IN EFI_FILE_PROTOCOL *This,\r | |
557 | IN UINT64 Position\r | |
558 | );\r | |
559 | \r | |
560 | /**\r | |
561 | Get information about a file.\r | |
562 | \r | |
b9ae1705 HW |
563 | @attention This is boundary function that may receive untrusted input.\r |
564 | @attention The input is from FileSystem.\r | |
565 | \r | |
566 | The File Set Descriptor is external input, so this routine will do basic\r | |
567 | validation for File Set Descriptor and report status.\r | |
568 | \r | |
99c9b949 PA |
569 | @param This Protocol instance pointer.\r |
570 | @param InformationType Type of information to return in Buffer.\r | |
b9ae1705 HW |
571 | @param BufferSize On input size of buffer, on output amount of data in\r |
572 | buffer.\r | |
99c9b949 PA |
573 | @param Buffer The buffer to return data.\r |
574 | \r | |
575 | @retval EFI_SUCCESS Data was returned.\r | |
576 | @retval EFI_UNSUPPORTED InformationType is not supported.\r | |
577 | @retval EFI_NO_MEDIA The device has no media.\r | |
578 | @retval EFI_DEVICE_ERROR The device reported an error.\r | |
579 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r | |
580 | @retval EFI_WRITE_PROTECTED The device is write protected.\r | |
581 | @retval EFI_ACCESS_DENIED The file was open for read only.\r | |
b9ae1705 HW |
582 | @retval EFI_BUFFER_TOO_SMALL Buffer was too small; required size returned in\r |
583 | BufferSize.\r | |
99c9b949 PA |
584 | \r |
585 | **/\r | |
586 | EFI_STATUS\r | |
587 | EFIAPI\r | |
588 | UdfGetInfo (\r | |
589 | IN EFI_FILE_PROTOCOL *This,\r | |
590 | IN EFI_GUID *InformationType,\r | |
591 | IN OUT UINTN *BufferSize,\r | |
592 | OUT VOID *Buffer\r | |
593 | );\r | |
594 | \r | |
595 | /**\r | |
596 | Set information about a file.\r | |
597 | \r | |
077f8c43 | 598 | @param This Protocol instance pointer.\r |
99c9b949 PA |
599 | @param InformationType Type of information in Buffer.\r |
600 | @param BufferSize Size of buffer.\r | |
601 | @param Buffer The data to write.\r | |
602 | \r | |
603 | @retval EFI_SUCCESS Data was set.\r | |
604 | @retval EFI_UNSUPPORTED InformationType is not supported.\r | |
605 | @retval EFI_NO_MEDIA The device has no media.\r | |
606 | @retval EFI_DEVICE_ERROR The device reported an error.\r | |
607 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r | |
608 | @retval EFI_WRITE_PROTECTED The device is write protected.\r | |
609 | @retval EFI_ACCESS_DENIED The file was open for read only.\r | |
610 | \r | |
611 | **/\r | |
612 | EFI_STATUS\r | |
613 | EFIAPI\r | |
614 | UdfSetInfo (\r | |
615 | IN EFI_FILE_PROTOCOL *This,\r | |
616 | IN EFI_GUID *InformationType,\r | |
617 | IN UINTN BufferSize,\r | |
618 | IN VOID *Buffer\r | |
619 | );\r | |
620 | \r | |
621 | /**\r | |
622 | Flush data back for the file handle.\r | |
623 | \r | |
624 | @param This Protocol instance pointer.\r | |
625 | \r | |
626 | @retval EFI_SUCCESS Data was flushed.\r | |
627 | @retval EFI_UNSUPPORTED Writes to Open directory are not supported.\r | |
628 | @retval EFI_NO_MEDIA The device has no media.\r | |
629 | @retval EFI_DEVICE_ERROR The device reported an error.\r | |
630 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r | |
631 | @retval EFI_WRITE_PROTECTED The device is write protected.\r | |
632 | @retval EFI_ACCESS_DENIED The file was open for read only.\r | |
633 | @retval EFI_VOLUME_FULL The volume is full.\r | |
634 | \r | |
635 | **/\r | |
636 | EFI_STATUS\r | |
637 | EFIAPI\r | |
638 | UdfFlush (\r | |
639 | IN EFI_FILE_PROTOCOL *This\r | |
640 | );\r | |
641 | \r | |
642 | /**\r | |
643 | Read volume information on a medium which contains a valid UDF file system.\r | |
644 | \r | |
645 | @param[in] BlockIo BlockIo interface.\r | |
646 | @param[in] DiskIo DiskIo interface.\r | |
647 | @param[out] Volume UDF volume information structure.\r | |
648 | \r | |
649 | @retval EFI_SUCCESS Volume information read.\r | |
650 | @retval EFI_NO_MEDIA The device has no media.\r | |
651 | @retval EFI_DEVICE_ERROR The device reported an error.\r | |
652 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r | |
653 | @retval EFI_OUT_OF_RESOURCES The volume was not read due to lack of resources.\r | |
654 | \r | |
655 | **/\r | |
656 | EFI_STATUS\r | |
657 | ReadUdfVolumeInformation (\r | |
658 | IN EFI_BLOCK_IO_PROTOCOL *BlockIo,\r | |
659 | IN EFI_DISK_IO_PROTOCOL *DiskIo,\r | |
660 | OUT UDF_VOLUME_INFO *Volume\r | |
661 | );\r | |
662 | \r | |
663 | /**\r | |
664 | Find the root directory on an UDF volume.\r | |
665 | \r | |
666 | @param[in] BlockIo BlockIo interface.\r | |
667 | @param[in] DiskIo DiskIo interface.\r | |
668 | @param[in] Volume UDF volume information structure.\r | |
669 | @param[out] File Root directory file.\r | |
670 | \r | |
671 | @retval EFI_SUCCESS Root directory found.\r | |
672 | @retval EFI_NO_MEDIA The device has no media.\r | |
673 | @retval EFI_DEVICE_ERROR The device reported an error.\r | |
674 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r | |
675 | @retval EFI_OUT_OF_RESOURCES The root directory was not found due to lack of\r | |
676 | resources.\r | |
677 | \r | |
678 | **/\r | |
679 | EFI_STATUS\r | |
680 | FindRootDirectory (\r | |
681 | IN EFI_BLOCK_IO_PROTOCOL *BlockIo,\r | |
682 | IN EFI_DISK_IO_PROTOCOL *DiskIo,\r | |
683 | IN UDF_VOLUME_INFO *Volume,\r | |
684 | OUT UDF_FILE_INFO *File\r | |
685 | );\r | |
686 | \r | |
687 | /**\r | |
688 | Find either a File Entry or a Extended File Entry from a given ICB.\r | |
689 | \r | |
690 | @param[in] BlockIo BlockIo interface.\r | |
691 | @param[in] DiskIo DiskIo interface.\r | |
692 | @param[in] Volume UDF volume information structure.\r | |
693 | @param[in] Icb ICB of the FID.\r | |
694 | @param[out] FileEntry File Entry or Extended File Entry.\r | |
695 | \r | |
696 | @retval EFI_SUCCESS File Entry or Extended File Entry found.\r | |
697 | @retval EFI_NO_MEDIA The device has no media.\r | |
698 | @retval EFI_DEVICE_ERROR The device reported an error.\r | |
699 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r | |
700 | @retval EFI_OUT_OF_RESOURCES The FE/EFE entry was not found due to lack of\r | |
701 | resources.\r | |
702 | \r | |
703 | **/\r | |
704 | EFI_STATUS\r | |
705 | FindFileEntry (\r | |
706 | IN EFI_BLOCK_IO_PROTOCOL *BlockIo,\r | |
707 | IN EFI_DISK_IO_PROTOCOL *DiskIo,\r | |
708 | IN UDF_VOLUME_INFO *Volume,\r | |
709 | IN UDF_LONG_ALLOCATION_DESCRIPTOR *Icb,\r | |
710 | OUT VOID **FileEntry\r | |
711 | );\r | |
712 | \r | |
713 | /**\r | |
714 | Find a file given its absolute path on an UDF volume.\r | |
715 | \r | |
716 | @param[in] BlockIo BlockIo interface.\r | |
717 | @param[in] DiskIo DiskIo interface.\r | |
718 | @param[in] Volume UDF volume information structure.\r | |
719 | @param[in] FilePath File's absolute path.\r | |
720 | @param[in] Root Root directory file.\r | |
721 | @param[in] Parent Parent directory file.\r | |
077f8c43 | 722 | @param[in] Icb ICB of Parent.\r |
99c9b949 PA |
723 | @param[out] File Found file.\r |
724 | \r | |
077f8c43 | 725 | @retval EFI_SUCCESS FilePath was found.\r |
99c9b949 PA |
726 | @retval EFI_NO_MEDIA The device has no media.\r |
727 | @retval EFI_DEVICE_ERROR The device reported an error.\r | |
728 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r | |
077f8c43 | 729 | @retval EFI_OUT_OF_RESOURCES The FilePath file was not found due to lack of\r |
99c9b949 PA |
730 | resources.\r |
731 | \r | |
732 | **/\r | |
733 | EFI_STATUS\r | |
734 | FindFile (\r | |
735 | IN EFI_BLOCK_IO_PROTOCOL *BlockIo,\r | |
736 | IN EFI_DISK_IO_PROTOCOL *DiskIo,\r | |
737 | IN UDF_VOLUME_INFO *Volume,\r | |
738 | IN CHAR16 *FilePath,\r | |
739 | IN UDF_FILE_INFO *Root,\r | |
740 | IN UDF_FILE_INFO *Parent,\r | |
741 | IN UDF_LONG_ALLOCATION_DESCRIPTOR *Icb,\r | |
742 | OUT UDF_FILE_INFO *File\r | |
743 | );\r | |
744 | \r | |
745 | /**\r | |
746 | Read a directory entry at a time on an UDF volume.\r | |
747 | \r | |
748 | @param[in] BlockIo BlockIo interface.\r | |
749 | @param[in] DiskIo DiskIo interface.\r | |
750 | @param[in] Volume UDF volume information structure.\r | |
751 | @param[in] ParentIcb ICB of the parent file.\r | |
752 | @param[in] FileEntryData FE/EFE of the parent file.\r | |
077f8c43 | 753 | @param[in, out] ReadDirInfo Next read directory listing structure\r |
99c9b949 PA |
754 | information.\r |
755 | @param[out] FoundFid File Identifier Descriptor pointer.\r | |
756 | \r | |
757 | @retval EFI_SUCCESS Directory entry read.\r | |
758 | @retval EFI_UNSUPPORTED Extended Allocation Descriptors not supported.\r | |
759 | @retval EFI_NO_MEDIA The device has no media.\r | |
760 | @retval EFI_DEVICE_ERROR The device reported an error.\r | |
761 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r | |
762 | @retval EFI_OUT_OF_RESOURCES The directory entry was not read due to lack of\r | |
763 | resources.\r | |
764 | \r | |
765 | **/\r | |
766 | EFI_STATUS\r | |
767 | ReadDirectoryEntry (\r | |
768 | IN EFI_BLOCK_IO_PROTOCOL *BlockIo,\r | |
769 | IN EFI_DISK_IO_PROTOCOL *DiskIo,\r | |
770 | IN UDF_VOLUME_INFO *Volume,\r | |
771 | IN UDF_LONG_ALLOCATION_DESCRIPTOR *ParentIcb,\r | |
772 | IN VOID *FileEntryData,\r | |
773 | IN OUT UDF_READ_DIRECTORY_INFO *ReadDirInfo,\r | |
774 | OUT UDF_FILE_IDENTIFIER_DESCRIPTOR **FoundFid\r | |
775 | );\r | |
776 | \r | |
777 | /**\r | |
778 | Get a filename (encoded in OSTA-compressed format) from a File Identifier\r | |
779 | Descriptor on an UDF volume.\r | |
780 | \r | |
b9ae1705 HW |
781 | @attention This is boundary function that may receive untrusted input.\r |
782 | @attention The input is from FileSystem.\r | |
783 | \r | |
784 | The File Identifier Descriptor is external input, so this routine will do\r | |
785 | basic validation for File Identifier Descriptor and report status.\r | |
786 | \r | |
99c9b949 | 787 | @param[in] FileIdentifierDesc File Identifier Descriptor pointer.\r |
b9ae1705 HW |
788 | @param[in] CharMax The maximum number of FileName Unicode char,\r |
789 | including terminating null char.\r | |
99c9b949 PA |
790 | @param[out] FileName Decoded filename.\r |
791 | \r | |
792 | @retval EFI_SUCCESS Filename decoded and read.\r | |
793 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r | |
b9ae1705 HW |
794 | @retval EFI_BUFFER_TOO_SMALL The string buffer FileName cannot hold the\r |
795 | decoded filename.\r | |
99c9b949 PA |
796 | **/\r |
797 | EFI_STATUS\r | |
798 | GetFileNameFromFid (\r | |
799 | IN UDF_FILE_IDENTIFIER_DESCRIPTOR *FileIdentifierDesc,\r | |
b9ae1705 | 800 | IN UINTN CharMax,\r |
99c9b949 PA |
801 | OUT CHAR16 *FileName\r |
802 | );\r | |
803 | \r | |
804 | /**\r | |
805 | Resolve a symlink file on an UDF volume.\r | |
806 | \r | |
b9ae1705 HW |
807 | @attention This is boundary function that may receive untrusted input.\r |
808 | @attention The input is from FileSystem.\r | |
809 | \r | |
810 | The Path Component is external input, so this routine will do basic\r | |
811 | validation for Path Component and report status.\r | |
812 | \r | |
99c9b949 PA |
813 | @param[in] BlockIo BlockIo interface.\r |
814 | @param[in] DiskIo DiskIo interface.\r | |
815 | @param[in] Volume UDF volume information structure.\r | |
816 | @param[in] Parent Parent file.\r | |
817 | @param[in] FileEntryData FE/EFE structure pointer.\r | |
818 | @param[out] File Resolved file.\r | |
819 | \r | |
820 | @retval EFI_SUCCESS Symlink file resolved.\r | |
821 | @retval EFI_UNSUPPORTED Extended Allocation Descriptors not supported.\r | |
822 | @retval EFI_NO_MEDIA The device has no media.\r | |
823 | @retval EFI_DEVICE_ERROR The device reported an error.\r | |
824 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r | |
825 | @retval EFI_OUT_OF_RESOURCES The symlink file was not resolved due to lack of\r | |
826 | resources.\r | |
827 | \r | |
828 | **/\r | |
829 | EFI_STATUS\r | |
830 | ResolveSymlink (\r | |
831 | IN EFI_BLOCK_IO_PROTOCOL *BlockIo,\r | |
832 | IN EFI_DISK_IO_PROTOCOL *DiskIo,\r | |
833 | IN UDF_VOLUME_INFO *Volume,\r | |
834 | IN UDF_FILE_INFO *Parent,\r | |
835 | IN VOID *FileEntryData,\r | |
836 | OUT UDF_FILE_INFO *File\r | |
837 | );\r | |
838 | \r | |
99c9b949 PA |
839 | /**\r |
840 | Clean up in-memory UDF file information.\r | |
841 | \r | |
842 | @param[in] File File information pointer.\r | |
843 | \r | |
844 | **/\r | |
845 | VOID\r | |
846 | CleanupFileInformation (\r | |
847 | IN UDF_FILE_INFO *File\r | |
848 | );\r | |
849 | \r | |
850 | /**\r | |
851 | Find a file from its absolute path on an UDF volume.\r | |
852 | \r | |
853 | @param[in] BlockIo BlockIo interface.\r | |
854 | @param[in] DiskIo DiskIo interface.\r | |
855 | @param[in] Volume UDF volume information structure.\r | |
856 | @param[in] File File information structure.\r | |
857 | @param[out] Size Size of the file.\r | |
858 | \r | |
077f8c43 | 859 | @retval EFI_SUCCESS File size calculated and set in Size.\r |
99c9b949 PA |
860 | @retval EFI_UNSUPPORTED Extended Allocation Descriptors not supported.\r |
861 | @retval EFI_NO_MEDIA The device has no media.\r | |
862 | @retval EFI_DEVICE_ERROR The device reported an error.\r | |
863 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r | |
864 | @retval EFI_OUT_OF_RESOURCES The file size was not calculated due to lack of\r | |
865 | resources.\r | |
866 | \r | |
867 | **/\r | |
868 | EFI_STATUS\r | |
869 | GetFileSize (\r | |
870 | IN EFI_BLOCK_IO_PROTOCOL *BlockIo,\r | |
871 | IN EFI_DISK_IO_PROTOCOL *DiskIo,\r | |
872 | IN UDF_VOLUME_INFO *Volume,\r | |
873 | IN UDF_FILE_INFO *File,\r | |
874 | OUT UINT64 *Size\r | |
875 | );\r | |
876 | \r | |
877 | /**\r | |
878 | Set information about a file on an UDF volume.\r | |
879 | \r | |
880 | @param[in] File File pointer.\r | |
881 | @param[in] FileSize Size of the file.\r | |
882 | @param[in] FileName Filename of the file.\r | |
077f8c43 | 883 | @param[in, out] BufferSize Size of the returned file infomation.\r |
99c9b949 PA |
884 | @param[out] Buffer Data of the returned file information.\r |
885 | \r | |
886 | @retval EFI_SUCCESS File information set.\r | |
887 | @retval EFI_NO_MEDIA The device has no media.\r | |
888 | @retval EFI_DEVICE_ERROR The device reported an error.\r | |
889 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r | |
890 | @retval EFI_OUT_OF_RESOURCES The file information was not set due to lack of\r | |
891 | resources.\r | |
892 | \r | |
893 | **/\r | |
894 | EFI_STATUS\r | |
895 | SetFileInfo (\r | |
896 | IN UDF_FILE_INFO *File,\r | |
897 | IN UINT64 FileSize,\r | |
898 | IN CHAR16 *FileName,\r | |
899 | IN OUT UINTN *BufferSize,\r | |
900 | OUT VOID *Buffer\r | |
901 | );\r | |
902 | \r | |
32698a8f HW |
903 | /**\r |
904 | Get volume label of an UDF volume.\r | |
905 | \r | |
906 | @attention This is boundary function that may receive untrusted input.\r | |
907 | @attention The input is from FileSystem.\r | |
908 | \r | |
909 | The File Set Descriptor is external input, so this routine will do basic\r | |
910 | validation for File Set Descriptor and report status.\r | |
911 | \r | |
912 | @param[in] Volume Volume information pointer.\r | |
913 | @param[in] CharMax The maximum number of Unicode char in String,\r | |
914 | including terminating null char.\r | |
915 | @param[out] String String buffer pointer to store the volume label.\r | |
916 | \r | |
917 | @retval EFI_SUCCESS Volume label is returned.\r | |
918 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r | |
919 | @retval EFI_BUFFER_TOO_SMALL The string buffer String cannot hold the\r | |
920 | volume label.\r | |
921 | \r | |
922 | **/\r | |
923 | EFI_STATUS\r | |
924 | GetVolumeLabel (\r | |
925 | IN UDF_VOLUME_INFO *Volume,\r | |
926 | IN UINTN CharMax,\r | |
927 | OUT CHAR16 *String\r | |
928 | );\r | |
929 | \r | |
99c9b949 PA |
930 | /**\r |
931 | Get volume and free space size information of an UDF volume.\r | |
932 | \r | |
3b30351b HW |
933 | @attention This is boundary function that may receive untrusted input.\r |
934 | @attention The input is from FileSystem.\r | |
935 | \r | |
936 | The Logical Volume Descriptor and the Logical Volume Integrity Descriptor are\r | |
937 | external inputs, so this routine will do basic validation for both descriptors\r | |
938 | and report status.\r | |
939 | \r | |
99c9b949 PA |
940 | @param[in] BlockIo BlockIo interface.\r |
941 | @param[in] DiskIo DiskIo interface.\r | |
942 | @param[in] Volume UDF volume information structure.\r | |
943 | @param[out] VolumeSize Volume size.\r | |
944 | @param[out] FreeSpaceSize Free space size.\r | |
945 | \r | |
946 | @retval EFI_SUCCESS Volume and free space size calculated.\r | |
947 | @retval EFI_NO_MEDIA The device has no media.\r | |
948 | @retval EFI_DEVICE_ERROR The device reported an error.\r | |
949 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r | |
950 | @retval EFI_OUT_OF_RESOURCES The volume and free space size were not\r | |
951 | calculated due to lack of resources.\r | |
952 | \r | |
953 | **/\r | |
954 | EFI_STATUS\r | |
955 | GetVolumeSize (\r | |
956 | IN EFI_BLOCK_IO_PROTOCOL *BlockIo,\r | |
957 | IN EFI_DISK_IO_PROTOCOL *DiskIo,\r | |
958 | IN UDF_VOLUME_INFO *Volume,\r | |
959 | OUT UINT64 *VolumeSize,\r | |
960 | OUT UINT64 *FreeSpaceSize\r | |
961 | );\r | |
962 | \r | |
963 | /**\r | |
964 | Seek a file and read its data into memory on an UDF volume.\r | |
965 | \r | |
966 | @param[in] BlockIo BlockIo interface.\r | |
967 | @param[in] DiskIo DiskIo interface.\r | |
968 | @param[in] Volume UDF volume information structure.\r | |
969 | @param[in] File File information structure.\r | |
970 | @param[in] FileSize Size of the file.\r | |
077f8c43 HW |
971 | @param[in, out] FilePosition File position.\r |
972 | @param[in, out] Buffer File data.\r | |
973 | @param[in, out] BufferSize Read size.\r | |
99c9b949 PA |
974 | \r |
975 | @retval EFI_SUCCESS File seeked and read.\r | |
976 | @retval EFI_UNSUPPORTED Extended Allocation Descriptors not supported.\r | |
977 | @retval EFI_NO_MEDIA The device has no media.\r | |
978 | @retval EFI_DEVICE_ERROR The device reported an error.\r | |
979 | @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r | |
980 | @retval EFI_OUT_OF_RESOURCES The file's recorded data was not read due to lack\r | |
981 | of resources.\r | |
982 | \r | |
983 | **/\r | |
984 | EFI_STATUS\r | |
985 | ReadFileData (\r | |
986 | IN EFI_BLOCK_IO_PROTOCOL *BlockIo,\r | |
987 | IN EFI_DISK_IO_PROTOCOL *DiskIo,\r | |
988 | IN UDF_VOLUME_INFO *Volume,\r | |
989 | IN UDF_FILE_INFO *File,\r | |
990 | IN UINT64 FileSize,\r | |
991 | IN OUT UINT64 *FilePosition,\r | |
992 | IN OUT VOID *Buffer,\r | |
993 | IN OUT UINT64 *BufferSize\r | |
994 | );\r | |
995 | \r | |
996 | /**\r | |
997 | Check if ControllerHandle supports an UDF file system.\r | |
998 | \r | |
999 | @param[in] This Protocol instance pointer.\r | |
1000 | @param[in] ControllerHandle Handle of device to test.\r | |
1001 | \r | |
1002 | @retval EFI_SUCCESS UDF file system found.\r | |
1003 | @retval EFI_UNSUPPORTED UDF file system not found.\r | |
1004 | \r | |
1005 | **/\r | |
1006 | EFI_STATUS\r | |
1007 | SupportUdfFileSystem (\r | |
1008 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
1009 | IN EFI_HANDLE ControllerHandle\r | |
1010 | );\r | |
1011 | \r | |
1012 | /**\r | |
1013 | Mangle a filename by cutting off trailing whitespaces, "\\", "." and "..".\r | |
1014 | \r | |
1015 | @param[in] FileName Filename.\r | |
1016 | \r | |
077f8c43 | 1017 | @retval The mangled Filename.\r |
99c9b949 PA |
1018 | \r |
1019 | **/\r | |
1020 | CHAR16 *\r | |
1021 | MangleFileName (\r | |
1022 | IN CHAR16 *FileName\r | |
1023 | );\r | |
1024 | \r | |
1025 | /**\r | |
1026 | Test to see if this driver supports ControllerHandle. Any ControllerHandle\r | |
1027 | than contains a BlockIo and DiskIo protocol can be supported.\r | |
1028 | \r | |
1029 | @param This Protocol instance pointer.\r | |
1030 | @param ControllerHandle Handle of device to test\r | |
1031 | @param RemainingDevicePath Optional parameter use to pick a specific child\r | |
1032 | device to start.\r | |
1033 | \r | |
1034 | @retval EFI_SUCCESS This driver supports this device\r | |
1035 | @retval EFI_ALREADY_STARTED This driver is already running on this device\r | |
1036 | @retval other This driver does not support this device\r | |
1037 | \r | |
1038 | **/\r | |
1039 | EFI_STATUS\r | |
1040 | EFIAPI\r | |
1041 | UdfDriverBindingSupported (\r | |
1042 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
1043 | IN EFI_HANDLE ControllerHandle,\r | |
1044 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r | |
1045 | );\r | |
1046 | \r | |
1047 | /**\r | |
1048 | Start this driver on ControllerHandle by opening a Block IO and Disk IO\r | |
1049 | protocol, reading Device Path, and creating a child handle with a\r | |
1050 | Disk IO and device path protocol.\r | |
1051 | \r | |
1052 | @param This Protocol instance pointer.\r | |
1053 | @param ControllerHandle Handle of device to bind driver to\r | |
1054 | @param RemainingDevicePath Optional parameter use to pick a specific child\r | |
1055 | device to start.\r | |
1056 | \r | |
1057 | @retval EFI_SUCCESS This driver is added to ControllerHandle\r | |
1058 | @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle\r | |
1059 | @retval other This driver does not support this device\r | |
1060 | \r | |
1061 | **/\r | |
1062 | EFI_STATUS\r | |
1063 | EFIAPI\r | |
1064 | UdfDriverBindingStart (\r | |
1065 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
1066 | IN EFI_HANDLE ControllerHandle,\r | |
1067 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r | |
1068 | );\r | |
1069 | \r | |
1070 | /**\r | |
1071 | Stop this driver on ControllerHandle. Support stopping any child handles\r | |
1072 | created by this driver.\r | |
1073 | \r | |
1074 | @param This Protocol instance pointer.\r | |
1075 | @param ControllerHandle Handle of device to stop driver on\r | |
1076 | @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of\r | |
1077 | children is zero stop the entire bus driver.\r | |
1078 | @param ChildHandleBuffer List of Child Handles to Stop.\r | |
1079 | \r | |
1080 | @retval EFI_SUCCESS This driver is removed ControllerHandle\r | |
1081 | @retval other This driver was not removed from this device\r | |
1082 | \r | |
1083 | **/\r | |
1084 | EFI_STATUS\r | |
1085 | EFIAPI\r | |
1086 | UdfDriverBindingStop (\r | |
1087 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
1088 | IN EFI_HANDLE ControllerHandle,\r | |
1089 | IN UINTN NumberOfChildren,\r | |
1090 | IN EFI_HANDLE *ChildHandleBuffer\r | |
1091 | );\r | |
1092 | \r | |
1093 | //\r | |
1094 | // EFI Component Name Functions\r | |
1095 | //\r | |
1096 | /**\r | |
1097 | Retrieves a Unicode string that is the user readable name of the driver.\r | |
1098 | \r | |
1099 | This function retrieves the user readable name of a driver in the form of a\r | |
1100 | Unicode string. If the driver specified by This has a user readable name in\r | |
1101 | the language specified by Language, then a pointer to the driver name is\r | |
1102 | returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r | |
1103 | by This does not support the language specified by Language,\r | |
1104 | then EFI_UNSUPPORTED is returned.\r | |
1105 | \r | |
1106 | @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r | |
1107 | EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
1108 | \r | |
1109 | @param Language[in] A pointer to a Null-terminated ASCII string\r | |
1110 | array indicating the language. This is the\r | |
1111 | language of the driver name that the caller is\r | |
1112 | requesting, and it must match one of the\r | |
1113 | languages specified in SupportedLanguages. The\r | |
1114 | number of languages supported by a driver is up\r | |
1115 | to the driver writer. Language is specified\r | |
1116 | in RFC 4646 or ISO 639-2 language code format.\r | |
1117 | \r | |
1118 | @param DriverName[out] A pointer to the Unicode string to return.\r | |
1119 | This Unicode string is the name of the\r | |
1120 | driver specified by This in the language\r | |
1121 | specified by Language.\r | |
1122 | \r | |
1123 | @retval EFI_SUCCESS The Unicode string for the Driver specified by\r | |
1124 | This and the language specified by Language was\r | |
1125 | returned in DriverName.\r | |
1126 | \r | |
1127 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
1128 | \r | |
1129 | @retval EFI_INVALID_PARAMETER DriverName is NULL.\r | |
1130 | \r | |
1131 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r | |
1132 | the language specified by Language.\r | |
1133 | \r | |
1134 | **/\r | |
1135 | EFI_STATUS\r | |
1136 | EFIAPI\r | |
1137 | UdfComponentNameGetDriverName (\r | |
1138 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
1139 | IN CHAR8 *Language,\r | |
1140 | OUT CHAR16 **DriverName\r | |
1141 | );\r | |
1142 | \r | |
1143 | /**\r | |
1144 | Retrieves a Unicode string that is the user readable name of the controller\r | |
1145 | that is being managed by a driver.\r | |
1146 | \r | |
1147 | This function retrieves the user readable name of the controller specified by\r | |
1148 | ControllerHandle and ChildHandle in the form of a Unicode string. If the\r | |
1149 | driver specified by This has a user readable name in the language specified by\r | |
1150 | Language, then a pointer to the controller name is returned in ControllerName,\r | |
1151 | and EFI_SUCCESS is returned. If the driver specified by This is not currently\r | |
1152 | managing the controller specified by ControllerHandle and ChildHandle,\r | |
1153 | then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r | |
1154 | support the language specified by Language, then EFI_UNSUPPORTED is returned.\r | |
1155 | \r | |
1156 | @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r | |
1157 | EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
1158 | \r | |
1159 | @param ControllerHandle[in] The handle of a controller that the driver\r | |
1160 | specified by This is managing. This handle\r | |
1161 | specifies the controller whose name is to be\r | |
1162 | returned.\r | |
1163 | \r | |
1164 | @param ChildHandle[in] The handle of the child controller to retrieve\r | |
1165 | the name of. This is an optional parameter that\r | |
1166 | may be NULL. It will be NULL for device\r | |
1167 | drivers. It will also be NULL for a bus drivers\r | |
1168 | that wish to retrieve the name of the bus\r | |
1169 | controller. It will not be NULL for a bus\r | |
1170 | driver that wishes to retrieve the name of a\r | |
1171 | child controller.\r | |
1172 | \r | |
1173 | @param Language[in] A pointer to a Null-terminated ASCII string\r | |
1174 | array indicating the language. This is the\r | |
1175 | language of the driver name that the caller is\r | |
1176 | requesting, and it must match one of the\r | |
1177 | languages specified in SupportedLanguages. The\r | |
1178 | number of languages supported by a driver is up\r | |
1179 | to the driver writer. Language is specified in\r | |
1180 | RFC 4646 or ISO 639-2 language code format.\r | |
1181 | \r | |
1182 | @param ControllerName[out] A pointer to the Unicode string to return.\r | |
1183 | This Unicode string is the name of the\r | |
1184 | controller specified by ControllerHandle and\r | |
1185 | ChildHandle in the language specified by\r | |
1186 | Language from the point of view of the driver\r | |
1187 | specified by This.\r | |
1188 | \r | |
1189 | @retval EFI_SUCCESS The Unicode string for the user readable name in\r | |
1190 | the language specified by Language for the\r | |
1191 | driver specified by This was returned in\r | |
1192 | DriverName.\r | |
1193 | \r | |
1194 | @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r | |
1195 | \r | |
1196 | @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r | |
1197 | EFI_HANDLE.\r | |
1198 | \r | |
1199 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
1200 | \r | |
1201 | @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r | |
1202 | \r | |
1203 | @retval EFI_UNSUPPORTED The driver specified by This is not currently\r | |
1204 | managing the controller specified by\r | |
1205 | ControllerHandle and ChildHandle.\r | |
1206 | \r | |
1207 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r | |
1208 | the language specified by Language.\r | |
1209 | \r | |
1210 | **/\r | |
1211 | EFI_STATUS\r | |
1212 | EFIAPI\r | |
1213 | UdfComponentNameGetControllerName (\r | |
1214 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
1215 | IN EFI_HANDLE ControllerHandle,\r | |
1216 | IN EFI_HANDLE ChildHandle OPTIONAL,\r | |
1217 | IN CHAR8 *Language,\r | |
1218 | OUT CHAR16 **ControllerName\r | |
1219 | );\r | |
1220 | \r | |
1221 | #endif // _UDF_H_\r |