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