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