]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Disk/UdfDxe/Udf.h
MdeModulePkg/UdfDxe: Refine boundary checks for file/path name string
[mirror_edk2.git] / MdeModulePkg / Universal / Disk / UdfDxe / Udf.h
CommitLineData
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
59typedef 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
82typedef 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
94typedef 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
133typedef struct {\r
134 UINT8 StandardIdentifier[UDF_STANDARD_IDENTIFIER_LENGTH];\r
135} UDF_STANDARD_IDENTIFIER;\r
136\r
137#pragma pack()\r
138\r
139typedef enum {\r
880ec683
HW
140 ReadFileGetFileSize,\r
141 ReadFileAllocateAndRead,\r
142 ReadFileSeekAndRead,\r
99c9b949
PA
143} UDF_READ_FILE_FLAGS;\r
144\r
145typedef 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
156typedef 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
169typedef struct {\r
170 UDF_DESCRIPTOR_TAG DescriptorTag;\r
171 UINT32 PrevAllocationExtentDescriptor;\r
172 UINT32 LengthOfAllocationDescriptors;\r
173} UDF_ALLOCATION_EXTENT_DESCRIPTOR;\r
174\r
175typedef 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
183typedef 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
194typedef 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
209typedef 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
231typedef struct {\r
232 UINT32 ExtentLength;\r
233 UINT32 ExtentPosition;\r
234} UDF_SHORT_ALLOCATION_DESCRIPTOR;\r
235\r
236typedef 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
246typedef 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
257typedef 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
281typedef 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
309typedef 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
321typedef 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
329typedef struct {\r
330 VOID *FileEntry;\r
331 UDF_FILE_IDENTIFIER_DESCRIPTOR *FileIdentifierDesc;\r
332} UDF_FILE_INFO;\r
333\r
334typedef 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
350typedef 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
374typedef 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
388extern EFI_DRIVER_BINDING_PROTOCOL gUdfDriverBinding;\r
389extern EFI_COMPONENT_NAME_PROTOCOL gUdfComponentName;\r
390extern 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
411EFI_STATUS\r
412EFIAPI\r
413UdfOpenVolume (\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
438EFI_STATUS\r
439EFIAPI\r
440UdfOpen (\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
462EFI_STATUS\r
463EFIAPI\r
464UdfRead (\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
478EFI_STATUS\r
479EFIAPI\r
480UdfClose (\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
494EFI_STATUS\r
495EFIAPI\r
496UdfDelete (\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
518EFI_STATUS\r
519EFIAPI\r
520UdfWrite (\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
536EFI_STATUS\r
537EFIAPI\r
538UdfGetPosition (\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
553EFI_STATUS\r
554EFIAPI\r
555UdfSetPosition (\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
586EFI_STATUS\r
587EFIAPI\r
588UdfGetInfo (\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
612EFI_STATUS\r
613EFIAPI\r
614UdfSetInfo (\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
636EFI_STATUS\r
637EFIAPI\r
638UdfFlush (\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
656EFI_STATUS\r
657ReadUdfVolumeInformation (\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
679EFI_STATUS\r
680FindRootDirectory (\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
704EFI_STATUS\r
705FindFileEntry (\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
733EFI_STATUS\r
734FindFile (\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
766EFI_STATUS\r
767ReadDirectoryEntry (\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
797EFI_STATUS\r
798GetFileNameFromFid (\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
829EFI_STATUS\r
830ResolveSymlink (\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
845VOID\r
846CleanupFileInformation (\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
868EFI_STATUS\r
869GetFileSize (\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
894EFI_STATUS\r
895SetFileInfo (\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
903/**\r
904 Get volume and free space size information of an UDF volume.\r
905\r
906 @param[in] BlockIo BlockIo interface.\r
907 @param[in] DiskIo DiskIo interface.\r
908 @param[in] Volume UDF volume information structure.\r
909 @param[out] VolumeSize Volume size.\r
910 @param[out] FreeSpaceSize Free space size.\r
911\r
912 @retval EFI_SUCCESS Volume and free space size calculated.\r
913 @retval EFI_NO_MEDIA The device has no media.\r
914 @retval EFI_DEVICE_ERROR The device reported an error.\r
915 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r
916 @retval EFI_OUT_OF_RESOURCES The volume and free space size were not\r
917 calculated due to lack of resources.\r
918\r
919**/\r
920EFI_STATUS\r
921GetVolumeSize (\r
922 IN EFI_BLOCK_IO_PROTOCOL *BlockIo,\r
923 IN EFI_DISK_IO_PROTOCOL *DiskIo,\r
924 IN UDF_VOLUME_INFO *Volume,\r
925 OUT UINT64 *VolumeSize,\r
926 OUT UINT64 *FreeSpaceSize\r
927 );\r
928\r
929/**\r
930 Seek a file and read its data into memory on an UDF volume.\r
931\r
932 @param[in] BlockIo BlockIo interface.\r
933 @param[in] DiskIo DiskIo interface.\r
934 @param[in] Volume UDF volume information structure.\r
935 @param[in] File File information structure.\r
936 @param[in] FileSize Size of the file.\r
077f8c43
HW
937 @param[in, out] FilePosition File position.\r
938 @param[in, out] Buffer File data.\r
939 @param[in, out] BufferSize Read size.\r
99c9b949
PA
940\r
941 @retval EFI_SUCCESS File seeked and read.\r
942 @retval EFI_UNSUPPORTED Extended Allocation Descriptors not supported.\r
943 @retval EFI_NO_MEDIA The device has no media.\r
944 @retval EFI_DEVICE_ERROR The device reported an error.\r
945 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r
946 @retval EFI_OUT_OF_RESOURCES The file's recorded data was not read due to lack\r
947 of resources.\r
948\r
949**/\r
950EFI_STATUS\r
951ReadFileData (\r
952 IN EFI_BLOCK_IO_PROTOCOL *BlockIo,\r
953 IN EFI_DISK_IO_PROTOCOL *DiskIo,\r
954 IN UDF_VOLUME_INFO *Volume,\r
955 IN UDF_FILE_INFO *File,\r
956 IN UINT64 FileSize,\r
957 IN OUT UINT64 *FilePosition,\r
958 IN OUT VOID *Buffer,\r
959 IN OUT UINT64 *BufferSize\r
960 );\r
961\r
962/**\r
963 Check if ControllerHandle supports an UDF file system.\r
964\r
965 @param[in] This Protocol instance pointer.\r
966 @param[in] ControllerHandle Handle of device to test.\r
967\r
968 @retval EFI_SUCCESS UDF file system found.\r
969 @retval EFI_UNSUPPORTED UDF file system not found.\r
970\r
971**/\r
972EFI_STATUS\r
973SupportUdfFileSystem (\r
974 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
975 IN EFI_HANDLE ControllerHandle\r
976 );\r
977\r
978/**\r
979 Mangle a filename by cutting off trailing whitespaces, "\\", "." and "..".\r
980\r
981 @param[in] FileName Filename.\r
982\r
077f8c43 983 @retval The mangled Filename.\r
99c9b949
PA
984\r
985**/\r
986CHAR16 *\r
987MangleFileName (\r
988 IN CHAR16 *FileName\r
989 );\r
990\r
991/**\r
992 Test to see if this driver supports ControllerHandle. Any ControllerHandle\r
993 than contains a BlockIo and DiskIo protocol can be supported.\r
994\r
995 @param This Protocol instance pointer.\r
996 @param ControllerHandle Handle of device to test\r
997 @param RemainingDevicePath Optional parameter use to pick a specific child\r
998 device to start.\r
999\r
1000 @retval EFI_SUCCESS This driver supports this device\r
1001 @retval EFI_ALREADY_STARTED This driver is already running on this device\r
1002 @retval other This driver does not support this device\r
1003\r
1004**/\r
1005EFI_STATUS\r
1006EFIAPI\r
1007UdfDriverBindingSupported (\r
1008 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
1009 IN EFI_HANDLE ControllerHandle,\r
1010 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
1011 );\r
1012\r
1013/**\r
1014 Start this driver on ControllerHandle by opening a Block IO and Disk IO\r
1015 protocol, reading Device Path, and creating a child handle with a\r
1016 Disk IO and device path protocol.\r
1017\r
1018 @param This Protocol instance pointer.\r
1019 @param ControllerHandle Handle of device to bind driver to\r
1020 @param RemainingDevicePath Optional parameter use to pick a specific child\r
1021 device to start.\r
1022\r
1023 @retval EFI_SUCCESS This driver is added to ControllerHandle\r
1024 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle\r
1025 @retval other This driver does not support this device\r
1026\r
1027**/\r
1028EFI_STATUS\r
1029EFIAPI\r
1030UdfDriverBindingStart (\r
1031 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
1032 IN EFI_HANDLE ControllerHandle,\r
1033 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
1034 );\r
1035\r
1036/**\r
1037 Stop this driver on ControllerHandle. Support stopping any child handles\r
1038 created by this driver.\r
1039\r
1040 @param This Protocol instance pointer.\r
1041 @param ControllerHandle Handle of device to stop driver on\r
1042 @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of\r
1043 children is zero stop the entire bus driver.\r
1044 @param ChildHandleBuffer List of Child Handles to Stop.\r
1045\r
1046 @retval EFI_SUCCESS This driver is removed ControllerHandle\r
1047 @retval other This driver was not removed from this device\r
1048\r
1049**/\r
1050EFI_STATUS\r
1051EFIAPI\r
1052UdfDriverBindingStop (\r
1053 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
1054 IN EFI_HANDLE ControllerHandle,\r
1055 IN UINTN NumberOfChildren,\r
1056 IN EFI_HANDLE *ChildHandleBuffer\r
1057 );\r
1058\r
1059//\r
1060// EFI Component Name Functions\r
1061//\r
1062/**\r
1063 Retrieves a Unicode string that is the user readable name of the driver.\r
1064\r
1065 This function retrieves the user readable name of a driver in the form of a\r
1066 Unicode string. If the driver specified by This has a user readable name in\r
1067 the language specified by Language, then a pointer to the driver name is\r
1068 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
1069 by This does not support the language specified by Language,\r
1070 then EFI_UNSUPPORTED is returned.\r
1071\r
1072 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
1073 EFI_COMPONENT_NAME_PROTOCOL instance.\r
1074\r
1075 @param Language[in] A pointer to a Null-terminated ASCII string\r
1076 array indicating the language. This is the\r
1077 language of the driver name that the caller is\r
1078 requesting, and it must match one of the\r
1079 languages specified in SupportedLanguages. The\r
1080 number of languages supported by a driver is up\r
1081 to the driver writer. Language is specified\r
1082 in RFC 4646 or ISO 639-2 language code format.\r
1083\r
1084 @param DriverName[out] A pointer to the Unicode string to return.\r
1085 This Unicode string is the name of the\r
1086 driver specified by This in the language\r
1087 specified by Language.\r
1088\r
1089 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
1090 This and the language specified by Language was\r
1091 returned in DriverName.\r
1092\r
1093 @retval EFI_INVALID_PARAMETER Language is NULL.\r
1094\r
1095 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
1096\r
1097 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
1098 the language specified by Language.\r
1099\r
1100**/\r
1101EFI_STATUS\r
1102EFIAPI\r
1103UdfComponentNameGetDriverName (\r
1104 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
1105 IN CHAR8 *Language,\r
1106 OUT CHAR16 **DriverName\r
1107 );\r
1108\r
1109/**\r
1110 Retrieves a Unicode string that is the user readable name of the controller\r
1111 that is being managed by a driver.\r
1112\r
1113 This function retrieves the user readable name of the controller specified by\r
1114 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
1115 driver specified by This has a user readable name in the language specified by\r
1116 Language, then a pointer to the controller name is returned in ControllerName,\r
1117 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
1118 managing the controller specified by ControllerHandle and ChildHandle,\r
1119 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
1120 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
1121\r
1122 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
1123 EFI_COMPONENT_NAME_PROTOCOL instance.\r
1124\r
1125 @param ControllerHandle[in] The handle of a controller that the driver\r
1126 specified by This is managing. This handle\r
1127 specifies the controller whose name is to be\r
1128 returned.\r
1129\r
1130 @param ChildHandle[in] The handle of the child controller to retrieve\r
1131 the name of. This is an optional parameter that\r
1132 may be NULL. It will be NULL for device\r
1133 drivers. It will also be NULL for a bus drivers\r
1134 that wish to retrieve the name of the bus\r
1135 controller. It will not be NULL for a bus\r
1136 driver that wishes to retrieve the name of a\r
1137 child controller.\r
1138\r
1139 @param Language[in] A pointer to a Null-terminated ASCII string\r
1140 array indicating the language. This is the\r
1141 language of the driver name that the caller is\r
1142 requesting, and it must match one of the\r
1143 languages specified in SupportedLanguages. The\r
1144 number of languages supported by a driver is up\r
1145 to the driver writer. Language is specified in\r
1146 RFC 4646 or ISO 639-2 language code format.\r
1147\r
1148 @param ControllerName[out] A pointer to the Unicode string to return.\r
1149 This Unicode string is the name of the\r
1150 controller specified by ControllerHandle and\r
1151 ChildHandle in the language specified by\r
1152 Language from the point of view of the driver\r
1153 specified by This.\r
1154\r
1155 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
1156 the language specified by Language for the\r
1157 driver specified by This was returned in\r
1158 DriverName.\r
1159\r
1160 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
1161\r
1162 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
1163 EFI_HANDLE.\r
1164\r
1165 @retval EFI_INVALID_PARAMETER Language is NULL.\r
1166\r
1167 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
1168\r
1169 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
1170 managing the controller specified by\r
1171 ControllerHandle and ChildHandle.\r
1172\r
1173 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
1174 the language specified by Language.\r
1175\r
1176**/\r
1177EFI_STATUS\r
1178EFIAPI\r
1179UdfComponentNameGetControllerName (\r
1180 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
1181 IN EFI_HANDLE ControllerHandle,\r
1182 IN EFI_HANDLE ChildHandle OPTIONAL,\r
1183 IN CHAR8 *Language,\r
1184 OUT CHAR16 **ControllerName\r
1185 );\r
1186\r
1187#endif // _UDF_H_\r